Advertisement
Guest User

Animated Title MOG

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