加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 兔毛鹿 于 2012-12-28 11:17 编辑
以下脚本是用来判断某编号事件的XX动画是否在播放,比如用 if $game_map.events[1].sprite.anima?(29) 来判断1号事件的29号动画是否在播放
但是用了显示多个动画的脚本后这个脚本就失效了,无论动画是否在播放,都判断成为在播放,求这两个脚本并存的方法
module RPG class Sprite < ::Sprite def anima?(id = nil) (x = (@_loop_animation || @_animation)) && (x.id == id || id==nil) end end end class Spriteset_Map def initialize # 生成显示端口 @viewport1 = Viewport.new(0, 0, 640, 480) @viewport2 = Viewport.new(0, 0, 640, 480) @viewport3 = Viewport.new(0, 0, 640, 480) @viewport2.z = 200 @viewport3.z = 5000 # 生成元件地图 @tilemap = Tilemap.new(@viewport1) @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name) for i in 0..6 autotile_name = $game_map.autotile_names[i] @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name) end @tilemap.map_data = $game_map.data @tilemap.priorities = $game_map.priorities # 生成远景平面 @panorama = Plane.new(@viewport1) @panorama.z = -1000 # 生成雾平面 [url=home.php?mod=space&uid=14217]@fog[/url] = Plane.new(@viewport1) @fog.z = 3000 # 生成角色活动块 @character_sprites = [] for i in $game_map.events.keys.sort sprite = Sprite_Character.new(@viewport1, $game_map.events[i]) sprite.character.sprite = sprite @character_sprites.push(sprite) end @character_sprites.push(Sprite_Character.new(@viewport1, $game_player)) # 生成天气 @weather = RPG::Weather.new(@viewport1) # 生成图片 @picture_sprites = [] for i in 1..50 @picture_sprites.push(Sprite_Picture.new(@viewport2, $game_screen.pictures[i])) end # 生成计时器块 @timer_sprite = Sprite_Timer.new # 刷新画面 update end def dispose # 释放元件地图 @tilemap.tileset.dispose for i in 0..6 @tilemap.autotiles[i].dispose end @tilemap.dispose # 释放远景平面 @panorama.dispose # 释放雾平面 @fog.dispose # 释放角色活动块 for sprite in @character_sprites sprite.character.sprite = nil sprite.dispose end # 释放天候 @weather.dispose # 释放图片 for sprite in @picture_sprites sprite.dispose end # 释放计时器块 @timer_sprite.dispose # 释放显示端口 @viewport1.dispose @viewport2.dispose @viewport3.dispose end end class Game_Character attr_accessor:sprite end
module RPG
class Sprite < ::Sprite
def anima?(id = nil)
(x = (@_loop_animation || @_animation)) && (x.id == id || id==nil)
end
end
end
class Spriteset_Map
def initialize
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
# 生成元件地图
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
# 生成远景平面
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# 生成雾平面
[url=home.php?mod=space&uid=14217]@fog[/url] = Plane.new(@viewport1)
@fog.z = 3000
# 生成角色活动块
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
sprite.character.sprite = sprite
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
# 生成天气
@weather = RPG::Weather.new(@viewport1)
# 生成图片
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
# 生成计时器块
@timer_sprite = Sprite_Timer.new
# 刷新画面
update
end
def dispose
# 释放元件地图
@tilemap.tileset.dispose
for i in 0..6
@tilemap.autotiles[i].dispose
end
@tilemap.dispose
# 释放远景平面
@panorama.dispose
# 释放雾平面
@fog.dispose
# 释放角色活动块
for sprite in @character_sprites
sprite.character.sprite = nil
sprite.dispose
end
# 释放天候
@weather.dispose
# 释放图片
for sprite in @picture_sprites
sprite.dispose
end
# 释放计时器块
@timer_sprite.dispose
# 释放显示端口
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
end
class Game_Character
attr_accessor:sprite
end
|