Beispiel #1
0
        public override void Update()
        {
            Text = "FPS: " + Engine_Game.CurrentFrameRate.ToString();

            if (Engine_Keyboard.IsTriggered(Key.F9))
            {
                Visible = !Visible;
            }
        }
Beispiel #2
0
        public override void Update()
        {
            int vx = 0, vy = 0;

            if (Position.Y > 50 && Engine_Keyboard.IsPressed(Key.UpArrow))
            {
                vy = -2;
            }
            if (Position.Y < 550 && Engine_Keyboard.IsPressed(Key.DownArrow))
            {
                vy = 2;
            }
            if (Position.X > 30 && Engine_Keyboard.IsPressed(Key.LeftArrow))
            {
                vx     = -2;
                ScaleX = 1;
            }

            if (Position.X < 770 && Engine_Keyboard.IsPressed(Key.RightArrow))
            {
                vx     = 2;
                ScaleX = -1;
            }
            if (Engine_Keyboard.IsPressed(Key.LeftShift))
            {
                vx *= 2;
                vy *= 2;
            }

            if (Engine_Keyboard.IsTriggered(Key.Space))
            {
                Shoot fire = (Shoot)Spillet.Fire.Clone();
                fire.Position = new PointF(Position.X, Position.Y - 32);
                fire.Velocity = new Vector2(0, -4);
                Spillet.Add(fire);

                Spillet.Shoot.Play();
                m_shots++;

                Spillet.Shots.Text = "Shots: " + m_shots.ToString();
            }

            Velocity = new Vector2(vx, vy);
        }