- 注册时间
- 2005-8-1
- 最后登录
- 2005-9-22
⑥精研
- 积分
- 1665
|
class Sprite_Battler < Animated_Sprite
attr_accessor :battler
attr_reader :index
attr_accessor :target_index
attr_accessor :frame_width
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@pattern_b = 0 #
@counter_b = 0 #
@index = 0 #
if @battler != nil
tempbitmap = RPG::Cache.battler(@battler.battler_name, @battler.battler_hue)
@frame_width = tempbitmap.width/4
picturephase = @battler.picturephase
if picturephase == "66RPG"
@frame_height = tempbitmap.height/8
else
@frame_height = tempbitmap.height/picturephase.to_i
end
else
@frame_width, @frame_height = 1,1
end
# start sprite
@battler.is_a?(Game_Enemy) ? enemy_pose(1) : pose(1)
@battler_visible = false
if $target_index == nil
$target_index = 0
end
end
def index=(index) #
@index = index #
update #
end #
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
def enemy #
$target_index += $game_troop.enemies.size
$target_index %= $game_troop.enemies.size
return $game_troop.enemies[$target_index] #
end #
def actor #
$target_index += $game_party.actors.size
$target_index %= $game_party.actors.size
return $game_party.actors[$target_index] #
end
为什么红色@frame_height = tempbitmap.height/picturephase.to_i这个代码,,老是说我,
ZeroDivisionError divided by 0怎么改阿,我是从王者归来复刻2003超级横板战斗拿的代码
|
|