Project1
标题:
求解!自己编写的Scene黑屏!
[打印本页]
作者:
tamashii
时间:
2011-7-7 18:01
标题:
求解!自己编写的Scene黑屏!
# Scene : Splash
# Usage : To show a logo in game.
# Author : Tamashii
# Copyright (c) 2011, Tamashii / DLM Studio.
class Scene_Splash
# Main processing
def main
if $BTEST
battle_test
return
end
@bg = Sprite.new
@bg.bitmap = Bitmap.new(640, 480)
@bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(255, 255, 255))
@bg.bitmap.font.color = Color.new(0, 0, 0)
@bg.bitmap.font.name = ["Arial"]
@bg.bitmap.draw_text(0, 32, 640, 32, "It's a tale told by :", 1)
@bg.opacity = 0
@sprite = Sprite.new
@sprite.bitmap = Bitmap.new("Graphics/Pictures/logo")
@sprite.opacity = 0
@fadeout = false
@frame_count = 0
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
@sprite.bitmap.dispose
@sprite.dispose
@bg.bitmap.dispose
@bg.dispose
end
# Update frame
def update
if Input.trigger?(Input::A) or Input.trigger?(Input::B) or Input.trigger?(Input::C)
$scene = Scene_Title.new
return
end
unless @fadeout
if @bg.opacity < 255
@bg.opacity += 10
return
end
if @sprite.opacity < 255
@sprite.opacity += 10
return
end
@frame_count += 1
if (@frame_count = 40)
@fadeout = true
end
return
end
if @sprite.opacity > 0
@sprite.opacity -= 10
return
end
if @bg.opacity > 0
@bg.opacity -= 10
return
end
$scene = Scene_Title.new
end
# Battle test
def battle_test
# Loading database for battle test
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# reset game timer counter
Graphics.frame_count = 0
# anylize game objects
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# setup parties used to battle test
$game_party.setup_battle_test_members
# setup troop ID, can escape mark, battle background.
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# play battle start SE
$game_system.se_play($data_system.battle_start_se)
# play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# move to battle scene
$scene = Scene_Battle.new
end
end
复制代码
运行该Scene,发现一片漆黑。
求解 - - dsu_plus_rewardpost_czw
作者:
cinderelmini
时间:
2011-7-7 18:07
首先 class Scene_Splash
后面加上 < Scene
然后试试~
作者:
忧雪の伤
时间:
2011-7-7 18:47
# Scene : Splash
# Usage : To show a logo in game.
# Author : Tamashii
# Copyright (c) 2011, Tamashii / DLM Studio.
class Scene_Splash
# Main processing
def main
if $BTEST
battle_test
return
end
@bg = Sprite.new
@bg.bitmap = Bitmap.new(640, 480)
@bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(255, 255, 255))
@bg.bitmap.font.color = Color.new(0, 0, 0)
@bg.bitmap.font.name = ["Arial"]
@bg.bitmap.draw_text(0, 32, 640, 32, "It's a tale told by :", 1)
@bg.opacity = 0
@sprite = Sprite.new
@sprite.bitmap = Bitmap.new("Graphics/Pictures/logo")
@sprite.opacity = 0
@fadeout = false
@frame_count = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@sprite.bitmap.dispose
@sprite.dispose
@bg.bitmap.dispose
@bg.dispose
end
# Update frame
def update
if Input.trigger?(Input::A) or Input.trigger?(Input::B) or Input.trigger?(Input::C)
$scene = Scene_Title.new
return
end
unless @fadeout
if @bg.opacity < 255
@bg.opacity += 10
return
end
if @sprite.opacity < 255
@sprite.opacity += 10
return
end
@frame_count += 1
if (@frame_count = 40)
@fadeout = true
end
return
end
if @sprite.opacity > 0
@sprite.opacity -= 10
return
end
if @bg.opacity > 0
@bg.opacity -= 10
return
end
$scene = Scene_Title.new
end
# Battle test
def battle_test
# Loading database for battle test
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# reset game timer counter
Graphics.frame_count = 0
# anylize game objects
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# setup parties used to battle test
$game_party.setup_battle_test_members
# setup troop ID, can escape mark, battle background.
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# play battle start SE
$game_system.se_play($data_system.battle_start_se)
# play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# move to battle scene
$scene = Scene_Battle.new
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1