From cc040f718b40dffe9e328bda233003a085f1dcf4 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Thu, 24 Oct 2019 12:01:25 -0500 Subject: [PATCH] Seperated entities by building/unit --- lib/entities/{ => buildings}/power_plant.rb | 0 lib/entities/{ => units}/construction_worker.rb | 0 lib/entities/{ => units}/harvester.rb | 0 lib/entities/{ => units}/tank.rb | 0 lib/entity.rb | 2 +- lib/states/game.rb | 7 ++++--- 6 files changed, 5 insertions(+), 4 deletions(-) rename lib/entities/{ => buildings}/power_plant.rb (100%) rename lib/entities/{ => units}/construction_worker.rb (100%) rename lib/entities/{ => units}/harvester.rb (100%) rename lib/entities/{ => units}/tank.rb (100%) diff --git a/lib/entities/power_plant.rb b/lib/entities/buildings/power_plant.rb similarity index 100% rename from lib/entities/power_plant.rb rename to lib/entities/buildings/power_plant.rb diff --git a/lib/entities/construction_worker.rb b/lib/entities/units/construction_worker.rb similarity index 100% rename from lib/entities/construction_worker.rb rename to lib/entities/units/construction_worker.rb diff --git a/lib/entities/harvester.rb b/lib/entities/units/harvester.rb similarity index 100% rename from lib/entities/harvester.rb rename to lib/entities/units/harvester.rb diff --git a/lib/entities/tank.rb b/lib/entities/units/tank.rb similarity index 100% rename from lib/entities/tank.rb rename to lib/entities/units/tank.rb diff --git a/lib/entity.rb b/lib/entity.rb index ffc13b6..56b66bb 100644 --- a/lib/entity.rb +++ b/lib/entity.rb @@ -139,6 +139,6 @@ class IMICRTS end end -Dir.glob("#{IMICRTS::GAME_ROOT_PATH}/lib/entities/*.rb").each do |entity| +Dir.glob("#{IMICRTS::GAME_ROOT_PATH}/lib/entities/**/*.rb").each do |entity| require_relative entity end \ No newline at end of file diff --git a/lib/states/game.rb b/lib/states/game.rb index 5aafb63..3cc0621 100644 --- a/lib/states/game.rb +++ b/lib/states/game.rb @@ -15,8 +15,8 @@ class IMICRTS label "SIDEBAR", text_size: 78, margin_bottom: 20 - flow do - @buttons = stack(width: 75) do + flow(width: 1.0) do + @buttons = stack(width: 0.9) do @h = button("Harvester", width: 1.0) do @player.entities << Entity.new( name: :harvester, @@ -49,7 +49,8 @@ class IMICRTS end end - stack(width: 0.25, height: 1.0) do + # Power meter + stack(width: 0.1, height: 1.0, align: :bottom) do background Gosu::Color::GREEN end end