Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

DragonRuby Game Toolkit - Game Jam Edition

An intuitive 2D game engine. Fast, xplat, tiny, hot loaded. · By DragonRuby

noob or bug using passes

A topic by Mozolog created 10 days ago Views: 90 Replies: 1
Viewing posts 1 to 2
(6 edits)

Having a great time playing with the toolkit.  Its a lot of fun and pretty easy too.   What I'm trying to do is generate a maze using tiles and dumping it into a pass.  Then I'll scroll around and look at it.  Everything works but the origin I'm getting for my pass is not in the bottom left (my pass is bigger than the window) so I need to add a "strange_yoffset" variable on the y axis to fix it.   I'm sure I'm doing something wrong as I'm guessing at how to do things but it seems correct.

pass =
pass.height = 32*44    
pass.width = 32*80    
strange_yoffset = -32*22+16                         
pass.solids << [0, strange_yoffset, pass.width, pass.height, black]

Basically in the snipit above I want to make the entire pass black.  To cover it I needed to hunt around to find the origin .  In this case it was on the y axis a little more than half way up.

My questions are.  Am I allowed to change the size of passes?  Is this an intended/supported way to do things?   If so  should the origin reset itself or is there a way for me to reset the origin of the pass?

Full Source

def tick args
  game, inputs, outputs, grid   =, args.inputs, args.outputs, args.grid  
  game.maze ||= generate_maze
  game.dx ||= 0
  game.dy ||= 0
  if game.tick_count == 1
    pass =
    pass.height = 32*44       # Making pass twice as big as the window
    pass.width = 32*80
    strange_yoffset = -32*22+16           # Why doesn't this = 0
    pass.solids << [0, strange_yoffset, 32*80,32*44, black] = 'maze'
    44.times do |r|
      80.times do |c|
        pass.sprites << [c*32,r*32+strange_yoffset, 32, 32,"metadata/#{tile(game.maze[r][c])}.png"]
    args.passes << pass
  outputs.solids  << [grid.rect, black]
  outputs.sprites << [0+game.dx,0+game.dy,32*80,32*44,'maze']
  game.dx += 10 if inputs.keyboard.key_held.left
  game.dx -= 10 if inputs.keyboard.key_held.right
  game.dy += 10 if inputs.keyboard.key_held.down
  game.dy -= 10 if inputs.keyboard.key_held.up
def generate_maze
  m = do |r|
    r = do |c|
      c = rand 100
def tile i
  case i
    when 0..50
    when 51..60
    when 61..95
    when 96..99
def white
def black

Poking around with this for a few minutes, it looks like a bug in the engine. I'll report back!