Artificial Intelligence (AI), Player & Object States, and much much more! A very important concept to learn! How to use Finite State Machines to code games in GameMaker.
Find these videos useful? Consider supporting on Patreon:
I believe in accessible education, this video’s content and any included GameMaker source files are and always will be free for anyone to use in their projects, commercial or otherwise. No credit or consent is needed to use this code in your own work, I merely ask that the video and/or source files themselves are not redistributed as they are without my consent.
Nguồn: https://zagran-tour.com/
Xem thêm bài viết khác: https://zagran-tour.com/game/
Oh my goodness Shaun you mad lad! I had someone reference Enumerators and State Machines to me in a live stream, coding my Megaman X platformer, and holy crap. This simplifies and ORGANIZES my code! Thank you ever so much!
This isn't as good of a GameMaker tutorial as it is a great coding tutorial in general for anything.
I didn't know about enums and had nightmares of making a stupid system of numbered string names in a list for climbing or stunned and either having to check if number in list is "climbing".
Now I can finally find a great way to organize my states as well as get a use for switches, never had any use for them.
Thought i'd have to make a stupid struct of bools and having to turn on one and turning off the rest every time I switched to one -_- ugh what a nightmare that would've been.
Now I can simply set if i'm not guarding and the force is strong enough, then simply set my state to stunned or knockedAway.
Thank you so SO much for this tutorial !!
What the language programing used??
how do I make an object jump with animations on a finite state machine ?
so if you were to add an enemy state machine you'd add it under the code for enum state? like enum enemystate for example?
5 years later and still immensely helpful. Thank you. I had hit a bump using "if then" statements realizing i couldn't get much further, but this is exactly what I needed! Finite state machines will definitely help me move forward.
Thank you! This started off as a long winded and unfocused description, but turned into a very helpful and clarifying explanation! Thank you!
Interesting, instead of enums I have been using macros (standing=0, running=1, ladder=2, etc). I'd have some global variable hold the current state (example: player_state=running). This method has worked perfectly for me for years but I feel kind of weird because everyone else uses enums when it comes to finite states. Is there something about enums that make them superior to the macro feature in GM?
this fucking sucks man
Great, now i have to re-code my script..
Btw thanks
can you PLEASE redo this tutorial for beginners cuz i can't seem to follow it , been watching this multiple times
Lol I watched this way later than I should have. My player step event code is a mess, now I know how to clean it up. Thank you!
I’m here watching this 4 years later and it has been a HUGE help. THANK YOU!
Щас я проверю что за программа вирус или нет?
Are enums "global"? I cannot for the life of me seem to be able to change the value unless it's in the player's event. If I put state = states.weapon; in any other event it doesn't change it. What am I doing wrong?
Not sure this has been said, but whats wrong with just using strings?
your while loops are broken. i have seen much better from you.
Does anyone know what the cut off part in the collideandmove script is? his video doesnt show the whole code and i cant seem to find the files or anything anywhere on it. My character gets stuck in floors after i jump and i followed his code all the way to this spot but i cant seem to fix this problem
My game keeps saying that in "switch (state)" that state is not a known variable
How do I fix this?
Thank you.
Wow this useful, I put so much if statements in my games. I will keep this in mind when I am developing games in the future.
I cant figure out the bit of code missing off the edge of screen.
Oh my god! Thanks! 😀
I'd do
state = (a macro)
man, im a beginner and i literally thought about this earlier in shantae while i was talking to an npc and thinking how complicated it must be for every single scenerio! but you literally just made me feel so much better about it. didnt think id get it but its almost like how can you not. super pumped. love the vids. im seriously only concerned about why your gamemaker studio looks different then mine when in earlier vids you had the same setup