lib/cyberarm_engine/common.rb in cyberarm_engine-0.23.0 vs lib/cyberarm_engine/common.rb in cyberarm_engine-0.24.0
- old
+ new
@@ -50,18 +50,18 @@
def fill(color, z = 0)
draw_rect(0, 0, window.width, window.height, color, z)
end
def lighten(color, amount = 25)
- if defined?(color.alpha)
+ if color.respond_to?(:alpha)
Gosu::Color.rgba(color.red + amount, color.green + amount, color.blue + amount, color.alpha)
else
Gosu::Color.rgb(color.red + amount, color.green + amount, color.blue + amount)
end
end
def darken(color, amount = 25)
- if defined?(color.alpha)
+ if color.respond_to?(:alpha)
Gosu::Color.rgba(color.red - amount, color.green - amount, color.blue - amount, color.alpha)
else
Gosu::Color.rgb(color.red - amount, color.green - amount, color.blue - amount)
end
end