Spawning one object but not allowing a second

Get help using Construct 2

Post » Tue Nov 01, 2011 7:20 pm

i would like to have a sprite (lets call it 'monster') spawn every 30 seconds but not letting the same sprite spawn again until it is destroyed. Now monster has a Boolean which is set to true.
In the event sheet i create the monster every 30 seconds and check if the Boolean is true. once it spawns i set the variable to false but the only problem is another monster is still created.
What am i doing wrong?
B
12
S
2
G
5
Posts: 23
Reputation: 3,320

Post » Tue Nov 01, 2011 10:10 pm

I think I worked out an example that might be what you need but I currently don't have a place to upload (my DropBox is packed) it so I can either mail it to you or try and manually type in the events.

I have only started messing around with Construct since yesterday but it might help a bit.

Let me know.
B
22
S
5
G
6
Posts: 57
Reputation: 4,487

Post » Tue Nov 01, 2011 10:23 pm

both options are great for me, so choose which option is easiest for you.
B
12
S
2
G
5
Posts: 23
Reputation: 3,320

Post » Tue Nov 01, 2011 10:30 pm

Sure, I can send you the file... email me at lance at digitalarchitecture.ca

I'll fire you the file then...
B
22
S
5
G
6
Posts: 57
Reputation: 4,487

Post » Tue Nov 01, 2011 10:35 pm

Should have sent you an email
B
12
S
2
G
5
Posts: 23
Reputation: 3,320

Post » Tue Nov 01, 2011 11:56 pm

Renegade, the logic behind it is, make a conditional checking a variable, if the variable is not active, then, check the timer, after 30 sec, spawn, if the variable is active, it'll not happen.
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,211
Reputation: 18,480

Post » Wed Nov 02, 2011 1:29 pm

Thanks PixelAmp that's exactly what i needed, i thought that by creating a variable inside the ghost object would be enough; didn't know i needed a global variable for this.
Thanks for your help
B
12
S
2
G
5
Posts: 23
Reputation: 3,320

Post » Wed Nov 02, 2011 3:57 pm

+>Every 30 seconds
->System compare sprite.count < 1
-->system create object

Sprite.count is the number of sprites that exist.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Nov 02, 2011 5:59 pm

Glad it helped. It was a good exercise for me to familiarize myself with the tool.
B
22
S
5
G
6
Posts: 57
Reputation: 4,487


Return to How do I....?

Who is online

Users browsing this forum: Kagubro and 22 guests