Platformer
The Platformer template is, as its name indicates, showing the “basic” usage of the Platform behavior.
This behavior is pretty useful in platformer type of games obviously, but can also be used whenever your game uses a “side-scrolling” perspective (a view from the side) and when you need a character to move on a floor that can potentially change in height.
The Player object that is being controlled by the player of the game is using the Platform behavior. This behavior will interact with platforms and allow the movement and jumps of the character.
The Player object also contains the ScrollTo behavior which purpose is to always keep the view on the current object, acting as a kind of camera that is going to follow the object in the layout and modify the ScrollX and ScrollY properties automatically to do so.
There are two types of platforms in this template. One is the SolidTile that uses the Solid behavior the other is the JumpThruTile that uses the Jumpthru behavior.
The object having the Platform behavior will be “pushed away” from an object having the Solid behavior, and this is how the SolidTile behaves.
When on top, the character will move over the platform.
In the case of a jump, it will hit the platform and not go through it.
JumpThruTile objects are using the Jumpthru behavior. Unlike the Solid behavior, this behavior allows for an object with the Platform behavior to go through the platform from underneath.
But when the character is on top of the platform, the Jumpthru behavior will act like the Solid behavior does, allowing for the character to stand on top of the platform.
The Jumpthru behavior can also allow for a standing character to “drop through” the platform it is standing on. This feature is used in this template at event 1.
The player can control the characters thanks to the arrow keys of the keyboard.
This is automatically handled thanks to the Platform behavior’s property “Default controls” which is set to True.
It will, by default, make the object the behavior has been applied to “answer” to the arrow keys being pressed.
We will be finding other examples of those three behaviors in the other templates we are going to explore.