protected void avaliarJogada() { KeyboardState newState = Keyboard.GetState(); if (newState.IsKeyDown(Keys.Right)) { aviao.direita(); } if (newState.IsKeyDown(Keys.Left)) { aviao.esquerda(); } if (newState.IsKeyDown(Keys.Up)) { aviao.frente(); } if (newState.IsKeyDown(Keys.Down)) { aviao.tras(); } if ((newState.IsKeyDown(Keys.Space)) && (!tiroPreparado) && (tempoTiro <= 0)) { tiroPreparado = true; tiro = aviao.atirar(gt); if (tiro != null) { tiro.Disparar(); } tiroPreparado = false; tempoTiro = 30; //tempoTiro = 100; } if ((newState.IsKeyUp(Keys.Space)) && (tiroPreparado)) { /*tiro = aviao.atirar(); * tiro.Disparar(); * gt.Add(tiro); * soundBank.PlayCue("Explosion"); * tiroPreparado = false; * tempoTiro = 10;*/ } if (newState.IsKeyDown(Keys.Escape)) { this.Exit(); } }
public Tiro atirar(GerenciadorTiro gt) { Tiro t = gt.getTiro(); if (t != null) { t.pos = this.pos; t.pos.X += 10; t.pos.Y += 5; t.Disparar(); } return(t); }