How do I compare animaton frame with another animarion frame

0 favourites
  • 5 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Hello

    I am not able to do something that seems simple ...

    I have 2 animations, I want to compare if the animation frame of anim1 is equal to animation Frama of anim2

    anim1 and anim2 is name os my animations

    i try someting like this:

    ------------

    -on touch object

    -compare animation frame of anim1

    -anim1 frame = anim2.AnimationFrame

    ------------

    but did not work

    need to compare if animation frame it matches for make an action and is different for make another action

    some can help me?

  • Do you compare animation from different instances or just an instance?

    Could you explain what exactly you want to achieve by doing that?

  • Are you trying to compare animations of two different objects? Or two different instances of the same object?

  • When you are using "on touch" you are picking only the object you touched. So when you are trying to compare 2 objects, its not finding the second one because it wasn't picked (or filtered by what you picked).

    So what you want to do if you want to use "on touched" is to add this line

    On touched object - Sprite

    store which frame this particular sprite is on (tempVar = sprite.animation.frame)

    then in a seperate event

    pick by evaluate (sprite.animation frame = tempVar)

    do actions

    this will check which frame the touched sprite is on, then go and pick all sprites whose frame = to that temp var.

    its cleaner if you put this all into a function as well

    On touched object - Call function "PickSameFrameSprite (sprite.animationframe)

    on function "pickSameFrameSprite"

    pick by evaluate: sprite.animationframe = function.param(0)

    do actions

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there an easier way to do this than the previous post by justifun? I have tried to experiment some with that method, but just can't fully wrap my brain around it. I am making an NPC dialogue and I have the dialogue as a series of animations in a sprite. I have a next button and a previous button with touch controls to add or subtract the conversation sprite's animation frame. What I want is the player to be able to pick from 4 choices when they reach animation frame #6. I have a blue highlighting square/button (set at 0 opacity) I want to appear when they reach frame #6. I have tried the compare frame animation as a separate event, but I can't get my blue highlighting sprite to appear as opacity 100 percent when frame #6 is displayed. Any tips, I'd greatly appreciate as I've been stuck on this for too long.

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