赞 | 16 |
VIP | 63 |
好人卡 | 13 |
积分 | 44 |
经验 | 33364 |
最后登录 | 2024-11-13 |
在线时间 | 1910 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 4397
- 在线时间
- 1910 小时
- 注册时间
- 2010-12-21
- 帖子
- 2365
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 黄亦天 于 2011-1-8 13:29 编辑
没事闲的想参加那个地图大赛去……
然后我把我原来游戏的data文件夹直接覆盖到了新建的工程下,也添加了原先需要的素材,但是测试的时候,就会弹出一行“
RGSS'Scene_Map' 的22 行NameError 发生错误
uninitialized consant Scene_Map::Type_Field
”
这个是什么问题?求解~~- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- $game_map.refresh
- @spriteset = Spriteset_Map.new
- @message_window = Window_Message.new
- #========================================
-
- @v = Viewport.new(120,120,320,20)
- @v.color.set(0,0,0,120)
- @tf = Type_Field.new(@v,"",16)
- @tf.active = false
- @v.visible = false
- #=========================================
-
- end
-
- #--------------------------------------------------------------------------
- # ● 执行渐变
- #--------------------------------------------------------------------------
- def perform_transition
- if Graphics.brightness == 0 # 战斗後或载入後等
- fadein(30)
- else # 从菜单中回来等
- Graphics.transition(15)
- end
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- if $scene.is_a?(Scene_Battle) # 切换至战斗场景的场合
- @spriteset.dispose_characters # 隐藏角色来生成战斗背景
- end
- snapshot_for_background
- @spriteset.dispose
- @message_window.dispose
-
- # 输入法测试
- @v.dispose
- @tf.dispose
-
- if $scene.is_a?(Scene_Battle) # 切换至战斗场景的场合
- perform_battle_transition # 执行战斗渐变
- end
- end
- #--------------------------------------------------------------------------
- # ● 基本更新处理
- #--------------------------------------------------------------------------
-
-
- def update_basic
- Graphics.update # 更新游戏画面
- Input.update # 更新输入信息
- $game_map.update # 更新地图
- @spriteset.update # 更新活动块组
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def call_tf_active
- case $old_name
- when 1
- @tf = Type_Field.new(@v,$game_actors[1].name,16)
- when 2
- @tf = Type_Field.new(@v,$game_actors[2].name,16)
- when 3
- @tf = Type_Field.new(@v,$game_actors[3].name,16)
- when 4
- @tf = Type_Field.new(@v,$game_actors[4].name,16)
- else
- @tf = Type_Field.new(@v,"",16)
- end
- @tf.active = true
- end
- def update
- super
- @tf.update
- @v.visible = @tf.active
- if @tf.active
- return
- end
- $game_map.interpreter.update # 更新解释器
- $game_map.update # 更新地图
- $game_player.update # 更新主角
- $game_system.update # 更新计时器
- @spriteset.update # 更新活动块组
- @message_window.update # 更新信息窗口
- unless $game_message.visible # 信息窗口显示中除外
- update_transfer_player
- update_encounter
- update_call_menu
- update_call_debug
- update_scene_change
- end
- end
- #--------------------------------------------------------------------------
- # ● 淡入画面
- # duration : 时间
- # 如果直接使用 Graphics.fadeout 的话会出现一些状况,如天候效果和远景
- # 滚动都会被强迫停止,所以用动态的 fade-in 效果会好些。
- #--------------------------------------------------------------------------
- def fadein(duration)
- Graphics.transition(0)
- for i in 0..duration-1
- Graphics.brightness = 255 * i / duration
- update_basic
- end
- Graphics.brightness = 255
- end
- #--------------------------------------------------------------------------
- # ● 淡出画面
- # duration : 时间
- # 与上面的 fadein 一样,不是直接调用 Graphics.fadein。
- #--------------------------------------------------------------------------
- def fadeout(duration)
- Graphics.transition(0)
- for i in 0..duration-1
- Graphics.brightness = 255 - 255 * i / duration
- update_basic
- end
- Graphics.brightness = 0
- end
- #--------------------------------------------------------------------------
- # ● 场所移动处理
- #--------------------------------------------------------------------------
- def update_transfer_player
- return unless $game_player.transfer?
- fade = (Graphics.brightness > 0)
- fadeout(30) if fade
- @spriteset.dispose # 释放活动块组
- $game_player.perform_transfer # 执行场所移动
- $game_map.autoplay # 自动更改 BGM 和 BGS
- $game_map.update
- Graphics.wait(15)
- @spriteset = Spriteset_Map.new # 重新生成活动块组
- fadein(30) if fade
- Input.update
- end
- #--------------------------------------------------------------------------
- # ● 遇敌处理
- #--------------------------------------------------------------------------
- def update_encounter
- return if $game_player.encounter_count > 0 # 检查步数
- return if $game_map.interpreter.running? # 判断是否有事件正在执行
- return if $game_system.encounter_disabled # 判断是否禁止遇敌
- troop_id = $game_player.make_encounter_troop_id # 判断敌人队伍
- return if $data_troops[troop_id] == nil # 判断队伍是否无效
- $game_troop.setup(troop_id)
- $game_troop.can_escape = true
- $game_temp.battle_proc = nil
- $game_temp.next_scene = "battle"
- preemptive_or_surprise
- end
- #--------------------------------------------------------------------------
- # ● 判断先下手或被偷袭
- #--------------------------------------------------------------------------
- def preemptive_or_surprise
- actors_agi = $game_party.average_agi
- enemies_agi = $game_troop.average_agi
- if actors_agi >= enemies_agi
- percent_preemptive = 5
- percent_surprise = 3
- else
- percent_preemptive = 3
- percent_surprise = 5
- end
- if rand(100) < percent_preemptive
- $game_troop.preemptive = true
- elsif rand(100) < percent_surprise
- $game_troop.surprise = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断是否呼叫菜单(按下B键)
- #--------------------------------------------------------------------------
- def update_call_menu
- if Input.trigger?(Input::B)
- return if $game_map.interpreter.running? # 判断是否有事件正在执行
- return if $game_system.menu_disabled # 判断是否禁止菜单呼叫
- $game_temp.menu_beep = true # 设置音效标志
- $game_temp.next_scene = "menu"
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断是否呼叫DEBUG场景(按下F9键)
- #--------------------------------------------------------------------------
- def update_call_debug
- if $TEST and Input.press?(Input::F9) # 游戏测试并按下F9
- $game_temp.next_scene = "debug"
- end
- end
- #--------------------------------------------------------------------------
- # ● 执行场景交替
- #--------------------------------------------------------------------------
- def update_scene_change
- return if $game_player.moving? # 判断主角是否移动中
- case $game_temp.next_scene
- when "battle"
- call_battle
- when "shop"
- call_shop
- when "name"
- call_name
- when "menu"
- call_menu
- when "save"
- call_save
- when "debug"
- call_debug
- when "gameover"
- call_gameover
- when "title"
- call_title
- else
- $game_temp.next_scene = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 切换至战斗画面
- #--------------------------------------------------------------------------
- def call_battle
- @spriteset.update
- Graphics.update
- $game_player.make_encounter_count
- $game_player.straighten
- $game_temp.map_bgm = RPG::BGM.last
- $game_temp.map_bgs = RPG::BGS.last
- RPG::BGM.stop
- RPG::BGS.stop
- Sound.play_battle_start
- $game_system.battle_bgm.play
- $game_temp.next_scene = nil
- $scene = Scene_Battle.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至商店画面
- #--------------------------------------------------------------------------
- def call_shop
- $game_temp.next_scene = nil
- $scene = Scene_Shop.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至名称输入画面
- #--------------------------------------------------------------------------
- def call_name
- $game_temp.next_scene = nil
- $scene = Scene_Name.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至菜单画面
- #--------------------------------------------------------------------------
- def call_menu
- if $game_temp.menu_beep
- Sound.play_decision
- $game_temp.menu_beep = false
- end
- $game_temp.next_scene = nil
- $scene = Scene_Menu.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至存档画面
- #--------------------------------------------------------------------------
- def call_save
- $game_temp.next_scene = nil
- $scene = Scene_File.new(true, false, true)
- end
- #--------------------------------------------------------------------------
- # ● 切换至DEBUG画面
- #--------------------------------------------------------------------------
- def call_debug
- Sound.play_decision
- $game_temp.next_scene = nil
- $scene = Scene_Debug.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至游戏结束画面
- #--------------------------------------------------------------------------
- def call_gameover
- $game_temp.next_scene = nil
- $scene = Scene_Gameover.new
- end
- #--------------------------------------------------------------------------
- # ● 切换至标题画面
- #--------------------------------------------------------------------------
- def call_title
- $game_temp.next_scene = nil
- $scene = Scene_Title.new
- fadeout(60)
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗渐变
- #--------------------------------------------------------------------------
- def perform_battle_transition
- Graphics.transition(80, "Graphics/System/BattleStart", 80)
- Graphics.freeze
- end
- end
复制代码 |
|