Telemetius
Tele*
- 256
- Posts
- 10
- Years
- Italy
- Seen Jan 9, 2022
Hello there, I was hoping that someone could help me with a simple scene script.
It's basically a book script entirely made of pictures, the hero will start from the first page(picture), pressing right will load the next page, pressing left will load the previous one.
The problem I'm having is that the first page shows up no problem, but pressing left or right will crash the game.
Here's the script:
It's basically a book script entirely made of pictures, the hero will start from the first page(picture), pressing right will load the next page, pressing left will load the previous one.
The problem I'm having is that the first page shows up no problem, but pressing left or right will crash the game.
Here's the script:
Code:
class Bookascene
def update
pbUpdateSpriteHash(@sprites)
end
def pbStartScene
page = 1
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["background"]=IconSprite.new(0,0,@viewport)
@sprites["background"].setBitmap("Graphics/Pictures/Book/Book template#{page}")
pbFadeInAndShow(@sprites) { update }
end
def pbMain
loop do
Graphics.update
Input.update
self.update
if Input.trigger?(Input::B)
break
elsif Input.trigger?(Input::LEFT) && page!=1
pbSEPlay("Page turn sound effect",80)
page -= 1
elsif Input.trigger?(Input::RIGHT) && page!=14
pbSEPlay("Page turn sound effect",80)
page += 1
elsif page == 14
$game_switches[131] = true
end
end
end
def pbEndScene
pbFadeOutAndHide(@sprites) { update }
pbDisposeSpriteHash(@sprites)
@viewport.dispose
Graphics.update
end
end
class Booka
def initialize(scene)
@scene=scene
end
def pbStartScreen
@scene.pbStartScene
@scene.pbMain
@scene.pbEndScene
end
end
def pbBooka
scene=Bookascene.new
screen=Booka.new(scene)
screen.pbStartScreen
end
Last edited by a moderator: