0 Favourites

Simultaneous events

  • 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.

  • 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

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Aphrodite - thanks! I completely forgot about the spawn object on the sprite action list!

    What about something like the enemy playing the shoot animation?

  • 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?)

  • Maybe add a for each condition..?

  • 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 )

    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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
59 13,714
holi's avatar
holi
Unread hot topic Locked topic
55 4,191
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
0 Favourites
[EVENT] A blossom tale
52 10,422
Windwalker's avatar
Windwalker