设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1204|回复: 0
打印 上一主题 下一主题

[子弹君] 标题画面加强V1.1

[复制链接]

卑微的梦

梦石
0
星屑
523
在线时间
820 小时
注册时间
2013-2-23
帖子
1185

短篇九勇士组季军

跳转到指定楼层
1
发表于 2014-9-27 10:42:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
1.1更新说明:添加了随机标题功能(注:但是1.1的版本使用之后默认的标题背景设置就会废掉,需要在脚本里设置背景)
例:
  TITLE_CASE = ["1"]
# 这里设置背景图片名字,放到Titles1文件夹里
  TITLE_CASE1 = ["1"]
# 这里设置前景图片名字,放到Titles2文件夹里

这样就能够只用一个标题背景了。
  1. #=============================================================================
  2. # 标题画面加强V1.1  by 子弹君
  3. #=============================================================================
  4. # 说明:
  5. # 加强默认标题画面的各种功能
  6. # 可以实现随机标题背景的效果,但是默认的背景设置会废掉= =
  7. #=============================================================================
  8. $BombScript ||= {};$BombScript["标题画面加强"] = "标题画面加强20140921"
  9. #==============================================================================
  10. #  设定部分
  11. #==============================================================================
  12. module BOMB
  13.   module TITLE1
  14.   FONT = "微软雅黑"
  15. # 设置标题选项字体
  16.   SIZE = 20
  17. # 设置字体大小
  18.   BOLD = false
  19. # 设置选项字是否加粗
  20.   SHADOW = true
  21. # 设置选项字是否有阴影
  22.   ITALIC = false
  23. # 设置选项字是否斜体
  24.   COLOR = Color.new(255,255,255,255)
  25. # 设置选项字的颜色
  26.   OPACITY = 0
  27. # 设置选项窗口不透明度  
  28.   WIDTH = 160
  29. # 设置窗口的宽度  
  30.   X = 190
  31. # 设置窗口的X坐标  
  32.   Y = 280
  33. # 设置窗口的Y坐标
  34.   TITLE = "Title"
  35. # 设置标题选项的背景图,若要显示一张背景请将不透明度调为0
  36. # 取为空值则不显示图片。

  37.   FONT2 = "微软雅黑"
  38. # 设置标题大字的字体
  39.   SIZE2 = 68
  40. # 设置标题大字的字号大小  
  41.   BOLD2 = false
  42. # 设置标题大字是否加粗  
  43.   SHADOW2 = true
  44. # 设置标题大字是否有阴影  
  45.   ITALIC2 = false
  46. # 设置标题大字是否斜体  
  47.   COLOR2 = Color.new(255,255,255,255)
  48. # 设置标题大字的颜色
  49.   TITLE_CASE = ["1","2","3"]
  50. # 这里设置随机标题的背景图片名字,放到Titles1文件夹里
  51.   TITLE_CASE1 = ["1","2","3"]
  52. # 这里设置随机标题的前景图片名字,放到Titles2文件夹里
  53.   end
  54. end
  55. class Window_TitleCommand < Window_Command
  56.   #--------------------------------------------------------------------------
  57.   # ● 初始化对象
  58.   #--------------------------------------------------------------------------
  59.   alias bomb20140921_initialize initialize
  60.   def initialize
  61.     bomb20140921_initialize
  62.     self.opacity = BOMB::TITLE1::OPACITY
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 获取窗口的宽度
  66.   #--------------------------------------------------------------------------
  67.   def window_width
  68.     return BOMB::TITLE1::WIDTH
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 更新窗口的位置
  72.   #--------------------------------------------------------------------------
  73.   def update_placement
  74.     self.x = self.x = BOMB::TITLE1::X
  75.     self.y = self.y = BOMB::TITLE1::Y
  76.   end
  77. end
  78. class Window_TitleCommand
  79.   #--------------------------------------------------------------------------
  80.   # ● 绘制字体
  81.   #--------------------------------------------------------------------------
  82.   alias bomb20140921_contents create_contents
  83.   def create_contents
  84.     bomb20140921_contents
  85.     self.contents.font.name = BOMB::TITLE1::FONT
  86.     self.contents.font.size = BOMB::TITLE1::SIZE
  87.     self.contents.font.bold = BOMB::TITLE1::BOLD
  88.     self.contents.font.shadow = BOMB::TITLE1::SHADOW
  89.     self.contents.font.italic = BOMB::TITLE1::ITALIC
  90.   end
  91.   def normal_color      
  92.   self.contents.font.color = BOMB::TITLE1::COLOR   
  93.   end
  94. end
  95. class Scene_Title < Scene_Base
  96.   #--------------------------------------------------------------------------
  97.   # ● 开始处理
  98.   #--------------------------------------------------------------------------
  99.   def start
  100.     super
  101.     SceneManager.clear
  102.     Graphics.freeze
  103.     create_background
  104.     create_foreground
  105.     create_command_window
  106.     play_title_music
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● 获取渐变速度
  110.   #--------------------------------------------------------------------------
  111.   def transition_speed
  112.     return 20
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 结束处理
  116.   #--------------------------------------------------------------------------
  117.   def terminate
  118.     super
  119.     SceneManager.snapshot_for_background
  120.     dispose_background
  121.     dispose_foreground
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 生成背景
  125.   #--------------------------------------------------------------------------
  126.   def create_background
  127.     @sprite1 = Sprite.new
  128.     @sprite1.bitmap = Cache.title1(BOMB::TITLE1::TITLE_CASE[rand(BOMB::TITLE1::TITLE_CASE.size)])
  129.     @sprite2 = Sprite.new
  130.     @sprite2.bitmap = Cache.title2(BOMB::TITLE1::TITLE_CASE1[rand(BOMB::TITLE1::TITLE_CASE1.size)])
  131.     @sprite3 = Sprite.new
  132.     @sprite3.bitmap = Cache.system(BOMB::TITLE1::TITLE)
  133.     center_sprite(@sprite1)
  134.     center_sprite(@sprite2)
  135.     center_sprite(@sprite3)
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● 生成前景
  139.   #--------------------------------------------------------------------------
  140.   def create_foreground
  141.     @foreground_sprite = Sprite.new
  142.     @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  143.     @foreground_sprite.z = 100
  144.     draw_game_title if $data_system.opt_draw_title
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 绘制游戏标题
  148.   #--------------------------------------------------------------------------
  149.   def draw_game_title
  150.     @foreground_sprite.bitmap.font.size = BOMB::TITLE1::SIZE2
  151.     @foreground_sprite.bitmap.font.name = BOMB::TITLE1::FONT2
  152.     @foreground_sprite.bitmap.font.bold = BOMB::TITLE1::BOLD2
  153.     @foreground_sprite.bitmap.font.shadow = BOMB::TITLE1::SHADOW2
  154.     @foreground_sprite.bitmap.font.italic = BOMB::TITLE1::ITALIC2
  155.     @foreground_sprite.bitmap.font.color = BOMB::TITLE1::COLOR2
  156.     rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
  157.     @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● 释放背景
  161.   #--------------------------------------------------------------------------
  162.   def dispose_background
  163.     @sprite1.bitmap.dispose
  164.     @sprite1.dispose
  165.     @sprite2.bitmap.dispose
  166.     @sprite2.dispose
  167.     @sprite3.dispose
  168.     @sprite3.bitmap.dispose
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 释放前景
  172.   #--------------------------------------------------------------------------
  173.   def dispose_foreground
  174.     @foreground_sprite.bitmap.dispose
  175.     @foreground_sprite.dispose
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● 执行精灵居中
  179.   #--------------------------------------------------------------------------
  180.   def center_sprite(sprite)
  181.     sprite.ox = sprite.bitmap.width / 2
  182.     sprite.oy = sprite.bitmap.height / 2
  183.     sprite.x = Graphics.width / 2
  184.     sprite.y = Graphics.height / 2   
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 生成指令窗口
  188.   #--------------------------------------------------------------------------
  189.   def create_command_window
  190.     @command_window = Window_TitleCommand.new
  191.     @command_window.set_handler(:new_game, method(:command_new_game))
  192.     @command_window.set_handler(:continue, method(:command_continue))
  193.     @command_window.set_handler(:shutdown, method(:command_shutdown))
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● 关闭指令窗口
  197.   #--------------------------------------------------------------------------
  198.   def close_command_window
  199.     @command_window.close
  200.     update until @command_window.close?
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 指令“开始游戏”
  204.   #--------------------------------------------------------------------------
  205.   def command_new_game
  206.     DataManager.setup_new_game
  207.     close_command_window
  208.     fadeout_all
  209.     $game_map.autoplay
  210.     SceneManager.goto(Scene_Map)
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 指令“继续游戏”
  214.   #--------------------------------------------------------------------------
  215.   def command_continue
  216.     close_command_window
  217.     SceneManager.call(Scene_Load)
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 指令“退出游戏”
  221.   #--------------------------------------------------------------------------
  222.   def command_shutdown
  223.     close_command_window
  224.     fadeout_all
  225.     SceneManager.exit
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 播放标题画面音乐
  229.   #--------------------------------------------------------------------------
  230.   def play_title_music
  231.     $data_system.title_bgm.play
  232.     RPG::BGS.stop
  233.     RPG::ME.stop
  234.   end
  235. end
复制代码
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-17 06:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表