Even though Super Mario World is considered an old game, Mario has a lot of behaviors. In fact, Super Mario World is complex enough that a tutorial which implemented all functionality would be considerably longer than this one. Therefore, we’ll skip over a number of behaviors and instead focus on the following:
- Look up
- Skid (Trying to turn around when running)
This list of behaviors will provide enough variety to explore how to create and manage a variety of animations and behavioral states.
For this tutorial we’ll be using the following image and .achx file.
Download both files to the same folder. Drag+drop the PlatformerAnimations.acxh file into the Player Files folder. Both the .achx and .png will automatically be copied into the project (assuming you downloaded both files to the same folder).
Next we’ll add a Sprite and animate it.
- Select Player
- Click Add Object to Player in Quick Actions
- Select the Sprite type
- Click OK
- Set the Animation Chains to PlayerAnimations
- Set the Current Chain Name to CharacterWalkRight
Now our character is fully animated, but it does have an offset issue.
This is happening because the .achx file is set up (properly) to align the bottom animations with the origin of the entity. We need to adjust the offset of the rectangle. While we’re at it, we can also adjust the rectangle size.
These changes should fix the collision size and offset.
Our Player entity is now set up with a rectangle of the right size and referencing animations. Next we’ll add the logic for setting the animations using AnimationLayers.