Project1
标题:
战斗移位
[打印本页]
作者:
qwe2121884
时间:
2010-8-1 09:58
标题:
战斗移位
请问各位前辈,战斗中移位是怎么做到的,需要脚本吗?
作者:
liuxi0202
时间:
2010-8-1 10:34
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
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1