View Single Post
  #13    
Old July 30th, 2013 (08:37 PM).
jim42's Avatar
jim42
 
Join Date: Jul 2009
Gender: Male
First you want to add parameters to the relevant methods. I've outlined these in red below. That way, you can call "pbCallPokemonSelect(a,b,c)" like you want to. Then, you want to move those three lines with the instance variables "@blahblah" into the def, "pbStartScene", as indicated in blue. From now on, if you want to access those values from any method in that class, you only need to use "@blahblah". I'll let you figure out what to do with them after that.

Oh, and as a quick side note, there are better ways of encapsulating your left/right input triggers.

Code:
def pbStartScene(starterOne,starterTwo,starterThree)
 @sprites={}
 @select=0
 @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
 @viewport.z=99999

 @sprites["bg"]=IconSprite.new(0,0,@viewport)
 @sprites["bg"].setBitmap("Graphics/Pictures/Starter_BG")

 @starterOne=starterOne
 @starterTwo=starterTwo
 @starterThree=starterThree

 pbFadeInAndShow(@sprites) { update }
end

=================

def pbStartScreen(starterOne,starterTwo,starterThree)
 @scene.pbStartScene(starterOne,starterTwo,starterThree)
 @scene.pbPokemonSelect
 @scene.pbEndScene
end

end

def pbCallPokemonSelect(starterOne,starterTwo,starterThree)
    scene=PokemonPokemonSelectScene.new
    screen=PokemonPokemonSelect.new(scene)
    screen.pbStartScreen(starterOne,starterTwo,starterThree)
end
Reply With Quote