IceDragon200

Untitled

Sep 10th, 2011
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.38 KB | None | 0 0
  1. #---------------------------------------------------------------------------#
  2. #                                                                           #
  3. #                ====           =====              ======                   #
  4. #                =======        ==  ===          ===                        #
  5. #                ==    ===      ==    ===        ===                        #
  6. #                ==     ===     ==      ===     ==                          #
  7. #                ==     ===     ==    ===         ===                       #
  8. #                ==    ===      ==  ===             ===                     #
  9. #                ==   ===       ========               ===                  #
  10. #                ======         ==     ===              ==                  #
  11. #                ==             ==      ===             ==                  #
  12. #                ==             ==        ==          ===                   #
  13. #                ==             ==      ===         ===                     #
  14. #                ==             ==    ===         ===                       #
  15. #                ==             ======          ==                          #
  16. #                                                                           #
  17. #---------------------------------------------------------------------------#
  18.  
  19. #---------------------------------------------------------------------------#
  20. #                                                                           #
  21. #                      *      Spriteset: Battle      *                      #
  22. #                                                                           #
  23. #          Remakes the sprites for the battlebackground and enemies         #
  24. #---------------------------------------------------------------------------#
  25.  
  26. class Spriteset_Battle
  27.  
  28.   #--------------------------------------------------------------------------
  29.   # * Object Initialization
  30.   #--------------------------------------------------------------------------
  31.   def initialize
  32.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  33.       create_actorback
  34.       create_actorfloor
  35.     end
  36.     create_viewports
  37.     create_battlefloor
  38.     create_enemyfloor
  39.     create_enemies
  40.     create_actors
  41.     create_pictures
  42.     create_timer
  43.     update
  44.   end
  45.  
  46.   #--------------------------------------------------------------------------
  47.   # * Dispose
  48.   #--------------------------------------------------------------------------
  49.   def dispose
  50.     dispose_actorback
  51.     dispose_actorfloor
  52.     dispose_enemyfloor
  53.     dispose_battlefloor
  54.     dispose_enemies
  55.     dispose_actors
  56.     dispose_pictures
  57.     dispose_timer
  58.     dispose_viewports
  59.   end
  60.  
  61.   #--------------------------------------------------------------------------
  62.   # * Frame Update
  63.   #--------------------------------------------------------------------------
  64.   def update
  65.     update_battleback
  66.     update_battlefloor
  67.     update_enemies
  68.     update_actors
  69.     update_pictures
  70.     update_timer
  71.     update_viewports
  72.     update_actorback
  73.   end
  74.  
  75.   #--------------------------------------------------------------------------
  76.   # * Update Battleback
  77.   #--------------------------------------------------------------------------
  78.   def update_battleback
  79.     @battlefloor_sprite.update
  80.   end
  81.  
  82.   #--------------------------------------------------------------------------
  83.   # EnemyFloor Sprite
  84.   #--------------------------------------------------------------------------
  85.   def create_enemyfloor
  86.     @enemyfloor_sprite = Sprite.new(@viewport1)
  87.     @enemyfloor_sprite.bitmap = PBS::Cache.system(PBS::Cache::ENEMYBACKGROUND)
  88.     @enemyfloor_sprite.x = -PBS::Cache.system(PBS::Cache::ENEMYBACKGROUND).width
  89.     @enemyfloor_sprite.y = 110
  90.     @enemyfloor_sprite.z = 1
  91.     @enemyfloor_sprite.opacity = 255
  92.   end
  93.  
  94.   def update_enemyfloor
  95.     @enemyfloor_sprite.update
  96.   end
  97.  
  98.   def dispose_enemyfloor
  99.     @enemyfloor_sprite.bitmap.dispose unless @enemyfloor_sprite.bitmap.disposed?()
  100.     @enemyfloor_sprite.dispose unless @enemyfloor_sprite.disposed?()
  101.   end
  102.  
  103.   #--------------------------------------------------------------------------
  104.   # Battleback Sprite
  105.   #--------------------------------------------------------------------------
  106.   def create_battlefloor
  107.     @battlefloor_sprite = Sprite.new(@viewport1)
  108.     @battlefloor_sprite.bitmap = PBS::Cache.system(PBS::Cache::BATTLEBACKGROUND)
  109.     @battlefloor_sprite.x = 0
  110.     @battlefloor_sprite.y = 0
  111.     @battlefloor_sprite.z = 0
  112.     @battlefloor_sprite.opacity = 255
  113.   end
  114.  
  115.   def dispose_battleback
  116.     @battlefloor_sprite.bitmap.dispose unless @battlefloor_sprite.bitmap.disposed?()
  117.     @battlefloor_sprite.dispose unless @battlefloor_sprite.disposed?()
  118.   end
  119.  
  120.   #--------------------------------------------------------------------------
  121.   # * Create Enemy Sprite
  122.   #--------------------------------------------------------------------------
  123.  
  124.   def create_enemies
  125.     @enemy_sprites = []
  126.     for enemy in $game_troop.members.reverse
  127.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  128.     end
  129.   end
  130.  
  131.   #--------------------------------------------------------------------------
  132.   # ActorFloor Sprite
  133.   #--------------------------------------------------------------------------
  134.   def create_actorfloor
  135.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  136.       @actorfloor_sprite = Sprite.new(@viewport1)
  137.       @actorfloor_sprite.bitmap = PBS::Cache.system(PBS::Cache::ACTORBACKGROUND)
  138.       @actorfloor_sprite.x = PBS::Cache.system(PBS::Cache::ACTORBACKGROUND).width
  139.       @actorfloor_sprite.y = 190
  140.       @actorfloor_sprite.z = 1
  141.       @actorfloor_sprite.opacity = 255
  142.      end
  143.     end
  144.  
  145.   def update_actorfloor
  146.     @actorfloor_sprite.update unless @actorfloor_sprite.nil?()
  147.   end
  148.  
  149.   def dispose_actorfloor
  150.     @actorfloor_sprite.dispose unless @actorfloor_sprite.nil?()
  151.   end
  152.  
  153.   def actorfloor_actor_hit_s
  154.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  155.       @actorfloor_sprite.x -=8
  156.       $scene.wait(2)
  157.     end
  158.   end
  159.  
  160.   def actorfloor_actor_hit_e
  161.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  162.       $scene.wait(2)
  163.       @actorfloor_sprite.x +=8
  164.     end
  165.   end
  166.  
  167.   #--------------------------------------------------------------------------
  168.   # * Actor Back Sprite
  169.   #--------------------------------------------------------------------------
  170.   def create_actorback
  171.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  172.       @actorback_sprite = Sprite.new(@viewport1)
  173.       @actorback_sprite.bitmap = PBS::Cache.actorbacks($game_party.members[1].id.to_s)
  174.       @actorback_sprite.x = 20
  175.       @actorback_sprite.y  = 140
  176.       @actorback_sprite.z = 2
  177.       @actorback_sprite.visible = false
  178.     end
  179.   end
  180.  
  181.   def update_actorback
  182.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  183.       @actorback_sprite.update
  184.     end
  185.   end
  186.  
  187.   def dispose_actorback
  188.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  189.       @actorback_sprite.dispose
  190.     end
  191.   end
  192.  
  193.  def actor_back_attack_s
  194.    if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  195.     @actorback_sprite.x += 3
  196.     $scene.wait(2)
  197.    end
  198.   end
  199.  
  200.   def actor_back_attack_e
  201.   if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  202.     $scene.wait(2)
  203.     @actorback_sprite.x -= 3
  204.   end
  205.  end
  206.  
  207.  def actor_back_damage_s
  208.   if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  209.    @actorback_sprite.x -= 8
  210.    $scene.wait(2)
  211.   end
  212.  end
  213.  
  214.   def actor_back_damage_e
  215.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  216.       $scene.wait(2)
  217.       @actorback_sprite.x += 8
  218.     end
  219.   end
  220.    
  221.  
  222.   #--------------------------------------------------------------------------
  223.   # * Slide In
  224.   #--------------------------------------------------------------------------
  225.  
  226.   def slide_in
  227.   if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  228.     @actorback_sprite.visible = true
  229.   end
  230.     $game_troop.members.each { |enemy| enemy.screen_x -= 295 }
  231.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  232.       $game_party.members.each { |actor| @actorback_sprite.x += 295 }
  233.     end
  234.     30.times { |i|
  235.     $game_troop.members.each { |enemy| enemy.screen_x += 10}
  236.     if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  237.       $game_party.members.each { |actor| @actorback_sprite.x -= 10}
  238.       update_actorback
  239.     end
  240.     update_enemies
  241.     if i <= 30
  242.       @enemyfloor_sprite.x += 14 # 10
  243.       if $game_switches[BATTLE_CONFIG::ACTOR_BACK_SWITCH_ID]
  244.         @actorfloor_sprite.x -= 9 # 10
  245.         update_actorfloor
  246.       end
  247.       update_enemyfloor
  248.     end
  249.     $scene.update_basic
  250.     }
  251.   end
  252.  
  253. end
  254.  
  255. class Sprite_Battler
  256.   def setup_new_effect
  257.     if @battler.animation_id != 0
  258.       animation = $data_animations[@battler.animation_id]
  259.       mirror = @battler.animation_mirror
  260.       start_animation(animation, mirror)
  261.       @battler.animation_id = 0
  262.     end
  263.   end
  264. end
  265.   #--------------------------------------------------------------------------
  266.   # * Start Animation
  267.   #--------------------------------------------------------------------------
  268.  
  269. #---------------------------------------------------------------------------#
  270. # END /:/  END /:/ END /:/ END /:/ END /:/ END /:/ END /:/ END /:/ END /:/  #
  271. # END /:/ END /:/ END /:/ END /:/ END /:/ END /:/ END /:/ END /:/ END /:/   #
  272. #---------------------------------------------------------------------------#
Advertisement
Add Comment
Please, Sign In to add comment