How do I spawn specific family object

Get help using Construct 2

Post » Sun Jun 28, 2015 11:24 pm

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
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Mon Jun 29, 2015 12:10 am

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.
B
14
S
4
Posts: 109
Reputation: 1,281

Post » Mon Jun 29, 2015 3:40 am

@Nabu0001 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
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Mon Jun 29, 2015 6:38 am

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!
B
69
S
28
G
24
Posts: 977
Reputation: 18,739


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 11 guests