public override void Draw(GameTime gameTime) { if (health > 0) { string action = !collision ? "skeleton_" : "skeleton_attac_"; Vector2 pos = collision ? position - new Vector2(64, 64) : position; spriteBatch.Begin(); switch (direction) { case Direction.Down: celAnimationManager.Draw(gameTime, action + "down", spriteBatch, pos, SpriteEffects.None); break; case Direction.Up: celAnimationManager.Draw(gameTime, action + "up", spriteBatch, pos, SpriteEffects.None); break; case Direction.Left: celAnimationManager.Draw(gameTime, action + "left", spriteBatch, pos, SpriteEffects.None); break; case Direction.Right: celAnimationManager.Draw(gameTime, action + "right", spriteBatch, pos, SpriteEffects.None); break; default: break; } spriteBatch.End(); } // base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime); //drawing bg. scrollingBackgroundManager.Draw("space", OurGame.spriteBatch); scrollingBackgroundManager.Draw("space2", OurGame.spriteBatch); scrollingBackgroundManager.Draw("space3", OurGame.spriteBatch); //drawing our board. ourBoard.Draw(OurGame.spriteBatch, Color.White); //drawing our giant flag Rectangle Rec = new Rectangle(Game1.screen_width * 8 / 10, Game1.screen_height * 7 / 10, Game1.screen_width * 1 / 10, Game1.screen_height * 2 / 10); celAnimationManager.Draw(gameTime, flag, OurGame.spriteBatch, Rec, SpriteEffects.None); //drawing our enemys giant flag Rec = new Rectangle(Game1.screen_width * 2 / 10, Game1.screen_height * 1 / 10, Game1.screen_width * 1 / 10, Game1.screen_height * 2 / 10); celAnimationManager.Draw(gameTime, enemy_flag, OurGame.spriteBatch, Rec, SpriteEffects.None); //drawing player pawns. for (int i = 0; i < player.pawns.Length; i++) { if (player.pawns[i] != null) { player.pawns[i].Draw(OurGame.spriteBatch, gameTime); } } //drawing enemy pawns. for (int i = 0; i < enemy.pawns.Length; i++) { if (enemy.pawns[i] != null) { enemy.pawns[i].Draw(OurGame.spriteBatch, gameTime); } } //drawing strings if (player.myTurn) { OurGame.spriteBatch.DrawString(font_small, "your turn", new Vector2(Game1.screen_width / 3, Game1.screen_height / 80), Color.White); } else { OurGame.spriteBatch.DrawString(font_small, "opponent's turn", new Vector2(Game1.screen_width / 3, Game1.screen_height / 80), Color.White); } if (win) { OurGame.spriteBatch.DrawString(font_small, "You win", new Vector2(Game1.screen_width / 3, Game1.screen_height / 10), Color.White); } if (lose) { OurGame.spriteBatch.DrawString(font_small, "You lose", new Vector2(Game1.screen_width / 3, Game1.screen_height / 10), Color.White); } }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); OurGame.spriteBatch.Draw(bg, new Rectangle(0, 0, Game1.screen_width, Game1.screen_height), Color.White); for (int i = 0; i < flags.Length; i++) { int width = (Game1.screen_width / 8) * (10 - Math.Abs(currFlag - i)) / 10; int height = (Game1.screen_height / 4) * (10 - Math.Abs(currFlag - i)) / 10; int x = (Game1.screen_width / 16) * 7 + (currFlag - i) * width * 2; int y = (Game1.screen_height / 8) * 3 - ((int)Math.Pow(Math.Abs(currFlag - i), 2) * (Game1.screen_height / 50)); if (i == taken) { color = Color.Red; } else { color = Color.White; } if (currFlag - i < 3) { celAnimationManager.Draw(gameTime, flags[i], OurGame.spriteBatch, new Rectangle(x, y, width, height), color, SpriteEffects.None); } } // OurGame.spriteBatch.Draw(main, new Rectangle(/*Game1.screen_width / 4*/0, Game1.screen_height / 4, Game1.screen_width , Game1.screen_height / 2),Color.AliceBlue); left.Draw(gameTime, OurGame.spriteBatch); right.Draw(gameTime, OurGame.spriteBatch); select.Draw(gameTime, OurGame.spriteBatch); }
public override void Draw(GameTime gameTime) { spriteBatch.Begin(); if (!hasdied) { celAnimationManager.Draw(gameTime, "my_ghost", spriteBatch, position, direction == Direction.Right ? SpriteEffects.None : SpriteEffects.FlipHorizontally); } else { celAnimationManager.Draw(gameTime, "Ghost_death", spriteBatch, position, direction == Direction.Right ? SpriteEffects.None : SpriteEffects.FlipHorizontally); } if (life_minus_swing || life_minus_swing_slam) { spriteBatch.DrawString(font_damage, damage_to_life.ToString(), Damage_font_position, Color.Red); } spriteBatch.End(); }
public override void Draw(GameTime gameTime) { string action = inputHandler.KeyboardHandler.IsKeyDown(Keys.Space) ? "orc_slash_" : "orc_"; action = inputHandler.KeyboardHandler.IsKeyDown(Keys.LeftShift) ? "orc_shield_" : action; Vector2 pos = inputHandler.KeyboardHandler.IsKeyDown(Keys.Space) ? position - new Vector2(64, 64) : position; spriteBatch.Begin(); int i = 0; for (; i < lives; i++) { celAnimationManager.Draw(gameTime, "hart", spriteBatch, new Vector2(100, 100), SpriteEffects.None); } for (; i < 3; i++) { celAnimationManager.Draw(gameTime, "hart_broken", spriteBatch, new Vector2(10 + 64 * i, 10), SpriteEffects.None); } if (lives > 0) { switch (direction) { case Direction.Down: celAnimationManager.Draw(gameTime, action + "down", spriteBatch, pos, SpriteEffects.None); break; case Direction.Up: celAnimationManager.Draw(gameTime, action + "up", spriteBatch, pos, SpriteEffects.None); break; case Direction.Left: celAnimationManager.Draw(gameTime, action + "left", spriteBatch, pos, SpriteEffects.None); break; case Direction.Right: celAnimationManager.Draw(gameTime, action + "right", spriteBatch, pos, SpriteEffects.None); break; default: break; } } else { if (isDead) { celAnimationManager.Draw(gameTime, "orc_grave", spriteBatch, pos, SpriteEffects.None); } } spriteBatch.End(); }
public override void Draw(GameTime gameTime) { spriteBatch.Begin(); spriteBatch.DrawString(font_life, "life: " + life.ToString(), new Vector2(50, 50), Color.Gold); spriteBatch.DrawString(font_life, "Kills: " + kills.ToString(), new Vector2(50, 80), Color.Silver); if (!hasdied) { celAnimationManager.Draw(gameTime, currentAnimation, spriteBatch, position, direction == Direction.Right ? SpriteEffects.None : SpriteEffects.FlipHorizontally); if (player_hit && player_hit_timer < 1) { spriteBatch.DrawString(font_damage, damage_to_life.ToString(), Damage_font_position, Color.DarkRed); } } else { spriteBatch.Draw(Game1.death, new Rectangle(0, 0, Game1.ScreenWidth, Game1.ScreenHeight), Color.White); } spriteBatch.End(); }
public override void Draw(GameTime gameTime) { float scaleOfFone = Pawn.scaleOfFont; //drawing space bg scrollingBackgroundManager.Draw("space", OurGame.spriteBatch); scrollingBackgroundManager.Draw("space2", OurGame.spriteBatch); scrollingBackgroundManager.Draw("space3", OurGame.spriteBatch); //drawing our board ourBoard.Draw(OurGame.spriteBatch, Color.White); //drawing our buttons. foreach (Button button in buttons) { button.Draw(gameTime, OurGame.spriteBatch); } //drawing our pawns and teleports. if (strength != "teleport") { celAnimationManager.Draw(gameTime, flag_animation, OurGame.spriteBatch, iso_rec, SpriteEffects.None); } else { OurGame.spriteBatch.Draw(teleport_texture, iso_rec, Color.White); } //debug view of flag // celAnimationManager.Draw(gameTime, "canada", OurGame.spriteBatch, new Rectangle(200,200,500,500), SpriteEffects.None); //drawing info near pawn or teleport. OurGame.spriteBatch.DrawString(font, strength, new Vector2(iso_rec.X, iso_rec.Y), Color.Black, 0, new Vector2(0), scaleOfFone, SpriteEffects.None, 0); save_and_start_game.Draw(gameTime, OurGame.spriteBatch); //drawing button if (Game.Components.Contains(save_flag_button)) { save_flag_button.Draw(gameTime, OurGame.spriteBatch); } //drawing button if (Game.Components.Contains(save_and_start_game)) { save_and_start_game.Draw(gameTime, OurGame.spriteBatch); } //drawing pawns(flags) for (int i = 0; i < player.army_size; i++) { if (player.pawns[i] != null) { player.pawns[i].Draw(OurGame.spriteBatch, gameTime); } } /* for (int i = 0; i < enemy.army_size; i++) * { * if (enemy.pawns[i] != null) * enemy.pawns[i].Draw(OurGame.spriteBatch, gameTime); * }*/ //debug view. // celAnimationManager.Draw(gameTime, "jamaica", OurGame.spriteBatch, cartasian_rec, SpriteEffects.None); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime); //drawing bg. scrollingBackgroundManager.Draw("space", OurGame.spriteBatch); scrollingBackgroundManager.Draw("space2", OurGame.spriteBatch); scrollingBackgroundManager.Draw("space3", OurGame.spriteBatch); //drawing our board. ourBoard.Draw(OurGame.spriteBatch, Color.White); //drawing our giant flag Rectangle Rec = new Rectangle(Game1.screen_width * 8 / 10, Game1.screen_height * 7 / 10, Game1.screen_width * 1 / 10, Game1.screen_height * 2 / 10); celAnimationManager.Draw(gameTime, flag, OurGame.spriteBatch, Rec, SpriteEffects.None); //drawing our enemys giant flag Rec = new Rectangle(Game1.screen_width * 1 / 10, Game1.screen_height * 1 / 10, Game1.screen_width * 1 / 10, Game1.screen_height * 2 / 10); celAnimationManager.Draw(gameTime, enemy_flag, OurGame.spriteBatch, Rec, SpriteEffects.None); //drawing player pawns. for (int i = 0; i < player.pawns.Length; i++) { if (player.pawns[i] != null) { player.pawns[i].Draw(OurGame.spriteBatch, gameTime); } } //drawing enemy pawns. for (int i = 0; i < enemy.pawns.Length; i++) { if (enemy.pawns[i] != null) { enemy.pawns[i].Draw(OurGame.spriteBatch, gameTime); } } //drawing strings if (win) { EndGameTimer += gameTime.ElapsedGameTime.TotalSeconds; OurGame.spriteBatch.DrawString(font_big, "You win", new Vector2(Game1.screen_width / 3, Game1.screen_height / 10), Color.White, 0, Vector2.Zero, Game1.FontScale, SpriteEffects.None, 0); } else if (lose) { EndGameTimer += gameTime.ElapsedGameTime.TotalSeconds; OurGame.spriteBatch.DrawString(font_big, "You lose", new Vector2(Game1.screen_width / 3, Game1.screen_height / 10), Color.White, 0, Vector2.Zero, Game1.FontScale, SpriteEffects.None, 0); } else if (player.myTurn) { OurGame.spriteBatch.DrawString(font_small, "your turn", new Vector2((Game1.screen_width / 3) * 2, (Game1.screen_height * 70) / 80), Color.White, 0, Vector2.Zero, Game1.FontScale, SpriteEffects.None, 0); } else { OurGame.spriteBatch.DrawString(font_small, "opponent's turn", new Vector2(Game1.screen_width / 3, Game1.screen_height / 80), Color.White, 0, Vector2.Zero, Game1.FontScale, SpriteEffects.None, 0); } if (EndGameTimer >= 5.0f) { connection.client.Disconnect(""); BuildingBoardState.i_am_second_player = false; StateManager.ChangeState(OurGame.TitleIntroState.Value); } }
public void Draw(SpriteBatch spriteBatch, GameTime gameTime) { //timers handling if (draw_atk_font) { timer_atk_num_display += gameTime.ElapsedGameTime.TotalSeconds; } if (timer_has_died > 0 && !hasDied) { timer_has_died += gameTime.ElapsedGameTime.TotalSeconds; } if (timer_has_died > 3.0) { hasDied = true; } //if pawn is still alive. if (!hasDied) { if (team == Team.my_team) { Rectangle Rec = new Rectangle(Game1.TwoD2isometrix(current_tile.GetCartasianRectangle().Center) - new Point(Tile.GetTileSize() / 2), new Point(Tile.GetTileSize())); celAnimationManager.Draw(gameTime, flag_animation, spriteBatch, Rec, SpriteEffects.None); //if king of flags. if (the_flag) { spriteBatch.DrawString(strength_font, "flag", Game1.TwoD2isometrix(current_tile.GetCartasianRectangle().Center.X, current_tile.GetCartasianRectangle().Center.Y), Color.White, 0, Vector2.Zero, scaleOfFont, SpriteEffects.None, 0); } //if regular pawn else { spriteBatch.DrawString(strength_font, strength.ToString(), Game1.TwoD2isometrix(current_tile.GetCartasianRectangle().Center.X, current_tile.GetCartasianRectangle().Center.Y), Color.White, 0, Vector2.Zero, scaleOfFont, SpriteEffects.None, 0); } //timer for drawing attack. if (timer_atk_num_display < 3.0 && draw_atk_font) { spriteBatch.DrawString(strength_font, strength.ToString(), Game1.TwoD2isometrix((int)position.X, (int)position.Y) + new Vector2(-Game1.screen_width / 10, -Game1.screen_height / 10 - 20 * (float)timer_atk_num_display), Color.Green, 0, Vector2.Zero, scaleOfFont * 10, SpriteEffects.None, 0); } else //resetting values. { draw_atk_font = false; timer_atk_num_display = 0; } } else //pawn of the enemy's team { Rectangle Rec = new Rectangle(Game1.TwoD2isometrix(current_tile.GetCartasianRectangle().Center) - new Point(Tile.GetTileSize() / 2), new Point(Tile.GetTileSize())); celAnimationManager.Draw(gameTime, flag_animation, spriteBatch, Rec, SpriteEffects.None); if (timer_atk_num_display < 3.0 && draw_atk_font) { spriteBatch.DrawString(strength_font, strength.ToString(), Game1.TwoD2isometrix((int)position.X, (int)position.Y) + new Vector2(+Game1.screen_width / 10, -Game1.screen_height / 10 - 20 * (float)timer_atk_num_display), Color.Red, 0, Vector2.Zero, scaleOfFont, SpriteEffects.None, 0); } else { draw_atk_font = false; timer_atk_num_display = 0; } } } //if pawn is dead we draw it in the dead section. else { if (team == Team.my_team) { // spriteBatch.Draw(texture, new Rectangle(30 * strength, 20, Tile.getTileSize() / 2, Tile.getTileSize() / 2), Color.White); celAnimationManager.Draw(gameTime, flag_animation, spriteBatch, new Rectangle(Game1.screen_width / 40 * strength, Game1.screen_height / 10, Tile.GetTileSize() / 2, Tile.GetTileSize() / 2), SpriteEffects.None); spriteBatch.DrawString(strength_font, strength.ToString(), new Vector2(Game1.screen_width / 40 * strength, Game1.screen_height / 10), Color.White, 0, Vector2.Zero, scaleOfFont, SpriteEffects.None, 0); } else { // spriteBatch.Draw(texture, new Rectangle(320 + 30 * strength, 20, Tile.getTileSize() / 2, Tile.getTileSize() / 2), Color.White); celAnimationManager.Draw(gameTime, flag_animation, spriteBatch, new Rectangle(Game1.screen_width / 40 * strength, Game1.screen_height / 10 * 8, Tile.GetTileSize() / 2, Tile.GetTileSize() / 2), SpriteEffects.None); spriteBatch.DrawString(strength_font, strength.ToString(), new Vector2(Game1.screen_width / 40 * strength, Game1.screen_height / 10 * 8), Color.White, 0, Vector2.Zero, scaleOfFont, SpriteEffects.None, 0); } } //drawing adjecant tiles if clicked if (isMouseClicked) { if ((current_tile.GetLeft() != null) && (current_tile.GetLeft().occupied == Tile.Occupied.no)) { current_tile.GetLeft().SetColor(Color.Red); } if ((current_tile.GetRight() != null) && (current_tile.GetRight().occupied == Tile.Occupied.no)) { current_tile.GetRight().SetColor(Color.Red); } if ((current_tile.GetUp() != null) && (current_tile.GetUp().occupied == Tile.Occupied.no)) { current_tile.GetUp().SetColor(Color.Red); } if ((current_tile.GetDown() != null) && (current_tile.GetDown().occupied == Tile.Occupied.no)) { current_tile.GetDown().SetColor(Color.Red); } } if (hasMoved) //drawing adjecant to white after pawn moved. { if ((current_tile.GetLeft() != null) && (current_tile.GetLeft().occupied == Tile.Occupied.no)) { current_tile.GetLeft().SetColor(Color.White); } if ((current_tile.GetRight() != null) && (current_tile.GetRight().occupied == Tile.Occupied.no)) { current_tile.GetRight().SetColor(Color.White); } if ((current_tile.GetUp() != null) && (current_tile.GetUp().occupied == Tile.Occupied.no)) { current_tile.GetUp().SetColor(Color.White); } if ((current_tile.GetDown() != null) && (current_tile.GetDown().occupied == Tile.Occupied.no)) { current_tile.GetDown().SetColor(Color.White); } isMouseClicked = false; hasMoved = false; direction = null; } //drawing the world mouse for debug purposes. //spriteBatch.Draw(texture,new Rectangle(mouseRec.Location,new Point(10)) , Color.Goldenrod); }