Internal API
GameZero.Actor
GameZero.ContingentScheduled
GameZero.OnceScheduled
GameZero.RepeatScheduled
GameZero.Scheduler
Base.angle
Base.angle
Base.angle
GameZero.collide
GameZero.collide
GameZero.distance
GameZero.distance
GameZero.draw
GameZero.edit_distance
GameZero.elapsed
GameZero.play_music
GameZero.play_sound
GameZero.tick
GameZero.tick
GameZero.tick
GameZero.tick!
GameZero.Actor
— MethodActor(image::String)
Creates an Actor with the image given, which must be located in the image
subdirectory.
GameZero.ContingentScheduled
— TypeA 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.OnceScheduled
— TypeA 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.RepeatScheduled
— TypeA 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.Scheduler
— TypeThe 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.angle
— Methodangle(a1::Actor, a2::Actor)
Angle between the horizontal and the line between two actors. Value returned is in degrees.
Base.angle
— Methodangle(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.angle
— Methodangle(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.collide
— Methodcollide(a, b)
Checks if a and b (both game objects) are colliding.
GameZero.collide
— Methodcollide(a, x::Integer, y::Integer)
collide(a, xy::Tuple{Integer, Integer})
Checks if a (a game object) is colliding with a point.
GameZero.distance
— Methoddistance(a1::Actor, a2::Actor)
Distance in pixels between two actors.
GameZero.distance
— Methoddistance(a::Actor, x::Number, y::Number)
Distance in pixels between an actor and a point in space
GameZero.draw
— Methoddraw(a::Actor)
Draws the Actor on-screen at its current position.
GameZero.edit_distance
— MethodSimplistic string edit distance method
GameZero.elapsed
— MethodReturn nanoseconds since timer was started or 0 if not yet started.
GameZero.play_music
— Functionplay_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_sound
— Functionplay_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.tick
— FunctionRun a single scheduled action if due
GameZero.tick
— FunctionRun a repeated scheduled action if due. If run, this method will add a new scheduled action to the scheduler
GameZero.tick
— FunctionRun a contingent schduled action if due. If run, and not stopped, add a new scheduled action to the scheduler
GameZero.tick!
— MethodRun all actions in the global scheduler that are due