Class: Yuki::Tilemap::MapData

Inherits:
Object
  • Object
show all
Defined in:
docs/01450_Systems_00003_Map_Engine.rb

Overview

Class containing the map Data and its resources

Defined Under Namespace

Classes: AnimatedTileCounter

Constant Summary collapse

POSITION_LOADERS =

List of method that help to load the position

{north: :load_position_north, south: :load_position_south, east: :load_position_east, west: :load_position_west, self: :load_position_self}

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(map, map_id) ⇒ MapData

Create a new MapData

Parameters:

  • map (RPG::Map)
  • map_id (Integer)


1100
1101
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1100

def initialize(map, map_id)
end

Class Attribute Details

.tileset_chunksHash{filename => Array<Texture>} (readonly)

Get tileset chunks

Returns:

  • (Hash{filename => Array<Texture>})


1186
1187
1188
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1186

def tileset_chunks
  @tileset_chunks
end

Instance Attribute Details

#mapRPG::Map (readonly)

Get access to the original map data

Returns:

  • (RPG::Map)


1074
1075
1076
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1074

def map
  @map
end

#map_idInteger (readonly)

Get the map id

Returns:

  • (Integer)


1077
1078
1079
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1077

def map_id
  @map_id
end

#offset_xInteger (readonly)

Get the map offset_x

Returns:

  • (Integer)


1086
1087
1088
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1086

def offset_x
  @offset_x
end

#offset_yInteger (readonly)

Get the map offset_y

Returns:

  • (Integer)


1089
1090
1091
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1089

def offset_y
  @offset_y
end

#sideSymbol (readonly)

Get the side of the map

Returns:

  • (Symbol)


1095
1096
1097
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1095

def side
  @side
end

#tileset_nameString (readonly)

Get the tileset filename (to prevent unwanted dispose in the future)

Returns:



1092
1093
1094
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1092

def tileset_name
  @tileset_name
end

#x_rangeRange (readonly)

Get the map X coordinate range

Returns:

  • (Range)


1080
1081
1082
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1080

def x_range
  @x_range
end

#y_rangeRange (readonly)

Get the map Y coordinate range

Returns:

  • (Range)


1083
1084
1085
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1083

def y_range
  @y_range
end

Instance Method Details

#[](x, y, z)

Get a tile from the map

Parameters:

  • x (Integer)

    real world x position

  • y (Integer)

    real world y position

  • z (Integer)

    z



1112
1113
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1112

def [](x, y, z)
end

#assign_tile_to_sprite(sprite, tile_id)

Set tile sprite to sprite

Parameters:

  • sprite (Sprite)
  • tile_id (Integer)

    ID of the tile the sprite wants



1117
1118
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1117

def assign_tile_to_sprite(sprite, tile_id)
end

#draw(x, y, tx, ty, tz, layer)

Draw the tile on the right layer

Parameters:

  • x (Integer)

    real world x of the top left tile

  • y (Integer)

    real world y of the top left tile

  • tx (Integer)

    x index of the tile to draw from top left tile (0)

  • ty (Integer)

    y index of the tile to draw from top left tile (0)

  • tz (Integer)

    z index of the tile to draw

  • layer (Array<Array<SpriteMap>>)

    layers of the tilemap .dig(priority, ty)



1126
1127
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1126

def draw(x, y, tx, ty, tz, layer)
end

#draw_map(x, y, rx, ry, layers)

Draw the visible part of the map

Parameters:

  • x (Integer)

    real world x of the top left tile

  • y (Integer)

    real world y of the top left tile

  • rx (Integer)

    real world x of the bottom right tile

  • ry (Integer)

    real world y of the bottom right tile

  • layers (Array<Array<Array<SpriteMap>>>)

    layers of the tilemap .dig(tz, priority, ty)



1134
1135
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1134

def draw_map(x, y, rx, ry, layers)
end

#load_position(map, side, offset)

Sets the position of the map in the 2D Space

Parameters:

  • map (RPG::Map)

    current map

  • side (Symbol)

    which side the map is (:north, :south, :east, :west)

  • offset (Integer)

    offset relative to the side of the map in the positive perpendicular position



1106
1107
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1106

def load_position(map, side, offset)
end

#load_tileset

Load the tileset



1137
1138
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1137

def load_tileset
end

#update_counters

Update the autotiles counter (for tilemap)



1140
1141
# File 'docs/01450_Systems_00003_Map_Engine.rb', line 1140

def update_counters
end