Take a look at Player class:
def initialize
...
@levels = {'guns' => 1, 'jets' => , 'bombs' => 1, 'shield' => 1}
...
end
...
def update
...
for i in @levels
i = [i, 4].min
end
...
end
...
For each iteration, i is actually an index of the hash you made. In other words, i is {'guns' => 1} (but i is now ['guns', 1] after Ruby converted it for you), which is not exactly comparable to a Fixnum when Array#min is called. Truthfully, I have no idea what you're trying to do with that #min method.
You have other errors and numerous scripting errors. It seems that you've misunderstood some things in Ruby. I can't help fix everything for the moment, but here are some things I like to point out. I would also suggest reviewing Ruby tutorials on syntaxes.
class Colour < Color
attr_accessor :black
attr_accessor :white
attr_accessor :desperate
def black
return Color.new(0, 0, 0)
end
def white
return Color.new(255, 255, 255)
end
def desperate(percent)
return Color.new(255 - (255 * percent), 255, 255 * percent)
end
end
@back_sprite.bitmap.fill_rect(0, 0, 104, 36, Colour.white)
# => Error!
attr_accessor applies both to WRITING and READING. You don't need to specify another reading method if you're using _accessor. If you just want to create special return cases, use attr_writer instead. Also, you DO NOT NEED to specify any attributes to create methods that return instance variables.
You're trying to call Colour as if it was a Module, yet you only specified it as a Class. It's better if you change Colour to Module instead, and removing the attributes as well:
module Colour
def self.black
return Color.new(0, 0, 0)
end
def self.white
return Color.new(255, 255, 255)
end
def self.desperate(percent)
return Color.new(255 - (255 * percent), 255, 255 * percent)
end
end
@back_sprite.bitmap.fill_rect(0, 0, 104, 36, Colour.white)
# => No error; do stuff.
Next stuff:
#--------------------------------------------------------#
attr_accessor :guns
attr_accessor :jets
attr_accessor :bombs
attr_accessor :shield
attr_accessor :score
attr_accessor :fuel
attr_accessor :speed
def guns; return @levels['guns']; end
def jets; return @levels['jets']; end
def bombs; return @levels['bombs']; end
def shield; return @levels['shield']; end
def score; return @score; end
def fuel; return @fuel; end
def speed; return @speed; end
#--------------------------------------------------------#
Again, attr_ is not required to create methods that return instance variables.
attr_reader :score
attr_reader :fuel
attr_reader :speed
def guns; return @levels['guns']; end
def jets; return @levels['jets']; end
def bombs; return @levels['bombs']; end
def shield; return @levels['shield']; end