0 Favourites

next fram - previous frame

  • I swear I search in the forums and tutorials but I coudn't find the action that let me set an animation to a previous or next frame.

    I'm making a prev and next buttons that, when clicked, will change the frame of an object; how can I do that?

    thanks!

  • You can use the animation controls within the sprite object:

    Event: On Button press -> Action: SpriteName -> Set frame (Frame number)

    EDIT// On re-read, you want a function that goes to the next frame instead of a specified one? Like AS nextFrame? That one I'm not so sure, you could manually specify each frame using the set frame action, but this may not be what your after

  • Event: On Button press -> Action: SpriteName -> Set frame (Frame number)

    But I should cover all the posibilities in events and actions? I mean, If the object is in frame 2, the prev button should set it to 1 and the next button should set it to 3, but, if the object is in frame 3 the buttons will still work like if it was in 2.

  • You can use the animation controls within the sprite object:

    Event: On Button press -> Action: SpriteName -> Set frame (Frame number)

    EDIT// On re-read, you want a function that goes to the next frame instead of a specified one? Like AS nextFrame? That one I'm not so sure, you could manually specify each frame using the set frame action, but this may not be what your after

    jajaja, sorry, didn't saw the edition. I guess that I should set every posibilty but I'm sure there must be an easier way to do it. If it isn't I would suggest it's integration for the next launch.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • On Next pressed
      -> Sprite: Set frame to (self.frame+1)%self.Animationframecount
    On Prev pressed
      -> Sprite: Set frame to self.frame = 0 ? self.Animationframecount-1 : self.frame-1
    

    Should work fine

  • On Next pressed
      -> Sprite: Set frame to (self.frame+1)%self.Animationframecount
    On Prev pressed
      -> Sprite: Set frame to self.frame = 0 ? self.Animationframecount-1 : self.frame-1
    

    Should work fine

    I'm trying to use it but it says

    "frame" is not an expression or instance variable in "Object"

    Any idea?

    Thanks anyway!

  • yeah it's self.AnimationFrame

    you know, every object property will appear after you type 'self.' so well... you just had to pick the one which made more sense, and seriously, rtfm (:

  • Thanks, it works perfectly.

    But, let's be clear.. the manual isn't a InDeep explanation of the functions and is not even close. Lot of information that could be clearified in the manual is actually in the forums (even this simple function to prev and next an animation could be cleared out in the manual in the Animation controlling section).

    Either way,I'll check it out in the future just in case.

    bye

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
195 24,890
Cryptwalker's avatar
Cryptwalker
Unread hot topic Locked topic
122 33,127
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
118 15,546
Ashley's avatar
Ashley Construct Team Founder