Creation of object in game
Hi everoyne
I understand about how classes work but i have an issue with creating new objects. In my game i want to read a file which has level data. No problem.
What i want to do is make a number of enemies that the file determins and then sets their attributes. So if my file said 10 goblins the program would make 10 seperate goblins. Would their names be enemy.goblin1, enemy.goblin2..... enemy.goblin10
How do i tell the difference between two goblins????
The only way i could think was to hard code the levels, that i dont want to do!. I want to beable to choose how many goblins there are and their attributes from an external file. Is it done with a loop like:
Code:
do
{
"create new goblin"
"set attributes"
i ++
}(while i <= number of goblins)
thanks