Project1
标题:
脚本问题~~!
[打印本页]
作者:
冰城飞狐
时间:
2008-1-17 07:12
标题:
脚本问题~~!
class Scene_Save_Load
def main
# 生成命令窗口
s1 = "存档"
s2 = "读取"
s3 = "取消"
leave = Sprite.new
leave.bitmap = Bitmap.new("Graphics/Pictures/LOGO-HEROS")
leave.opacity=255
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
@command_window.back_opacity = 160
Graphics.transition
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
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入情报
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@command_window.dispose
# 如果在标题画面切换中的情况下
if $scene.is_a?(Scene_Title)
# 淡入淡出画面
Graphics.transition
Graphics.freeze
end
# 判定继续的有效性
# 存档文件一个也不存在的时候也调查
# 有効为 @continue_enabled 为 true、無効为 false
@continue_enabled = false
update
end
def update
# 刷新命令窗口
@command_window.update
if $game_system.save_disabled
# 存档无效
@command_window.disable_item(4)
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置的分支
case @command_window.index
when 0 #存档
savefile
when 1 #读取
loadfile
when 2
cancle
end
end
end
def savefile
if $game_system.save_disabled
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到存档画面
$scene = Scene_Save.new
end
def loadfile
# 继续无效的情况下
unless @continue_enabled
# 演奏无效 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到读档画面
$scene = Scene_Load.new
end
def cancle
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
end
end
复制代码
这脚本有问题吗?
为什么不能运行命令?
作者:
ryan2002
时间:
2008-1-17 07:15
少了个开始游戏吧 大哥 那个不能改啊
作者:
ryan2002
时间:
2008-1-17 07:16
好象读取存档和继续游戏是一个功能 我也不知道能不能分开
但开始新游戏是必须要有的
作者:
冰城飞狐
时间:
2008-1-17 07:17
以下引用
ryan2002于2008-1-16 23:15:43
的发言:
少了个开始游戏吧 大哥 那个不能改啊
{/pz}
大哥!
看看class语句之后跟的是Scen_Title吗?
作者:
ryan2002
时间:
2008-1-17 07:21
那就不知道了 反正你不能正常使用 哈哈
作者:
Moying
时间:
2008-1-17 07:36
51行 update
作者:
冰城飞狐
时间:
2008-1-17 07:56
以下引用
Moying于2008-1-16 23:36:53
的发言:
51行 update
什么问题?
作者:
ONEWateR
时间:
2008-1-17 20:04
class Scene_Save_Load
def main
# 生成命令窗口
s1 = "存档"
s2 = "读取"
s3 = "取消"
leave = Sprite.new
leave.bitmap = Bitmap.new("Graphics/Pictures/LOGO-HEROS")
leave.opacity=255
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
@command_window.back_opacity = 160
Graphics.transition
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
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入情报
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@command_window.dispose
# 如果在标题画面切换中的情况下
if $scene.is_a?(Scene_Title)
# 淡入淡出画面
Graphics.transition
Graphics.freeze
end
# 判定继续的有效性
# 存档文件一个也不存在的时候也调查
# 有効为 @continue_enabled 为 true、無効为 false
@continue_enabled = false
#update
end
def update
# 刷新命令窗口
@command_window.update
if $game_system.save_disabled
# 存档无效
@command_window.disable_item(4)
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置的分支
case @command_window.index
when 0 #存档
savefile
when 1 #读取
loadfile
when 2
cancle
end
return
end
end
def savefile
if $game_system.save_disabled
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到存档画面
$scene = Scene_Save.new
end
def loadfile
# 继续无效的情况下
unless @continue_enabled
# 演奏无效 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到读档画面
$scene = Scene_Load.new
end
def cancle
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
end
end
复制代码
作者:
风吹过的晴天
时间:
2008-1-17 20:23
提示:
作者被禁止或删除 内容自动屏蔽
作者:
冰城飞狐
时间:
2008-1-17 21:47
{/fd}话说……结贴按钮呢?{/fd}{/fd}
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1