diff options
Diffstat (limited to 'app')
25 files changed, 624 insertions, 34 deletions
diff --git a/app/dragonruby b/app/dragonruby new file mode 120000 index 0000000..2e5d301 --- /dev/null +++ b/app/dragonruby @@ -0,0 +1 @@ +/home/tradam/Documents/Ruby/dragon/dragonruby-linux-amd64/dragonruby
\ No newline at end of file diff --git a/app/lib/FelFlame b/app/lib/FelFlame deleted file mode 160000 -Subproject 7bec71db2680e0503f39c31047f5f90ca89433d diff --git a/app/lib/component_manager.rb b/app/lib/component_manager.rb new file mode 100644 index 0000000..f5261a2 --- /dev/null +++ b/app/lib/component_manager.rb @@ -0,0 +1,20 @@ +#require 'app/ECS/base_component.rb' + +#require 'app/ECS/components/00_test_component.rb' +#require 'app/ECS/components/01_based.rb' + +class Components + class <<self + def entity_destroyed(entity_id) + constants.each do |component| + component.delete(entity_id) unless (component.id & Entity.signatures[entity_id]).zero? + end + end + + def entity_created(entity_id) + constants.each do |component| + const_get(component.to_s).add(entity_id) unless (const_get(component.to_s).id & Entity.signatures[entity_id]).zero? + end + end + end +end diff --git a/app/lib/components/00_renderable.rb b/app/lib/components/00_renderable.rb new file mode 100644 index 0000000..3971c8c --- /dev/null +++ b/app/lib/components/00_renderable.rb @@ -0,0 +1,16 @@ +class Components + # If an entity can be rendered on screen + class Renderable < Helper::BaseComponent + attr_accessor :z + + def initialize + @z = 0 + end + + def set(**opts) + opts.each do |key, value| + self.send "#{key}=", value + end + end + end +end diff --git a/app/lib/components/01_sprite.rb b/app/lib/components/01_sprite.rb new file mode 100644 index 0000000..8d30cdf --- /dev/null +++ b/app/lib/components/01_sprite.rb @@ -0,0 +1,44 @@ +class Components + # If an entity can be rendered on screen + class Sprite < Helper::BaseComponent + + attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, + :source_x, :source_y, :source_w, :source_h, + :tile_x, :tile_y, :tile_w, :tile_h, + :flip_horizontally, :flip_vertically, + :angle_anchor_x, :angle_anchor_y + + def set(x: @x, y: @y, w: @w, h: @h, path: @path, angle: @angle, a: @a, r: @r, g: @g, b: @b, + source_x: @source_x, source_y: @source_y, source_w: @source_w, source_h: @source_h, + tile_x: @tile_x, tile_y: @tile_y, tile_w: @tile_w, tile_h: @tile_h, + flip_horizontally: @flip_horizontally, flip_vertically: @flip_vertically, + angle_anchor_x: @angle_anchor_x, angle_anchor_y: @angle_anchor_y) + {x: @x = x, + y: @y = y, + w: @w = w, + h: @h = h, + path: @path = path, + angle: @angle = angle, + a: @a = a, + r: @r = r, + g: @g = g, + b: @b = b, + source_x: @source_x = source_x, + source_y: @source_y = source_y, + source_w: @source_w = source_w, + source_h: @source_h = source_h, + tile_x: @tile_x = tile_x, + tile_y: @tile_y = tile_y, + tile_w: @tile_w = tile_w, + tile_h: @tile_h = tile_h, + flip_horizontally: @flip_horizontally = flip_horizontally, + flip_vertically: @flip_vertically = flip_vertically, + angle_anchor_x: @angle_anchor_x = angle_anchor_x, + angle_anchor_y: @angle_anchor_y = angle_anchor_y} + end + + def primative_marker + :sprite + end + end +end diff --git a/app/lib/components/02_label.rb b/app/lib/components/02_label.rb new file mode 100644 index 0000000..13544b7 --- /dev/null +++ b/app/lib/components/02_label.rb @@ -0,0 +1,27 @@ +class Components + # A dragonruby label wrapper + class Label < Helper::BaseComponent + + attr_accessor :x, :y, :text, :size_enum, :alignment_enum, + :a, :r, :g, :b, :font, :vertical_alignment_enum + + def set(x: @x, y: @y, text: @text, size_enum: @size_enum, alignment_enum: @alignment_enum, + a: @a, r: @r, g: @g, b: @b, font: @font, vertical_alignment_enum: @vertical_alignment_enum) + {x: @x = x, + y: @y = y, + text: @text = text, + size_enum: @size_enum = size_enum, + alignment_enum: @alignment_enum = alignment_enum, + r: @r = r, + g: @g = g, + b: @b = b, + a: @a = a, + font: @font = font, + vertical_alignment_enum: @vertical_alignment_enum = vertical_alignment_enum } + end + + def primative_marker + :label + end + end +end diff --git a/app/lib/components/03_player_control.rb b/app/lib/components/03_player_control.rb new file mode 100644 index 0000000..d5d8f7a --- /dev/null +++ b/app/lib/components/03_player_control.rb @@ -0,0 +1,21 @@ +class Components + # Gives control(keyboard or otherwise) over an object + class PlayerControl < Helper::BaseComponent + attr_accessor :north, :south, :east, :west, :interact, :menu + + def initialize + @north = 'up' + @south = 'down' + @east = 'right' + @west = 'left' + @interact = 'space' + @menu = 'enter' + end + + def set(**opts) + opts.each do |key, value| + send "#{key}=", value + end + end + end +end diff --git a/app/lib/components/04_map.rb b/app/lib/components/04_map.rb new file mode 100644 index 0000000..7700e9f --- /dev/null +++ b/app/lib/components/04_map.rb @@ -0,0 +1,21 @@ +class Components + # dragonruby label wrapper + class Map < Helper::BaseComponent + + attr_accessor :json_name, :json, :x, :y, :tilewidth, :tileheight, :a, :r, :g, :b + + def set(json_name: @json_name, x: @x, y: @y, tilewidth: @tilewidth, + tileheight: @tileheight, a: @a, r: @r, g: @g, b: @b) + { json_name: @json_name = json_name, + json: @json = Helper.get_json_tiles(json_name), + x: @x = x, + y: @y = y, + tilewidth: @tilewidth = tilewidth, + tileheight: @tileheight = tileheight, + r: @r = r, + g: @g = g, + b: @b = b, + a: @a = a } + end + end +end diff --git a/app/lib/components/05_interactable.rb b/app/lib/components/05_interactable.rb new file mode 100644 index 0000000..636a216 --- /dev/null +++ b/app/lib/components/05_interactable.rb @@ -0,0 +1,16 @@ +class Components + # If an entity can be rendered on screen + class Interactable < Helper::BaseComponent + attr_accessor :z + + def initialize + @z = z + end + + def set(**opts) + opts.each do |key, value| + self.send "#{key}=", value + end + end + end +end diff --git a/app/lib/components/06_collidable.rb b/app/lib/components/06_collidable.rb new file mode 100644 index 0000000..76ce51e --- /dev/null +++ b/app/lib/components/06_collidable.rb @@ -0,0 +1,22 @@ +class Components + # If an entity can be rendered on screen + class Collidable < Helper::BaseComponent + class <<self + def add(entity_id) + super(entity_id) + #add to grid? + end + end + attr_accessor :grid + + def initialize + @grid = [[]] + end + + def set(**opts) + opts.each do |key, value| + self.send "#{key}=", value + end + end + end +end diff --git a/app/lib/components/07_battle.rb b/app/lib/components/07_battle.rb new file mode 100644 index 0000000..b4ef622 --- /dev/null +++ b/app/lib/components/07_battle.rb @@ -0,0 +1,4 @@ +class Components + class Battle < Helper::Level + end +end diff --git a/app/lib/components/07_indoor.rb b/app/lib/components/07_indoor.rb new file mode 100644 index 0000000..e409da8 --- /dev/null +++ b/app/lib/components/07_indoor.rb @@ -0,0 +1,4 @@ +class Components + class Indoor < Helper::Level + end +end diff --git a/app/lib/components/07_overworld.rb b/app/lib/components/07_overworld.rb new file mode 100644 index 0000000..55ab38a --- /dev/null +++ b/app/lib/components/07_overworld.rb @@ -0,0 +1,16 @@ +class Components + class Overworld < Helper::Level + attr_accessor :x, :y + + def initialize + @x = 0 + @y = 0 + end + + def set(**opts) + opts.each do |key, value| + self.send "#{key}=", value + end + end + end +end diff --git a/app/lib/components/debug_singleton.rb b/app/lib/components/debug_singleton.rb new file mode 100644 index 0000000..f298172 --- /dev/null +++ b/app/lib/components/debug_singleton.rb @@ -0,0 +1,13 @@ +class Components + # If an entity can be rendered on screen + class DebugSingleton + class <<self + @data = false + attr_accessor :data + + def id + 0 + end + end + end +end diff --git a/app/lib/entity_manager.rb b/app/lib/entity_manager.rb new file mode 100644 index 0000000..7d0d1ff --- /dev/null +++ b/app/lib/entity_manager.rb @@ -0,0 +1,63 @@ +class Entity + attr_accessor :id + + def initialize(*signature) + final_signature = 0 + signature.each do |sig| + final_signature += sig + end + @id = Entity.generate_new_id + self.class.all.push self + self.class.signatures.push final_signature + Components.entity_created(@id) + end + + class <<self + # All entities that exist + def all + @all ||= [] + end + + def id_queue + @id_queue ||= [] + end + + def generate_new_id + if id_queue.empty? + all.size + else + id_queue.shift + end + end + + # What components a given entity uses + def signatures + @signatures ||= [] + end + + def destroy_entity(entity_id) + if all[entity_id].nil? + puts 'Entity can not be destroyed, id out of bounds' + elsif entity_id < all.size - 1 + Components.constants.each do |constant| + unless (signatures[entity_id] & Components::const_get(constant).id).zero? + Components::const_get(constant).delete(entity_id) + end + end + all[entity_id] = nil + signatures[entity_id] = nil + id_queue.push entity_id + elsif entity_id == all.size - 1 + Components.constants.each do |constant| + unless (signatures[entity_id] & Components::const_get(constant).id).zero? + Components::const_get(constant).delete(entity_id) + end + end + all.pop + signatures.pop + else + puts 'Unknown error with destroy_entity, entity not destroyed' + end + end + end +end diff --git a/app/lib/helpers/00_tileset.rb b/app/lib/helpers/00_tileset.rb new file mode 100644 index 0000000..3890550 --- /dev/null +++ b/app/lib/helpers/00_tileset.rb @@ -0,0 +1,49 @@ +class Helper + # Returns a loaded map and its dependecies(images,json) + # If any are missing then it will load them from files + + @json_data = {} + class <<self + attr_accessor :json_data + + def get_json_tiles(json_name, hitbox: false) + unless hitbox + return nil if json_name == 'hitbox' && !Components::DebugSingleton.data + end + + if self.json_data[json_name].nil? + self.json_data[json_name] = $gtk.parse_json_file "assets/json/#{json_name}.json" + raise Exception.new "#{json_name} is null and not loaded. Cannot get json tile" if self.json_data[json_name].nil? + + if self.json_data[json_name]['type'] == 'map' #json_name.split("_").first == 'map' + self.json_data[json_name]['tilesets'].each do |tileset| + tileset = Helper.get_json_tiles(tileset['source'].split('/').last.delete_suffix('.tsx')) + # download tileset here + # $gtk.args.gtk.http_get 'https://mysite.net/#{tileset['name']}.png' + end + end + end + self.json_data[json_name] + end + + def get_tile(json_name:, tile_index:) + if json_name == 'hitbox' && !Components::DebugSingleton.data + return tile_index - 1 if tile_index > 1 + return {} + end + + json_tiles = self.get_json_tiles(json_name) + raise Exception.new "Error, json file not a tileset" unless json_tiles['type'] == 'tileset' + return tile_index - json_tiles['tilecount'] if tile_index > json_tiles['tilecount'] + source_height_tiles = (tile_index.to_i / json_tiles['columns'].to_i).to_i# * json_tiles['tileheight'] + { w: json_tiles['tilewidth'], + h: json_tiles['tileheight'], + path: json_tiles['image'].split('mygame/').last.delete('\\'), + source_x: [((tile_index % json_tiles['columns']) - 1) * json_tiles['tilewidth'], 0].max, + # source_y gets special treatment + source_y: [json_tiles['imageheight'] - ((source_height_tiles + 1) * json_tiles['tileheight']), 0].max, + source_w: json_tiles['tilewidth'], + source_h: json_tiles['tileheight'] } + end + end +end diff --git a/app/lib/helpers/01_component.rb b/app/lib/helpers/01_component.rb new file mode 100644 index 0000000..4937ec9 --- /dev/null +++ b/app/lib/helpers/01_component.rb @@ -0,0 +1,76 @@ +class Helper + class BaseComponent + class <<self + def id + @id ||= ID.send(Helper::ComponentHelper.underscore(ancestors[0].name.split('::').last)) + end + + def data + @data ||= {} + end + + def add(entity_id) + data[entity_id] = new + end + + def delete(entity_id) + data.delete entity_id + end + end + end + + class Level < Helper::BaseComponent + class <<self + def data + @data ||= { add: [], remove: [], grid: Helper::Array2D.new } + end + + def add(entity_id) + super + data[:add].push entity_id + end + + def remove(entity_id) + data[:remove].push entity_id + super + end + end + end + + class Array2D < Array + def [](val) + unless val.nil? + return self[val] = [] if super.nil? + end + super + end + end + + + module ComponentHelper + class <<self + def up? char + char == char.upcase + end + + def down? char + char == char.downcase + end + + def underscore(input) + output = input[0].downcase + (1...(input.length - 1)).each do |iter| + if down?(input[iter]) && up?(input[iter + 1]) + output += "#{input[iter].downcase}_" + elsif up?(input[iter - 1]) && up?(input[iter]) && down?(input[iter + 1]) + output += "_#{input[iter].downcase}" + else + output += input[iter].downcase + end + end + output += input[-1].downcase unless input.length == 1 + output + end + end + end +end diff --git a/app/lib/signatures.rb b/app/lib/signatures.rb new file mode 100644 index 0000000..f7e1cd4 --- /dev/null +++ b/app/lib/signatures.rb @@ -0,0 +1,43 @@ +class ID + class <<self + def renderable + 0b0_001 + end + + def sprite + 0b0_010 + end + + def label + 0b0_100 + end + + def player_control + 0b0_001_000 + end + + def map + 0b0_010_000 + end + + def interactable + 0b0_100_000 + end + + def collidable + 0b0_001_000_000 + end + + def overworld + 0b0_010_000_000 + end + + def indoor + 0b0_100_000_000 + end + + def battle + 0b0_001_000_000_000 + end + end +end diff --git a/app/lib/system_manager.rb b/app/lib/system_manager.rb new file mode 100644 index 0000000..e63375c --- /dev/null +++ b/app/lib/system_manager.rb @@ -0,0 +1,5 @@ +#require 'app/ECS/systems/00_movement.rb' +#require 'app/ECS/systems/01_flying.rb' + +class Systems +end diff --git a/app/lib/systems/00_update_levels.rb b/app/lib/systems/00_update_levels.rb new file mode 100644 index 0000000..6f3a056 --- /dev/null +++ b/app/lib/systems/00_update_levels.rb @@ -0,0 +1,34 @@ +class Systems + class UpdateLevels + @co = Components::Overworld + def self.run + @co.data[:add].each do |id| + @co.data[:add].delete(id) + if !(Components::Sprite.id & Entity.signatures[id]).zero? + @co.data[:grid][@co.data[id].x][@co.data[id].y] = {} if @co.data[:grid][@co.data[id].x][@co.data[id].y].nil? + #@co.data[:grid][@co.data[id].x][@co.data[id].y].merge!({ player: true }) + puts @co.data[:grid][@co.data[id].x][@co.data[id].y].inspect + elsif !(Components::Map.id & Entity.signatures[id]).zero? + if Components::Map.data[id].json['tilesets'].last['source'].split('/').last.delete('\\').delete_suffix('.tsx') == 'hitbox' + Components::Map.data[id].json['layers'].each do |layer| + layer['chunks'].each do |chunk| + chunk['data'].each_slice(chunk['width']).with_index do |row, row_index| + row.each_with_index do |tile, column_index| + if tile.to_i == Components::Map.data[id].json['tilesets'].last['firstgid'].to_i + @co.data[:grid][column_index][row_index] = {} if @co.data[:grid][column_index][row_index].nil? + @co.data[:grid][column_index][row_index].merge!({ hitbox: true }) + end + end + end + end + end + end + end + puts @co.data[:grid] + end + Components::Overworld.data[:remove].each do |id| + Components::Overworld.data[:remove].delete(id) + end + end + end +end diff --git a/app/lib/systems/10_player.rb b/app/lib/systems/10_player.rb new file mode 100644 index 0000000..307731a --- /dev/null +++ b/app/lib/systems/10_player.rb @@ -0,0 +1,41 @@ +class Systems + class Player + @co = Components::Overworld + def self.run + Components::PlayerControl.data.each do |id, data| + puts6 "Right: #{@co.data[:grid][@co.data[id].x+1][@co.data[id].y]}" + puts6 "Left #{@co.data[:grid][@co.data[id].x-1][@co.data[id].y]}" + puts6 "Down #{@co.data[:grid][@co.data[id].x][@co.data[id].y+1]}" + puts6 "Up #{@co.data[:grid][@co.data[id].x][@co.data[id].y-1]}" + #puts6 @co.data[:grid][@co.data[id].x + 1][@co.data[id].y][:hitbox].nil? + + if !(Components::Sprite.id & Entity.signatures[id]).zero? + if $gtk.args.inputs.keyboard.key_down.send(data.north) &&\ + (@co.data[:grid][@co.data[id].x][@co.data[id].y - 1].nil? ||\ + @co.data[:grid][@co.data[id].x][@co.data[id].y - 1][:hitbox].nil?) + Components::Sprite.data[id].y -= 64 + @co.data[id].y -= 1 + elsif $gtk.args.inputs.keyboard.key_down.send(data.south) &&\ + (@co.data[:grid][@co.data[id].x][@co.data[id].y + 1].nil? ||\ + @co.data[:grid][@co.data[id].x][@co.data[id].y + 1][:hitbox].nil?) + Components::Sprite.data[id].y += 64 + @co.data[id].y += 1 + elsif $gtk.args.inputs.keyboard.key_down.send(data.east) &&\ + (@co.data[:grid][@co.data[id].x + 1][@co.data[id].y].nil? ||\ + @co.data[:grid][@co.data[id].x + 1][@co.data[id].y][:hitbox].nil?) + Components::Sprite.data[id].x += 64 + @co.data[id].x += 1 + elsif $gtk.args.inputs.keyboard.key_down.send(data.west) &&\ + (@co.data[:grid][@co.data[id].x - 1][@co.data[id].y].nil? || @co.data[:grid][@co.data[id].x - 1][@co.data[id].y][:hitbox].nil?) + Components::Sprite.data[id].x -= 64 + @co.data[id].x -= 1 + end + #Components::Sprite.data[id].y -= 64 if $gtk.args.inputs.keyboard.key_down.send(data.north) + #Components::Sprite.data[id].y += 64 if $gtk.args.inputs.keyboard.key_down.send(data.south) + #Components::Sprite.data[id].x += 64 if $gtk.args.inputs.keyboard.key_down.send(data.east) + #Components::Sprite.data[id].x -= 64 if $gtk.args.inputs.keyboard.key_down.send(data.west) + end + end + end + end +end diff --git a/app/lib/systems/99_render.rb b/app/lib/systems/99_render.rb new file mode 100644 index 0000000..c71c6fc --- /dev/null +++ b/app/lib/systems/99_render.rb @@ -0,0 +1,37 @@ +class Systems + class Render + def self.run + Components::Renderable.data.sort_by { |v| v[1].z }.each do |key, data| + if !(Components::Sprite.id & Entity.signatures[key]).zero? + $gtk.args.outputs.sprites << Components::Sprite.data[key].set + elsif !(Components::Label.id & Entity.signatures[key]).zero? + $gtk.args.outputs.labels << Components::Label.data[key].set + elsif !(Components::Map.id & Entity.signatures[key]).zero? + Components::Map.data[key].json['layers'].each do |layer| + layer['chunks'].each do |chunk| + chunk['data'].each_slice(chunk['width']).with_index do |row, row_index| + row.each_with_index do |tile, column_index| + unless tile.zero? + iter = 0 + loop do + tile = Helper.get_tile(json_name: Components::Map.data[key].json['tilesets'][iter]['source'].split('/').last.delete('\\').delete_suffix('.tsx'), tile_index: tile) + break if tile.is_a?(Hash) + raise Exception.new "#{Components::Map.data[key].json['json_name']} not valid map, exceeded tile range" if (iter += 1) >= Components::Map.data[key].json['tilesets'].count + end + unless tile.empty? + tile[:x] = Components::Map.data[key].x + (Components::Map.data[key].tilewidth * column_index) + chunk['x'] + tile[:y] = Components::Map.data[key].y + (Components::Map.data[key].tileheight * row_index) + chunk['y'] + tile[:w] = Components::Map.data[key].tilewidth + tile[:h] = Components::Map.data[key].tileheight + $gtk.args.outputs.sprites << tile + end + end + end + end + end + end + end + end + end + end +end diff --git a/app/lib/test.rb b/app/lib/test.rb new file mode 100644 index 0000000..13fd401 --- /dev/null +++ b/app/lib/test.rb @@ -0,0 +1,18 @@ +require_relative './entity_manager.rb' +require_relative './component_manager.rb' +require_relative './system_manager.rb' + +move = '0001'.to_i(2) +base = '0010'.to_i(2) +both = '0011'.to_i(2) +Entity.new(move) +Entity.new(base) +Entity.new(both) + +3.times do + Systems.constants.each do |constant| + puts "|----#{constant.to_s.upcase}----|" + Systems::const_get(constant).run + end + #ECS::Entity.destroy_entity(ECS::Entity.all.last.id) unless ECS::Entity.all.empty? +end diff --git a/app/main.rb b/app/main.rb index 50cd976..a05c9da 100644 --- a/app/main.rb +++ b/app/main.rb @@ -3,23 +3,23 @@ # replaces by require of each individual ruby file def require_all dir `ls #{dir}`.each_line do |file| - require "#{dir}/#{file.strip}" + require "app/#{dir}/#{file.strip}" end end -require 'mygame/app/dragonruby-game-toolkit-contrib/dragon/grid.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/grid.rb' -require_all 'mygame/app/lib/FelFlame/helpers' +require_all 'lib/helpers' -require 'mygame/app/lib/FelFlame/signatures.rb' +require 'app/lib/signatures.rb' -require 'mygame/app/lib/FelFlame/entity_manager.rb' +require 'app/lib/entity_manager.rb' -require 'mygame/app/lib/FelFlame/component_manager.rb' -require_all 'mygame/app/lib/FelFlame/components' +require 'app/lib/component_manager.rb' +require_all 'lib/components' -require 'mygame/app/lib/FelFlame/system_manager.rb' -require_all 'mygame/app/lib/FelFlame/systems' +require 'app/lib/system_manager.rb' +require_all 'lib/systems' -require 'mygame/app/tick.rb' +require 'app/tick.rb' diff --git a/app/tick.rb b/app/tick.rb index 509d550..a4b2153 100644 --- a/app/tick.rb +++ b/app/tick.rb @@ -1,34 +1,33 @@ $gtk.args.grid.origin_top_left! Components::DebugSingleton.data = true -def sample - @thing0 = Entity.new(ID.sprite, - ID.renderable, - ID.player_control, - ID.overworld) - Components::Sprite.data[@thing0.id].set(x: 256, y: 128, w: 64, h: 64, path: 'dragonruby.png') - Components::Renderable.data[@thing0.id].z = 10 - Components::Overworld.data[@thing0.id].set(x: 4, y: 2) +@thing0 = Entity.new(ID.sprite, + ID.renderable, + ID.player_control, + ID.overworld) +Components::Sprite.data[@thing0.id].set(x: 256, y: 128, w: 64, h: 64, path: 'dragonruby.png') +Components::Renderable.data[@thing0.id].z = 10 +Components::Overworld.data[@thing0.id].set(x: 4, y: 2) - #@thing1 = Entity.new(ID.label, ID.renderable) +#@thing1 = Entity.new(ID.label, ID.renderable) - @thing2 = Entity.new(ID.label, ID.renderable) - Components::Label.data[@thing2.id].set(x: 740, y: 520, - text: 'It Werks', - size_enum: 5, - alignment_enum: 1) - Components::Renderable.data[@thing2.id].z = 5 +@thing2 = Entity.new(ID.label, ID.renderable) +Components::Label.data[@thing2.id].set(x: 740, y: 520, + text: 'It Werks', + size_enum: 5, + alignment_enum: 1) +Components::Renderable.data[@thing2.id].z = 5 + +@map2 = Entity.new(ID.map, ID.renderable, ID.overworld) +Components::Map.data[@map2.id].set(x: 0, + y: 0, + tilewidth: 64, + tileheight: 64, + json_name: 'map_test2') +Components::Renderable.data[@map2.id].z = 4 - @map2 = Entity.new(ID.map, ID.renderable, ID.overworld) - Components::Map.data[@map2.id].set(x: 0, - y: 0, - tilewidth: 64, - tileheight: 64, - json_name: 'map_test2') - Components::Renderable.data[@map2.id].z = 4 -end -sample +#Helper.get_json_tiles('map_test') @x = 0 def tick args @x += 1 |
