• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

State and/or Animation switching issue?

K

Kaleb Brinkman

Guest
Apologies for the bit of setup before getting to the problem but this has been frustrating me and I hope the background info might help someone to understand wtf is going on.

I'm working on a platforming game for a school group project and we've been working on it in 2 separate gamemaker files as I have been using one file as sort of a sandbox to test out and teach myself things about gamemaker that I can just copy over to our main file when I'm done.

I learned state machines and storing a lot of the basic step event code in separate scripts. It's nothing crazy but so far I have an idle player state and an air player state. My animation code is placed in a separate script that I call in both states.

I only have a few different animations:
Idle (1 frame)
Running
and
Jump (2 frames. 1 while rising and 1 while falling)

In my 'sandbox' file, everything works correctly. Leaving the ground switches to the air state where double jumping is possible and the correct sprites are called at the correct time and nothing weird is going on.

After getting all this to work, I copied my code into a shared Google Doc with my groupmates and copied the code from there into our main version of the file, cleaned up the player step and create event, made sure all the states and scripts were implemented correctly, and even compared the code to my sandbox version and everything looks identical.

The problem:
Upon testing the game out, our player object upon returning from air to ground, will rapidly cycle through the 2 air sprites and the idle sprite for about a second while slightly sinking into the wall object below. After the sinking/sprite cycling stops, everything works as normal with movement until the player is in the air again and the problem repeats the next time they land.

I feel like I have tried so many things to fix this or even figure out what aspect of the file is causing this issue.
I've doublechecked that the scripts in this file are identical to my scripts in my sandbox version (where this issue doesn't happen)

I placed a show_debug_message() in both the air and idle state scripts and ran in debug mode, and it appears that its just looping each state infinitely. My output log fills up with idle messages while the player is standing on the ground and cycles between idle and air messages for a few lines when the player lands.

I am so completely lost as to what is causing this. Everything for the states in the player step event appears correct to me.

If anyone can help me figure out whats going on, that would be amazing. Idk if there's some option that could have been changed in this version of the file by my groupmate that I dont know about or something else I should check that could cause this.

Thank you in advance. This bug has wasted 2 entire class sessions and I have a week left to finish this project and we are fairly behind now
 
Top