Animations Won't Play On Certain Events

0 favourites
  • 3 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • CAPX:

    EVENT SHEET: E 2D Crew

    LINE: 17 (Group "Octagon")

    Summary of desired results:

    Depending on the location (and distance) of Mr Stick relative to the objects EnemyOctagon and EnemyOctagonEye, the Eye will look to its right or left, whether in its green state or red state (see the animations for both objects). If the Octagon is spinning, transitioning from green to red or red to green, the eye will close momentarily, then resume its appropriate looking direction.

    I'll refer to both the Octagon body and the eye as just the Octagon, since technically it's one object when I finally get it all working...

    I'll try to further list the conditions I'm trying to set up...

    Mr Stick is close (within 500 pixels) + Octagon is not spinning

    • Mr Stick moves from left to right of Octagon (or right to left)

    Octagon looks from former direction to new direction based on Mr Stick's location.

    Mr Stick is more than 500 pixels away from Octagon

    Octagon looks forward, neither to left nor right.

    Octagon begins transition from red to green or green to red states

    Octagon eye closes until spinning animation is finished. Resumes appropriate eye direction depending on where Mr Stick is located. (NON-left-to-right (or right to left) animation.)

    So the conditions include checking if the Octagon is spinning, when Mr Stick moves from one side to another, and the distance Mr Stick is from the Octagon.

    The trouble I'm having is getting the Octagon to respond appropriately. In the capx I've shared, I have two instances of the Octagon (the eye and body are combined in a container). When I walk past each one, they will respond to Mr Stick walking past in one direction, but when I walk past in the opposite direction, they will not respond.

    I've restarted the event list several times, trying to catch any errors I might have made, but I can't figure out what I'm doing wrong, if it's a bug in C2, itself, or if I'm missing a detail in the way events (specifically nested events) are handled.

    Could someone point out to me what I'm missing, please? Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't crack open the capx as I am at work, but you may want to split it out a bit more and have the first event check to see if you are within 500 pixels (or use overlapping at offset maybe?). Then a sub condition to see if it is spinning. My assumption is you are using a variable to track if it is spinning or not. If you aren't you may want to try it that way. Same with transitioning from green/red, etc... set a variable (eyeTransitioning) and set it to true or false and key off that. Also how are you checking for left or right? Comparing X coordinates? That might be the safest method if not.

  • BluePhaze - Understood about work. If I don't have it figured out by the time you're off, I would be so grateful if you could give it a closer look. Thank you for your input, either way. Means a lot.

    Anyway, to answer your questions...

    I am definitely trying to apply your tips from a while back about using custom variables to establish specific conditions.

    I have variables for

    • IsSpinning (Boolean)
    • StopEffectState (Text; determines whether Octagon color should be red or green and when to cause Mr Stick to be stuck in place when in range.)
    • IsClose (Boolean; using the distance() expression)
    • LookDirection (Text; to determine, ultimately, which eye animation to play...whether to look left-to-right or just look right, etc)
    • DistanceToStick (Number)
    • LookStraight (Boolean; similar to LookDirection and used in conjunction with DistanceToStick to determine when to use the LookStraight animation)
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)