Project1

标题: 关于标题按纽图片脚本的问题 [打印本页]

作者: xia0082    时间: 2008-12-15 09:24
标题: 关于标题按纽图片脚本的问题
代码如下,这是一个使用图片做标题按纽的脚本。

现在我有一个问题就是,这个脚本在按纽移动的时候有一个渐变效果,我现在不需要这个效果,只要直接改变改变图片就好,请问我应该如何修改??

  1. #==============================================================================
  2. # ■ 图片标题菜单1.0
  3. # Scene_Title
  4. #------------------------------------------------------------------------------
  5. # 作者:chaochao
  6. # http://zhuchao.go1.icpcn.com
  7. #==============================================================================
  8. class Scene_Title
  9. def main
  10. if $BTEST
  11. battle_test
  12. return
  13. end
  14. $data_actors = load_data("Data/Actors.rxdata")
  15. $data_classes = load_data("Data/Classes.rxdata")
  16. $data_skills = load_data("Data/Skills.rxdata")
  17. $data_items = load_data("Data/Items.rxdata")
  18. $data_weapons = load_data("Data/Weapons.rxdata")
  19. $data_armors = load_data("Data/Armors.rxdata")
  20. $data_enemies = load_data("Data/Enemies.rxdata")
  21. $data_troops = load_data("Data/Troops.rxdata")
  22. $data_states = load_data("Data/States.rxdata")
  23. $data_animations = load_data("Data/Animations.rxdata")
  24. $data_tilesets = load_data("Data/Tilesets.rxdata")
  25. $data_common_events = load_data("Data/CommonEvents.rxdata")
  26. $data_system = load_data("Data/System.rxdata")
  27. $game_system = Game_System.new
  28. # 生成标题图形
  29. @sprite = [Sprite.new]
  30. for i in 0..6
  31. @sprite[i] = Sprite.new
  32. @sprite[i].opacity = 0
  33. end
  34. @sprite[0].bitmap = RPG::Cache.title($data_system.title_name)
  35. @sprite[0].opacity = 0
  36. #开始游戏的图片
  37. @sprite[1].bitmap = Bitmap.new("Graphics/Pictures/start-2.png")
  38. @sprite[2].bitmap = Bitmap.new("Graphics/Pictures/start-1.png")
  39. #继续游戏的图片
  40. @sprite[3].bitmap = Bitmap.new("Graphics/Pictures/continue-2.png")
  41. @sprite[4].bitmap = Bitmap.new("Graphics/Pictures/continue-1.png")
  42. #退出游戏的图片
  43. @sprite[5].bitmap = Bitmap.new("Graphics/Pictures/exit-2.png")
  44. @sprite[6].bitmap = Bitmap.new("Graphics/Pictures/exit-1.png")
  45. #图片位置
  46. for i in 1..6
  47. x=235
  48. y=(i+1)/2*26+175
  49. @sprite[i].x =x
  50. @sprite[i].y =y
  51. end
  52. @continue_enabled = false
  53. for i in 0..3
  54. if FileTest.exist?("Save#{i+1}.rxdata")
  55. @continue_enabled = true
  56. end
  57. end
  58. if @continue_enabled
  59. @command_index = 1
  60. else
  61. @command_index = 0
  62. @sprite[3].tone = Tone.new(0, 0, 0, 255)
  63. @sprite[4].tone = Tone.new(0, 0, 0, 255)
  64. end
  65. $game_system.bgm_play($data_system.title_bgm)
  66. Audio.me_stop
  67. Audio.bgs_stop
  68. Graphics.transition
  69. loop do
  70. Graphics.update
  71. #淡出背景图
  72. if @sprite[0].opacity <= 255
  73. @sprite[0].opacity += 15
  74. end
  75. Input.update
  76. update
  77. if $scene != self
  78. break
  79. end
  80. end
  81. Graphics.freeze
  82. # 释放图形
  83. for i in 0..6
  84. @sprite[i].bitmap.dispose
  85. @sprite[i].dispose
  86. end
  87. end
  88. def update
  89. chaochaocommandchaochao
  90. if Input.trigger?(Input::C)
  91. case @command_index
  92. when 0
  93. command_new_game
  94. when 1
  95. command_continue
  96. when 2
  97. command_shutdown
  98. end
  99. end
  100. end
  101. def chaochaocommandchaochao
  102. if Input.trigger?(Input::UP)
  103. @command_index -= 1
  104. if @command_index < 0
  105. @command_index = 2
  106. end
  107. $game_system.se_play($data_system.cursor_se)
  108. end
  109. if Input.trigger?(Input::DOWN)
  110. @command_index += 1
  111. if @command_index > 2
  112. @command_index = 0
  113. end
  114. $game_system.se_play($data_system.cursor_se)
  115. end
  116. case @command_index
  117. when 0
  118. if @sprite[1].opacity >= 0
  119. @sprite[1].opacity -= 30
  120. end
  121. if @sprite[2].opacity <= 240
  122. @sprite[2].opacity += 30
  123. end
  124. if @sprite[3].opacity <= 210
  125. @sprite[3].opacity += 30
  126. end
  127. if @sprite[4].opacity >= 0
  128. @sprite[4].opacity -= 30
  129. end
  130. if @sprite[5].opacity <= 210
  131. @sprite[5].opacity += 30
  132. end
  133. if @sprite[6].opacity >= 0
  134. @sprite[6].opacity -= 30
  135. end
  136. when 1
  137. if @sprite[1].opacity <= 210
  138. @sprite[1].opacity += 30
  139. end
  140. if @sprite[2].opacity >= 0
  141. @sprite[2].opacity -= 30
  142. end
  143. if @sprite[3].opacity >= 0
  144. @sprite[3].opacity -= 30
  145. end
  146. if @sprite[4].opacity <= 240
  147. @sprite[4].opacity += 30
  148. end
  149. if @sprite[5].opacity <= 210
  150. @sprite[5].opacity += 30
  151. end
  152. if @sprite[6].opacity >= 0
  153. @sprite[6].opacity -= 30
  154. end
  155. when 2
  156. if @sprite[1].opacity <= 210
  157. @sprite[1].opacity += 30
  158. end
  159. if @sprite[2].opacity >= 0
  160. @sprite[2].opacity -= 30
  161. end
  162. if @sprite[3].opacity <= 210
  163. @sprite[3].opacity += 30
  164. end
  165. if @sprite[4].opacity >= 0
  166. @sprite[4].opacity -= 30
  167. end
  168. if @sprite[5].opacity >= 0
  169. @sprite[5].opacity -= 30
  170. end
  171. if @sprite[6].opacity <= 240
  172. @sprite[6].opacity += 30
  173. end
  174. end
  175. end
  176. end
复制代码

[LINE]1,#dddddd[/LINE]此贴于 2008-12-19 13:45:06 被版主darkten提醒,请楼主看到后对本贴做出回应。 [LINE]1,#dddddd[/LINE]版务信息:版主帮忙结贴~
作者: 天圣的马甲    时间: 2008-12-15 16:48
  1. case @command_index
  2. when 0
  3. if @sprite[1].opacity >= 0
  4. @sprite[1].opacity -= 30
  5. end
  6. if @sprite[2].opacity <= 240
  7. @sprite[2].opacity += 30
  8. end
  9. if @sprite[3].opacity <= 210
  10. @sprite[3].opacity += 30
  11. end
  12. if @sprite[4].opacity >= 0
  13. @sprite[4].opacity -= 30
  14. end
  15. if @sprite[5].opacity <= 210
  16. @sprite[5].opacity += 30
  17. end
  18. if @sprite[6].opacity >= 0
  19. @sprite[6].opacity -= 30
  20. end
  21. when 1
  22. if @sprite[1].opacity <= 210
  23. @sprite[1].opacity += 30
  24. end
  25. if @sprite[2].opacity >= 0
  26. @sprite[2].opacity -= 30
  27. end
  28. if @sprite[3].opacity >= 0
  29. @sprite[3].opacity -= 30
  30. end
  31. if @sprite[4].opacity <= 240
  32. @sprite[4].opacity += 30
  33. end
  34. if @sprite[5].opacity <= 210
  35. @sprite[5].opacity += 30
  36. end
  37. if @sprite[6].opacity >= 0
  38. @sprite[6].opacity -= 30
  39. end
  40. when 2
  41. if @sprite[1].opacity <= 210
  42. @sprite[1].opacity += 30
  43. end
  44. if @sprite[2].opacity >= 0
  45. @sprite[2].opacity -= 30
  46. end
  47. if @sprite[3].opacity <= 210
  48. @sprite[3].opacity += 30
  49. end
  50. if @sprite[4].opacity >= 0
  51. @sprite[4].opacity -= 30
  52. end
  53. if @sprite[5].opacity >= 0
  54. @sprite[5].opacity -= 30
  55. end
  56. if @sprite[6].opacity <= 240
  57. @sprite[6].opacity += 30
  58. end
  59. end
  60. end
  61. end
复制代码

作者: xia0082    时间: 2008-12-15 23:03
那个……请问下这段要如何修改才能没有渐变效果?

我改了以后要么就是背景没了,要么就是按纽没了……
作者: xia0082    时间: 2008-12-16 02:18
顶起
作者: xia0082    时间: 2008-12-16 21:48
没人能帮我下吗?
作者: 天圣的马甲    时间: 2008-12-19 00:09
- -直接写成
when XXX
@sprite[X].opacity = 255
不就行了么…… [LINE]1,#dddddd[/LINE]系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1