Skip to main content

Game

TicksPerSecond

TicksPerSecond -> number

Returns 60, the number of ticks per second.

AfterPhysics

await AfterPhysics(interval?)

Sleeps for interval ticks, then wakes up at the beginning of the next AfterPhysics phase.

  • interval (Number): The number of ticks to sleep.

AfterReap

await AfterReap(interval?)

Sleeps for interval ticks, then wakes up at the beginning of the next AfterReap phase.

  • interval (Number): The number of ticks to sleep.

AfterTick

await AfterTick(interval?)

Sleeps for interval ticks, then wakes up at the beginning of the next AfterTick phase.

  • interval (Number): The number of ticks to sleep.

BeforePhysics

await BeforePhysics(interval?)

Sleeps for interval ticks, then wakes up at the beginning of the next BeforePhysics phase.

  • interval (Number): The number of ticks to sleep.

BeforeReap

await BeforeReap(interval?)

Sleeps for interval ticks, then wakes up at the beginning of the next BeforeReap phase.

  • interval (Number): The number of ticks to sleep.

BeforeTick

await BeforeTick(interval?)

Sleeps for interval ticks, then wakes up at the beginning of the next BeforeTick phase.

  • interval (Number): The number of ticks to sleep.

GameStartTimestamp

GameStartTimestamp -> timestamp

Returns a timestamp representing the date and time the current game started.

InPageMode

InPageMode -> boolean

Returns true if the entrypoint function was a page fn, or false if it was a game fn.

Paint

await Paint(interval?)

Sleeps for interval ticks, then wakes up at the beginning of the next Paint phase.

  • interval (Number): The number of ticks to sleep.

ProjectName

ProjectName -> string

Returns the name of the project, according to its easel.toml file.

RemixIntent

RemixIntent -> intent

Returns an intent to take the user to the game editor where they can create their own version of this game. Intents can be triggered by a button Button press.

Remixing is an essential part of the Easel culture - it is easier for people to learn to code when they can tinker with a game they already know and love.

ShareIntent

ShareIntent(page?) -> intent

Returns an intent to share your game with other people. Intents can be triggered by a button Button press.

  • page (Intent): If provided, links to a particular page of your game. Otherwise, shares the home page of your game. Only a page fn intent is supported.

Example:

pub page fn owner.HomePage() {
Content {
Link(ShareIntent) { "Share this game!" }
Link(ShareIntent(LeaderboardPage)) { "Share the leaderboard!" }
}
}

pub page fn owner.LeaderboardPage() { }

Tick

await Tick(interval?)

Sleeps for interval ticks, then wakes up at the beginning of the next Tick phase.

  • interval (Number): The number of ticks to sleep.
Tick -> number

Returns the current tick number.