[ Solved ] How do I use system repeat?

Get help using Construct 2

Post » Sat Aug 08, 2015 12:56 am

Hi there,

I have 2 sprites, first sprite spawn sprite two every 1 second, and I want the action just do 4 times, means just spawn the second sprite 4times, but when I add the system ->repeat count 4, it not works, it keep spawning, never stop, so how to spawn object in a given times? thanks
Last edited by laoniustudio on Mon Aug 10, 2015 1:57 pm, edited 1 time in total.
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Sat Aug 08, 2015 1:21 am

Uh, Try "System-Trigger Once"
Risk Rocket now available on Google Play
Image
B
36
S
15
G
6
Posts: 337
Reputation: 6,300

Post » Sat Aug 08, 2015 8:08 am

@Usman Haq trigger once is not work
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Sat Aug 08, 2015 11:16 am

How about

https://db.tt/w2JvnwL7

(r211 beta)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sat Aug 08, 2015 12:04 pm

You could do something like this:

Image
B
15
S
6
Posts: 105
Reputation: 1,356

Post » Sat Aug 08, 2015 3:53 pm

@phimaka - perhaps instead of using a global variable updated every tick you would be better using :

Image

although perhaps I should have called the group "less than five missiles on screen at once method" :oops:
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sat Aug 08, 2015 6:11 pm

edited the above capx - perhaps a bit OTT ?

https://db.tt/9012BJud
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sun Aug 09, 2015 12:15 am

@RamPackWobble The way your doing it is a better programming practice.
B
15
S
6
Posts: 105
Reputation: 1,356

Post » Sun Aug 09, 2015 1:15 am

try using a variable.. the repeat X times.. its just gonna respawn as many missile as you tell it to multiplied by 4

in order to stop spawning it... after it spawned 4 times.. considering there are no other similar sprites on screen... you can do a condition check... that counts how many sprites of the same type are on screen... Example :


Condition - when mouse click -(or every 1 second how you want to be)
- if sprite.count<4
Action create actor sprite at x y

that means every 1 second if the missle count is less then 4 will automatically create another 1 till are 4 on screen... hope it helped you...

you can disable the condition triggering by placing it in a group and enable the group when you want it to happen...

lets say if Spacebar is pressed Set group shootmissile active

if sprite.count - greater or equal with 4 ... Set group shootmissile disabled

you can also do it by using a boolean its same thing.. just you'd have to say when spacebar is pressed set boolean to true...

and when the count of the sprites is equal or greater to 4 set boolean to false

now if you want the sprite when spawned to have a delayed space between them if you dont know how to count the space in pixel.. you could calculate it visual by adding a wait period... of 0.5 lets say and let the whole creating system you just created to happen every tick.. with a delay of 0.5 between each creation of a sprite... that way youl have all sprites spawning at different spaces from each other... and you wont have to worrie about them overlapping...

hope it helped you, and i hope i was in the area of your question. please add [ Solved ] in title of the topic if its already Solved @laoniustudio
Last edited by gamecorpstudio on Sun Aug 09, 2015 1:31 am, edited 3 times in total.
B
78
S
23
G
69
Posts: 1,354
Reputation: 44,027

Post » Sun Aug 09, 2015 1:27 am

thanks all of you, @RamPackWobble it works well, thank you.
B
11
S
3
Posts: 172
Reputation: 1,178

Next

Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot] and 28 guests