Join Steven Moser for an in-depth discussion in this video Player state machine, part of Building a Physics-Based Platformer in GameMaker Studio Using GML.
- [Instructor] Let's implement a simple state machine…that will take care of our character movement.…We'll use the following five states in our game.…Idle, run, jump,…duck, and dead.…I'll open up the player object and add an event.…We'll set up our state variables in the create event,…which is run once when this player object is created,…but only once.…I'll go to the control tab,…I'll drag in a code block,…and we'll give it a comment,…three slashes, call it states.…
And let's set up our state variable with an enum.…So enum, and I'll call is ps, for player states.…And we'll set up our five variables.…We want idle, run, jump,…duck, and dead.…We'll also need a variable to hold the current player state.…I'll create that and call it st_player.…And we'll initialize it to the idle state.…We do this with ps.idle.…
Alright, that's all we need to get…our state variables set up.…So I'll close out the create event.…And we'll create our state machine in the step event.…The step event is run once every frame.…I'll go to add event, step, and step.…
- Setting up basic game components
- Creating the player object
- Using Finite State Machines
- Making the player duck
- Creating physics fixtures in code
- Creating physics obstacles
- Box2D liquid physics
- Creating particles that behave like water
- Creating a floating blocks obstacle
- Creating a swinging chain obstacle and a rope bridge
- Adding the finishing touches
Skill Level Beginner
1. Set Up Basic Game Components
2. The Player Object
3. Create Physics Obstacles
4. Liquid Physics
5. Decorate the Level
6. Finishing Touches
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.