Пример #1
0
    protected override void AD2Logic(int ms, KeyboardState keyboardState, GamePadState[] gamePadState)
    {
        //move the camera left.
        CamX -= 3;

        //update the player.
        Player.update(this, keyboardState);

        //update the baddies.
        foreach (Baddie b in Baddies)
        {
            b.update(this);
        }

        //do bullet logic. move them and collect the ones that are out of bounds.
        LinkedList <Bullet> outOfBounds = new LinkedList <Bullet>();;

        foreach (Bullet b in Bullets)
        {
            if (b.left)
            {
                b.x -= 10;
            }
            else
            {
                b.x += 5;
            }

            if (CamX > b.x)
            {
                outOfBounds.AddLast(b);
            }
        }

        foreach (Bullet b in outOfBounds)
        {
            Bullets.Remove(b);
        }
    }