class Damage_Sprite < Sprite def initialize(targ, val) super(nil) @target = targ self.bitmap = Bitmap.new(100, 20) self.bitmap.draw_text(0,0,100,20, val, 1) self.ox = 50 self.x = @target.screen_x self.y = @target.screen_y - 40 self.z = 999 @timer = 20 end def update self.x = @target.screen_x self.y = @target.screen_y - 40 if @timer > 0 @timer -= 1 self.zoom_x += 0.01 self.zoom_y += 0.01 else self.opacity > 0 ? self.opacity -= 5 : dispose end end def dispose self.bitmap.dispose super end endIn this particular script, you can see that I am using a text to represent the damages of my actor. Is there a way and what way is it possible to represent the numbers through an indexed image?
For example, I want to represent it with this. How can I call two numbers? I tried calling it but failed, as it goes from an if else statement whether it is 1 to 10, 11 onwards, which is of course very unprofessional and will be long.
I need a way to represent any number with this image, but I have absolutely no idea.
For example, I want to represent it with this. How can I call two numbers? I tried calling it but failed, as it goes from an if else statement whether it is 1 to 10, 11 onwards, which is of course very unprofessional and will be long.
I need a way to represent any number with this image, but I have absolutely no idea.