View Single Post
  #1    
Old September 12th, 2012 (12:00 AM).
jim42's Avatar
jim42 jim42 is offline
 
Join Date: Jul 2009
Gender: Male
Posts: 185
Hey guys,
I've been working on a starter selection screen for my game, and for the most part I have it working, with all the accompanying graphics and whatnot. Granted it's not the fanciest looking thing, but it does its job well enough. I just have a few things I need to address in order to continue working on it.

First up: at present, I've been hardcoding the starter Pokemon and their respective data, images etc into the script. I know I should really be using the @pokemon thing, and getting the names, types and number out of that, but I don't understand how it works, and I couldn't find like a def thing that describes how it operates or how to set it to a particular Pokemon. Oh, and at the completion of the screen, it should add the selected Pokemon to the party. Would someone please elaborate upon this function?

Secondly, I have some questions about message and choice windows. I was wondering if it was possible to display a smaller window, one line high, at the bottom of the screen, and containing text defined in the script. In addition, this window should have attached a choice window thingy with the yes and no thing, ensuring it aligns with the newer sized window. I've included an attachment to illustrate what I mean.

In addition, I've also included my current code. It's a bit messy, unfinished, and will be cleaned up in due time. Here it is:
Spoiler:
Code:
#==============================================================================#
# This is a script to display and handle a starter selection scene. It         #
# displays three Pokeballs, their corresponding Pokemon, and their basic data. #
# The player may use the arrow keys to select a Pokemon, and the C input to    #
# confirm their selection.                                                     #
#==============================================================================#
# Copyright Aaron J Richards, not to be used with the exception of testing for 
answers to my questions                     #
#==============================================================================#



class PokemonStarterSelectionScene
  def update
    pbUpdateSpriteHash(@sprites)
  end
  
  def pbStartScene
    @sprites={}
    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=99999
    addBackgroundPlane(@sprites,"bg","starterbg",@viewport)
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    pbSetSystemFont(@sprites["overlay"].bitmap)
    pbDrawStarterSelection
    pbFadeInAndShow(@sprites) { update }
  end
  
  def pbDrawStarterSelection
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    shadowColor=Color.new(72,72,72)
    baseColor=Color.new(185,185,185)
    textPositions=[]
    textPositions.push([_INTL("Which Pokémon would you like?"),108,330,0,
                       baseColor,shadowColor])
    textPositions.push([_INTL("WWWWWWWWWW"),35,240,0,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Electric"),477,204,1,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Fighting"),477,240,1,
                       baseColor,shadowColor])
    textPositions.push([_INTL("Type"),477,276,1,
                       baseColor,shadowColor])
    #textPositions.push([pokename,35,220,0,
    #                   baseColor,shadowColor])
    #textPositions.push([_INTL("{1} Type",@pokemon.type1),477,220,1,
    #                   baseColor,shadowColor])
    pbDrawTextPositions(overlay,textPositions)
    
    imagePositions=[]
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",9,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",25,25,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",178,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",194,25,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBallShadow",347,105,0,0,-1,-1])
    imagePositions.push(["Graphics/Pictures/StarterBall",363,25,0,0,-1,-1])
    if $game_variables[26]==1
      imagePositions.push(["Graphics/Pictures/StarterSelector",25,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/252",176,165,0,0,-1,-1])
    elsif $game_variables[26]==2
      imagePositions.push(["Graphics/Pictures/StarterSelector",194,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/255",176,165,0,0,-1,-1])
    elsif $game_variables[26]==3
      imagePositions.push(["Graphics/Pictures/StarterSelector",363,25,0,0,-1,-1])
      imagePositions.push(["Graphics/Battlers/258",176,165,0,0,-1,-1])
    end
    pbDrawImagePositions(overlay,imagePositions)
  end
  
  def pbStarterSelection
    loop do
      Graphics.update
      Input.update
      self.update
      if Input.trigger?(Input::LEFT)
        $game_variables[26]-=1
        if $game_variables[26]<1
          $game_variables[26]+=3
        end            
        pbPlayCursorSE()
        pbDrawStarterSelection
      elsif Input.trigger?(Input::RIGHT) 
        $game_variables[26]+=1
        if $game_variables[26]>3
          $game_variables[26]-=3
        end
        pbPlayCursorSE()
        pbDrawStarterSelection
      elsif Input.trigger?(Input::C)
        if $game_variables[26]==1
          #Sure?
          break
        elsif $game_variables[26]==2
          #Sure?
          break
        elsif $game_variables[26]==3
          #Sure?
          break
        end
      end       
    end 
  end
  
  def pbEndScene
    pbFadeOutAndHide(@sprites) { update }
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
  end
end

class PokemonStarterSelection
  def initialize(scene)
    @scene=scene
  end

  def pbStartScreen
    @scene.pbStartScene
    @scene.pbStarterSelection
    @scene.pbEndScene
  end
end
  
def pbShowStarterSelection
  pbFadeOutIn(99999) {
     scene=PokemonStarterSelectionScene.new
     screen=PokemonStarterSelection.new(scene)
     screen.pbStartScreen
  }
end

I also intend on somehow adding parameters to the script call such that the user can define their own starters without having to modify the code, but I'll get to that one I have to regular script working. Thanks in advance for any help, guys.
Cheers, Jim
Attached Thumbnails
demonstration.png‎  
Reply With Quote