class Core::Game::Tile

Attributes

properties[R]
x[RW]
y[RW]
z[RW]

Public Class Methods

new(sprite, x, y, z, props=[]) click to toggle source
# File lib/game/map/tile.rb, line 11
def initialize(sprite, x, y, z, props=[])
  @sprite = sprite
  @x, @y, @z = x, y, z
  if props[:collide]
    @passable = !props[:collide].to_b
  else
    @passable = true
  end
  @properties = props
end

Public Instance Methods

draw(x, y) click to toggle source
# File lib/game/map/tile.rb, line 22
def draw(x, y)
  if @x + x + 32 < 0 or @y + y + 32 < 0 or @x + x >1024 or @y + y > 768
    return
  end
  @sprite.draw(@x+x, @y+y, @z)
end
passable?() click to toggle source
# File lib/game/map/tile.rb, line 29
def passable?
  return @passable
end