View Single Post
  #1    
Old February 2nd, 2011 (12:39 PM).
zingzags's Avatar
zingzags zingzags is offline
PokemonGDX creator
     
    Join Date: Jan 2009
    Location: Boston
    Age: 23
    Nature: Adamant
    Posts: 562
    Well sense today is my birthday, I decided to share my first script for my pokemon game, Enjoy and give credits.

    Code:
    ################################################################################
    # CREATED BY ZINGZAGS OF POKECOMMUNITY AND PLANETDEV
    # Starter Pokemon Option Screen
    # THIS IS TO MAKE A CUSTOM STARTER CHOOSING SCENE LIKE IN ACUTAL POKEMON GAMES
    # VERSION TWO OF THE SCRIPT (FINAL)
    ################################################################################
    
    
    class SceneTable
      
      def pbUpdate
       pbUpdateSpriteHash(@sprites)
      end
     
      def pbEndScene
       pbDisposeSpriteHash(@sprites)
       @viewport.dispose
      end
      
      
      def pbStartScene
        @sprites={}
        @viewport=Viewport.new(0,0,$Graphics_widthx2, $Graphics_heightx2)
        @viewport.z=99999
        
        @sprites["bg"]=Sprite.new(@viewport)
        @sprites["bg"].bitmap = BitmapCache.load_bitmap("Graphics/Pictures/bottombger")
        @sprites["bg"].x=0
        @sprites["bg"].y=400
        @sprites["bg"].z=0
        
        @sprites["bgt"]=Sprite.new(@viewport)
        @sprites["bgt"].bitmap = BitmapCache.load_bitmap("Graphics/Pictures/touch up.png")
        @sprites["bgt"].x=0
        @sprites["bgt"].y=289
        @sprites["bgt"].z=0    
        
        @sprites["1"]=Sprite.new(@viewport)
        @sprites["1"].bitmap = BitmapCache.load_bitmap("Graphics/Pictures/pokeballC")
        @sprites["1"].x=124
        @sprites["1"].y=500
        @sprites["1"].z=1
        
        @sprites["2"]=Sprite.new(@viewport)
        @sprites["2"].bitmap = BitmapCache.load_bitmap("Graphics/Pictures/pokeballC")
        @sprites["2"].x=198
        @sprites["2"].y=500
        @sprites["2"].z=1
        
        @sprites["2"]=Sprite.new(@viewport)
        @sprites["2"].bitmap = BitmapCache.load_bitmap("Graphics/Pictures/pokeballC")
        @sprites["2"].x=272
        @sprites["2"].y=500
        @sprites["2"].z=1
        
        
       
        @sprites["overlay"]=BitmapSprite.new($Graphics_widthx2,784,@viewport)
        @sprites["overlay"].z=1
        [email protected]["overlay"].bitmap
        overlay.clear
        baseColor=Color.new(12*8,12*8,12*8)#(255,255,240)
        shadowColor=Color.new(255,255,240)#(12*8,12*8,12*8)
        pbSetSystemFont(@sprites["overlay"].bitmap)
        textPositions=[
         ["Please click on one of the pokeballs       ",420,306,true,baseColor,shadowColor],
       #   ["POKEBALL's                      ",423,146,true,baseColor,shadowColor],
         ["to choose your starting pokemon.            ",428,333,true,baseColor,shadowColor],
         ]
        pbDrawTextPositions(overlay,textPositions)
      end 
      
      def pbScene
      loop do
        Graphics.update
        Input.update
        pbUpdate
        
       #  Kernel.pbMessage(_INTL("There are three pokemon here, each one of these red ball, or PokeBall contains one Pokemon."))
        # Kernel.pbMessage(_INTL("Please choose your starting pokemon that you will journey out with."))
        
          if pbMouseInAreaLeft?(124, 500, 74, 74)
          
          pbPlayDecisionSE()
            Kernel.pbMessage(_INTL("The pokemon that is inside this pokeball is TURTWIG")) 
          if !Kernel.pbConfirmMessageSerious(
             _INTL("Are you sure you want to have TURTWIG as your starter pokemon?"))
             Kernel.pbMessage(_INTL("Please make a decision before you act next time."))
             else
              Kernel.pbAddPokemon(PBSpecies::TURTWIG,05)
              break
          
          end
        end
        
         
      if pbMouseInAreaLeft?(198, 500, 74, 74)
           
          pbPlayDecisionSE()
            Kernel.pbMessage(_INTL("The pokemon that is inside this pokeball is CHARMANDER")) 
          if !Kernel.pbConfirmMessageSerious(
             _INTL("Are you sure you want to have CHARMANDER as your starter pokemon?"))
             Kernel.pbMessage(_INTL("Please make a decision before you act next time."))
             else
              Kernel.pbAddPokemon(PBSpecies::CHARMANDER,05)
              break
      
          end
        end
        
           if pbMouseInAreaLeft?(272, 500, 74, 74)
           
          pbPlayDecisionSE()
            Kernel.pbMessage(_INTL("The pokemon that is inside this pokeball is PIPLUP")) 
          if !Kernel.pbConfirmMessageSerious(
             _INTL("Are you sure you want to have PIPLUP as your starter pokemon?"))
             Kernel.pbMessage(_INTL("Please make a decision before you act next time."))
             else
              Kernel.pbAddPokemon(PBSpecies::PIPLUP,05)
              break
        
          end
        end
      end
    end
      end
    
    class TableScreen
     def initialize(scene)
      @scene = scene
     end
     def pbStartScreen
      @scene.pbStartScene
      @scene.pbScene
      @scene.pbEndScene
     end
    end
    #
    #
    #  Here is how a script would initialize SceneMine:
    #  
    #  pbFadeOutIn(99999){
    #    scene=SceneTable.new
    #    screen=TableScreen.new(scene)
    #    screen.pbStartScreen
    #  }
    
    
    # def pbEndScene
       
      # pbFadeOutAndHide(@sprites) { pbUpdate }
       #pbDisposeSpriteHash(@sprites)
       #@viewport.dispose
     # end
    
    # Kernel.pbAddPokemon(PBSpecies::MEW,20)
    __________________
    Check out the Pokemon Game Engine I am working on:
    https://github.com/sjosegarcia/Pokemon
    Reply With Quote