Beispiel #1
0
 public void removeShot(Shot s)
 {
     shots.Remove(s);
 }
Beispiel #2
0
        private void UpdateMovement(KeyboardState aCurrentKeyboardState)
        {
            Vertical = 0f;
            Horizontal = 0f;
            if (!alive) return;
            if (aCurrentKeyboardState.IsKeyDown(Keys.Space))
            {
                if (canShoot)
                {
                    shotsound.CreateInstance().Play();

                    Shot ammus = new Shot();
                    ammus.LoadContent(mContentManager);
                    ammus.Position = Position;
                    ammus.Position.X += 8 + cannon*60;
                    ammus.Maxposition = new Vector2(1600, 1200);

                    shots.Add(ammus);
                    canShoot = false;
                    cannon = 1 - cannon;
                }
            }
            else canShoot = true;
                if (aCurrentKeyboardState.IsKeyDown(Keys.Left) == true)
                {

                    Horizontal = -1f;

                }

                else if (aCurrentKeyboardState.IsKeyDown(Keys.Right) == true)
                {

                    Horizontal = 1f;

                }

                if (aCurrentKeyboardState.IsKeyDown(Keys.Up) == true)
                {

                    Vertical = -1f;
                }

                else if (aCurrentKeyboardState.IsKeyDown(Keys.Down) == true)
                {

                    Vertical = 1f;

                }
        }