public override void HandleInput(InputHelper inputHelper) { if(inputHelper.MouseLeftButtonPressed() && !shooting) { shooting = true; velocity = (inputHelper.MousePosition - position) * speed; ballShot.Play(); Color = Painter.GameWorld.Cannon.Color; } }
public override void HandleInput(InputHelper inputHelper) { //Handle the color if (inputHelper.keyPressed(Keys.R)) Color = Color.Red; else if (inputHelper.keyPressed(Keys.G)) Color = Color.Green; else if (inputHelper.keyPressed(Keys.B)) Color = Color.Blue; //Handle the angle double opposite = inputHelper.MousePosition.Y - position.Y; double adjacent = inputHelper.MousePosition.X - position.X; angle = (float)Math.Atan2(opposite, adjacent); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here inputHelper = new InputHelper(); IsMouseVisible = true; random = new Random(); base.Initialize(); }
public void HandleInput(InputHelper inputHelper) { cannon.HandleInput(inputHelper); ball.HandleInput(inputHelper); }
public virtual void HandleInput(InputHelper inputHelper) { }