Internal API

GameZero.ActorMethod

Actor(image::String)

Creates an Actor with the image given, which must be located in the image subdirectory.

GameZero.ContingentScheduledType

A contingent schdule. This type of schedule checks the return value of the action. If the action method returns nothing, no further action is scheduled. Otherwise, the return value is considered to be the interval, in seconds, to the next invocation of the action.

Since action methods are written by end users, the return value of those methods are not considered significant for ease of use. Hence ContingentScheduled is a separate type that should not be end user visible.

GameZero.OnceScheduledType

A scheduled action that is run once. The action is a zero-argument function that is wrapped as a WeakRef object. This ensures that schedules do not inadvertantly store references to game objects. This does however mean that anynymous functions should not be used as scheduled actions.

The time stored in the schedule is in absolute nanoseconds since epoch (Note the epoch for nanoseconds can be arbitrary). User facing times should always be in seconds, or fractions of a second, and usually specifed as interval from current time. Hence the time should be converted before being stored in a Sheduled object.

GameZero.RepeatScheduledType

A scheduled action that is repeated indefinitely. The time of next invocation is stored as time, while the interval between each invocation is stored in interval. Both of these are stored in units of nanoseconds.

GameZero.SchedulerType

The schedule type stores an array of Sheduled objects, and a WallTimer object that is used to keep time. The scheduler object keeps its own timer, and does not reuse the timer in the game main loop, since the game timer can be reset every frame, while the scheduler timer needs to keep absolute time.

Base.angleMethod

angle(a1::Actor, a2::Actor)

Angle between the horizontal and the line between two actors. Value returned is in degrees.

Base.angleMethod

angle(a::Actor, x::Number, y::Number)

Angle between the horizontal of the line between an actor and a point in space. Value returned is in degrees.

Base.angleMethod

angle(a::Actor, xy::Tuple{Number, Number})

Angle between the horizontal of the line between an actor and a point in space. Value returned is in degrees.

GameZero.collideMethod

collide(a, b)

Checks if a and b (both game objects) are colliding.

GameZero.collideMethod
collide(a, x::Integer, y::Integer)
collide(a, xy::Tuple{Integer, Integer})

Checks if a (a game object) is colliding with a point.

GameZero.distanceMethod

distance(a1::Actor, a2::Actor)

Distance in pixels between two actors.

GameZero.distanceMethod

distance(a::Actor, x::Number, y::Number)

Distance in pixels between an actor and a point in space

GameZero.drawMethod

draw(a::Actor)

Draws the Actor on-screen at its current position.

GameZero.elapsedMethod

Return nanoseconds since timer was started or 0 if not yet started.

GameZero.play_musicFunction

play_music(name::String, loops::Integer)

Plays music from the sounds subdirectory. It will play the file the specified number of times. If not specified, it will default to infinitely.

GameZero.play_soundFunction

play_sound(filename::String, loops::Integer)

Plays a sound effect from the sounds subdirctory. It will play the specified number of times. If not specified, it will default to once.

GameZero.tickFunction

Run a repeated scheduled action if due. If run, this method will add a new scheduled action to the scheduler

GameZero.tickFunction

Run a contingent schduled action if due. If run, and not stopped, add a new scheduled action to the scheduler

GameZero.tick!Method

Run all actions in the global scheduler that are due