How do I Check the Current Frame of a Sprite

0 favourites
  • 4 posts
From the Asset Store
three fully animated characters ideal for your RPG side scroller projects
  • Hey there,

    I am currently using a sprite object that holds 100+ frames. The sprite is then duplicated 100 times and each instances initial frame is set to 1, 2, 3, and so on. I then use an onTouch condition and I compare the frame of the touched sprite. This then allows me to control some events.

    The issue I am having is... I don't feel that this is the most efficient way of handling this type of condition/event. Does anyone have information or suggestions on how to check the current animation frame with maybe a function or reusable line of conditions/events?

    Thank You,

    Hawkadium

  • Yep.

    On touch -> selectedChampion = current.frame

    Lol

    ~Sol

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ugh, thank you. Sometimes it is so simple, that I completely overlook it.

    Edit:

    Tested and working.

  • Yeah it often is really that easy. Over-thinking things can often lead to this type of long-winded event style being made.

    If all else fails and you can't do a direct comparison between something (like in your example, animation frame and the sprite set to use) then make a variable for it and compare that.

    I have made some seriously complicated stuff happen with only one or two events - it's all about the logical mechanics used to build your idea.

    Hopefully when you create your object and set the animation frame you did it using something like "set animation/frame to loopindex" or similar. It would also save a lot of time and be more flexible

    ~Sol

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