public void keyDown(Keys key) { foreach (var b in bombermans) { if (key == b.upKey) { b.direction = Directions.up; } else if (key == b.downKey) { b.direction = Directions.down; } else if (key == b.leftKey) { b.direction = Directions.left; } else if (key == b.rightKey) { b.direction = Directions.right; } else if (key == b.plantBombKey) { if (b.currentBombCount < b.maxBombsCount) { Bomb bomb = b.plantBomb(); bombs.Add(bomb); objMap[(int)bomb.getCoords().X / 50, (int)bomb.getCoords().Y / 50] = 5; } } } }
private void bombermansTic() { foreach (var b in bombermans) { b.tic(); if (b.bombPlanted && b.currentBombCount < b.maxBombsCount) { b.bombPlanted = false; Bomb bomb = b.plantBomb(); bombs.Add(bomb); objMap[(int)bomb.getCoords().X / 50, (int)bomb.getCoords().Y / 50] = 5; } } }