Animation just shows first sprite

Get help using Construct 2

Post » Tue Apr 05, 2016 5:53 am

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...
B
27
S
10
G
3
Posts: 76
Reputation: 3,068

Post » Tue Apr 05, 2016 7:00 am

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
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Post » Tue Apr 05, 2016 7:23 am

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..
B
27
S
10
G
3
Posts: 76
Reputation: 3,068

Post » Tue Apr 05, 2016 7:41 am

Nefaru would it be possible if you can provide CAPX
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Post » Tue Apr 05, 2016 9:23 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,310
Reputation: 71,084

Post » Tue Apr 05, 2016 11:39 am

Okey first thank you guys :) @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!
B
27
S
10
G
3
Posts: 76
Reputation: 3,068

Post » Tue Apr 05, 2016 3:19 pm

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).

Image
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,310
Reputation: 71,084

Post » Tue Apr 05, 2016 5:21 pm

@Kyatric You are my hero! It works, thanks man :) Really really nice!
B
27
S
10
G
3
Posts: 76
Reputation: 3,068


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 18 guests