Endless Runner is a template that gives you the control of a character that runs and jumps over platforms.
The template displays what is called a horizontal scrolling. The background and platforms will move from right to left in an infinite way, platforms are created randomly, their width and height are random according to the values set in event 6.
Notice this action uses the expression Random().
Random(a,b) will return a random value between the number a and up to but not equal to b.
In this example, only a single number is given. a by default is equal to 0 and b here is 400 (or 180). The expression will return a number between 0 and 400 (but it cannot be 400).
The Block object is using the Bullet behavior for its movement. This behavior automatically moves the object it is applied to a given amount of pixels per second in the “Angle of motion” - this creates the scrolling effect.
Despite the title of the template, the character is not running in this game. Instead, it stays in position and the scenery around it moves.
The character is jumping however, in a vertical direction.
Since the scenery is moving around it, it provides the impression the character is jumping in a parabola, a curved trajectory when in reality it is simply jumping from bottom to top and falling back to the bottom.
The player needs to anticipate and have the character jump at a correct timing so that the landing of the jump will happen on a platform.
The player needs to press the jump key at the correct time.
This input of the player is handled by the Touch plugin OR the Keyboard plugin.
The Keyboard will allow you to determine if the player has pressed (pushed down and then released), is pressing, or has released a key of the keyboard on desktop computers.
Please note the virtual keyboard on a mobile device won’t trigger Keyboard plugin’s events.
The character is using the Platform behavior and the platforms named “Block” have the Solid behavior.
The object having the Platform behavior will be “pushed away” from an object having the Solid behavior, and this is how the block behaves like a floor for the character to walk on.
The death condition is when the character falls in the space between two different platforms.
The game is reset right away and the player starts again with a score of 0 at the original setting.