Compare 2 frames of 2 animations

Get help using Construct 2

Post » Thu Feb 06, 2014 12:30 pm

I have 5 in my layout objects with drag and drop behavior, they need to drop in 5 slots, so far OK, however these slots are 5 frames of an animation and every time I start the game they are in random positions.

must allocate each object in each frame is when I drop
if I pick up the object and drop 1 slot on the frame 1, position 1 Set About the object, if not it back into place (the part back to the place where wrong is already done with lerp)

I thought of something like "when drop object on the right frame, position the set of the object to slot.AnimationFrame" but do not know expecificar about which animation frame it will stay (I do not know if it works well)

understood? was not a perfect explanation haha

~explaining the game, example: is a game where you have to drag the image of the animal (which appears in a random order) for the correct name of it (which also appear in a random order).

both are made by random loopindex in a sprite.~
can someone help?
B
5
Posts: 34
Reputation: 322

Post » Thu Feb 06, 2014 1:23 pm

Maybe I misunderstood you, but then you can just ignore my post :D

But if I understood you correct, you have several slots which each have a name of an animal attached.

Some pictures of animals then needs to be match to the correct slot?

If that's the case, I think the easiest would simply be to "hard code" the solution in C2, for the 3 objects.

1. Textbox with the name of the animal
2. Slot where the picture of the animal should be placed.
3. Animal picture.

For each of these objects you add a variable called "Animal_name" and you simply use this to make sure that they match.

A way to do this could be like this:

1. When the game starts you set the variable "Animal_name" for the textbox to a random animal name.

2. Copy this animal_name to slot where the picture of the animal should be placed. So now both the textbox and the slot have the same "Animal_name"

3. Since you already know what animal each picture shows, you can add the correct animal name to the picture in C2.

4. When the player drag a picture of an animal over a slot. You just compare that the "Animal_name" is the same for the slot and the picture dragged.

Anyway hope that answers you question :)
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Thu Feb 06, 2014 1:31 pm

If both objects have the same amount of animationframes you could just use:

Object1 on dropped
system compare two values :
object1.animationframe = object2.animationframe
- object1 set position : object2.x,object2.yLittleStain2014-02-06 13:32:41
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Feb 07, 2014 10:33 am

that was it, worked, thank you (:
B
5
Posts: 34
Reputation: 322


Return to How do I....?

Who is online

Users browsing this forum: ASHKAR, brunopalermo, kellehk, ST314 and 32 guests