コード例 #1
0
        private void addMissileToList(int x, int y, cMovement move)
        {
            if (aCount == 0)
            {
                missiles.Add(new cMissile()
                {
                    Location = new Point(x, y), Movement = move, Damage = spaceShip.Damage, Image = missileA, Size = missileSize, Speed = 20
                });
            }
            else
            {
                missiles.Add(new cMissile()
                {
                    Location = new Point(x, y), Movement = move, Damage = spaceShip.Damage, Image = missileB, Size = missileSize, Speed = 20
                });
            }

            aCount++;
            if (aCount > 2)
            {
                aCount = 0;
            }
        }
コード例 #2
0
        private void addSpaceshipMissile(int count)
        {
            if (missiles.Count == 0)
            {
                aCount = 0;
            }

            int x = spaceShip.Location.X + (spaceShip.Size.Width / 2 - missileSize.Width / 2);
            int y = spaceShip.Location.Y;

            // Geradzahlige Menge von Raketen
            if (spaceShip.WeaponStrength % 2 != 0)
            {
                addMissileToList(x, y, new cMovement()
                {
                    Speed = 200, Y = -1
                });
            }
            for (int i = 1; i < spaceShip.WeaponStrength; i += 2)
            {
                cMovement move = new cMovement()
                {
                    X     = Math.Cos(-90 - i * 3),
                    Y     = -Math.Sin(-90 - i * 3),
                    Speed = 200
                };
                cMovement move2 = new cMovement()
                {
                    X     = -Math.Cos(-90 - i * 3),
                    Y     = -Math.Sin(-90 - i * 3),
                    Speed = 200
                };
                addMissileToList(x, y, move);
                addMissileToList(x, y, move2);
            }
        }