class Sprite < Gosu::Image
attr_accessor :x
attr_accessor :y
attr_accessor :z
attr_accessor :zoomX
attr_accessor :zoomY
attr_accessor :color
attr_accessor :mode
def initialize(source, options = {})
super(source,options)
@x = 0
@y = 0
@z = 0
@zoomX = 1.0
@zoomY = 1.0
@color = 0xff_ffffff
@mode = :default
end
def draw
super(@x,@y,@z,@zoomX,@zoomY,@color,@mode)
end
end
class GameMessageScene < GameScene
def initialize(text,skinNumber)
super()
#GLOBAL SETTINGS
@color = Color.new(180,255,255,255)
@path = "Graphics/Messages/#{skinNumber}.png"
@space = 5
#CORNERS
@backgroundTopLeft = Sprite.new(@path,{rect: [0,0,16,16]})
@backgroundTopLeft.color = @color
@backgroundTopLeft.x = @space
@backgroundTopLeft.y = $gameWindow.height - 64 / 2 - @space
@backgroundTopRight = Sprite.new(@path,{rect: [32,0,16,16]})
@backgroundTopRight.color = @color
@backgroundTopRight.x = $gameWindow.width - 16 - @space
@backgroundTopRight.y = @backgroundTopLeft.y
#THE NEXT LINE WILL BUG
@backgroundBottomLeft = Sprite.new(@path,{rect: [0,32,16,16]})
@backgroundBottomLeft.color = @color
@backgroundBottomLeft.x = @space
@backgroundBottomLeft.y = $gameWindow.height - 16 - @space
zohran@alienware-m17-r3 ~/Documents/Programmation/PGM $ ruby Game.rb
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_vector.h:1144: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = Gosu::Color; _Alloc = std::allocator<Gosu::Color>; const_reference = const Gosu::Color&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill