Simultaneous events

Get help using Construct 2

Post » Thu May 01, 2014 5:48 pm

I've had an issue for a while that I normally found a work-around for, but I'm still rather curious; When I have an event such as :

if ROCK on collision with FLOOR
>>>>Create ROCK death sprite
>>>>Destroy ROCK

It doesn't seem to work right if 2 rocks hit the floor at the same time (it will destroy both of them, but it won't create a rock death sprite on both). I've noticed this on other occasions as well:

if ENEMY is playing animation "Shoot" and = frame 3
>>>>Create Projectile

If 2 enemies are on screen, playing the animation simultaneously, only one will shoot (usually the first on screen). However if I offset the animation by 1 frame, both shoot the projectile fine.

I'm just trying to wrap my head around why this is happening.
B
38
S
12
G
1
Posts: 526
Reputation: 4,085

Post » Thu May 01, 2014 5:54 pm

If your rock is a sprite, use the rock action: create object

If not, add a system: for each rock loop just after the collision check
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Thu May 01, 2014 5:57 pm

@Aphrodite - thanks! I completely forgot about the spawn object on the sprite action list!

What about something like the enemy playing the shoot animation?
B
38
S
12
G
1
Posts: 526
Reputation: 4,085

Post » Thu May 01, 2014 6:00 pm

@Aphrodite - nevermind; just realized the same thing should work for that, as well. Thanks again!

EDIT - I was wrong - upon further investigation, it still has the same issue where the sprites aren't being created. I'm wondering if it can't decipher which location to create the sprite? (I'm creating it at the ROCK.X, so I'm guessing since 2 hit simultaneously, it only chooses one of them?)
B
38
S
12
G
1
Posts: 526
Reputation: 4,085

Post » Thu May 01, 2014 6:43 pm

Maybe add a for each condition..?
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Thu May 01, 2014 6:53 pm

@eli0s - I figured out the collision issue. It was a mistake on my part (I was multiplying the size of the death animation by a variable set on the ROCK's creation event and some of them were accidentally set to 0 :D)

I've tried a for each in the event list and it still doesn't seem to play nice when 2 on-screen are playing the same frames. Like I said, if I offset the frame, it's fine. I'm more curious on why it's happening.
B
38
S
12
G
1
Posts: 526
Reputation: 4,085

Post » Thu May 01, 2014 7:14 pm

Perhaps if you provide an example capx it will easier to help.

This multiplication thing sounds tricky, some frame numbers are ought to be skipped. In your 1rst post you mention frame 3, is this the last frame of an active animation (an animation that it's playing, not still frames of a sprite)...? If yes, perhaps the "on animation finished" condition will trigger the spawning.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649


Return to How do I....?

Who is online

Users browsing this forum: DjowG, jaytrott86 and 8 guests