0 Favourites

Pushing an object

This forum is currently in read-only mode.
  • Hi,

    Because I am not experienced in Construct I cannot play a push animation when the player is pushing an object.

    When this happens, a private variable 'CratePush' of the player object is set to 1. In order to play the push animation, I check if the 'CratePush' equals to 1. But I always see the first frame of the animation

    <img src="http://www.mediafire.com/imgbnc.php/0a2991f120470d3b5594baad20d8f5a66g.jpg">

    What I am doing wrong?

  • I believe that's because that event is telling your player to constantly play the push animation. Try adding "Trigger once" with the system object, loop the animation, and stop it when needed.

  • You can get away with adding another subevent that will set 'CratePush' back to zero.

  • I believe that's because that event is telling your player to constantly play the push animation. Try adding "Trigger once" with the system object, loop the animation, and stop it when needed.

    Could you please give me an example of use the "Trigger once" event?

    You can get away with adding another subevent that will set 'CratePush' back to zero.

    This is done before in an "Always" event

  • Could you please give me an example of use the "Trigger once" event?

    +CPlayer: Value 'CratePush' Equal to 1

    +Trigger once (system object condition)

    -Do stuff

    With that your animation will only be triggered once instead of constantly restarting and showing only the first frame.

  • Thanks for the tip but It is not working. I noticed that if I will set tags in the Animator, every time I will start another animation (with tag=None) this is going to start in the first frame because it will stopped automatically by the default tag "Stopped". As a result the animation for the pushing will restart again from the first frame.

    My solution: I removed all the default tags from the Animator handling all animations manually:

    <img src="http://www.mediafire.com/imgbnc.php/4b74557bd15ce8df0bfa5203e16c05a96g.jpg">

  • Um you don't need all those else's, and:

    [quote:l5pgdsxn]This is done before in an "Always" event

    Might be causing some issues as well.

  • Um you don't need all those else's,...

    I removed the else's but my animations are not played properly.

  • Ok try making your animation changes into single events.

    Remember sub-events take place only after the event's condition before it are met.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • newt: thanks for the tip

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