Esempio n. 1
0
        public void enemyBulletMove()
        {
            for (int i = 0; i < enemyBullets.Count; i++)
            {
                enemyBullets[i].Move(this);
            }

            for (int i = 0; i < enemyBullets.Count; i++)
            {
                if (Crash.isCrashWall(enemyBullets[i]))
                {
                    bool a = enemyBullets.Remove(enemyBullets[i]);
                }
            }
        }
Esempio n. 2
0
        private void myBulletMove()
        {
            for (int i = 0; i < planeBullets.Count; i++)
            {
                planeBullets[i].Move(this);
            }

            for (int i = 0; i < planeBullets.Count; i++)
            {
                if (Crash.isCrashWall(planeBullets[i]))
                {
                    //撞墙
                    planeBullets.Remove(planeBullets[i]);
                    break;
                }
                for (int j = 0; j < enemyList.Count; j++)
                {
                    if (Crash.crash(enemyList[j].getRectangle(), planeBullets[i].getRectangle()))
                    {
                        //撞敌机
                        score += 10;
                        SoundPlayer p = new SoundPlayer(Properties.Resources.boom);
                        p.Play();
                        planeBullets.Remove(planeBullets[i]);

                        blastX = enemyList[j].X;
                        blastY = enemyList[j].Y;


                        enemyList.Remove(enemyList[j]);
                        break;
                    }
                }

                for (int j = 0; j < enemyBullets.Count; j++)
                {
                    if (planeBullets.Count > 0 && Crash.crash(planeBullets[i].getRectangle(), enemyBullets[j].getRectangle()))
                    {
                        bool a = planeBullets.Remove(planeBullets[i]);
                        bool b = enemyBullets.Remove(enemyBullets[j]);
                        break;
                    }
                }
            }
        }