public void KeyboardUpdate(KeyboardStateEventArgs args) { KeyboardState st = args.keyState; if (st.IsKeyDown(Keys.Left)) { this.xSpeed = -5; } else if (st.IsKeyDown(Keys.Right)) { this.xSpeed = 5; } else { this.xSpeed = 0; } if (st.IsKeyDown(Keys.Up)) { if (this.ground) { this.ySpeed = -24; this.ground = false; } } else if (st.IsKeyDown(Keys.Down)) { this.ySpeed = 5; } }
protected virtual void OnKeyboard(KeyboardStateEventArgs args) { if (KeyboardEvent != null) KeyboardEvent (args); }