pigu_6

MOG| Animated title 2.2

Dec 18th, 2012
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.78 KB | None | 0 0
  1. #==============================================================================
  2. # +++ MOG - Animated Title A (v2.2) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Tela de titulo animado, com logo, imagens aleatórias e outros efeitos visuais.
  8. #==============================================================================
  9.  
  10. #==============================================================================
  11. # IMAGENS NECESSÁRIAS
  12. #==============================================================================
  13. # Serão necessários as seguintes imagens na pasta Graphics/Titles2/
  14. #
  15. # Cursor.png
  16. # Commmand_Name.png (image filename = name of command)
  17. # Particle.png (Opcional)
  18. # Logo.jpg (Opcional)
  19. # Animated.png (Opcional)
  20. #==============================================================================
  21.  
  22. #==============================================================================
  23. # NOTA 1 - Para definir a imagem de texto basta selecionar no banco de dados
  24. # a imagem do titulo numero 2 (Segunda camada)
  25. #==============================================================================
  26.  
  27. #==============================================================================
  28. # NOTA 2 - O nome da imagem de comando é iguál ao nome do comando definido
  29. # no banco de dados do Rpg Maker.
  30. #==============================================================================
  31.  
  32.  
  33. #==============================================================================
  34. # ● Histórico (Version History)
  35. #==============================================================================
  36. # v 2.2 - Possibilidade de colocar valores de movemento negativo nas partículas.
  37. # v 2.1 - Correção do Bug quando a quantidade de imagens aleatórias é definida
  38. # com a quantidade menor que 1.
  39. # v 2.0 - Adição do Sprite Animado. (Opcional)
  40. # - Adição de cores aleatórias nas partículas.
  41. # - Adição do multiplas camadas de imagens. (Opcional)
  42. # - Adição do efeito Wave no texto do titulo.
  43. # - Opção de definir a velocidade de movimento das partículas.
  44. # - Opção de ativar ou não o tremor na seleção de comando.
  45. #
  46. # v 1.2 - Melhoria no sistema de dispose de imagens.
  47. #
  48. # v 1.1 - Opção de pular o logo ao apertar alguma tecla.
  49. # - Adição de comandos em pictures.
  50. # - Adição de cursor de comando.
  51. #==============================================================================
  52.  
  53. module MOG_SCENE_TITLE_A
  54.  
  55. #--------------------------------------------------------------------------
  56. # ▼ LOGO ▼
  57. #--------------------------------------------------------------------------
  58. # Apresenta um Logo ao começar a tela de titulo.
  59. # Será necessário ter a imagem LOGO.jpg (png) na pasta Graphics/Title2
  60. #--------------------------------------------------------------------------
  61. # Ativar Logo
  62. LOGO = true
  63. # Duração do logo.
  64. LOGO_DURATION = 2 #(Sec)
  65.  
  66. #--------------------------------------------------------------------------
  67. # ▼ RANDOM BACKGROUND ▼
  68. #--------------------------------------------------------------------------
  69. #Definição das pictures.
  70. #--------------------------------------------------------------------------
  71. RANDOM_PICTURES = [
  72. "Title0", "Title1", "Title2","Title3",
  73. #"Title4","Title5","Title6","Title7"
  74. ]
  75. #Tempo de duração para ativar a troca de imagens.
  76. RANDOM_PICTURES_DURATION = 3#(sec)
  77. #Seleção aleatória.
  78. RAMDOM_SELECTION = true
  79. #Velocidade de Scrolling. (Speed X , Speed Y)
  80. RANDOM_PICTURES_SCROLL_SPEED = [0,0]
  81.  
  82. #--------------------------------------------------------------------------
  83. # ▼ MULTIPLE LAYERS ▼
  84. #--------------------------------------------------------------------------
  85. # Definição de multiplas camadas. * (não há limíte na quantidade de camadas
  86. # usadas)
  87. #--------------------------------------------------------------------------
  88. # MULTIPLE_LAYERS = [ ["A",B,C,D], ["A",B,C,D], ["A",B,C D], ["A",B,C,D ], ....]
  89. #
  90. # A - Nome da imagem.
  91. # B - Velocidade de scroll na horizontal.
  92. # C - Velocidade de scroll na vertical.
  93. # D - Tipo de Blend. (0 - Normal / 2 - Add / 3 - Substract)
  94. #
  95. MULTIPLE_LAYERS = [
  96. # ["Layer1",1,0,1],
  97. # ["Layer2",3,0,1],
  98. # ["Layer3",0,0,0]
  99. # ["Layer4",0,0,0],
  100. # ["Layer5",0,0,0],
  101. # ["Layer6",0,0,0]
  102. ]
  103.  
  104. #--------------------------------------------------------------------------
  105. # ▼ PARTICLES ▼
  106. #--------------------------------------------------------------------------
  107. # Adiciona partículas animadas na tela do titulo.
  108. # Será necessário ter a imagem PARTICLE.png na pasta Graphics/Title2
  109. #--------------------------------------------------------------------------
  110. # Ativar Partículas.
  111. PARTICLE = true
  112. # Ativar Cores Aleatórias.
  113. PARTICLE_RANDOM_COLOR = true
  114. # Definição do tipo de blend. (0,1,2)
  115. PARTICLE_BLEND_TYPE = 1
  116. #Definição do limite de velocidade das partículas.
  117. PARTICLE_MOVEMENT_RANGE_X = 3
  118. PARTICLE_MOVEMENT_RANGE_Y = 3
  119. PARTICLE_ANGLE_RANGE = 3
  120.  
  121. #--------------------------------------------------------------------------
  122. # ▼ WAVE TITLE ▼
  123. #--------------------------------------------------------------------------
  124. # Ativa o efeito WAVE no texto do titulo, o Texto do titulo é definido
  125. # na camada do titulo 2, que pode ser definido através do banco de dados
  126. #--------------------------------------------------------------------------
  127. #Ativar o efeito do titulo com efeito WAVE.
  128. TITLE_WAVE = false
  129. #Configuração do efeito WAVE
  130. #
  131. # TITLE_WAVE_CONFIG = [ AMP, LENGTH , SPEED]
  132. #
  133. TITLE_WAVE_CONFIG = [6 , 232 , 360]
  134.  
  135. #--------------------------------------------------------------------------
  136. # ▼ ANIMATED_SPRITE ▼ (Opcional)
  137. #--------------------------------------------------------------------------
  138. # Adiciona um sprite animado no titulo.
  139. # A quantidade de frames é proporcional a largura dividido pela altura
  140. # da imagem, ou seja, não há limite de quantidade de frames e nem de
  141. # tamanho da imagem.
  142. # Será necessário ter a imagem ANIMATED.png (Jpg) na pasta Graphics/Title2
  143. #--------------------------------------------------------------------------
  144. # Ativar Sprite animado.
  145. ANIMATED_SPRITE = true
  146. # Posição do Sprite animado.
  147. ANIMATED_SPRITE_POSITION = [130,150]
  148. # Velocidade da animação
  149. ANIMATED_SPRITE_SPEED = 10
  150. # Tipo de Blend. (0 - Normal / 2 - Add / 3 - Substract)
  151. ANIMATED_SPRITE_BLEND_TYPE = 1
  152. # Definição do zoom,
  153. ANIMATED_SPRITE_ZOOM = 1.5
  154.  
  155.  
  156. #--------------------------------------------------------------------------
  157. # ▼ COMMANDS / SELECTION ▼
  158. #--------------------------------------------------------------------------
  159. # Configuração extras da tela de titulo.
  160. #--------------------------------------------------------------------------
  161. # Posição do comando.
  162. COMMANDS_POS = [220 , 280]
  163. # Ativar o efeito de tremor ao selecionar o comando.
  164. COMMAND_SHAKE = true
  165. # Definição da posição do cursor.(Para ajustes)
  166. CURSOR_POS = [-42,-7]
  167. # Ativar flash ao mover o comando.
  168. CURSOR_FLASH_SELECTION = true
  169. # Definição da posição do flash.
  170. CURSOR_FLASH_SLECTION_POS = [-180,0]
  171. # Tipo de Blend. (0 - Normal / 2 - Add / 3 - Substract)
  172. CURSOR_FLASH_SLECTION_BLEND_TYPE = 1
  173.  
  174. end
  175.  
  176. #==============================================================================
  177. # ■ Window TitleCommand
  178. #==============================================================================
  179. class Window_TitleCommand < Window_Command
  180. attr_reader :list
  181. end
  182.  
  183. #==============================================================================
  184. # ■ Particle Title
  185. #==============================================================================
  186. class Particle_Title < Sprite
  187.  
  188. include MOG_SCENE_TITLE_A
  189.  
  190. #--------------------------------------------------------------------------
  191. # ● Initialize
  192. #--------------------------------------------------------------------------
  193. def initialize(viewport = nil)
  194. super(viewport)
  195. self.bitmap = Cache.title2("Particle")
  196. self.tone.set(rand(255),rand(255), rand(255), 255) if PARTICLE_RANDOM_COLOR
  197. self.blend_type = PARTICLE_BLEND_TYPE
  198. @cw = self.bitmap.width
  199. @ch = self.bitmap.height
  200. @nx = PARTICLE_MOVEMENT_RANGE_X
  201. @ny = PARTICLE_MOVEMENT_RANGE_Y
  202. reset_setting
  203. end
  204.  
  205. #--------------------------------------------------------------------------
  206. # ● Reset Setting
  207. #--------------------------------------------------------------------------
  208. def reset_setting
  209. zoom = (50 + rand(100)) / 100.1
  210. self.zoom_x = zoom
  211. self.zoom_y = zoom
  212. self.x = (rand(576) -32)
  213. self.y = rand(448 + @ch)
  214. self.opacity = 0
  215. self.angle = rand(360)
  216. nx2 = rand(@nx).abs
  217. nx2 = 1 if (@nx != 0 and nx2 < 1)
  218. @speed_x = @nx > 0 ? nx2 : @nx < 0 ? -nx2 : 0
  219. ny2 = rand(@ny).abs
  220. ny2 = 1 if (@ny != 0 and ny2 < 1)
  221. @speed_y = @ny > 0 ? ny2 : @ny < 0 ? -ny2 : 0
  222. @speed_a = [[rand(PARTICLE_ANGLE_RANGE), PARTICLE_ANGLE_RANGE].min, 0].max
  223. end
  224.  
  225. #--------------------------------------------------------------------------
  226. # ● Dispose
  227. #--------------------------------------------------------------------------
  228. def dispose
  229. super
  230. self.bitmap.dispose
  231. end
  232.  
  233. #--------------------------------------------------------------------------
  234. # ● Update
  235. #--------------------------------------------------------------------------
  236. def update
  237. super
  238. self.x += @speed_x
  239. self.y -= @speed_y
  240. self.angle += @speed_a
  241. self.opacity += 5
  242. reset_setting if can_reset_setting?
  243. end
  244.  
  245. #--------------------------------------------------------------------------
  246. # ● Can Reset Setting
  247. #--------------------------------------------------------------------------
  248. def can_reset_setting?
  249. return true if (self.x < -48 or self.x > 592)
  250. return true if (self.y < -48 or self.y > 464)
  251. return false
  252. end
  253. end
  254.  
  255. #==============================================================================
  256. # ■ Multiple Layers Title
  257. #==============================================================================
  258. class Multiple_Layers_Title
  259.  
  260. #--------------------------------------------------------------------------
  261. # ● Initialize
  262. #--------------------------------------------------------------------------
  263. def initialize(name = "", scroll_x = 0, scroll_y = 0, blend = 0, index = 0)
  264. @layer = Plane.new
  265. @layer.bitmap = Cache.title1(name.to_s) rescue nil
  266. @layer.bitmap = Bitmap.new(32,32) if @layer.bitmap == nil
  267. @layer.z = 10 + index
  268. @layer.opacity = 0
  269. @layer.blend_type = blend
  270. @scroll_speed = [scroll_x, scroll_y]
  271. end
  272.  
  273. #--------------------------------------------------------------------------
  274. # ● Dispose
  275. #--------------------------------------------------------------------------
  276. def dispose
  277. @layer.bitmap.dispose
  278. @layer.bitmap = nil
  279. @layer.dispose
  280. end
  281.  
  282. #--------------------------------------------------------------------------
  283. # ● Update
  284. #--------------------------------------------------------------------------
  285. def update
  286. @layer.opacity += 2
  287. @layer.ox += @scroll_speed[0]
  288. @layer.oy += @scroll_speed[1]
  289. end
  290.  
  291. end
  292.  
  293. #==============================================================================
  294. # ■ Scene Title
  295. #==============================================================================
  296. class Scene_Title < Scene_Base
  297. include MOG_SCENE_TITLE_A
  298.  
  299. #--------------------------------------------------------------------------
  300. # ● Start
  301. #--------------------------------------------------------------------------
  302. def start
  303. super
  304. RPG::BGM.fade(2000)
  305. @logo_active = LOGO
  306. SceneManager.clear
  307. @phase = 1
  308. @phase_time = -1
  309. dispose_title_sprites
  310. create_logo if @logo_active
  311. create_command_window
  312. create_commands
  313. create_background
  314. create_light
  315. create_cursor
  316. create_animated_object
  317. create_flash_select
  318. create_multiple_layers
  319. play_title_music unless @logo_active
  320. end
  321.  
  322. #--------------------------------------------------------------------------
  323. # ● Create Multiple Layers
  324. #--------------------------------------------------------------------------
  325. def create_flash_select
  326. return if !CURSOR_FLASH_SELECTION
  327. @flash_select = Sprite.new
  328. @flash_select.bitmap = Cache.title2("Cursor2")
  329. @flash_select.z = 99
  330. @flash_select.opacity = 0
  331. @flash_select.blend_type = CURSOR_FLASH_SLECTION_BLEND_TYPE
  332. end
  333.  
  334. #--------------------------------------------------------------------------
  335. # ● Create Multiple Layers
  336. #--------------------------------------------------------------------------
  337. def create_multiple_layers
  338. @m_layers = []
  339. index = 0
  340. for i in MULTIPLE_LAYERS
  341. @m_layers.push(Multiple_Layers_Title.new(i[0],i[1],i[2],i[3],index))
  342. index += 1
  343. end
  344. end
  345.  
  346. #--------------------------------------------------------------------------
  347. # ● Create_Logo
  348. #--------------------------------------------------------------------------
  349. def create_animated_object
  350. return if !ANIMATED_SPRITE
  351. @object_index = 0
  352. @object_animation_speed = 0
  353. @object = Sprite.new
  354. @object.z = 98
  355. @object.opacity = 0
  356. @object.blend_type = ANIMATED_SPRITE_BLEND_TYPE
  357. @object.zoom_x = ANIMATED_SPRITE_ZOOM
  358. @object.zoom_y = ANIMATED_SPRITE_ZOOM
  359. @object_image = Cache.title2("Animated")
  360. @object_frame_max = @object_image.width / @object_image.height
  361. @object_width = @object_image.width / @object_frame_max
  362. @object.bitmap = Bitmap.new(@object_width,@object_image.height)
  363. @object.x = ANIMATED_SPRITE_POSITION[0]
  364. @object.y = ANIMATED_SPRITE_POSITION[1]
  365. make_object_bitmap
  366. end
  367.  
  368. #--------------------------------------------------------------------------
  369. # ● Create_Logo
  370. #--------------------------------------------------------------------------
  371. def create_cursor
  372. @cursor = Sprite.new
  373. @cursor.bitmap = Cache.title2("Cursor")
  374. @cursor.opacity = 0
  375. @cursor.z = 130
  376. @cursor_position = [0,0]
  377. @mx = [0,0,0]
  378. end
  379.  
  380. #--------------------------------------------------------------------------
  381. # ● Create_Logo
  382. #--------------------------------------------------------------------------
  383. def create_logo
  384. @phase = 0
  385. @logo = Sprite.new
  386. @logo.bitmap = Cache.title2("Logo")
  387. @logo.opacity = 0
  388. @logo_duration = 180 + (LOGO_DURATION * 60)
  389. @logo.z = 200
  390. end
  391.  
  392. #--------------------------------------------------------------------------
  393. # ● Create Commands
  394. #--------------------------------------------------------------------------
  395. def create_commands
  396. @command_window.visible = false
  397. @commands_index_old = -1
  398. @commands = []
  399. @commands_shake_duration = 0
  400. index = 0
  401. for com in @command_window.list
  402. sprite = Sprite.new
  403. sprite.bitmap = Cache.title2(com[:name].to_s) rescue nil
  404. if sprite.bitmap == nil
  405. sprite.bitmap = Bitmap.new(200,32)
  406. sprite.bitmap.font.size = 24
  407. sprite.bitmap.font.bold = true
  408. sprite.bitmap.font.italic = true
  409. sprite.bitmap.draw_text(0, 0, 200, 32, com[:name].to_s,1)
  410. end
  411. sprite.x = COMMANDS_POS[0] - 100 - (index * 20)
  412. sprite.y = index * sprite.bitmap.height + COMMANDS_POS[1]
  413. sprite.z = 100 + index
  414. sprite.opacity = 0
  415. index += 1
  416. @commands.push(sprite)
  417. end
  418. @command_max = index
  419. end
  420.  
  421. #--------------------------------------------------------------------------
  422. # ● create_background
  423. #--------------------------------------------------------------------------
  424. def create_background
  425. @rand_title_duration = 120
  426. @old_back_index = 0
  427. @sprite1 = Plane.new
  428. @sprite1.opacity = 0
  429. @sprite1.z = 1
  430. if RAMDOM_SELECTION
  431. execute_random_picture(false)
  432. else
  433. execute_random_picture(true)
  434. end
  435. @sprite2 = Sprite.new
  436. @sprite2.bitmap = Cache.title2($data_system.title2_name)
  437. @sprite2.z = 140
  438. @sprite2.opacity = 0
  439. if TITLE_WAVE
  440. @sprite2.wave_amp = TITLE_WAVE_CONFIG[0]
  441. @sprite2.wave_length = TITLE_WAVE_CONFIG[1]
  442. @sprite2.wave_speed = TITLE_WAVE_CONFIG[2]
  443. end
  444. end
  445.  
  446. #--------------------------------------------------------------------------
  447. # ● Create Light
  448. #--------------------------------------------------------------------------
  449. def create_light
  450. return unless PARTICLE
  451. @viewport_light = Viewport.new(-32, -32, 600, 480)
  452. @viewport_light.z = 50
  453. @light_bitmap =[]
  454. for i in 0...20
  455. @light_bitmap.push(Particle_Title.new(@viewport_light))
  456. end
  457. end
  458.  
  459. #--------------------------------------------------------------------------
  460. # ● dispose Background1
  461. #--------------------------------------------------------------------------
  462. def dispose_background1
  463. @sprite1.bitmap.dispose
  464. @sprite1.bitmap = nil
  465. @sprite1.dispose
  466. @sprite1 = nil
  467. end
  468.  
  469. #--------------------------------------------------------------------------
  470. # ● Dispose Background2
  471. #--------------------------------------------------------------------------
  472. def dispose_background2
  473. if @sprite2.bitmap != nil
  474. @sprite2.bitmap.dispose
  475. @sprite2.bitmap = nil
  476. @sprite2.dispose
  477. @sprite2 = nil
  478. end
  479. end
  480.  
  481. #--------------------------------------------------------------------------
  482. # ● Dispose Light
  483. #--------------------------------------------------------------------------
  484. def dispose_light
  485. return unless PARTICLE
  486. if @light_bitmap != nil
  487. for i in @light_bitmap
  488. i.dispose
  489. end
  490. @light_bitmap = nil
  491. end
  492. @viewport_light.dispose
  493. end
  494.  
  495. #--------------------------------------------------------------------------
  496. # ● Dispose Logo
  497. #--------------------------------------------------------------------------
  498. def dispose_logo
  499. return unless @logo_active
  500. @logo.bitmap.dispose
  501. @logo.dispose
  502. end
  503.  
  504. #--------------------------------------------------------------------------
  505. # ● Dispose Multiple Layers
  506. #--------------------------------------------------------------------------
  507. def dispose_multiple_layers
  508. return if @m_layers == nil
  509. @m_layers.each {|layer| layer.dispose }
  510. end
  511.  
  512. #--------------------------------------------------------------------------
  513. # ● Terminate
  514. #--------------------------------------------------------------------------
  515. def terminate
  516. super
  517. dispose_title_sprites
  518. end
  519.  
  520. #--------------------------------------------------------------------------
  521. # ● Dispose Title Sprites
  522. #--------------------------------------------------------------------------
  523. def dispose_title_sprites
  524. return if @cursor == nil
  525. dispose_background1
  526. dispose_background2
  527. dispose_light
  528. dispose_logo
  529. dispose_multiple_layers
  530. @cursor.bitmap.dispose
  531. @cursor.dispose
  532. @cursor = nil
  533. if @flash_select != nil
  534. @flash_select.bitmap.dispose
  535. @flash_select.dispose
  536. end
  537. for com in @commands
  538. com.bitmap.dispose
  539. com.dispose
  540. end
  541. if ANIMATED_SPRITE
  542. @object.bitmap.dispose
  543. @object.dispose
  544. @object_image.dispose
  545. end
  546. end
  547.  
  548. #--------------------------------------------------------------------------
  549. # ● Update
  550. #--------------------------------------------------------------------------
  551. def update
  552. super
  553. update_logo
  554. update_initial_animation
  555. update_command
  556. update_background
  557. update_light
  558. update_object_animation
  559. update_multiple_layers
  560. end
  561.  
  562. #--------------------------------------------------------------------------
  563. # ● Update Multiple Layers
  564. #--------------------------------------------------------------------------
  565. def update_multiple_layers
  566. return if @m_layers == nil
  567. @m_layers.each {|layer| layer.update }
  568. end
  569.  
  570. #--------------------------------------------------------------------------
  571. # ● Make Object bitmap
  572. #--------------------------------------------------------------------------
  573. def make_object_bitmap
  574. @object.bitmap.clear
  575. src_rect_back = Rect.new(@object_width * @object_index, 0,@object_width,@object_image.height)
  576. @object.bitmap.blt(0,0, @object_image, src_rect_back)
  577. end
  578.  
  579. #--------------------------------------------------------------------------
  580. # ● Update Object Animation
  581. #--------------------------------------------------------------------------
  582. def update_object_animation
  583. return if !ANIMATED_SPRITE
  584. @object.opacity += 2
  585. @object_animation_speed += 1
  586. if @object_animation_speed > ANIMATED_SPRITE_SPEED
  587. @object_animation_speed = 0
  588. @object_index += 1
  589. @object_index = 0 if @object_index >= @object_frame_max
  590. make_object_bitmap
  591. end
  592. end
  593.  
  594. #--------------------------------------------------------------------------
  595. # ● Update Cursor Position
  596. #--------------------------------------------------------------------------
  597. def update_cursor_position
  598. @cursor.opacity += 5
  599. execute_animation_s
  600. execute_cursor_move(0,@cursor.x,@cursor_position[0] + @mx[1])
  601. execute_cursor_move(1,@cursor.y,@cursor_position[1])
  602. end
  603.  
  604. #--------------------------------------------------------------------------
  605. # ● Execute Animation S
  606. #--------------------------------------------------------------------------
  607. def execute_animation_s
  608. @mx[2] += 1
  609. return if @mx[2] < 4
  610. @mx[2] = 0
  611. @mx[0] += 1
  612. case @mx[0]
  613. when 1..7; @mx[1] += 1
  614. when 8..14; @mx[1] -= 1
  615. else
  616. @mx[0] = 0
  617. @mx[1] = 0
  618. end
  619. end
  620.  
  621. #--------------------------------------------------------------------------
  622. # ● Execute Cursor Move
  623. #--------------------------------------------------------------------------
  624. def execute_cursor_move(type,cp,np)
  625. sp = 5 + ((cp - np).abs / 5)
  626. if cp > np
  627. cp -= sp
  628. cp = np if cp < np
  629. elsif cp < np
  630. cp += sp
  631. cp = np if cp > np
  632. end
  633. @cursor.x = cp if type == 0
  634. @cursor.y = cp if type == 1
  635. end
  636.  
  637. #--------------------------------------------------------------------------
  638. # ● Update Logo
  639. #--------------------------------------------------------------------------
  640. def update_logo
  641. return if @phase != 0
  642. loop do
  643. break if @logo_duration == 0
  644. execute_logo
  645. Graphics.update
  646. Input.update
  647. end
  648. play_title_music
  649. end
  650.  
  651. #--------------------------------------------------------------------------
  652. # ● Execute Logo
  653. #--------------------------------------------------------------------------
  654. def execute_logo
  655. if @logo_duration > 120 and (Input.trigger?(:C) or Input.trigger?(:B))
  656. @logo_duration = 120
  657. end
  658. @logo_duration -= 1
  659. if @logo_duration > 120
  660. @logo.opacity += 5
  661. else
  662. @logo.opacity -= 5
  663. end
  664. if @logo.opacity <= 0
  665. @logo_duration = 0
  666. @phase = 1
  667. end
  668. end
  669.  
  670. #--------------------------------------------------------------------------
  671. # ● Update Background
  672. #--------------------------------------------------------------------------
  673. def update_background
  674. @sprite1.ox += RANDOM_PICTURES_SCROLL_SPEED[0]
  675. @sprite1.oy += RANDOM_PICTURES_SCROLL_SPEED[1]
  676. @sprite2.opacity += 2
  677. @sprite2.update
  678. return if RANDOM_PICTURES.size < 1
  679. @rand_title_duration -= 1
  680. if @rand_title_duration <= 0
  681. @sprite1.opacity -= 5 unless RANDOM_PICTURES.size < 2
  682. else
  683. @sprite1.opacity += 5
  684. end
  685. return if @sprite1.opacity != 0
  686. execute_random_picture
  687. end
  688.  
  689. #--------------------------------------------------------------------------
  690. # ● Execute Random Picture
  691. #--------------------------------------------------------------------------
  692. def execute_random_picture(initial = false)
  693. @rand_title_duration = [[60 * RANDOM_PICTURES_DURATION, 9999].min, 60].max
  694. if @sprite1.bitmap != nil
  695. @sprite1.bitmap.dispose
  696. @sprite1.bitmap = nil
  697. end
  698. if RAMDOM_SELECTION
  699. rand_pic = rand(RANDOM_PICTURES.size)
  700. if rand_pic == @old_back_index
  701. rand_pic += 1
  702. rand_pic = 0 if rand_pic >= RANDOM_PICTURES.size
  703. end
  704. @old_back_index = rand_pic
  705. else
  706. @old_back_index += 1 unless initial
  707. @old_back_index = 0 if @old_back_index >= RANDOM_PICTURES.size
  708. end
  709. pic = RANDOM_PICTURES[@old_back_index]
  710. @sprite1.bitmap = Cache.title1(pic) rescue nil
  711. @sprite1.bitmap = Cache.title1("") if @sprite1.bitmap == nil
  712. end
  713.  
  714. #--------------------------------------------------------------------------
  715. # ● Update Light
  716. #--------------------------------------------------------------------------
  717. def update_light
  718. return unless PARTICLE
  719. if @light_bitmap != nil
  720. for i in @light_bitmap
  721. i.update
  722. end
  723. end
  724. end
  725.  
  726. #--------------------------------------------------------------------------
  727. # ● Update Initial Animation
  728. #--------------------------------------------------------------------------
  729. def update_initial_animation
  730. return if @phase != 1
  731. @phase_time -= 1 if @phase_time > 0
  732. if @phase_time == 0
  733. @phase = 2
  734. @phase_time = 30
  735. end
  736. for i in @commands
  737. index = 0
  738. if i.x < COMMANDS_POS[0]
  739. i.x += 5 + (2 * index)
  740. i.opacity += 10
  741. if i.x >= COMMANDS_POS[0]
  742. i.x = COMMANDS_POS[0]
  743. i.opacity = 255
  744. if @phase_time < 15 / 2
  745. @phase_time = 15
  746. end
  747. end
  748. end
  749. index += 1
  750. end
  751. end
  752.  
  753. #--------------------------------------------------------------------------
  754. # ● Update Command
  755. #--------------------------------------------------------------------------
  756. def update_command
  757. return if @phase != 2
  758. update_command_slide
  759. update_cursor_position
  760. update_flash_select
  761. end
  762.  
  763. #--------------------------------------------------------------------------
  764. # ● Update Command Slide
  765. #--------------------------------------------------------------------------
  766. def update_command_slide
  767. if @commands_index_old != @command_window.index
  768. @commands_index_old = @command_window.index
  769. @commands_shake_duration = 30
  770. if @flash_select != nil
  771. @flash_select.opacity = 255
  772. end
  773. end
  774. return if @commands_shake_duration == 0
  775. @commands_shake_duration -= 1 if @commands_shake_duration > 0
  776. @commands_shake_duration = 0 if !COMMAND_SHAKE
  777. for i in @commands
  778. if (i.z - 100) == @command_window.index
  779. i.opacity += 10
  780. @cursor_position = [COMMANDS_POS[0] + CURSOR_POS[0],i.y + CURSOR_POS[1]]
  781. i.x = COMMANDS_POS[0] + rand(@commands_shake_duration)
  782. else
  783. i.opacity -= 7 if i.opacity > 100
  784. i.x = COMMANDS_POS[0]
  785. end
  786. end
  787. end
  788.  
  789. #--------------------------------------------------------------------------
  790. # ● Update Flash Select
  791. #--------------------------------------------------------------------------
  792. def update_flash_select
  793. return if !CURSOR_FLASH_SELECTION
  794. @flash_select.opacity -= 8
  795. @flash_select.x = @cursor_position[0] + CURSOR_FLASH_SLECTION_POS[0]
  796. @flash_select.y = @cursor_position[1] + CURSOR_FLASH_SLECTION_POS[1]
  797. end
  798.  
  799. end
  800.  
  801. $mog_rgss3_animated_title_a = true
Advertisement
Add Comment
Please, Sign In to add comment