Hola compañeros de Taringa. Hoy les vengo a enseñar como crear un script para el Pokémon Essentials de RPG Maker XP.
Tomo 1: Menú táctil V2.5
Introducción
Hoy veremos, como crear un menú
Aquí imágenes de como quedara maso menos [Aun esta incompleto]
Se llama V2.5 por el script de input, y porque lo de el menú lo he perfeccionado 2 veces, y estoy en la tercera a la mitad de desarrollo.
Desarrollo
Primero que nada, necesitaremos crear 1 script y editar otro:
Primero crean un script llamado Input abajo de RGSS2Compatibility
[/spoiler]input dijo:
[color=#000000]# Mouse and Input
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
module Mouse
#--------------------------------------------------------------------------
# * Variable Setup
#--------------------------------------------------------------------------
gsm = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
[email protected] _pos = Win32API.new('user32', 'GetCursorPos', 'p', 'i')
module_function
#--------------------------------------------------------------------------
# * Mouse Global Position
#--------------------------------------------------------------------------
def mouse_global_pos
pos = [0, 0].pack('ll')
[email protected] _pos.call(pos) != 0
return pos.unpack('ll')
else
return nil
end
end
#--------------------------------------------------------------------------
# * Mouse Position
#--------------------------------------------------------------------------
def mouse_pos(catch_anywhere = false)
x, y = screen_to_client(*getMouseGlobalPos)
width, height = Win32API.client_size
if Input.Anykey == false
if catch_anywhere or (x >= 0 and y >= 0 and x < width and y < height)
return (x/$ResizeFactor).to_i, (y/$ResizeFactor).to_i
else
[email protected] , [email protected] #nil
end
else
return (x/$ResizeFactor).to_i, (y/$ResizeFactor).to_i
end
end
#--------------------------------------------------------------------------
# * Delete
#--------------------------------------------------------------------------
# def del
[email protected] == nil
# return
# else
[email protected] (handel ,-12, [email protected] )
[email protected] = nil
# end
# end
end
#--------------------------------------------------------------------------
# * Variable Setup
#--------------------------------------------------------------------------
$scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i')
$client_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
$readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
$findwindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
#--------------------------------------------------------------------------
# * Screen to Client
#--------------------------------------------------------------------------
def screen_to_client(x, y)
return nil unless x and y
pos = [x, y].pack('ll')
if $scr2cli.call(hwnd, pos) != 0
return pos.unpack('ll')
else
return nil
end
end
#--------------------------------------------------------------------------
# * H Windowed
#--------------------------------------------------------------------------
def hwnd
game_name = "" * 256
$readini.call('Game','Title','',game_name,255,".Game.ini")
game_name.delete!("")
return $findwindow.call('RGSS Player',nil)
end
#--------------------------------------------------------------------------
# * Client Size
#--------------------------------------------------------------------------
def client_size
rect = [0, 0, 0, 0].pack('l4')
$client_rect.call(hwnd, rect)
right, bottom = rect.unpack('l4')[2..3]
return right, bottom
end
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
cursor = Win32API.new("user32", "ShowCursor", "i", "i" )
cursor.call(0)
class Game_Mouse
#--------------------------------------------------------------------------
# * Attributes
#--------------------------------------------------------------------------
attr_accessor :icon
attr_accessor :x
attr_accessor :y
#--------------------------------------------------------------------------
# * Starts up the class, and creates the cursor icon
#--------------------------------------------------------------------------
def initialize
[email protected] = 0
[email protected] = 0
[email protected] = RPG::Cache.picture("mouse")
[email protected] = Sprite.new
[email protected] [email protected]
[email protected] = 9999999
[email protected] = false
[email protected] < 384
[email protected] = 255
else
[email protected] = 255
end
end
#--------------------------------------------------------------------------
# * Reset
#--------------------------------------------------------------------------
def reset
[email protected] = RPG::Cache.picture("mouse")
[email protected] @mouse.bitmap != nil
[email protected] = Sprite.new
[email protected] [email protected]
[email protected] = false
# Updates the co-ordinates of the icon
[email protected] , [email protected] = Mouse.mouse_pos
[email protected] [email protected]
[email protected] [email protected]
[email protected] = 9999999
[email protected] < 384
[email protected] = 255
else
[email protected] = 255
end
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# Updates the co-ordinates of the icon
[email protected] [email protected] # prevent the F2 bug
[email protected] [email protected] # prevent the F2 bug
[email protected] , [email protected] = Mouse.mouse_pos
[email protected] [email protected] [email protected] ==nil # prevent the F2 bug
[email protected] [email protected] [email protected] ==nil # Prevent the F2 Bug
[email protected] [email protected]
[email protected] [email protected]
[email protected] < 384
[email protected] = 255
else
[email protected] = 255
end
self.reset
if $scene.kind_of? Scene_Map
end
end
#--------------------------------------------------------------------------
# * Returns the current y-coordinate of the tile the mouse is over on the map
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Makes the mouse sprite disappear
#--------------------------------------------------------------------------
def invisible
[email protected] = 0
#Win32API.new('user32', 'ShowCursor', 'l', 'l').call(1)
end
#--------------------------------------------------------------------------
# * Makes the mouse sprite visible
#--------------------------------------------------------------------------
def visible
[email protected] = 255
#Win32API.new('user32', 'ShowCursor', 'l', 'l').call(0)
end
#--------------------------------------------------------------------------
# * Disposes the sprite
#--------------------------------------------------------------------------
def dispose
[email protected]
end
end
#-------------------------------------------------------------------------------
# End SDK Enabled Check
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Modified by Rafael-animal
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
module Input
#--------------------------------------------------------------------------
# * Variable Setup
#--------------------------------------------------------------------------
[email protected] = []
[email protected] = []
Mouse_Left = 1
Mouse_Right = 2
Mouse_Middle = 4
Back= 8
Tab = 9
Enter = 13
Shift = 16
Ctrl = 17
Alt = 18
X = 0x1B
LT = 0x25
UPs = 0x26
RT = 0x27
DN = 0x28
Space = 32
Numberpad = {}
Numberpad[0] = 45
Numberpad[1] = 35
Numberpad[2] = 40
Numberpad[3] = 34
Numberpad[4] = 37
Numberpad[5] = 12
Numberpad[6] = 39
Numberpad[7] = 36
Numberpad[8] = 38
Numberpad[9] = 33
Equ={} # Shift Value for num US
Equ[0]=')' # FR: à
Equ[1]='!' # FR: &
Equ[2]='@' # FR: é
Equ[3]='#' # FR: "
Equ[4]='$' # FR: '
Equ[5]='%' # FR: (
Equ[6]='^' # FR: -
Equ[7]='&' # FR: è
Equ[8]='*' # FR: _
Equ[9]='(' # FR: ç
Carac = {}
Carac[0] = 48 # => 0
Carac[1] = 49 # => 1
Carac[2] = 50 # => 2
Carac[3] = 51 # => 3
Carac[4] = 52 # => 4
Carac[5] = 53 # => 5
Carac[6] = 54 # => 6
Carac[7] = 55 # => 7
Carac[8] = 56 # => 8
Carac[9] = 57 # => 9
Carac["A"] = 65
Carac["B"] = 66
Carac["C"] = 67
Carac["D"] = 68
Carac["E"] = 69
Carac["F"] = 70
Carac["G"] = 71
Carac["H"] = 72
Carac["I"] = 73
Carac["J"] = 74
Carac["K"] = 75
Carac["L"] = 76
Carac["M"] = 77
Carac["N"] = 78
Carac["O"] = 79
Carac["P"] = 80
Carac["Q"] = 81
Carac["R"] = 82
Carac["S"] = 83
Carac["T"] = 84
Carac["U"] = 85
Carac["V"] = 86
Carac["W"] = 87
Carac["X"] = 88
Carac["Y"] = 89
Carac["Z"] = 90
Fkeys = {}
Fkeys[1] = 112
Fkeys[2] = 113
Fkeys[3] = 114
Fkeys[4] = 115
Fkeys[5] = 116
Fkeys[6] = 117
Fkeys[7] = 118
Fkeys[8] = 119
Fkeys[9] = 120
Fkeys[10] = 121
Fkeys[11] = 122
#Fkeys[12] = 123
Collon = 186 # US: ;:
Equal = 187 # US: =+ FR: =+
Comma = 188 # US: ,< FR: ,?
Underscore = 189 # US: -_
Dot = 190 # US: .> FR: ;.
Backslash = 191 # US: /? FR: :/
Quote = 222 # US: '" FR: ²
Lb = 219 # US: [{ FR: )°
Rb = 221 # US: ]} FR: ^¨
E2 = 226 # FR: <>
DC = 220 # US: | FR: *µ
DF = 223 # FR: !§
C0 = 192 # US: `~ FR: ù%
Test = Carac.values+Numberpad.values+Fkeys.values
State = Win32API.new('user32','GetKeyState',['i'],'i')
Key = Win32API.new('user32','GetAsyncKeyState',['i'],'i')
#-------------------------------------------------------------------------------
USED_KEYS = [Mouse_Left, Mouse_Right, Mouse_Middle]
#-------------------------------------------------------------------------------
module_function
#--------------------------------------------------------------------------
def Input.getstate(key)
return true unless State.call(key).between?(0, 1)
return false
end
#--------------------------------------------------------------------------
def Input.testkey(key)
Win32API.new('user32','GetAsyncKeyState',['i'],'i').call(key) & 1==1
end
#--------------------------------------------------------------------------
def Input.update
[email protected] = []
[email protected] = []
for key in Test
[email protected] (key) if testkey(key)
[email protected] (key) if getstate(key)
end
[email protected] (Back) if testkey(Back)
[email protected] (Tab) if testkey(Tab)
[email protected] (Enter) if testkey(Enter)
[email protected] (Shift) if testkey(Shift)
[email protected] (Ctrl) if testkey(Ctrl)
[email protected] (Alt) if testkey(Alt)
[email protected] (Esc) if testkey(Esc)
[email protected] (Collon) if testkey(Collon)
[email protected] (Equal) if testkey(Equal)
[email protected] (Comma) if testkey(Comma)
[email protected] (Underscore) if testkey(Underscore)
[email protected] (Dot) if testkey(Dot)
[email protected] (Backslash) if testkey(Backslash)
[email protected] (Lb) if testkey(Lb)
[email protected] (Rb) if testkey(Rb)
[email protected] (E2) if testkey(E2)
[email protected] (DF) if testkey(DF)
[email protected] (C0) if testkey(C0)
[email protected] (DC) if testkey(DC)
[email protected] (Quote) if testkey(Quote)
[email protected] (Space) if testkey(Space)
[email protected] (LT) if testkey(LT)
[email protected] (UPs) if testkey(UPs)
[email protected] (RT) if testkey(RT)
[email protected] (DN) if testkey(DN)
[email protected] (Space) if getstate(Space)
[email protected] (Back) if getstate(Back)
[email protected] (Tab) if getstate(Tab)
[email protected] (Enter) if getstate(Enter)
[email protected] (Shift) if getstate(Shift)
[email protected] (Ctrl) if getstate(Ctrl)
[email protected] (Alt) if getstate(Alt)
[email protected] (Esc) if getstate(Esc)
[email protected] (LT) if getstate(LT)
[email protected] (UPs) if getstate(UPs)
[email protected] (RT) if getstate(RT)
[email protected] (DN) if getstate(DN)
@pressed.push(Collon) if getstate(Collon)
@pressed.push(Equal) if getstate(Equal)
@pressed.push(Comma) if getstate(Comma)
@pressed.push(Underscore) if getstate(Underscore)
@pressed.push(Dot) if getstate(Dot)
@pressed.push(Backslash) if getstate(Backslash)
@pressed.push(Lb) if getstate(Lb)
@pressed.push(Rb) if getstate(Rb)
@pressed.push(E2) if getstate(E2)
@pressed.push(DF) if getstate(DF)
@pressed.push(C0) if getstate(C0)
@pressed.push(DC) if getstate(DC)
@pressed.push(Quote) if getstate(Quote)
end
#--------------------------------------------------------------------------
def Input.triggerd?(key)
return true if @keys.include?(key)
return false
end
#--------------------------------------------------------------------------
def Input.pressed?(key)
return true if @pressed.include?(key)
return false
end
#--------------------------------------------------------------------------
# * 4 Diraction
#--------------------------------------------------------------------------
def Input.dir4
return 2 if pressed?(DN)
return 4 if pressed?(LT)
return 6 if pressed?(RT)
return 8 if pressed?(UPs)
return 0
end
#--------------------------------------------------------------------------
# * Trigger (key)
#--------------------------------------------------------------------------
def trigger?(key)
keys = []
case key
when Input::DOWN
keys.push(DN)
when Input::UP
keys.push(UPs)
when Input::LEFT
keys.push(LT)
when Input::RIGHT
keys.push(RT)
when Input::C
keys.push(Space, Enter)
when Input::B
keys.push(X, Numberpad[0])
when Input::X
keys.push(Carac["A"])
when Input::L
keys.push(Carac["Q"])
when Input::R
keys.push(Carac["W"])
when Input::Y
keys.push(Carac["R"])
when Input::F5
keys.push(Fkeys[5])
when Input::F6
keys.push(Fkeys[6])
when Input::F7
keys.push(Fkeys[7])
when Input::F8
keys.push(Fkeys[8])
when Input::F9
keys.push(Fkeys[9])
when Input::SHIFT
keys.push(Shift)
when Input::CTRL
keys.push(Ctrl)
when Input::ALT
keys.push(Alt)
else
keys.push(key)
end
for k in keys
if triggerd?(k)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Repeat (key)
#--------------------------------------------------------------------------
def repeat?(key)
keys = []
case key
when Input::DOWN
keys.push(DN)
when Input::UP
keys.push(UPs)
when Input::LEFT
keys.push(LT)
when Input::RIGHT
keys.push(RT)
when Input::C
keys.push(Space, Enter)
when Input::B
keys.push(X, Numberpad[0])
when Input::X
keys.push(Carac["A"])
when Input::L
keys.push(Carac["Q"])
when Input::R
keys.push(Carac["W"])
when Input::Y
keys.push(Carac["R"])
when Input::F5
keys.push(Fkeys[5])
when Input::F6
keys.push(Fkeys[6])
when Input::F7
keys.push(Fkeys[7])
when Input::F8
keys.push(Fkeys[8])
when Input::F9
keys.push(Fkeys[9])
when Input::SHIFT
keys.push(Shift)
when Input::CTRL
keys.push(Ctrl)
when Input::ALT
keys.push(Alt)
else
keys.push(key)
end
for k in keys
if Input.triggerd?(k)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Check (key)
#--------------------------------------------------------------------------
def check(key)
Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(key) & 0x01 == 1 # key 0
end
#--------------------------------------------------------------------------
# * Mouse Update
#--------------------------------------------------------------------------
def mouse_update
@used_i = []
for i in USED_KEYS
x = check(i)
if x == true
@used_i.push(i)
end
end
end
#--------------------------------------------------------------------------
# * Mouse Triggered ? (key)
#--------------------------------------------------------------------------
def trigger(key)
return @used_i.include?(key)
end
#--------------------------------------------------------------------------
# * Mouse Pressed ? (key)
#--------------------------------------------------------------------------
def pressed(key)
return true unless Win32API.new("user32","GetKeyState",['i'],'i').call(key).between?(0, 1)
return false
end
#--------------------------------------------------------------------------
# * Short Write C
#--------------------------------------------------------------------------
def Input.C
triggerd?(Space) or triggerd?(Enter)
end
#--------------------------------------------------------------------------
# * Short Write B
#--------------------------------------------------------------------------
def Input.B
triggerd?(X) or triggerd?(Numberpad[0])
end
#--------------------------------------------------------------------------
# * Short Write A
#--------------------------------------------------------------------------
def Input.A
trigger?(Input::A)
end
#--------------------------------------------------------------------------
# * Short Write Down
#--------------------------------------------------------------------------
def Input.Down
triggerd?(DN)
end
#--------------------------------------------------------------------------
# * Short Write Up
#--------------------------------------------------------------------------
def Input.Up
triggerd?(UPs)
end
#--------------------------------------------------------------------------
# * Short Write Right
#--------------------------------------------------------------------------
def Input.Right
triggerd?(RT)
end
#--------------------------------------------------------------------------
# * Short Write Left
#--------------------------------------------------------------------------
def Input.Left
triggerd?(LT)
end
#--------------------------------------------------------------------------
# * Anykey pressed? ( A or B or C or Down or Up or Right or Left )
#--------------------------------------------------------------------------
def Input.Anykey
if A or B or C or Down or Up or Right or Left
return true
else
return false
end
end
end
#-------------------------------------------------------------------------------
# End SDK Enabled Check
#-------------------------------------------------------------------------------
def pbMouseClickImage?(image)
if $mouse.x >= image.x && $mouse.x <= (image.x + image.bitmap.width) and $mouse.y >= image.y && $mouse.y <= (image.y + image.bitmap.height) && Input.pressed(Input::Mouse_Left)
return true
else
return false
end
end
def pbMouseClick?(x,y,w,h)
if $mouse.x >= x && $mouse.x <= (x + w) and $mouse.y >= y && $mouse.y <= (y + h) && Input.pressed(Input::Mouse_Left)
return true
else
return false
end
end
[/color]
NOTA: Se necesita una imagen llamada Cursor.png en la carpeta pictures.
Ya hecho esto, editamos el script Main, antes de
[color=#000000] $scene = pbCallTitle[/color]
main dijo:
[color=#000000] $mouse = Game_Mouse.new
$mouse.visible[/color]
Ya que tenemos esto, eliminamos el script PokemonPauseMenu, y creamos un nuevo script con el nombre que quieran, en mi caso, este se llamara PokemonTouchMenu, y empezamos con la clase. La clase es lo que distingue el script de los demás. Pueden usar el Class que viene por defecto:
[color=#000000]class PokemonMenu_Scene[/color]
Yo usare un class nuevo, le llamare Scene_Map
Ahora deben agregar un codigo para que el touch no afecte el mapa, y sean solo los botones:
[color=#000000] def createSpritesets
@spritesets={}
for map in $MapFactory.maps
@spritesets[map.map_id]=Spriteset_Map.new(map)
end
$MapFactory.setSceneStarted(self)
updateSpritesets
menu
end
def disposeSpritesets
return if !@spritesets
for i in @spritesets.keys
if @spritesets[i]
@spritesets[i].dispose
@spritesets[i]=nil
end
end
@spritesets.clear
@spritesets={}
pbDisposeSpriteHash(@sprites)
end[/color]
Y ahora empezamos lo bueno, el script en si.
[color=#000000] def main
createSpritesets
Graphics.transition
loop do
$mouse.visible
$mouse.update
Graphics.update
Input.update
update
if $Trainer
menutactil if $game_map.map_id != X [/color]
Ese de arriba sirve para que no aparezca en el mapa de la intro, cambien X por el ID del mapa de introducción, en mi caso es el 51
Ahora agregaremos el código que define si tenemos la Pokedex o no, y si si la tenemos muestra los graficos:
[color=#000000]if $Trainer.pokedex
if !@sprites["X"]
@sprites["X"] = Sprite.new(@viewport)
@sprites["X"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/Y")
@sprites["X"].x=B
@sprites["X"].y=A
@sprites["overlay"]=BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["overlay"].z = 9999
overlay= @sprites["overlay"].bitmap
overlay.clear
baseColor=Color.new(255, 255, 255)
shadowColor=Color.new(156,156,156)
pbSetSystemFont(@sprites["overlay"].bitmap)
end
end[/color]
Cambiamos X por el nombre que queremos que tenga, en mi caso, sera menupokedex [RECUERDEN NO USAR MAYUSCULAS NI ESPACIOS], cambiamos Y por el nombre de la imagen que tendremos en la carpeta pictures, en mi caso es llamada menupokedex, y por ultimo, A y B es la ubicación de la imagen según un plano cartesiano, en mi caso, la resolución del juego es 584 de X y 700 de Y, y como uso media pantalla para touch, todos mis scripts tendrán más de 350 en y.
Ahora, hacemos un proceso muy similar
[color=#000000]if $Trainer.party.length>0
if !@sprites["X"]
@sprites["X"] = Sprite.new(@viewport)
@sprites["X"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/Y")
@sprites["X"].x=B
@sprites["X"].y=A
@sprites["overlay"]=BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["overlay"].z = 9999
overlay= @sprites["overlay"].bitmap
overlay.clear
baseColor=Color.new(255, 255, 255)
shadowColor=Color.new(156,156,156)
pbSetSystemFont(@sprites["overlay"].bitmap)
end
end
[/color]
Solo cambio lo que va en IF, todo lo demás se maneja de forma igual.
Es opcional agregar esto, solo crea textos:
[color=#000000] baseColor=Color.new(49,49,49)
shadowColor=Color.new(140, 140, 140)
baseColor2=Color.new(222,222,222)
shadowColor2=Color.new(132,132,132)
pbSetSystemFont(@sprites["overlaylol"].bitmap)
textos.push([_INTL("TEXTO")
[/color]
Y, hayan o no agregado texto, agregan un end después de estos códigos.
Agregan esto:
[color=#000000]
if $scene != self
break
end
end
Graphics.freeze
disposeSpritesets
if $game_temp.to_title
Graphics.transition
Graphics.freeze
end
end[/color]
Sirve para que se congele el juego mientras están los menús abiertos, asi si mueves las flechas, presionas la tecla para interactuar con un evento cercano, se mueve un personaje, etc, no pase ninguna acción, y no se mueva nada, ni siquiera los autotiles.
Ahora agregan los gráficos de todos los menús [Cambien solo lo que esta entre comillas y los números a tu gusto]:
[color=#000000] def menu
@sprites= {}
if $Trainer
@sprites["bg"]=Sprite.new(@viewport)
@sprites["bg"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menubg")
@sprites["bg"].x=0
@sprites["bg"].y=400
@sprites["menutrainer"] = Sprite.new(@viewport)
@sprites["menutrainer"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menutc")
@sprites["menutrainer"].x=0
@sprites["menutrainer"].y=0
@sprites["menuguardar"] = Sprite.new(@viewport)
@sprites["menuguardar"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuguardar")
@sprites["menuguardar"].x=0
@sprites["menuguardar"].y=400
@sprites["menuopciones"] = Sprite.new(@viewport)
@sprites["menuopciones"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuopciones")
@sprites["menuopciones"].x=0
@sprites["menuopciones"].y=400
@sprites["menumochila"] = Sprite.new(@viewport)
@sprites["menumochila"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menumochila")
@sprites["menumochila"].x=0
@sprites["menumochila"].y=400
if $Trainer.pokedex
@sprites["menupokedex"] = Sprite.new(@viewport)
@sprites["menupokedex"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menupokedex")
@sprites["menupokedex"].x=0
@sprites["menupokedex"].y=400
end
if $Trainer.party.length>0
@sprites["menuball"] = Sprite.new(@viewport)
@sprites["menuball"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuball")
@sprites["menuball"].x=0
@sprites["menuball"].y=400
end
@sprites["overlay"]=BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["overlay"].z = 9999
overlay= @sprites["overlay"].bitmap
overlay.clear
baseColor=Color.new(255, 255, 255)
shadowColor=Color.new(156,156,156)
pbSetSystemFont(@sprites["overlay"].bitmap)
end
end [/color]
EXPLICACION:
bg: es el fondo del menú, yo cree un fondo transparente de arriba, por eso es de pantalla completa, pero normalmente, si es de media pantalla, pongan el grafico en 350
menutrainer,mochila,opciones,guardar: Son simplemente los menu que hay.
menupokedex y menuball: USEN EL NOMBRE QUE TIENEN EN if $Trainer.pokedex COMO X Y EN EL DE Trainer.party.length>0 COMO X
Ya vamos acabando el script, solo nos falta definir las zonas táctiles:
[color=#000000]def menutactil
Input.update
if $Trainer[/color]
Con esto le decimos al script que es con cursor, y que tiene el IF TRAINER, lo cual conecta con el IF TRAINER de los codigos anteriores:
[color=#000000]if @sprites["menuball"]
if $mouse.x >= 17 && $mouse.x <= (17 + 87) and $mouse.y >= 450 && $mouse.y <= (450 + 75)
@sprites["menuball"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuball-s")
if Input.pressed(Input::Mouse_Left)
pbPlayDecisionSE()
sscene=PokemonScreen_Scene.new
sscreen=PokemonScreen.new(sscene,$Trainer.party)
hiddenmove=nil
pbFadeOutIn(99999) {
hiddenmove=sscreen.pbPokemonScreen
if hiddenmove
@scene.pbEndScene
end
}
end
else
@sprites["menuball"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuball")
end
end
if @sprites["menupokedex"]
if $mouse.x >= 131*2 && $mouse.x <= (131*2 + 246) and $mouse.y >= (272*2 - 48*2) && $mouse.y <= ((272*2 - 48*2) + 86)
@sprites["menupokedex"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menupokedex-s")
if Input.pressed(Input::Mouse_Left)
pbPlayDecisionSE()
pbFadeOutIn(99999) {
scene=PokemonPokedexScene.new
screen=PokemonPokedex.new(scene)
screen.pbStartScreen
}
end
else
@sprites["menupokedex"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menupokedex")
end
end
if $mouse.x >= 3*2 && $mouse.x <= (3*2 + 246) and $mouse.y >= (320*2 - 48*2) && $mouse.y <= ((320*2 - 48*2) + 86)
@sprites["menumochila"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menumochila-s")
if Input.pressed(Input::Mouse_Left)
pbPlayDecisionSE()
item=0
scene=PokemonBag_Scene.new
screen=PokemonBagScreen.new(scene,$PokemonBag)
pbFadeOutIn(99999) {
item=screen.pbStartScreen
if item>0
break
end
}
if item>0
Kernel.pbUseKeyItemInField(item)
return
end
end
else
@sprites["menumochila"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menumochila")
end
if $mouse.x >= 0 && $mouse.x <= 500 and $mouse.y >= 0 && $mouse.y <= 100
@sprites["menutrainer"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menutc-s")
if Input.pressed(Input::Mouse_Left)
pbPlayDecisionSE()
PBDebug.logonerr {
scene=PokemonTrainerCardScene.new
screen=PokemonTrainerCard.new(scene)
pbFadeOutIn(99999) {
screen.pbStartScreen
@scene.pbRefresh
}
}
end
else
@sprites["menutrainer"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menutc")
end
if $mouse.x >= (700 - 17 -87) && $mouse.x <= (700 - 17) and $mouse.y >= (450) && $mouse.y <= (450 + 75)
@sprites["menuguardar"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuguardar-s")
if Input.pressed(Input::Mouse_Left)
pbPlayDecisionSE()
scene=PokemonSaveScene.new
screen=PokemonSave.new(scene)
if screen.pbSaveScreen
end
end
else
@sprites["menuguardar"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuguardar")
end
if $mouse.x >= (700 - 55) && $mouse.x <= (700) and $mouse.y >= (784 - 40 - 100) && $mouse.y <= (784 - 40)
@sprites["menuopciones"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuopciones-s")
if Input.pressed(Input::Mouse_Left)
pbPlayDecisionSE()
pbFadeOutIn(99999){
scene=PokemonOptionScene.new
screen=PokemonOption.new(scene)
screen.pbStartScreen
}
end
else
@sprites["menuopciones"].bitmap=BitmapCache.load_bitmap("Graphics/Pictures/menuopciones")
end
end
end # Menu Táctil
end [/color]
SOLO CAMBIEN LOS "if $mouse.x >= 17 && $mouse.x <= (17 + 87) and $mouse.y >= 450 && $mouse.y <= (450 + 75)" Y LOS "("Graphics/Pictures/menuopciones-s"

PORQUE SI CAMBIAN ALGO MÁS, NO LES LLEVARA A LOS MENÚ
El menú mencionado en la nota, es el que usare como ejemplo. Tiene que cambiar el numero que va después de >= 17 para decir en que punto de X empieza el gráfico, <= (17 + 87) para decir donde va a acabar el punto de X, y lo mismo con los Y, siempre empiecen por el número menor
Ahora, pueden testear el juego, y verán como sus botones cambian al pasar el cursor

Conclusión
Gracias a esto, podremos crear menús no solo de media pantalla, si no que ahora también de pantalla completa, pero les recomiendo empezar de poco a poco, no busquen todo con su primer script
Creditos
Rafael-Animal de Wahack por enseñarme lo básico
Taringa: Ser una gran comunidad para poder aportar
Mi madre por pagar el Internet
Los users que comentan por animarme a hacer otra tutorial
Próximas Tutoriales
Hacer Mapas al estilo BW [Cuando este post tenga 100 puntos]
Crear un script de perspectiva [Cuando este y el de mapas tengan 500 puntos en total]
Script de vídeos a travez de pictures al estilo la intro de BW [Cuando tenga Mil puntos en mi perfil

]
input dijo: