Using pick to start a tween is not working and I can't figure out why

Not favoritedFavorited Favorited 0 favourites
  • 8 posts
From the Asset Store
Calculate parabolic trajectories and tween objects over them.
  • I have been working on this ALL NIGHT and I can't figure it out for the life of me. I've even tried multiple LLMs and they are stumped, too.

    What I'm trying to do is very straightforward:

    Run tween "pawDown"

    On tween "pawDown" finished - play sound (I hear the sound playing so I know this works)

    - Pick all fam_paws

    - Pick fam_paws by evaluating fam_paws.pawState = "current"

    + Do something

    The evaluation fails every time. I have verified, multiple times, that when the code above executes there is only one sprite with pawState = "current". But this condition fails every time.

    Any ideas why this could be happening??? Nothing else in my code is affecting pawState.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you post a screenshot of your code? Also, run the game in Debug Mode and check that there is an instance of fam_paws with pawState containing current (without quotation marks).

  • Here are the events in question, along with a shot of the debugger and game screen.

    EXPECTED RESULT:

    After the pawDown tween finishes I want the circular highlight to move from the first fam_paws sprite to the second fam_paws sprite. (Which is the only sprite that has pawState = current. This is verified.)

    ACTUAL RESULT:

    The pawDown tween finishes, I hear the gallery1 sound effect, and then nothing happens.

    One of the LLMS suggested the Pick all fam_paws to "clear" the picked objects list, but that didn't work. I also tried changing the event to a For each fam_paws condition but that didn't work either.

    There is nothing else in the sheet that does anything with spr_pawHighlight (the ring) except I have another tween that makes the ring pulse up and down. I added tags to these tweens, but that didn't work. Then I just commented out those events. It still didn't work.

    As a test I removed the Picks and just left the condition blank, and I had the moveRing tween move to x = 100 and y = 100. That works just fine.

    I am completely bamboozled by this not working. Any ideas?

  • pick all fam_paws appears to be redundant. I guess you've tried without that?

  • pick all fam_paws appears to be redundant. I guess you've tried without that?

    Yeah, one of the LLMs suggested that. It didn't make a difference, but I left it in anyway.

  • No, "pick all fam_paws" is not redundant, it's required in this case. But I can see on your screenshot that this condition is in a separate sub-event. Combine both sub-events into one and it should fix the issue.

    Also, instead of "pick by evaluating" use "fam_paws compare instance variable", it's easier.

  • Well, dop2000, you have once again proven your genius! Thank you!!!

    I was pretty sure I had tried this already, but this time it worked. But... WHY did combining the sub-events work?

    Super glad it's working now, but still confused about the *why*...

  • That's how picking works in C3. The parent "On tween" event picks a single instance of pam_paws for the entire event.

    If you want to access other instances in the same event, you need to use "Pick all" condition - but it will only be active within its sub-event. Once the sub-event has finished, the picked scope reverts to that single instance.

    The order of conditions is also important. In this case "Pick all" needs to be first, above the "compare instance variable" condition.

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