How do I compare animaton frame with another animarion frame

Get help using Construct 2

Post » Mon Jun 09, 2014 2:13 pm

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?
B
5
Posts: 34
Reputation: 322

Post » Wed Jun 11, 2014 7:34 pm

Do you compare animation from different instances or just an instance?
Could you explain what exactly you want to achieve by doing that?
ImageImage
B
115
S
51
G
24
Posts: 790
Reputation: 23,505

Post » Wed Jun 11, 2014 9:16 pm

Are you trying to compare animations of two different objects? Or two different instances of the same object?
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

Post » Wed Jun 11, 2014 9:29 pm

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
B
90
S
44
G
17
Posts: 1,012
Reputation: 18,527

Post » Wed Jun 24, 2015 12:35 am

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.
B
5
Posts: 6
Reputation: 237


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests