protected override void Draw(GameTime gameTime) { spriteBatch.Begin(); spriteBatch.Draw(background, new Rectangle(0, y - Constantes.SCREEN_HEIGHT, background.Width, background.Height), Color.White); spriteBatch.Draw(background, new Rectangle(0, y, background.Width, background.Height), Color.White); if (!game_over) { y += starSpeed; if (y == Constantes.SCREEN_HEIGHT) { y = 0; } } spriteBatch.End(); if (!game_over) { for (int i = 0; i < Constantes.SHOT_COUNT; i++) { if (player_laser_x[i] != Constantes.DEFAULT_POSITION) { if (player_laser_y[i] > -Constantes.PLAYER_SHOT_HEIGHT) { player_laser_y[i] -= 20; } else { player_laser_x[i] = Constantes.DEFAULT_POSITION; player_laser_y[i] = Constantes.DEFAULT_POSITION; } shots[i].Draw(gameTime); } } enemyShip.Draw(gameTime); enemyLaser.Draw(gameTime); meteorBig.Draw(gameTime); meteorSmall.Draw(gameTime); if (show_enemy_ufo) { enemyUfo.Draw(gameTime); } player.Draw(gameTime); } else { gameOver.Draw(gameTime); } base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { spriteBatch.Begin(); spriteBatch.Draw(background, new Rectangle(0, y - Constantes.SCREEN_HEIGHT, background.Width, background.Height), Color.White); spriteBatch.Draw(background, new Rectangle(0, y, background.Width, background.Height), Color.White); if (!game_over) { y += starSpeed; if (y == Constantes.SCREEN_HEIGHT) { y = 0; } } spriteBatch.End(); if (game_over) { return; } if (player_laser_y > -Constantes.PLAYER_SHOT_HEIGHT) { player_laser_y -= 20; } else { player_laser_x = -50; player_laser_y = -50; } //if (enemy_laser_x != -50) //{ // if (enemy_laser_y > -Constantes.ENEMY_SHOT_HEIGHT) // { // enemy_laser_y -= 20; // } // else // { // enemy_laser_x = -50; // enemy_laser_y = -50; // } //} playerLaser.SetPosicao(new Vector2(player_laser_x, player_laser_y)); playerLaser.Draw(gameTime); meteorBig.Draw(gameTime); meteorSmall.Draw(gameTime); if (show_enemy_ufo) { enemyUfo.Draw(gameTime); } enemyShip.Draw(gameTime); enemyLaser.Draw(gameTime); player.Draw(gameTime); base.Draw(gameTime); }