Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class NewScene
- def initialize
- $SelectedIndex = 1 if $SelectedIndex == nil
- @scenenum = $SelectedIndex
- @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
- @viewport.z = 99999
- @sprites = {}
- @sprites["bg"] = IconSprite.new(0,0,@viewport)
- @sprites["bg"].setBitmap("Graphics/Pictures/bagbg#{@scenenum}")
- @sprites["bg"].opacity = 0
- pbStartAnimation
- pbUpdate
- end
- def msg(mesg)
- Kernel.pbMessage(mesg)
- end
- def pbStartAnimation
- pbUpdateSpriteHash(@sprites)
- 16.times do
- Graphics.update
- @sprites["bg"].opacity += 16
- end
- end
- def wait(frames = 1)
- frames.times do
- Graphics.update
- Input.update
- end
- end
- def pbUpdate
- loop do
- Graphics.update
- Input.update
- if Input.trigger?(Input::B)
- @viewport.dispose
- break
- end
- if Input.trigger?(Input::RIGHT)
- pbMoveRight
- end
- if Input.trigger?(Input::LEFT)
- pbMoveLeft
- end
- end
- end
- def pbMoveRight(amount = 1)
- @scenenum += amount
- @scenenum = 1 if @scenenum >= 9
- $SelectedIndex = @scenenum
- @sprites["bg"].setBitmap("Graphics/Pictures/bagbg#{@scenenum}")
- end
- def pbMoveLeft(amount = 1)
- @scenenum -= amount
- @scenenum = 8 if @scenenum <= 0
- $SelectedIndex = @scenenum
- @sprites["bg"].setBitmap("Graphics/Pictures/bagbg#{@scenenum}")
- end
- def pbMoveTo(index)
- @scenenum = index
- @scenenum = 1 if index < 1
- @scenenum = 8 if index > 8
- @sprites["bg"].setBitmap("Graphics/Pictures/bagbg#{@scenenum}")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement