Project1
标题:
标题画面加强V1.1
[打印本页]
作者:
子弹君
时间:
2014-9-27 10:42
标题:
标题画面加强V1.1
1.1更新说明:添加了随机标题功能(注:但是1.1的版本使用之后默认的标题背景设置就会废掉,需要在脚本里设置背景)
例:
TITLE_CASE = ["1"]
# 这里设置背景图片名字,放到Titles1文件夹里
TITLE_CASE1 = ["1"]
# 这里设置前景图片名字,放到Titles2文件夹里
这样就能够只用一个标题背景了。
#=============================================================================
# 标题画面加强V1.1 by 子弹君
#=============================================================================
# 说明:
# 加强默认标题画面的各种功能
# 可以实现随机标题背景的效果,但是默认的背景设置会废掉= =
#=============================================================================
$BombScript ||= {};$BombScript["标题画面加强"] = "标题画面加强20140921"
#==============================================================================
# 设定部分
#==============================================================================
module BOMB
module TITLE1
FONT = "微软雅黑"
# 设置标题选项字体
SIZE = 20
# 设置字体大小
BOLD = false
# 设置选项字是否加粗
SHADOW = true
# 设置选项字是否有阴影
ITALIC = false
# 设置选项字是否斜体
COLOR = Color.new(255,255,255,255)
# 设置选项字的颜色
OPACITY = 0
# 设置选项窗口不透明度
WIDTH = 160
# 设置窗口的宽度
X = 190
# 设置窗口的X坐标
Y = 280
# 设置窗口的Y坐标
TITLE = "Title"
# 设置标题选项的背景图,若要显示一张背景请将不透明度调为0
# 取为空值则不显示图片。
FONT2 = "微软雅黑"
# 设置标题大字的字体
SIZE2 = 68
# 设置标题大字的字号大小
BOLD2 = false
# 设置标题大字是否加粗
SHADOW2 = true
# 设置标题大字是否有阴影
ITALIC2 = false
# 设置标题大字是否斜体
COLOR2 = Color.new(255,255,255,255)
# 设置标题大字的颜色
TITLE_CASE = ["1","2","3"]
# 这里设置随机标题的背景图片名字,放到Titles1文件夹里
TITLE_CASE1 = ["1","2","3"]
# 这里设置随机标题的前景图片名字,放到Titles2文件夹里
end
end
class Window_TitleCommand < Window_Command
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias bomb20140921_initialize initialize
def initialize
bomb20140921_initialize
self.opacity = BOMB::TITLE1::OPACITY
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return BOMB::TITLE1::WIDTH
end
#--------------------------------------------------------------------------
# ● 更新窗口的位置
#--------------------------------------------------------------------------
def update_placement
self.x = self.x = BOMB::TITLE1::X
self.y = self.y = BOMB::TITLE1::Y
end
end
class Window_TitleCommand
#--------------------------------------------------------------------------
# ● 绘制字体
#--------------------------------------------------------------------------
alias bomb20140921_contents create_contents
def create_contents
bomb20140921_contents
self.contents.font.name = BOMB::TITLE1::FONT
self.contents.font.size = BOMB::TITLE1::SIZE
self.contents.font.bold = BOMB::TITLE1::BOLD
self.contents.font.shadow = BOMB::TITLE1::SHADOW
self.contents.font.italic = BOMB::TITLE1::ITALIC
end
def normal_color
self.contents.font.color = BOMB::TITLE1::COLOR
end
end
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
SceneManager.clear
Graphics.freeze
create_background
create_foreground
create_command_window
play_title_music
end
#--------------------------------------------------------------------------
# ● 获取渐变速度
#--------------------------------------------------------------------------
def transition_speed
return 20
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
SceneManager.snapshot_for_background
dispose_background
dispose_foreground
end
#--------------------------------------------------------------------------
# ● 生成背景
#--------------------------------------------------------------------------
def create_background
@sprite1 = Sprite.new
@sprite1.bitmap = Cache.title1(BOMB::TITLE1::TITLE_CASE[rand(BOMB::TITLE1::TITLE_CASE.size)])
@sprite2 = Sprite.new
@sprite2.bitmap = Cache.title2(BOMB::TITLE1::TITLE_CASE1[rand(BOMB::TITLE1::TITLE_CASE1.size)])
@sprite3 = Sprite.new
@sprite3.bitmap = Cache.system(BOMB::TITLE1::TITLE)
center_sprite(@sprite1)
center_sprite(@sprite2)
center_sprite(@sprite3)
end
#--------------------------------------------------------------------------
# ● 生成前景
#--------------------------------------------------------------------------
def create_foreground
@foreground_sprite = Sprite.new
@foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@foreground_sprite.z = 100
draw_game_title if $data_system.opt_draw_title
end
#--------------------------------------------------------------------------
# ● 绘制游戏标题
#--------------------------------------------------------------------------
def draw_game_title
@foreground_sprite.bitmap.font.size = BOMB::TITLE1::SIZE2
@foreground_sprite.bitmap.font.name = BOMB::TITLE1::FONT2
@foreground_sprite.bitmap.font.bold = BOMB::TITLE1::BOLD2
@foreground_sprite.bitmap.font.shadow = BOMB::TITLE1::SHADOW2
@foreground_sprite.bitmap.font.italic = BOMB::TITLE1::ITALIC2
@foreground_sprite.bitmap.font.color = BOMB::TITLE1::COLOR2
rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
@foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
end
#--------------------------------------------------------------------------
# ● 释放背景
#--------------------------------------------------------------------------
def dispose_background
@sprite1.bitmap.dispose
@sprite1.dispose
@sprite2.bitmap.dispose
@sprite2.dispose
@sprite3.dispose
@sprite3.bitmap.dispose
end
#--------------------------------------------------------------------------
# ● 释放前景
#--------------------------------------------------------------------------
def dispose_foreground
@foreground_sprite.bitmap.dispose
@foreground_sprite.dispose
end
#--------------------------------------------------------------------------
# ● 执行精灵居中
#--------------------------------------------------------------------------
def center_sprite(sprite)
sprite.ox = sprite.bitmap.width / 2
sprite.oy = sprite.bitmap.height / 2
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_TitleCommand.new
@command_window.set_handler(:new_game, method(:command_new_game))
@command_window.set_handler(:continue, method(:command_continue))
@command_window.set_handler(:shutdown, method(:command_shutdown))
end
#--------------------------------------------------------------------------
# ● 关闭指令窗口
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
update until @command_window.close?
end
#--------------------------------------------------------------------------
# ● 指令“开始游戏”
#--------------------------------------------------------------------------
def command_new_game
DataManager.setup_new_game
close_command_window
fadeout_all
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# ● 指令“继续游戏”
#--------------------------------------------------------------------------
def command_continue
close_command_window
SceneManager.call(Scene_Load)
end
#--------------------------------------------------------------------------
# ● 指令“退出游戏”
#--------------------------------------------------------------------------
def command_shutdown
close_command_window
fadeout_all
SceneManager.exit
end
#--------------------------------------------------------------------------
# ● 播放标题画面音乐
#--------------------------------------------------------------------------
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1