public void Draw() { spriteBatch.Begin(); for (int i = 0; i < Constants.MAP_SIZE * 2; i++) { for (int j = 0; j < Constants.MAP_SIZE * 2; j++) { if (world.getMapData(Constants.MAP_SIZE - i / 2 - 1, Constants.MAP_SIZE - j / 2 - 1) != '-') { spriteBatch.Draw(ground, mapRectangle[i][j], Color.White); } if (world.getMapData(Constants.MAP_SIZE - i / 2 - 1, Constants.MAP_SIZE - j / 2 - 1) == '1' || world.getMapData(Constants.MAP_SIZE - i / 2 - 1, Constants.MAP_SIZE - j / 2 - 1) == '#') { spriteBatch.Draw(obstacle, mapRectangle[i][j], Color.White); } if (data.npcs.npcMoveData[Constants.MAP_SIZE * 2 - i - 1][Constants.MAP_SIZE * 2 - j - 1] != 0 && data.npcs.npcMoveData[Constants.MAP_SIZE * 2 - i - 1][Constants.MAP_SIZE * 2 - j - 1] != 255) { spriteBatch.Draw(enemy, mapRectangle[i][j], Color.White); } if (Constants.DEBUG && data.npcs.npcMoveData[Constants.MAP_SIZE * 2 - i - 1][Constants.MAP_SIZE * 2 - j - 1] == 255) { spriteBatch.Draw(enemy, mapRectangle[i][j], Color.Black); } } } spriteBatch.Draw(player, mapRectangle[Constants.MAP_SIZE * 2 - data.player.xTile - 1][Constants.MAP_SIZE * 2 - data.player.zTile - 1], Color.White); spriteBatch.End(); }
private int consoleState() { if (world.theme == 0) { //data.npcs.clear(); Vector3 camDir = new Vector3(camera.Direction.X, 0, camera.Direction.Z); camDir.Normalize(); float dx = camDir.X; float dz = camDir.Z; int xtile = (int)Math.Round((-1 * data.player.position.X - dx + Constants.MAP_SIZE - 1) / 2.0f); int ztile = (int)Math.Round((-1 * data.player.position.Z - dz + Constants.MAP_SIZE - 1) / 2.0f); if (world.getMapData(xtile, ztile) == '#')//ztile == 14 && xtile == 12)//(xtile == 11 || xtile == 12 || xtile == 13)) { if (Keyboard.GetState().IsKeyDown(Keys.E)) { return(Constants.CMD_JOURNAL); // activate Journal } if (Keyboard.GetState().IsKeyDown(Keys.Q)) { return(Constants.CMD_MOD); // activate Modscreen } if (Keyboard.GetState().IsKeyDown(Keys.R)) { return(Constants.CMD_DEX); // activate NPC screen } return(Constants.CMD_NEW); // console is only in front but nothing done } } return(Constants.CMD_NONE); // console is not in front }