[SOLVED] Stuck with playing animations, please help


I have a very strange problem, which I have hard time solving and without additional help, will be stuck with it for a very long time.

I have a character for which I can’t change animations due to these problems, collision mask, and probably something with piskel, to be honest I have not got any clue, resulting in animations not getting played. I have a backup version where previous animations work good, just as I wanted to do a quick update on sprites, change it to new ones, seems to be stuck, and everything fails, I cant jump anymore, which is the main goal of the game, game becoming unplayable.

I have tried disabling all of the events, and what is even stranger it still persists to be doing the same problem so I guess there is not a problem with code but rather with piskel , or some sprite config. I am sure I have made collision mask right , and cantered the points, but still here are my events and images.

As usual I made a simple mask, and have the points and mask shared trough my all animations.

For some reason at first time I add the animations inside the piskel the editor plays them, but the game still doesn’t, but at a second change as I have to change the width and height, they don’t even play in editor so can’t preview them.

All I did different on this version, what I haven’t done on the backup was I changed the width from 105 / 93 to 193 / 192 and everything blocked out.

Here are some of the events, as I have quite a lot of events, but those are by my opinion the ones that handle some part of animations just left and right movement. So I disabled those ones and added a simple one line event, and the animation still doesn’t play. But it plays on the backup fine so I haven’t changed any of the code, but there could also be some problem with code, as I cant even jump and that just cause I updateed a sprite in piskel and redo the mask.

A simple one line code event

I can also share a whole project thought my DM, if you write a contact in the comments. I would be very grateful for every help as the project means a lot to me.

do you use animation loop? you can toggle it while editing the object

Yes, I am using the animation loop, but still doesn’t work. It doesn’t play, loop even thought it is toggled.

how fast does the animation go? maybe its too slow or too fast.

If you change an animation from on to another, the animation changes back to the first frame. You’re changing animation to another one (“GunWalking” or “Walking”) before setting it to “Jump”.

One way to fix this is to create an event to check that player is on the floor, and moving those two events that check the value of blue_laser_gun as subevents of that one.

The fps is 12.5 and time is 0.08, some of them have 0.2. It should work fine.

I don’t understand cause, on my backup version everything works fine and smooth as I wanted, I tried few times to update the old sprites with new ones, and I haven’t changed the events just the mask and points and it all messed up.

So I have disabled all of the events, and just tried to figure out the animation problem, and, I am sure it should work if I created a new project, but it doesn’t I am also not getting any errors so it is hard for me to trace.

Your trigger once stop your animations to play.
dont put them in a subevents after a trigger once.

So the events you posted are exactly the same in your backup version?

Use the “debug log to console” to see where the game logic is going. Put a number of log statements, with values of variables or animations, into your events, and see if these values are what you expect.

No they don’t. The trigger once is acting on the conditions of the event it’s in. In this case, it acts on the key being pressed, and prevents the events from being actioned multiple times when the keys are pressed.

what i read is that
if the next frame the keypress still happen animation will stop bcs the trigger once

I will try figure out the problem by checking it with printouts, but what I find very odd is that, not even idle loop animation plays even thought I don’t have any events that would overlap with it. I have created a new project and pasted the same cut of events and it works fine as expected obviously. But in the other project, same thing, all of the events disabled and nothing, here is a short video of a problem, which is even worse as you will see I have a lot of events. I have little idea on how to tackle as usually all of the code errors are either shown in console, and if their are not I disable events and try that way.

again try to un-subevents your animation condition.
Try with a simple event 1st.


if left pressed
if global blue_laser gun=1 ----------- change animation

try 1st without a trigger once

also what global variable animation do?

Not true. Animations play until the last frame, or continue if the loop option was selected.

What you are suggesting is to have the same conditions repeatedly in a series of events. That’s inefficient and not a good programming standard.

@Danijel, from the gif, is the start of the jump animation, or idle? What is the value of the global variable KEYS.NOKEYSET? Are there any other set animation actions?

And is the distance from the origin to the hitbox bottom the same for all of the frames of each animation?

from what he posted it’s the only way since he’s using change animation and (not play) under a trigger once.
If it’s inefficeint or not? i don’t know since it’s not my game and i don’t know what he want to achieve.
Also i was suggesting first to start with something simple that

you can see clearly before getting…efficient…

and there are a lot of inefficeint things in the picture posted noone pointed before

“Change animation” will automatically set the animation to the first frame and start playing it if it isn’t already on that animation. If the animation is changed to what it currently is, then the playing of it isn’t started from the first frame but continues on.

That is indeed the problem.

I have partially solved the problem, I tinkered and replaced the sprite with a new one, which took me a lot of time as I had to change all the variables too also the code was correct with an exception of one event which was related to jump animation I took it out of sub event , but now the animation work I suppose something got corrupted, overwritten , but the " charge jump " I had, got broken, still related as it works if I create a new project and fails in my main project. All the variables, everything is I think correct as it works in a new project. And in debug, I noticed that the variable is not collected but in the print it shows me that it is collected. So from one problem a new one appeared.

Here is the code for the charge jump anyway. It is the same code in my main project, I have disabled all of the comments and still doesn’t work.

How is the charge jump supposed to work? What are you expecting it to do?

Do you understand what those single “Trigger once” do? They only allow the action to be run once in the game, and that’s it. Those actions won’t get triggered for the rest of the game.

You use a global variable SPACE_KEY. I assume this is so space key can act as the jump key. If that’s false, then the actions and subevents will be run every single frame. You may want to add a “Trigger once” on that event.

You’re also getting the character’s position, deleting it and then recreating it at the same position when space is pressed. Why?

On a further look, I don’t think adding that trigger once is the right solution and instead should look at using a Finite State Machine (FSM).


The goal of this events are to act as jump charge, as you hold down the space button the variable rises, as you release the space key, you lift up as high as the variable " Increase_Power" is. That is what I am trying to achieve, as long as you hold the space key the further you jump when you release it. This events are based on trampoline extension, and trampoline extension bounces you off on contact. The events might not be the most optimal, but they are trying to hold you on the same exact position as you hold down the space key, it is hardcoded, giving an " illusion " that you are charging up, that is why I had to delete the player at some point.

Those two single trigger once conditions, are backed up by the " space key is released "condition. They will execute as I release the space key, and they will do that once each time, that is how I understand it and it works in a new project with the same events.

The reason I use the trampoline extension is cause it has force, integrated force inside it, then I just add direction with additional forces to turn the player the way I want him to jump , and cause I want the player to bounce of blocks which by having this extensions works conveniently as it can function also as platform, and I can turn it the way I want .