Project1
标题:
如何判断某角色是否正在显示某编号的动画
[打印本页]
作者:
兔毛鹿
时间:
2013-1-4 10:31
标题:
如何判断某角色是否正在显示某编号的动画
本帖最后由 兔毛鹿 于 2013-1-4 12:13 编辑
以下脚本是用一句 if $game_map.events[2].sprite.anima?(29) 来判断某事件是否正在显示某编号的动画,但无法用于角色的判断,我希望用类似 if $game_player.sprite.anima?(29) 的脚本来判断角色是否正在显示某编号的动画,应该怎么改动?
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
复制代码
作者:
zhangbanxian
时间:
2013-1-4 11:10
本帖最后由 zhangbanxian 于 2013-1-4 11:14 编辑
46行@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))改成
sprite = Sprite_Character.new(@viewport1, $game_player)
sprite.character.sprite = sprite
@character_sprites.push(sprite)
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1