赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 445 |
最后登录 | 2015-9-4 |
在线时间 | 3 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 3 小时
- 注册时间
- 2009-7-29
- 帖子
- 53
|
- class Bitmap
- def draw_number(x, y, number,o,picture = RPG::Cache.system("number"))
- w = picture.width / 10
- h = picture.height / 5
- rect = Rect.new(0,0,w,h)
- number = number.to_s
- array = number.split(//)
- for i in 0...array.size
- array[i] = array[i].to_i
- end
- case o
- when 1
- x += 81 - (array.size * 9)
- when 2
- end
- if number == "Miss"
- self.blt(x,y,picture,Rect.new(0,h*3,picture.width,h))
- return
- end
- for sz in array
- rect.x = sz * w
- self.blt(x,y,picture,rect)
- x += w
- end
- end
- end
- module RPG
- class Sprite < ::Sprite
- def damage(value, critical)
- dispose_damage
- if value.is_a?(Numeric)
- damage_string = value.abs.to_s
- else
- damage_string = value.to_s
- end
- bitmap = Bitmap.new(160, 48)
- bitmap.font.name = "Arial Black"
- bitmap.font.size = 32
- if value.is_a?(Numeric) and value < 0
- bitmap.font.color.set(176, 255, 144)
- else
- bitmap.font.color.set(255, 255, 255)
- end
- bitmap.draw_number(0, 12, damage_string,1)
- if critical
- bitmap.font.size = 20
- bitmap.font.color.set(0, 0, 0)
- bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
- bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
- bitmap.font.color.set(255, 255, 255)
- bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
- end
- @_damage_sprite = ::Sprite.new(self.viewport)
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 80
- @_damage_sprite.oy = 20
- @_damage_sprite.x = self.x
- @_damage_sprite.y = self.y - self.oy / 2
- @_damage_sprite.z = 3000
- @_damage_duration = 40
- end
- def dispose_animation
- if @_animation_sprites != nil
- sprite = @_animation_sprites[0]
- #if sprite != nil
- # @@_reference_count[sprite.bitmap] -= 1
- # if @@_reference_count[sprite.bitmap] == 0
- # sprite.bitmap.dispose
- # end
- #end
- for sprite in @_animation_sprites
- sprite.dispose
- end
- @_animation_sprites = nil
- @_animation = nil
- end
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|