ChirpyHopEngine

class ChirpyHopEngine(obstacleX: Double = INITIAL_OBSTACLE_X, obstacleKind: ChirpyObstacleKind = ChirpyObstacleKind.Antenna)(source)

Chirpy Hop's rules, free of any drawing. Positions are fractions of the play field: x runs 0..1 left to right and y is height above the ground, so the same state renders at any size. Physics advances in fixed steps, so the outcome of a run does not depend on the frame rate.

Difficulty rises with the score: the run speeds up, the spare gap between obstacles closes, and harder obstacles join the mix in stages. Every combination stays clearable at the top speed.

Constructors

Link copied to clipboard
constructor(obstacleX: Double = INITIAL_OBSTACLE_X, obstacleKind: ChirpyObstacleKind = ChirpyObstacleKind.Antenna)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The obstacle Chirpy cleared last, still scrolling off the left edge, or null once it has gone. It has no effect on the run; it is kept so a cleared obstacle leaves the screen instead of vanishing when the next one spawns.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var score: Int
Link copied to clipboard

Functions

Link copied to clipboard
fun advance(deltaSeconds: Double)
Link copied to clipboard

Tap: starts a run and jumps, jumps while running, and resets after a game over.

Link copied to clipboard
fun reset()
Link copied to clipboard
fun setCrouching(crouching: Boolean)