Join Steven Moser for an in-depth discussion in this video Make the player duck, part of Building a Physics-Based Platformer in GameMaker Studio Using GML.
- [Instructor] The next thing we want to do…is make our player duck when we press the down arrow,…stop ducking when we release the down arrow,…and we also want to enable our player…to jump from the duck state.…So let's get that going.…Let's first create a couple scripts.…I'll go to the script folder, and say Create Script,…and we'll use this script…to check for the down arrow being pressed,…and move our player into the duck state.…So I'll call it sc for script, underscore duck.…I'll give it a comment, call it ducking,…and we say if, we'll check for a keyboard press.…
And here we want to check for the down arrow,…so we'll use vk_down.…That's GameMaker's built-in variable for the down arrow key.…A couple brackets, and since we're using…our state machine architecture,…we simply have to take our current state variable,…and change it to our new state variable of ps.duck.…We can also take this opportunity to set the sprite index,…so let's take our current sprite_index,…and set it to our ducking sprite which is s_player_duck.…
- 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.