SOLVED How do I set repeat in events

Get help using Construct 2

Post » Mon Jul 11, 2016 10:11 pm

When i click LMB i set action repeat 5 times (5 times is in variable so when i change variable to 4 action will repeat 4 times)every repeat player shoot 5 times particle
but problem is when player spawn projectiles
action spawn 5 times but at once

i add every 0.1 ant this doesnt help
projectiles ar spawned at this same time.

How fix this??
Last edited by IGDev on Tue Jul 12, 2016 9:02 am, edited 1 time in total.
B
25
S
8
Posts: 212
Reputation: 2,167

Post » Mon Jul 11, 2016 10:16 pm

Try using a "System-Wait" action in between 5 seperate spawn projectile actions. Don't use repeat.

Remember the entire event sheet is run once per frame. Repeats will all be processed within the same frame.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Mon Jul 11, 2016 10:34 pm

Image Image
B
22
S
13
G
135
Posts: 871
Reputation: 70,320

Post » Tue Jul 12, 2016 7:42 am

@MadSpy when i add loopindex this help me :) thanks
B
25
S
8
Posts: 212
Reputation: 2,167

Post » Tue Jul 12, 2016 7:59 am

@oosyrag i try madspy's example. I use this to enemy fire projectiles. (i have one sprite of enemy)
Now when player spotted enemy, enemy wil repeat spawning projectiles every 0.1*loopindex

All enemies spwan projectiles the same way, the same speed

So...

I add to each enemy varible 'recoil'

i change 0.1*loopindex to enemy.recoil*loopindex
first enemy has recoil 0.1(slower shooting)
second enemy have recoil 0.01(high speed of shooting)

if two enemies is on screen every enemy spawn projectiles at the same speed. Its possible to fix this ?
B
25
S
8
Posts: 212
Reputation: 2,167

Post » Tue Jul 12, 2016 8:01 am

See if adding "For Each - Enemy" and see if that helps.

Actions by default run "For All"... if you add for each, your actions will be done separately for each instance of the obect.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Tue Jul 12, 2016 9:02 am

@oosyrag Yes :D its working
all my problems ar solved
thanks guys
B
25
S
8
Posts: 212
Reputation: 2,167


Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish, marc254, Mayfly and 14 guests