Compare 2 frames of 2 animations

0 favourites
  • 4 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • 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?

  • 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 :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.y
  • that was it, worked, thank you (:

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