diff options
| author | realtradam <[email protected]> | 2021-05-20 05:04:21 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-05-20 05:04:21 -0400 |
| commit | f97a9ca95e464e728bba9337b579bc380c33bc7d (patch) | |
| tree | dd45a6e615e6e873cee15cb41daaca24b3357ea6 /app/ECS/components | |
| parent | fee80f42f0889f2d484e25f4366f14b68c65ba70 (diff) | |
| download | typemon-code-f97a9ca95e464e728bba9337b579bc380c33bc7d.tar.gz typemon-code-f97a9ca95e464e728bba9337b579bc380c33bc7d.zip | |
implemented hitboxes
Diffstat (limited to 'app/ECS/components')
| -rw-r--r-- | app/ECS/components/00_renderable.rb | 16 | ||||
| -rw-r--r-- | app/ECS/components/01_sprite.rb | 44 | ||||
| -rw-r--r-- | app/ECS/components/02_label.rb | 27 | ||||
| -rw-r--r-- | app/ECS/components/03_player_control.rb | 21 | ||||
| -rw-r--r-- | app/ECS/components/04_map.rb | 21 | ||||
| -rw-r--r-- | app/ECS/components/05_interactable.rb | 16 | ||||
| -rw-r--r-- | app/ECS/components/06_level.rb | 25 | ||||
| -rw-r--r-- | app/ECS/components/07_collidable.rb | 22 | ||||
| -rw-r--r-- | app/ECS/components/debug_singleton.rb | 13 |
9 files changed, 0 insertions, 205 deletions
diff --git a/app/ECS/components/00_renderable.rb b/app/ECS/components/00_renderable.rb deleted file mode 100644 index 4008691..0000000 --- a/app/ECS/components/00_renderable.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Components - # If an entity can be rendered on screen - class Renderable < 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/ECS/components/01_sprite.rb b/app/ECS/components/01_sprite.rb deleted file mode 100644 index 5aa71ba..0000000 --- a/app/ECS/components/01_sprite.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Components - # If an entity can be rendered on screen - class Sprite < 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/ECS/components/02_label.rb b/app/ECS/components/02_label.rb deleted file mode 100644 index aed00ed..0000000 --- a/app/ECS/components/02_label.rb +++ /dev/null @@ -1,27 +0,0 @@ -class Components - # A dragonruby label wrapper - class Label < 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/ECS/components/03_player_control.rb b/app/ECS/components/03_player_control.rb deleted file mode 100644 index 58d0102..0000000 --- a/app/ECS/components/03_player_control.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Components - # Gives control(keyboard or otherwise) over an object - class PlayerControl < BaseComponent - attr_accessor :north, :south, :east, :west, :interact, :menu - - def initialize - @north = 'w' - @south = 's' - @east = 'd' - @west = 'a' - @interact = 'space' - @menu = 'enter' - end - - def set(**opts) - opts.each do |key, value| - send "#{key}=", value - end - end - end -end diff --git a/app/ECS/components/04_map.rb b/app/ECS/components/04_map.rb deleted file mode 100644 index 804fc02..0000000 --- a/app/ECS/components/04_map.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Components - # dragonruby label wrapper - class Map < 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/ECS/components/05_interactable.rb b/app/ECS/components/05_interactable.rb deleted file mode 100644 index 305bb02..0000000 --- a/app/ECS/components/05_interactable.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Components - # If an entity can be rendered on screen - class Interactable < 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/ECS/components/06_level.rb b/app/ECS/components/06_level.rb deleted file mode 100644 index 4d692e6..0000000 --- a/app/ECS/components/06_level.rb +++ /dev/null @@ -1,25 +0,0 @@ -class Components - # If an entity can be rendered on screen - class Level < BaseComponent - attr_accessor :z - - def initialize - @grid = [[]] #Array.new(1) { Array.new(1) } - end - - def set(x: x, y: y, **opts) - smart_array(x, y).merge(opts) - end - - # Things that the smart_array holds - # - # player: is the player in the square? - # hitbox: true/false - # interact: id/false - def smart_array(x, y) - @grid[x] = [] if @grid[x].nil? - @grix[x][y] = {} if @grid[x][y].nil? - @grid[x][y] - end - end -end diff --git a/app/ECS/components/07_collidable.rb b/app/ECS/components/07_collidable.rb deleted file mode 100644 index 207e138..0000000 --- a/app/ECS/components/07_collidable.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Components - # If an entity can be rendered on screen - class Collidable < 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/ECS/components/debug_singleton.rb b/app/ECS/components/debug_singleton.rb deleted file mode 100644 index f298172..0000000 --- a/app/ECS/components/debug_singleton.rb +++ /dev/null @@ -1,13 +0,0 @@ -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 |
