Beep8 logo

Actors Documentation

Actors Documentation Source Code

Actors Methods

beep8.Actors.draw(ch, frame, direction)

Draw an actor at the current cursor position.

Parameters

  • ch (number): The character to draw.
  • frame (number): The frame to draw.
  • direction (number): The direction to draw the actor in. 0 = right, 1 = left.

beep8.Actors.spr(ch, animation, x, y [,startTime])

Draw an actor at the specified x, y position. This ignores the cursor position and draws at specific x, y coordinates. This is useful for drawing actors in the game world and real-time apps.

By default the animations will start playing based upon the current game time. This means they may loop from anywhere in the animation sequence. If you specify the startTime then the animation will start from the beginning. This is particularly useful for non-looping animations.

The startTime should be stored and not changed each time the animation is drawn.

The function will return false if the animation has finished playing.

Parameters

  • ch (number): The character to draw.
  • animation (string): The animation to draw.
  • x (number): The x coordinate to draw the actor at.
  • y (number): The y coordinate to draw the actor at.
  • [startTime] (number): The time the animation started. (default: null)

Returns

  • (boolean): True if the animation is still playing, false if it has finished.

More Beep8 Docs

Actors Documentation

Async Documentation

Core Functions

Input Documentation

App Intro Documentation

Joystick Documentation

Menu Documentation

Music Documentation

Passcodes Documentation

Public API

Random Numbers Documentation

SFX Documentation

Tilemap Documentation

Utilities Documentation