jeudi 25 février 2016

How can I place objects randomly in a cell for a 2D array based game? Java

Here I'm asked to do a method for the game which randomly places monsters in a map.. Im not really sure to start and how can I place an object (ex.Boss) in cell (0,0) using nested for loops for the 2D array Or randomly place the weak foes. How to translate this idea into a code?

public void generateMap(ArrayList weakFoes, ArrayList strongFoes): //It should generate the whole map grid randomly. It should be filled with:

• 1 Boss: A random boss should be positioned in the top left of the map i.e. cell (0,0).

• 15 Weak Foes: The weak foes should be randomly positioned on the map. The weak foes should be chosen randomly from the input weakFoes.

Any help is appreciated.. Thank youu




Aucun commentaire:

Enregistrer un commentaire