public void Draw(Renderer renderer) { int b = 150; int a = 0; renderer.Begin(CenterCamera); renderer.DrawTexture("mario", Vector2.Zero); map1.Draw(renderer); characterManager.Draw(renderer); renderer.End(); renderer.Begin(); for (int i = 1; i <= player.Hp; i++) { renderer.DrawTexture("hart", new Vector2(a, 0)); a = a + b; } a = 0; if (robot.Isk) { for (int i = 1; i <= robot.Hp; i++) { renderer.DrawTexture("hart", new Vector2(a, 100)); a = a + b; } } renderer.End(); }
public override void Draw(SpriteBatch sp) { sp.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, _camera.GetTransfromMatrix()); sp.Draw(_background, Vector2.Zero, Color.White); DrawObj(sp); _parManager.Draw(sp); _map1.Draw(sp); if (_gameIsPlaying) { /// show death and kill _deathCount.SetPosition(_camera.GetFollowPos() + new Vector2((int)(Consts.VIEWPORT_WIDTH / 2 - _deathCount.GetBoundingBox().Width), (int)(-Consts.VIEWPORT_HEIGHT / 2))); _deathCount.Draw(sp); _killCount.SetPosition(_camera.GetFollowPos() + new Vector2((int)(Consts.VIEWPORT_WIDTH / 2 - _deathCount.GetBoundingBox().Width * 2), (int)(-Consts.VIEWPORT_HEIGHT / 2))); //_killCount.SetPosition(_camera.GetFollowPos() + new Vector2((int)(Consts.VIEWPORT_WIDTH / 2 - _deathCount.GetBoundingBox().Width), (int)(-Consts.VIEWPORT_HEIGHT / 2 + _deathCount.GetBoundingBox().Height))); _killCount.Draw(sp); // death state effect Tank tank = (Tank)_network.GetMainTank(); if (!tank.IsAlive()) { //sp.DrawString(_font, ""+(int)delayTime, _camera.GetFollowPos(), Color.Red); sp.Draw(_deathBG, new Rectangle((int)_camera.GetFollowPos().X - 400, (int)_camera.GetFollowPos().Y - 300, 800, 600), Color.White); DrawDeathScreen(sp); } } else { this.DrawEndGame(sp); _okButton.SetPosition(_camera.GetFollowPos() + new Vector2(-_okButton.GetBoundingBox().Width / 2 + 20, _okButton.GetBoundingBox().Height)); _okButton.Draw(sp); } sp.End(); base.Draw(sp); }
public override void Draw(SpriteBatch sp) { sp.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, _camera.GetTransfromMatrix()); sp.Draw(_background, Vector2.Zero, Color.White); DrawObj(sp); _parManager.Draw(sp); map1.Draw(sp); sp.End(); base.Draw(sp); }