I'm having trouble with my MiniHud... Hopefully, someone can help.
class HudGunMini < Sprite
def initialize(viewport = nil)
super
self.x, self.y, self.z, self.opacity = 50, 120, 5000, 255
self.bitmap = Bitmap.new(150, 43)
refresh
end
def refresh
self.bitmap.fill_rect(1, 20, 120, 28, Color.new(0, 0, 0, 0))
@gunministring = $gunletterarray
string = []
if @gunministring != nil
for i in 0..@gunministring.size
case @gunministring[i]
when 1
string.push('A')
when 2
string.push('B')
when 3
string.push('C')
end
return string
end
end
self.bitmap.draw_text(1, 20, 120, 28, string.to_s, 1)
end
def update
refresh if @gunministring != $gunletterarray
end
end
class Scene_Map
alias upd_gunmini update
def update
$gunminihud.update if $gunminihud != nil
upd_gunmini
end
end
What I want this HUD to do is to show a certain key combination on the map.
The Key combination is stored within $gunletterarray as numbers like [1, 2, 3] would be A, B, C.
I am able to show the key combination in the form of numbers using
self.bitmap.draw_text(1, 20, 120, 28, $gunletterarray.to_s, 1)
The problem I'm having is converting the array such that 1 => A, 2 => B, etc.
if @gunministring != nil
for i in 0..@gunministring.size
case @gunministring[i]
when 1
string.push('A')
when 2
string.push('B')
when 3
string.push('C')
end
return string
end
end
From what I can tell... this should take the value of $gunletterarray at index i and throw it into the case.
So, if i is 1, then it should push 'A' into the string then repeat with the next index.
But when I display it using
self.bitmap.draw_text(1, 20, 120, 28, string.to_s, 1)
Nothing shows up at all... =/
No error message... just... emptiness...
Any suggestions?