Animation just shows first sprite

  • http://www.pic-upload.de/view-30253808/ ... n.png.html

    Here's a pic from my events. If the player gets the gun, the variable "Gun_ready" will change to 1.

    Now if I press left or right arrow, the player switches to the right animation "Lazerwalk" but it shows just the first sprite from the animation...

    I already tried it with trigger once and other things but I really don't know how to fix it...

  • Nefaru I have some demo works to learn from here is link see if that can help you

    https://www.dropbox.com/sh/eioscti86bpr ... 7YPza?dl=0

  • Thank you, I tried some but I think theres nothing who really helps me now :/ My basic animations for my character working perfect.

    If i move left and right, the "walk" animation works fine. Now to the problem. If he collides with a gun, I add one to a global variable called "Gun_ready".

    So now I know, the player got his gun. I also change now the player animation to "Lazer". Thats also working. My problem now is, if the player wonna walk with the gun, the animation "Lazerwalk" just shows the first frame. I think it's because my global variable "Gun_ready" is always true now. So it repeats always just the first frame from my animation. You can see it in the screenshot. I tried so many things, with the trigger once and other stuff but nothing helped..

  • Nefaru would it be possible if you can provide CAPX

  • As a subevent add the inverted condition (IS NOT) "Playing animation 'Lazerwalk'", action Set animation to "Lazerwalk".

    This way if the animation is already playing it won't try to play it again.

    If this still only display the first frame of your animation it hints that every tick it is still changing animation and the last to be displayed is "Lazerwalk".

    Make sure your collision polygons on each frames are properly set up so that when the frame changes, your character is not considered as falling, which would modify the animation.

    Consider indeed posting your capx for review, it will make things simpler.

  • Okey first thank you guys <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> Kyatric I tried it with the IS NOT playing subevent but it still doesnt work..

    So I made a short capx for you, ignore the bad normal walking animation, it's just to show you my problem after you took the gun.

    https://www.dropbox.com/s/msvs196csawo3 ... .capx?dl=0

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, the thing is you should gather your inputs in a single event.

    I mean, when you are pressing left arrow AND you don't have a gun AND the "Walk" animation is not currently playing, play it. When you are pressing left arrow AND you have a gun AND the "Lazerwalk" animation is not currently playing, play it. And so on.

    Currently, each tick, your code reads your input, sets the walk animation, then read again your input and sees that you are having the gun, and so setting the lazerwalk animation.

    Plus the fact that all the collision polygon are off, so in addition to that there is often some "Platform on landed" interrupting in there as well.

    Corrected capx (Made in Beta 226 see at the bottom of the page for a link if you haven't it).

  • Kyatric You are my hero! It works, thanks man Really really nice!

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