From the course: Building a Physics-Based Platformer in GameMaker Studio Using GML
Unlock this course with a free trial
Join today to access over 22,400 courses taught by industry experts.
Control logic: Idle and run animations - GameMaker Tutorial
From the course: Building a Physics-Based Platformer in GameMaker Studio Using GML
Control logic: Idle and run animations
- [Instructor] Clearly, our idle and running animations are working correctly, so let's go in and fix those up. I'll open up the player object, go to the create event, and let's go back to our initialization code. Since the initial sprite for our player object is the idle sprite, let's go ahead and set the image speed here. We'll use the function image underscore speed, and I'll set this to something small like 0.12. I've tested this and it looks like it'll work pretty well. Usually I just set these by trial and error, though. Let's close this out, and go to our state machine. I'll go to the step event, click on the state machine, and let's go into the idle event. We've already set up the image speed in the create event, but we want to set it up here as well in case we transition into the idle state from another state in our state machine. So let's do a check. Let's see if our current sprite index, with sprite underscore index, is not equal to our idle sprite, S underscore player…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Create the player object2m 48s
-
Using Finite State Machines1m 38s
-
Player state machine3m 16s
-
Control logic: Idle to run state2m 5s
-
Control logic: Idle and run animations2m 38s
-
Control logic: Jump state3m 50s
-
Control logic: Rotation and animation2m 46s
-
Collision checking with the ground3m 49s
-
Make the player duck3m 57s
-
View following and debug3m 18s
-
Create physics fixtures in code6m 48s
-
Swap fixtures4m 3s
-
-
-
-
-
-