How to make a platformer in Gamemaker (the easy way) #4
This platformer video tutorial series teaches you how to create a platformer in simple steps.
This time we get our code more structured by using a state machine and putting reusedable code into scripts. The idea here is to have one variable that defines the current state the player is in and run code for that specific case. Also we define what kind of criteria is there to break out of that state, so if you are idle you can break out of it by moving or jumping. The method of a state machine is a standard practise to make the code look easier and make it more modular.
That's it!
Tldr this video:
use scripts for reuseable code
make state dependent code and break out code
Blog post mentioned:
https://gamemaker.io/de/tutorials/easy-platformer
π Support me and get fresh game art and game maker projects every month:
https://www.patreon.com/1upindie
Follow me on:
πΈ Instangram: https://www.instagram.com/1upindie
π¦ Twitter: https://twitter.com/1upIndie
π¬ Discord: https://discord.gg/gvr98nb
π Udemy: https://www.udemy.com/course/become-a-video-game-developer-with-gms-23/ (See youtube about page for discount)
0:00 Explaining what we will do
1:22 Package code into scripts, here - gravity and jumping
3:32 Use a variable for the state machine and toggle it with a switch statement
4:28 Define the "idle" state
6:42 Define the "walk" state
9:07 Define the "jump" state
12:24 Game shown: Monarchy