Landing Sprite Issues

I have been considering how to structure the game in terms of simplifying the workflow of the game designer. Today, I have come up with a way of pausing the game without requiring the designers to implement boilerplate code in order to make sure it stays working.

The recommended way of pausing a game in GameMaker is to deactivate everything by running the following code:

instance_deactivate_all(true);

The true parameter means to deactivate everything except the object running the code. In this case, I’ve placed it in the LevelManager object. It makes sense to do it here because it is a completely neutral object that manages the flow of the level, and it doesn’t get in the way of the player. In fact, most players won’t know that the LevelManager is a thing at all.

The disadvantage to this approach is that it stops the rendering of all the deactivated objects. I don’t want that. I want everything to still be visible and to just stop animating. However, if I deactivate all the objects during the Begin Step phase then reactivate them at the End Step phase, everything will continue to render without them advancing in time. It worked great.

Unfortunately, it wasn’t all smooth sailing. The objects will continue to animate. This is because the objects remain active during the draw phase, and it is during this stage that the animation cycles continue. There is an image_speed variable tied to each object that allows me to control the pacing of animation. 1.0 = normal animation speed, 0.0 = no animation speed. GameMaker 2 has no global animation speed variable, so I needed to make one.

global.imageSpeed = 1.0;

For each object’s Draw Begin stage, I set their individual image_speed variable to that of global.imageSpeed. This allows me to pause every object by changing a single, globally-accessible variable.


The other thing I have been working on today is the jump physics. In particular, I have been working on the landing. It is working well at the moment. However, if you look at the feature image of this post, you will observe an issue I am having with it at the moment: the character jumps into the terrain for one frame. It pops back into the correct place the very next frame, but it is possible to witness this anomaly in real time. I need to find a way to fix this issue, which is what I will be doing tomorrow.

Leave a Reply

Your email address will not be published. Required fields are marked *