Added team colors hash

This commit is contained in:
2020-12-31 08:41:40 -06:00
parent c44ab8e66d
commit 0b3897451e
3 changed files with 18 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ require_relative "lib/errors"
require_relative "lib/window"
require_relative "lib/camera"
require_relative "lib/setting"
require_relative "lib/team_colors"
require_relative "lib/states/boot"
require_relative "lib/states/game"

View File

@@ -2,7 +2,7 @@ class IMICRTS
class Player
attr_reader :id, :name, :color, :team, :entities, :orders, :camera, :spawnpoint
attr_reader :selected_entities
def initialize(id:, spawnpoint:, name: nil, color: Gosu::Color.rgb(rand(150..200), rand(100..200), rand(150..200)), team: nil)
def initialize(id:, spawnpoint:, name: nil, color: IMICRTS::TeamColors.values.sample, team: nil)
@id = id
@spawnpoint = spawnpoint
@name = name ? name : "Novice-#{id}"

16
lib/team_colors.rb Normal file
View File

@@ -0,0 +1,16 @@
class IMICRTS
TeamColors = {
lightred: Gosu::Color.rgb(255, 100, 100),
red: Gosu::Color::RED,
lightblue: Gosu::Color.rgb(100, 100, 255),
blue: Gosu::Color::BLUE,
lime: Gosu::Color::GREEN,
lightgreen: Gosu::Color.rgb(50, 200, 50),
green: Gosu::Color.rgb(0, 200, 0),
orange: Gosu::Color.rgb(255, 127, 0),
gold: Gosu::Color::YELLOW,
lightgray: Gosu::Color::WHITE,
gray: Gosu::Color::GRAY,
black: Gosu::Color.rgb(25, 25, 25),
}
end