Project1
标题:
用显示图片的方法显示动画"眼花问题"[有工程]
[打印本页]
作者:
七仙女
时间:
2008-4-22 06:10
提示:
作者被禁止或删除 内容自动屏蔽
作者:
暴风の龙
时间:
2008-4-22 06:11
那些图片的总祯数拉长点吧,主要是图的问题。
作者:
havealook
时间:
2008-4-22 06:16
试试用另一种方法连续播放图片(节省内存):http://rpg.blue/web/htm/news900.htm
作者:
link006007
时间:
2008-4-22 06:18
如果是每一帧调用一次 应该不会出现这种问题
还是你直接一个for循环?
作者:
七仙女
时间:
2008-4-22 06:24
提示:
作者被禁止或删除 内容自动屏蔽
作者:
link006007
时间:
2008-4-22 07:14
先看看又没用吧 - -
class Scene_Title
#--------------------------------------------------------------------------
# ● 住处理
#--------------------------------------------------------------------------
def main
# 战斗测试的情况下
if $BTEST
battle_test
return
end
# 载入数据库
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# 生成系统对像
$game_system = Game_System.new
# 生成标题图形
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# 生成命令窗口
s1 = "动画"
s2 = "继续"
s3 = "退出"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# 判定继续的有效性
# 存档文件一个也不存在的时候也调查
# 有効为 @continue_enabled 为 true、無効为 false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# 继续为有效的情况下、光标停止在继续上
# 无效的情况下、继续的文字显示为灰色
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
@w_wuli=Sprite.new#W_wuli.new
@w_wuli.x = @w_wuli.y = 0
@w_wuli.bitmap=Bitmap.new("Graphics/Wuli/黄金待机")
@w_wuli.src_rect.set(0, 0, 195, 195)
@nCount = 0
# 演奏标题 BGM
$game_system.bgm_play($data_system.title_bgm)
# 停止演奏 ME、BGS
Audio.me_stop
Audio.bgs_stop
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
# 释放命令窗口
@command_window.dispose
# 释放标题图形
@sprite.bitmap.dispose
@sprite.dispose
@w_wuli.dispose if nil != @w_wuli
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新命令窗口
@command_window.update
if (0 != @nCount)
@nCount -= 1
ziji_dh()
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置的分支
case @command_window.index
when 0 # 动画
@nCount = 61
# command_new_game
when 1 # 继续
command_continue
when 2 # 退出
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# ● 命令 : 动画
def ziji_dh
#--------------------------------------------------------------------------
# 开头动画
x1 = 400
y1 = 300
x2 = 10
y2 = 10
#x=0
#y=0
x = @w_wuli.x
y = @w_wuli.y
b=(x1-x2)/20
@w_wuli.src_rect.set(195 * (@nCount % 5), 0, 195, 195)
#@w_wuli.contents.blt(0, 0, bitmap, Rect.new(0, 0, 192, 192), 255)
#for i in 0..60
x = x1 if @nCount == 1
x = x1 if @nCount == 2
x = x1 if @nCount == 3
x = x1 if @nCount == 4
x = x1 if @nCount == 5
x = x1-1*b if @nCount == 8
x = x1-1*b if @nCount == 9
x = x1-1*b if @nCount ==10
x = x1-1*b if @nCount == 11
x = x1-1*b if @nCount == 12
x = x1-2*b if @nCount == 13
x = x1-2*b if @nCount == 15
x = x1-2*b if @nCount == 16
x = x1-2*b if @nCount == 17
x = x1-2*b if @nCount == 18
x = x1-3*b if @nCount == 19
x = x1-3*b if @nCount == 21
x = x1-3*b if @nCount == 22
x = x1-3*b if @nCount == 23
x = x1-3*b if @nCount == 24
x = x1-4*b if @nCount == 25
x = x1-4*b if @nCount == 27
x = x1-4*b if @nCount == 28
x = x1-4*b if @nCount == 29
x = x1-4*b if @nCount == 30
x = x1-5*b if @nCount == 31
x = x1-5*b if @nCount == 33
x = x1-5*b if @nCount == 34
x = x1-5*b if @nCount == 35
x = x1-5*b if @nCount == 36
x = x1-6*b if @nCount == 37
x = x1-6*b if @nCount == 39
x = x1-6*b if @nCount == 40
x = x1-6*b if @nCount == 41
x = x1-6*b if @nCount == 42
x = x1-7*b if @nCount == 43
x = x1-7*b if @nCount == 45
x = x1-7*b if @nCount == 46
x = x1-7*b if @nCount == 47
x = x1-7*b if @nCount == 48
x = x1-8*b if @nCount == 49
x = x1-8*b if @nCount == 51
x = x1-8*b if @nCount == 52
x = x1-8*b if @nCount == 53
x = x1-8*b if @nCount == 54
x = x1-9*b if @nCount == 55
x = x1-9*b if @nCount == 57
x = x1-9*b if @nCount == 58
x = x1-9*b if @nCount == 59
x = x1-9*b if @nCount == 60
y=(y2-y1)*(x-x1)/(x2-x1)+y1
@w_wuli.x=x
@w_wuli.y=y
# s1 = Time.now
#while (Time.now - s1) <= 0.03
# Graphics.update
#end
#Graphics.update
#end
#@w_wuli.dispose
end
end
复制代码
果然写在一个for循环里了... ...
根据计算机当前时刻的性能 会倒置动画速度不稳定(系统每次执行方法消耗时间不同)
应该利用update函数,和游戏一起刷新 或自己控制更新时间差 (有合理的动画逻辑, 那个@nCount可以不要 只是为了配合那一大串if - -)
PS 很乱啊..
作者:
七仙女
时间:
2008-4-22 15:11
提示:
作者被禁止或删除 内容自动屏蔽
作者:
link006007
时间:
2008-4-22 18:44
我只是把你的脚本for循环去掉了, 去掉了window... 本来想说数值你自己改,结果断网了 = =||
那个可能是你自己坐标设置的问题
你那一大串if导致的, 每一帧移动长度变化率不平滑, 而且帧数不连续(每10个段一帧)
你先试试这个是不是你说的平滑
class Scene_Title
#--------------------------------------------------------------------------
# ● 住处理
#--------------------------------------------------------------------------
def main
# 战斗测试的情况下
if $BTEST
battle_test
return
end
# 载入数据库
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# 生成系统对像
$game_system = Game_System.new
# 生成标题图形
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# 生成命令窗口
s1 = "动画"
s2 = "继续"
s3 = "退出"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# 判定继续的有效性
# 存档文件一个也不存在的时候也调查
# 有効为 @continue_enabled 为 true、無効为 false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# 继续为有效的情况下、光标停止在继续上
# 无效的情况下、继续的文字显示为灰色
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
@w_wuli=Sprite.new#W_wuli.new
@w_wuli.x = @w_wuli.y = 0
@w_wuli.bitmap=Bitmap.new("Graphics/Wuli/黄金待机")
@w_wuli.src_rect.set(0, 0, 195, 195)
@nCount = 0
# 演奏标题 BGM
$game_system.bgm_play($data_system.title_bgm)
# 停止演奏 ME、BGS
Audio.me_stop
Audio.bgs_stop
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
# 释放命令窗口
@command_window.dispose
# 释放标题图形
@sprite.bitmap.dispose
@sprite.dispose
@w_wuli.dispose if nil != @w_wuli
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新命令窗口
@command_window.update
if (0 != @nCount)
@nCount -= 1
ziji_dh()
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置的分支
case @command_window.index
when 0 # 动画
@nCount = 61
# command_new_game
when 1 # 继续
command_continue
when 2 # 退出
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# ● 命令 : 动画
def ziji_dh
#--------------------------------------------------------------------------
# 开头动画
x1 = 400
y1 = 300
x2 = 10
y2 = 10
#x=0
#y=0
x = @w_wuli.x
y = @w_wuli.y
b=(x1-x2)/20
@w_wuli.src_rect.set(192 * (@nCount % 5), 0, 192, 192)
#@w_wuli.contents.blt(0, 0, bitmap, Rect.new(0, 0, 192, 192), 255)
#for i in 0..60
x += 5
y += 2
@w_wuli.x=x
@w_wuli.y=y
# s1 = Time.now
#while (Time.now - s1) <= 0.03
# Graphics.update
#end
#Graphics.update
#end
#@w_wuli.dispose
end
复制代码
[LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1