An example game
# Your setup method
def init
@x = 0
@y = 0
@z = 0
@birdie = 0
end
# All drawing operations must happen in draw
def draw
rect(@x, @y, width, height, black, @z)
sprite(@birdie, @x, @y, @z)
text("string", @x, @y, 10, @z, white)
end
def update
@x+=1 if button?("right")
@x-=1 if button?("left")
@y-=1 if button?("up")
@y+=1 if button?("down")
end
Virtual display width (e.g. 128)
Virtual display height (e.g. 128)
Current Frames Per Second
Milliseconds since game started
returns the bounding_box for sprite
determine whether 2 sprites are colliding
returns an array of level tiles that sprite is colliding with. returns an empty array if non are colliding.
determine the edge of which sprite is colliding with with target
draws sprites bounding box
draws bounding boxes around each tile of level
draw bounding box around sprite with optional edges from colliding_edges to show colliding edges
Swap level's current_sprite with replacement_sprite
Translate the contents of block by x and y
Rotate the contents of block by angle, rotating about at around_x and around_y
returns true if the specied button is currently being pressed
Valid values for string are:
mapped to the X key
mapped to the C key