Strange family behavior

This forum is currently in read-only mode.
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I have the following events set up for an enemy with the platform behavior.

    +Enemy.Angle = 0

    ++Terrain offset(10,2)

    --Set horizontal speed to 100

    ++Else

    --Enemy: Set angle to 180

    +Enemy.Angle = 180

    ++Terrain offset(-10,2)

    --Set horizontal speed to -100

    ++Else

    --Enemy: Set angle to 0

    This makes the enemy walk back and forth along the platform it is standing on. Works great! That is, until I add a copy of the enemy to the layout. Then, it no longer works until ALL the enemies reach the edge of their platform.

    How can I make this work for each enemy separately?

  • Are you using the Compare Values system condition? It doesn't do ordinary object picking. It should work fine if you use the conditions within the sprite object itself to compare. Alternatively you could put a "For Each Enemy" condition above the comparison.

  • No, I'm not using the system compare object. I'm doing a straight-from-the-wizard enemy angle comparison.

    I just tried the "For each Enemy" condition outside the whole set, and it inverts the behavior. Instead of requiring ALL enemies to reach the ledge before turning around, now as soon as a SINGLE enemy reaches the edge, ALL enemies turn around in sync.

    Here's the new event block:

    +For each Enemy

    ++Enemy.Angle = 0

    +++Terrain offset(10,2)

    ---Enemy: Set horizontal speed to 100

    +++Else

    ---Enemy: Set angle to 180

    ++Enemy.Angle = 180

    +++Terrain offset(-10,2)

    ---Enemy: Set horizontal speed to -100

    +++Else

    ---Enemy: Set angle to 0

  • Maybe post an example .cap so people can find a way to fix it.

  • Uploaded here.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have responded there. In your case, the Else condition was messing the stuff up, as it picked all objects matching the first condition - is going into the same angle. Changing that to "is not overlapping terrain at offset", basically the inverse of previous condition, only picks the one that is at the end of platform and thus saves it from the certain doom, while other skeletons are still happily going their way.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)