Confira o Videos Épicos #45!
7 Respostas   575 Visualizações
0 Membros e 1 Visitante estão vendo este tópico.
sprite = Sprite.newsprite.bitmap = Bitmap.new("exemplo")sprite.src_rect = Rect.new(0,0, 32, 32) # retângulo 32x32 na posição 0;0
class Teste def initialize @sprite = Sprite.new @sprite.bitmap = Cache::system("flaCaps") #carrega a imagem @sprite.src_rect = Rect.new(0,0,64,16) #adquire a base @sprite.blend_type = 2 #modo de mesclagem do sprite: subtração @sprite.z = 99999 #ordem Z: deve ficar acima da mascara de fundo @backmask = Sprite.new @backmask.bitmap = Cache::system("flaCaps") #mascara de fundo, deve ser branca no formato final da imagem @backmask.src_rect = Rect.new(160,0,64,16) #adiquire a mascara de fundo @backmask.blend_type = 1 #modo de mesclagem: adição @backmask.z = 99998 #ordem z, abaixo da base @mask = Cache::system("flaCaps") #mascara, a cor preta deve ser usada para "apagar partes da base @sprite.bitmap.blt(0,0,@mask, Rect.new(79,0,64,16)) endend
def initialize super(0, 0, 176, 80) default_z = 200 # Fundo @layout1 = Sprite.new @layout1.bitmap = Cache.picture("HUD - Layout") @layout1.z = default_z # Barrinha de HP @hp1 = Sprite.new @hp1.bitmap = Cache.picture("HUD - HP Bar") @hp1.src_rect = Rect.new(0, 0, 100, 13) @hp1.blend_type = 2 @hp1.x = x + 53 @hp1.y = y + 25 @hp1.z = default_z + 2 @hp1_back = Sprite.new @hp1_back.bitmap = Cache.picture("HUD - HP Bar") @hp1_back.src_rect = Rect.new(200, 0, 100, 13) @hp1_back.blend_type = 1 @hp1_back.x = x + 53 @hp1_back.y = y + 25 @hp1_back.z = default_z + 1 @hp1_mask = Cache.picture("HUD - HP Bar") @hp1.bitmap.blt(x + 53, y + 25, @hp1_mask, Rect.new(100, 0, 100, 13)) end