做了个范例,只改了Scene_Battle 3,详细打开工程搜★,就能看到所有改的地方了。
战斗显示箭头.rar
(186.62 KB, 下载次数: 57)
写了三个箭头用的方法
#-------------------------------------------------------------------------- # ● 生成箭头★ #-------------------------------------------------------------------------- def createArrow @actArrSp = Sprite.new @actArrSp.bitmap = RPG::Cache.windowskin($game_system.windowskin_name) @actArrSp.ox = 16 @actArrSp.oy = 64 @actArrSp.z = 2500 @arrBlkCount = 0 end #-------------------------------------------------------------------------- # ● 销毁箭头★ #-------------------------------------------------------------------------- def destroyArrow @actArrSp.bitmap.dispose @actArrSp.dispose @actArrSp = nil end #-------------------------------------------------------------------------- # ● 刷新箭头★ #-------------------------------------------------------------------------- def updateArrow # 刷新点灭记数 @arrBlkCount = (@arrBlkCount + 1) % 8 # 设置传送源矩形 if @arrBlkCount < 4 @actArrSp.src_rect.set(128, 96, 32, 32) else @actArrSp.src_rect.set(160, 96, 32, 32) end @actArrSp.x = $game_party.actors[@actor_index].screen_x @actArrSp.y = $game_party.actors[@actor_index].screen_y end
#--------------------------------------------------------------------------
# ● 生成箭头★
#--------------------------------------------------------------------------
def createArrow
@actArrSp = Sprite.new
@actArrSp.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
@actArrSp.ox = 16
@actArrSp.oy = 64
@actArrSp.z = 2500
@arrBlkCount = 0
end
#--------------------------------------------------------------------------
# ● 销毁箭头★
#--------------------------------------------------------------------------
def destroyArrow
@actArrSp.bitmap.dispose
@actArrSp.dispose
@actArrSp = nil
end
#--------------------------------------------------------------------------
# ● 刷新箭头★
#--------------------------------------------------------------------------
def updateArrow
# 刷新点灭记数
@arrBlkCount = (@arrBlkCount + 1) % 8
# 设置传送源矩形
if @arrBlkCount < 4
@actArrSp.src_rect.set(128, 96, 32, 32)
else
@actArrSp.src_rect.set(160, 96, 32, 32)
end
@actArrSp.x = $game_party.actors[@actor_index].screen_x
@actArrSp.y = $game_party.actors[@actor_index].screen_y
end
然后在需要生成、销毁、刷新的地方分别调用这些方法就好。详见范例
|