Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Menu
- def pbStartScene
- @done=false
- @index=0
- @oldindex=0
- @commands=[]
- @helptext=
- [
- "See all the Pokémon you \nhave seen and captured.",
- "Check your Pokémon party \n and view their summary.",
- "View your collection of items that you have collected on your journey.",
- "Inspect your Trainer Card, see how many badges you have and more.",
- "Save the progress of your journey.",
- "Edit your options and decide on your preferences.",
- "Exit the menu.",
- "Debug isn't here in the main game."
- ]
- @sprites={}
- @sprites["overlay"]=Sprite.new
- @sprites["overlay"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/Overlay image")
- @sprites["bg"]=Sprite.new
- @sprites["bg"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/textBG")
- @sprites["cursor"]=Sprite.new
- @sprites["cursor"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/Selected Option")
- @sprites["cursor"].x=67
- @sprites["cursor"].y=76
- @sprites["cursor"].z=1
- @sprites["text"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
- pbSetSystemFont(@sprites["text"].bitmap)
- @sprites["text"].bitmap.font.size=28
- @sprites["text"].z=2
- @sprites["helptext"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
- pbSetSystemFont(@sprites["helptext"].bitmap)
- if $Trainer.pokedex
- @commands.push("PokeDex")
- else
- @commands.push("")
- end
- if $Trainer.party.length>0
- @commands.push("Pokemon")
- else
- @commands.push("")
- end
- @commands.push("Bag")
- @commands.push("I.D.")
- @commands.push("Save")
- @commands.push("Config")
- @commands.push("Exit")
- if $DEBUG
- @commands.push("Debug")
- end
- for i in 0...@commands.length
- pbDrawShadowText(@sprites["text"].bitmap,80,76+34*i,100,30,@commands[i],Color.new(0,0,0),Color.new(190,190,170))
- end
- pbDrawShadowText(@sprites["helptext"].bitmap,200,315,275,100,@helptext[@index],Color.new(31*8,31*8,31*8),Color.new(0,0,0))
- #pbFadeInAndShow(@sprites){update}
- end
- def pbScene
- loop do
- @oldindex=@index
- Graphics.update
- Input.update
- update
- if Input.trigger?(Input::B) || @done
- break
- end
- end
- end
- def update
- if Input.trigger?(Input::UP)
- @index > 0 ? @index-=1 : @index=@commands.length-1
- @sprites["cursor"].y=76+@index*34
- @sprites["helptext"].bitmap.clear
- pbDrawShadowText(@sprites["helptext"].bitmap,200,215,275,100,@helptext[@index],Color.new(31*8,31*8,31*8),Color.new(0,0,0))
- elsif Input.trigger?(Input::DOWN)
- @index < @commands.length-1 ? @index+=1 : @index=0
- @sprites["cursor"].y=76+@index*34
- @sprites["helptext"].bitmap.clear
- pbDrawShadowText(@sprites["helptext"].bitmap,200,215,275,100,@helptext[@index],Color.new(31*8,31*8,31*8),Color.new(0,0,0))
- elsif Input.trigger?(Input::C)
- pbSEPlay("Select")
- case @commands[@index]
- when "PokeDex"
- pbFadeOutIn(99999) {
- scene=PokemonPokedexScene.new
- screen=PokemonPokedex.new(scene)
- screen.pbStartScreen
- }
- when "Pokemon"
- sscene=PokemonScreen_Scene.new
- sscreen=PokemonScreen.new(sscene,$Trainer.party)
- hiddenmove=nil
- pbFadeOutIn(99999) {
- hiddenmove=sscreen.pbPokemonScreen
- if hiddenmove
- @scene.pbEndScene
- end
- }
- if hiddenmove
- Kernel.pbUseHiddenMove(hiddenmove[0],hiddenmove[1])
- return
- end
- when "Bag"
- item=0
- scene=PokemonBag_Scene.new
- screen=PokemonBagScreen.new(scene,$PokemonBag)
- pbFadeOutIn(99999) {
- item=screen.pbStartScreen
- if item>0
- @scene.pbEndScene
- end
- }
- if item>0
- Kernel.pbUseKeyItemInField(item)
- return
- end
- when "I.D."
- scene=PokemonTrainerCardScene.new
- screen=PokemonTrainerCard.new(scene)
- pbFadeOutIn(99999) {
- screen.pbStartScreen
- }
- when "Save"
- #hide all sprites
- for sprite in @sprites
- #[0] is the sprite name, [1] is the image
- sprite[1].opacity=0
- end
- scene=PokemonSaveScene.new
- screen=PokemonSave.new(scene)
- if screen.pbSaveScreen
- @done=true
- else
- #make all sprites visible again
- for sprite in @sprites
- sprite[1].opacity=255
- end
- end
- when "Config"
- scene=PokemonOptionScene.new
- screen=PokemonOption.new(scene)
- pbFadeOutIn(99999) {
- screen.pbStartScreen
- pbUpdateSceneMap
- }
- when "Debug"
- pbFadeOutIn(99999) {
- pbDebugMenu
- }
- when "Exit"
- @done=true
- end
- end
- pbUpdateSpriteHash(@sprites)
- end
- def pbEndScene
- #pbFadeOutAndHide(@sprites){update}
- pbDisposeSpriteHash(@sprites)
- end
- end#class end
- class MenuScreen
- def initialize(scene)
- @scene=scene
- end
- def pbStartScreen
- @scene.pbStartScene
- @scene.pbScene
- @scene.pbEndScene
- end
- end#class end
Add Comment
Please, Sign In to add comment