public override void Draw(SpriteBatch sb) { this.villagerAnim.Draw(sb, this.screenPos); if (drawWelcomeBox) { if (openingBox) { if (welcomeBoxOpenAnimation.loops <= 0) { welcomeBoxOpenAnimation.Draw(sb, this.screenPos); } else { sb.Draw(this.welcomeBoxTex, new Rectangle((int)this.screenPos.X, (int)this.screenPos.Y, welcomeBoxTex.Width, welcomeBoxTex.Height), Color.White); } } else if (closingBox) { if (welcomeBoxCloseAnimation.loops <= 0) { welcomeBoxCloseAnimation.Draw(sb, this.screenPos); } } } }
public void Draw(SpriteBatch sb) { sb.Draw(this.backgroundTint, this.backgroundTintRect, Color.Black * 0.75f); sb.DrawString(this.titleFont, "Inventory", new Vector2(Window.resolution.X / 2 - this.titleFont.MeasureString("Inventory").X / 2, 40), Color.White); Vector2 folderNamePos = new Vector2((int)(25 + (squareSpacing * 2) + (emptySquare.Width * 2) + (emptySquare.Width / 2) - (titleFont.MeasureString(folderTitles[curFolder]).X / 2)), 108); sb.DrawString(titleFont, folderTitles[curFolder], folderNamePos, Color.White); folderArrow_Left.Draw(sb, new Vector2(folderNamePos.X - 7 - folderArrow_Left.frameWidth, folderNamePos.Y)); folderArrow_Right.Draw(sb, new Vector2(folderNamePos.X + 7 + titleFont.MeasureString(folderTitles[curFolder]).X, folderNamePos.Y)); for (int y = 0; y < 4; y++) { for (int x = 0; x < 5; x++) { if (folders[curFolder].pages[curPage].squares[x + (y * 5)].isEmpty) { sb.Draw(this.emptySquare, new Vector2(25 + (squareSpacing * x) + (x * emptySquare.Width), 150 + (squareSpacing * y) + (y * emptySquare.Width)), Color.White); } else { sb.Draw(this.fullSqaure, new Vector2(25 + (squareSpacing * x) + (x * fullSqaure.Width), 150 + (squareSpacing * y) + (y * fullSqaure.Width)), Color.White); } //System.Diagnostics.Debug.WriteLine("Square (" + x + ", " + y + ") is empty: " + folders[curFolder].pages[curPage].squares[x + y * 5].isEmpty); } } //Draw name, hp, mp, and money sb.DrawString(this.titleFont, this.playerName, new Vector2(Window.resolution.X - 205, Window.resolution.Y - 430), Color.White); sb.DrawString(this.titleFont, "HP: " + this.curHP + "/" + this.maxHP, new Vector2(Window.resolution.X - 225, Window.resolution.Y - 405), Color.White); sb.DrawString(this.titleFont, "MP: " + this.curMP + "/" + this.maxMP, new Vector2(Window.resolution.X - 225, Window.resolution.Y - 380), Color.White); sb.DrawString(this.titleFont, "Money: " + this.money, new Vector2(Window.resolution.X - 220, Window.resolution.Y - 355), Color.White); // //Left column for (int i = 0; i < 4; i++) { sb.Draw(this.statIcons[i], new Vector2(Window.resolution.X - 265, Window.resolution.Y - 320 + (45 * i)), Color.White); sb.DrawString(this.titleFont, this.statValues[i].ToString(), new Vector2(Window.resolution.X - 220, Window.resolution.Y - 320 + (45 * i) + 10), Color.White); } // //Right column for (int j = 4; j < 8; j++) { int i = j - 4; sb.Draw(this.statIcons[j], new Vector2(Window.resolution.X - 160, Window.resolution.Y - 320 + (45 * i)), Color.White); sb.DrawString(this.titleFont, this.statValues[j].ToString(), new Vector2(Window.resolution.X - 115, Window.resolution.Y - 320 + (45 * i) + 10), Color.White); } // expBar.Draw(sb, new Vector2(558, 500)); }
public void Draw(SpriteBatch sb) { sb.Draw(this.backgroundTex, new Rectangle(0, 0, (int)Window.resolution.X, (int)Window.resolution.Y), Color.White); sb.Draw(this.floorTex, new Rectangle(0, 0, (int)Window.resolution.X, (int)Window.resolution.Y), Color.White); if (curBattleState == Fighter.STATE_IDLE) //This has to be here s othe gray screen is drawn before the actual stuff { sb.Draw(this.timeSlowOverlayTex, new Rectangle(0, 0, (int)Window.resolution.X, (int)Window.resolution.Y), Color.Black * 0.65f); } foreach (EnemyFighter enemy in enemies) { sb.Draw(fighterShadowTex, new Rectangle((int)enemy.curScreenPos.X, (int)enemy.curScreenPos.Y + 3, (int)enemy.baseDims.X, (int)enemy.baseDims.Y), Color.White); enemy.Draw(sb); } sb.Draw(fighterShadowTex, new Rectangle((int)player.curScreenPos.X, (int)player.curScreenPos.Y + 3, (int)player.baseDims.X, (int)player.baseDims.Y), Color.White); player.Draw(sb); if (curBattleState == Fighter.STATE_IDLE) { sb.DrawString(this.countdownFont, String.Format("{0:0.0}", this.timeUntilFightState / 1000), new Vector2(700 - countdownFont.MeasureString(String.Format("{0:0.0}", this.timeUntilFightState / 1000)).X / 2, 30), (this.timeUntilFightState / 1000 <= 2) ? Color.Red : Color.White); if (!drawingFightWheel) { this.mainSelectionWheel.Draw(sb); } else { if (selectingEnemy) { enemySelectorAnim.Draw(sb, new Vector2(enemyScreenPositions[curEnemyHighlightID].X, enemyScreenPositions[curEnemyHighlightID].Y - 55)); } else { this.fightWheel.Draw(sb); } } } else if (curBattleState == Fighter.STATE_FIGHT) //this is at the bottom bc moves should alwasy be drawn last { if (player.isFighting) { player.attackList[player.curAttackID].DrawMove(sb); //this isnt happening after the 1st time, something with these variavles } else if (player.hasAttacked) { //enemy attack } } }
public void DrawTilemap(SpriteBatch sb) { Vector2 firstSquare = new Vector2(Camera.Location.X / Tile.TileWidth, Camera.Location.Y / Tile.TileHeight); int firstX = (int)firstSquare.X; int firstY = (int)firstSquare.Y; //System.Diagnostics.Debug.WriteLine("firstX: " + firstX + " firstY: " + firstY); squaresAcross = (int)Math.Ceiling((double)(Camera.viewWidth / Tile.TileWidth)) + 1; squaresDown = (int)Math.Ceiling((double)(Camera.viewHeight / Tile.TileHeight)) + 2; //System.Diagnostics.Debug.WriteLine("Squaresdown: " + squaresDown + " SquaresAcross: " + squaresAcross); for (int y = 0; y < squaresDown; y++) { for (int x = 0; x < squaresAcross; x++) { int mapX = firstX + x; int mapY = firstY + y; if ((mapX >= map.mapWidth) || (mapY >= map.mapHeight)) //Makes sure we're not out of bounds { continue; } foreach (int tileID in map.Rows[mapY].Columns[mapX].BaseTiles) { if (tileID == Tile.OVERWORLD_WATER) //maybe changethis to an isAnimated value later { FrameAnim tileAnim = new FrameAnim(this.tileAnimSpiteSheets[Tile.OVERWORLD_WATER], map.waterMaxAnimFrame + 1, Tile.TileWidth, Tile.TileHeight, map.waterAnimFrameMS, true, false); tileAnim.curFrameID = map.curWaterAnimFrame; tileAnim.Draw(sb, Camera.WorldToScreen(new Vector2(mapX * Tile.TileWidth, mapY * Tile.TileHeight))); } else { sb.Draw(Tile.TileSetTexture, //this calls the tileset that the tile texture comes from Camera.WorldToScreen(new Vector2(mapX * Tile.TileWidth, mapY * Tile.TileHeight)), Tile.GetSourceRectangle(tileID), //this calls the position from the tileset of the tile Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 1.0f); } } } } }
public override void Draw(SpriteBatch sb, GFXHandler gh, GameTime gameTime) { if (gameHandler.curSceneID == Scene.ID_OVERWORLD) { this.worldScene.Draw(sb, gh); } else if (gameHandler.curSceneID == Scene.ID_BATTLE) { this.battleScene.Draw(sb); } //sb.Draw(this.mousePointerTex, new Rectangle(Mouse.GetState().Position.X, Mouse.GetState().Position.Y, this.mousePointerTex.Width, this.mousePointerTex.Height), Color.White); mousePointer.Draw(sb, new Vector2(Mouse.GetState().Position.X, Mouse.GetState().Position.Y)); }
public override void Draw(SpriteBatch sb) { spriteAnim.Draw(sb, screenPos); //sb.Draw(this.debugTex, new Rectangle((int)this.screenPos.X, (int)this.screenPos.Y, this.bounds.Width, this.bounds.Height), Color.White); }