The Player object
This represents our cyclist. It will jump, float, and collide with the _terrain
object. Its x
speed is passed to the _terrain
object causing the Terrain
object to move, side scrolling to the left of the screen.
The Player
object derives, once again, from a GameSprite
class. This one has getters and setters for next position, vector of movement, and the sprite's width and height.
The Player
interface has inline helper methods to retrieve information about its rectangle boundaries related to its current position (left, right, top, bottom), and its next position (next_left
, next_right
, next_top
, next_bottom
). These will be used in collision detection with the _terrain
object.