trouble spawning enemy

Get help using Construct 2

Post » Thu May 31, 2012 4:08 pm

Hi I'm working on a commercial IOS game. But there seems to be a blank pause at the spawning of my enemy.

for example:

system    every 3 sec |   system     set enemygen to int(random(3))

system    enemygen=0|   system     create object blue on layer 1
system    trigger once

system    enemygen=1|   system     create object red on layer 1
system    trigger once

system    enemygen=2|   system     create object green on layer 1
system    trigger once

i figured out that the blank pause is caused by the number generator when it generates the same number. I wanna keep the trigger once condition because I don't want to overspam , limited to one enemy per 3 second.

so how do i fix this?
Posts: 4
Reputation: 233

Post » Thu May 31, 2012 4:25 pm

Hi there, first of all, shouldn't you be using "enemygen=1,2,3" instead of "0,1,2"? maybe I'm wrong, if it works as it is, then it's all right, I'm kind of a n00b here :P

My approach would be to have a number variable with kind of a "cooldown" effect instead of the "trigger once" condition, for example, I would set a "cooldown" variable to... I dunno... 500, and have an new event with "every tick" substracting 1 from that variable. Then have:

system    enemygen=1
system    compare variable: "if cooldown = 0"

That's one idea... maybe it'll come in handy. Hope it helps :P

Another idea, you could put a "wait 3 seconds" after every enemy spawning :) I think that could work too... you could give it a try.Terrato2012-05-31 16:27:00
Posts: 47
Reputation: 7,581

Post » Thu May 31, 2012 7:37 pm

lol thanks! the cooldown idea is something i didn't think of! I used the 3 second instead when i was tinkering around =)
Posts: 4
Reputation: 233

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], brunopalermo, Google [Bot], grigrizljac, korbaach, Yahoo [Bot] and 18 guests