/* CHARACTER CREATION IN PROGRESS --- IN FUTURE UPDATE * * public static PlayerCharacter createCharacter(GameWindow gw) { * bool characterCreated = false; * List<System.Windows.Forms.Label> skillValues = gw.skillValueList; * List<System.Windows.Forms.CheckBox> skillCheckBoxes = gw.skillBoxList; * int amountOfSpezializationSkills = 5; * while (!characterCreated) { * * } * return null; * }*/ public static void moveCharacter(KeyEventArgs e, Character player, Tile[][] tiles, List <Character> enemies) { eventLogger.Empty(); // empty logs /* Horribly organized moving controls - NEEDS REWORKING */ Tile targetTile; // The tile the player is possibly moving to if (e.KeyCode == Keys.A) { targetTile = tiles[player.getTile().getCoordX()][player.getTile().getCoordY() - 1]; /* If tile already has a character, player will attack */ if (targetTile.getCharacter() != null) { attackCharacter(player, targetTile.getCharacter(), enemies); } /* Check that the tile player is moving to is empty and is not a wall */ if (targetTile.isWalkable() && targetTile.getCharacter() == null) { /* Move character to tile */ player.moveCharacter(tiles[player.getTile().getCoordX()][player.getTile().getCoordY() - 1]); } if (targetTile.getItem() != null) { /* If player steps on an item */ eventLogger.logEvent(player.getName() + " stepped on " + targetTile.getItem().getName() + ". "); } } if (e.KeyCode == Keys.W) { targetTile = tiles[player.getTile().getCoordX() - 1][player.getTile().getCoordY()]; if (targetTile.getCharacter() != null) { attackCharacter(player, targetTile.getCharacter(), enemies); } if (targetTile.isWalkable() && targetTile.getCharacter() == null) { player.moveCharacter(targetTile); } if (targetTile.getItem() != null) { eventLogger.logEvent(player.getName() + " stepped on " + targetTile.getItem().getName() + ". "); } } if (e.KeyCode == Keys.D) { targetTile = tiles[player.getTile().getCoordX()][player.getTile().getCoordY() + 1]; if (targetTile.getCharacter() != null) { attackCharacter(player, targetTile.getCharacter(), enemies); } if (targetTile.isWalkable() && targetTile.getCharacter() == null) { player.moveCharacter(targetTile); } if (targetTile.getItem() != null) { eventLogger.logEvent(player.getName() + " stepped on " + targetTile.getItem().getName() + ". "); } } if (e.KeyCode == Keys.S) { targetTile = tiles[player.getTile().getCoordX() + 1][player.getTile().getCoordY()]; if (targetTile.getCharacter() != null) { attackCharacter(player, targetTile.getCharacter(), enemies); } if (targetTile.isWalkable() && targetTile.getCharacter() == null) { player.moveCharacter(targetTile); } if (targetTile.getItem() != null) { eventLogger.logEvent(player.getName() + " stepped on " + targetTile.getItem().getName() + ". "); } } /* Check if player is on the ladder */ if (e.KeyCode == Keys.C && currentLayer.getLadder().climbLadder()) { currentLayer = dungeon[dungeon.IndexOf(currentLayer) + 1]; currentLayer.addPlayer((PlayerCharacter)player); eventLogger.logEvent("Climbing ladder... "); } /* Check if player picks up an item */ if (e.KeyCode == Keys.E && player.getTile().getItem() != null) { Item item = player.getTile().getItem(); player.getInventory().addItem(item); player.getTile().deleteItem(); gameWindow.updateInventoryScreen(); eventLogger.logEvent(player.getName() + " picked up " + item.getName()); } /* This part is needed to stop that annoying Windows BLING sound every time the player moves */ e.SuppressKeyPress = true; }