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: 219
Reputation: 2,181

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
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Mon Jul 11, 2016 10:34 pm

Image Image
B
25
S
14
G
140
Posts: 877
Reputation: 73,012

Post » Tue Jul 12, 2016 7:42 am

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

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: 219
Reputation: 2,181

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
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

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: 219
Reputation: 2,181


Return to How do I....?

Who is online

Users browsing this forum: dop2000, irina and 7 guests