Hi,
I made a family for the game enemies, I would like to spawn different enemy in the family depends on a global variable "score", like at the beginning spawn score =0, spawn enemy "Sprite1", when the score >100,spawn enemy "Sprite2" and so on. but the problem is I do not know how to spawn different family enmey depend on score. please help. thanks
file: https://www.dropbox.com/s/oqrc08yu7nnmn ... .capx?dl=0
Develop games in your browser. Powerful, performant & highly capable.
Hello,
Here's how to do that : https://www.dropbox.com/s/mb8oxg5zgnis9wt/spawnEnemyOnScore.capx?dl=0
You can search and use the Rex's Nickname behavior to create object by a nickname you set on each object type that had this behavior, so have a different one for each object type in your family. In a cleaner way and fewer events.
— thanks, the problem is have many enemies, so your way make to many codes for min project. would you have idea how to use the nickname, thanks
There's a way to do it using a family and a function, however, you will have one sub-event for each enemy under the function. Here's a quick example :
https://dl.dropboxusercontent.com/u/700 ... bject.capx
However, Rex's Nickname behavior is a far better solution, if having 3rd party plugin is alright with you!