Advertisement
M3rein

Untitled

Mar 25th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. class NewScene
  2. def initialize
  3. $SelectedIndex = 1 if $SelectedIndex == nil
  4. @scenenum = $SelectedIndex
  5. @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
  6. @viewport.z = 99999
  7. @sprites = {}
  8.  
  9. @sprites["bg"] = IconSprite.new(0,0,@viewport)
  10. @sprites["bg"].setBitmap("Graphics/Pictures/bagbg#{@scenenum}")
  11. @sprites["bg"].opacity = 0
  12.  
  13. pbStartAnimation
  14. pbUpdate
  15. end
  16.  
  17. def msg(mesg)
  18. Kernel.pbMessage(mesg)
  19. end
  20.  
  21. def pbStartAnimation
  22. pbUpdateSpriteHash(@sprites)
  23. 16.times do
  24. Graphics.update
  25. @sprites["bg"].opacity += 16
  26. end
  27. end
  28.  
  29. def wait(frames = 1)
  30. frames.times do
  31. Graphics.update
  32. Input.update
  33. end
  34. end
  35.  
  36. def pbUpdate
  37. loop do
  38. Graphics.update
  39. Input.update
  40. if Input.trigger?(Input::B)
  41. @viewport.dispose
  42. break
  43. end
  44. if Input.trigger?(Input::RIGHT)
  45. pbMoveRight
  46. end
  47. if Input.trigger?(Input::LEFT)
  48. pbMoveLeft
  49. end
  50. end
  51. end
  52.  
  53. def pbMoveRight(amount = 1)
  54. @scenenum += amount
  55. @scenenum = 1 if @scenenum >= 9
  56. $SelectedIndex = @scenenum
  57. @sprites["bg"].setBitmap("Graphics/Pictures/bagbg#{@scenenum}")
  58. end
  59.  
  60. def pbMoveLeft(amount = 1)
  61. @scenenum -= amount
  62. @scenenum = 8 if @scenenum <= 0
  63. $SelectedIndex = @scenenum
  64. @sprites["bg"].setBitmap("Graphics/Pictures/bagbg#{@scenenum}")
  65. end
  66.  
  67. def pbMoveTo(index)
  68. @scenenum = index
  69. @scenenum = 1 if index < 1
  70. @scenenum = 8 if index > 8
  71. @sprites["bg"].setBitmap("Graphics/Pictures/bagbg#{@scenenum}")
  72. end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement