daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. # New animation
  3. #===============================================================================
  4. class TrainerFadeAnimation < PokeBattle_Animation
  5.   def createProcesses
  6.     # NOTE: The movement speeds of trainers/bar/balls are all different.
  7.     # Move trainer sprite(s) off-screen
  8.     trainer1 = addSprite(@sprites["trainer"])
  9.     trainer1.setOrigin(0,PictureOrigin::Bottom)
  10.     trainer1.moveDelta(0,16,Graphics.width/2,0)
  11.     if @sprites["trainer2"]
  12.       trainer2 = addSprite(@sprites["trainer2"])
  13.       trainer2.setOrigin(0,PictureOrigin::Bottom)
  14.       trainer2.moveDelta(0,16,Graphics.width/2,0)
  15.     end
  16.     # Move and fade party bar/balls
  17.     delay = 3
  18.     partyBar = addSprite(@sprites["partybar1"])
  19.     partyBar.moveDelta(delay,16,Graphics.width/4,0)
  20.     partyBar.moveOpacity(delay,12,0)
  21.     for i in 0...6
  22.       next if !@sprites["partyball1_#{i}"]
  23.       partyBall = addSprite(@sprites["partyball1_#{i}"])
  24.       partyBall.moveDelta(delay+2*i,16,Graphics.width,0)
  25.       partyBall.moveOpacity(delay,12,0)
  26.     end
  27.   end
  28. end
  29.  
  30.  
  31.  
  32. #===============================================================================
  33. # Old animation
  34. #===============================================================================
  35. class TrainerFadeAnimation
  36.   def initialize(sprites)
  37.     @frame    = 0
  38.     @sprites  = sprites
  39.     @animdone = false
  40.   end
  41.  
  42.   def animdone?; return @animdone; end
  43.  
  44.   def update
  45.     return if @animdone
  46.     @frame += 1
  47.     @sprites["trainer"].x += 8
  48.     @sprites["trainer2"].x += 8 if @sprites["trainer2"]
  49.     @sprites["partybar1"].x       += 8
  50.     @sprites["partybar1"].opacity -= 12
  51.     for i in 0...6
  52.       @sprites["partyball1_#{i}"].opacity -= 12
  53.       @sprites["partyball1_#{i}"].x       += 8 if @frame>=i*4
  54.     end
  55.     if @sprites["trainer"].x-@sprites["trainer"].ox>=Graphics.width &&
  56.        (!@sprites["trainer2"] || @sprites["trainer2"].x-@sprites["trainer2"].ox>=Graphics.width)
  57.       @animdone = true
  58.     end
  59.   end
  60. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top