Join Steven Moser for an in-depth discussion in this video Import an animated sprite, part of Building a Physics-Based Platformer in GameMaker Studio Using GML.
- [Instructor] Now, let's import a series of images to create a simple animation. I'll create a new sprite by right clicking on the sprites folder and saying create sprite. This will be the running animation for our player so I'll call it S underscore player underscore running, and hit the load sprite button. I'll navigate to the exercise files, resources, assets, and go to the player sprites folder, and in the run folder we'll see the sequence of animations for our player running.
I'll hit control A to select all of them, check the remove background button to make sure the white background is removed, and hit open. We can cycle through our images by clicking the green button here, and see that all the frames seemed to be aligned correctly. Lastly, I'll hit the center button, to set the origin of the sprite to the center of our image. To ensure the sprite aligns correctly with my ducking and jumping sprites, I'll set the Y origin to 120.
If we wanna see a preview of the animation, we can click the edit sprite button. This is a great place to check for missing frames in your animation, or to see what the animation looks like running at a faster or slower speed. I might change the speed here to 15 frames instead of 30. That looks pretty good. Notice the note down here that this is not the speed that's used in game.
We'll set the actual speed of the animation later through code. I'll close the preview box by clicking on the green check, close out our properties dialogue, and lastly, I'll create a group for all of our player sprites. I'll call the group player, and drag our running animation into it.
- 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