class DXRuby::Tiled::FlippedTile

Attributes

angle[R]
scale_x[R]
scale_y[R]
tile[R]

Public Class Methods

new(tile, tileid, hex = false) click to toggle source
# File lib/dxruby_tiled/tile.rb, line 61
def initialize(tile, tileid, hex = false)
  @tile = tile
  if hex
    @scale_x, @scale_y, @angle = case tileid & 0xf0000000
    when 0x10000000 then [ 1,  1, 120]
    when 0x20000000 then [ 1,  1,  60]
    when 0x30000000 then [-1, -1,   0]
    when 0x40000000 then [ 1, -1,   0]
    when 0x50000000 then [-1,  1, 300]
    when 0x60000000 then [-1,  1, 240]
    when 0x70000000 then [-1,  1,   0]
    when 0x80000000 then [-1,  1,   0]
    when 0x90000000 then [-1,  1, 120]
    when 0xa0000000 then [-1,  1,  60]
    when 0xb0000000 then [ 1, -1,   0]
    when 0xc0000000 then [-1, -1,   0]
    when 0xd0000000 then [ 1,  1, 300]
    when 0xe0000000 then [ 1,  1, 240]
    when 0xf0000000 then [ 1,  1,   0]
    end
  else
    @scale_x, @scale_y, @angle = case tileid & 0xe0000000
    when 0x20000000 then [ 1, -1, 90]
    when 0x40000000 then [ 1, -1,  0]
    when 0x60000000 then [-1, -1, 90]
    when 0x80000000 then [-1,  1,  0]
    when 0xa0000000 then [ 1,  1, 90]
    when 0xc0000000 then [-1, -1,  0]
    when 0xe0000000 then [-1,  1, 90]
    end
  end
  extend DXRuby::Tiled::DiagonallyFlippedTile if @angle == 90
end

Public Instance Methods

adjusted_offset_y() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 107
def adjusted_offset_y; @tile.adjusted_offset_y; end
collision() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 111
def collision; @tile.collision; end
collision=(value) click to toggle source
# File lib/dxruby_tiled/tile.rb, line 112
def collision=(value); @tile.collision = value; end
collision_enable() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 113
def collision_enable; @tile.collision_enable; end
collision_enable=(value) click to toggle source
# File lib/dxruby_tiled/tile.rb, line 114
def collision_enable=(value); @tile.collision_enable = value; end
draw(x, y, target=DXRuby::Window, z_index = 0)
Alias for: render
height() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 102
def height; @tile.height; end
image() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 103
def image; @tile.image; end
offset_x() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 105
def offset_x; @tile.offset_x; end
offset_y() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 106
def offset_y; @tile.offset_y; end
original_image() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 104
def original_image; @tile.original_image; end
render(x, y, target=DXRuby::Window, z_index = 0) click to toggle source
# File lib/dxruby_tiled/tile.rb, line 95
def render(x, y, target=DXRuby::Window, z_index = 0)
  target.draw_ex(x + offset_x, y + adjusted_offset_y, @tile.image,
                 { scale_x: @scale_x, scale_y: @scale_y, angle: @angle, z: z_index })
end
Also aliased as: draw
tileset() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 108
def tileset; @tile.tileset; end
to_sprite(x, y) click to toggle source
# File lib/dxruby_tiled/tile.rb, line 116
def to_sprite(x, y)
  TileObject.new(x, y, self, rotation: @angle)
end
type() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 109
def type; @tile.type; end
type=(value) click to toggle source
# File lib/dxruby_tiled/tile.rb, line 110
def type=(value); @tile.type = value; end
width() click to toggle source
# File lib/dxruby_tiled/tile.rb, line 101
def width; @tile.width; end