Vamos con otro capitulo mas que os tengo abandonaos y luego me llorais
Vamos a aprender a hacer menos con cursor(si esa flechita como la que has usado para poner esta pagina)
Necesitais usar la imaginacion, luego vereis pk
Code: Select all
-- Colores --
azul = Color.new(0,0,255)
blanco = Color.new(255,255,255)
-- Imagenes --
fondo = Image.load("ms0:/PSP/GAME/Programa/Imagenes/fondo.png")
cursor = Image.load("ms0:/PSP/GAME/Programa/Imagenes/cursor.png")
icono1 = Image.load("ms0:/PSP/GAME/Programa/Imagenes/icono1.png")
icono1sel = Image.load("ms0:/PSP/GAME/Programa/Imagenes/icono1sel.png")
icono2 = Image.load("ms0:/PSP/GAME/Programa/Imagenes/icono2.png")
icono2sel = Image.load("ms0:/PSP/GAME/Programa/Imagenes/icono2sel.png")
es la flechita, icono1 es la imagen de la opcion 1, icono1sel es la opcion uno seleccionada(es decir con el cursor encima), icono2 la
opcion 2 y icono2sel pues la 2 elegida. Aqui se puede variar la variable, el nombre de la imagen, si quieres que cambie al
seleccionarla o no, etc...
Code: Select all
-- Variables --
x = 0
x0 = 235
y0 = 193
x1 = 0
y1 = 0
nombreiso = " "
Code: Select all
-- Controles --
function LeerPulsacion()
pad = Controls.read()
dy = pad:analogY()
dx = pad:analogX()
if math.abs(dx) > 64 then
x0 = x0 + dx / 24
end
if math.abs(dy) > 64 then
y0 = y0 + dy / 24
end
if pad:up() then
y0 = y0 - 8
end
if pad:down() then
y0 = y0 + 8
end
if pad:right() then
x0 = x0 + 8
end
if pad:left() then
x0 = x0 - 8
end
if x0 >= 10 and x0 <= 200 and y0 >= 20 and y0 <= 250 and pad:cross() then
screen:clear()
screen:print(1, 1, "Menu Ingles", blanco)
screen.flip()
screen:waitVblanckStart(200)
screen.flip()
end
if x0 >= 210 and x0 <= 400 and y0 >= 20 and y0 <= 250 and pad:cross() then
screen:clear()
screen:print(1, 1, "Menu Español", blanco)
screen.flip()
screen:waitVblanckStart(200)
screen.flip()
end
if pad:circle() then
dofile("ms0:/PSP/GAME/MultiR-evolutionLUA/script.lua")
end
if pad:start() then
break
end
end
Code: Select all
dy = pad:analogY()
dx = pad:analogX()
if math.abs(dx) > 64 then
x0 = x0 + dx / 24
end
if math.abs(dy) > 64 then
y0 = y0 + dy / 24
end
Code: Select all
if pad:up() then
y0 = y0 - 8
end
if pad:down() then
y0 = y0 + 8
end
if pad:right() then
x0 = x0 + 8
end
if pad:left() then
x0 = x0 - 8
end
Code: Select all
if x0 >= 10 and x0 <= 200 and y0 >= 20 and y0 <= 250 and pad:cross() then
screen:clear()
screen:print(1, 1, "Menu Ingles", blanco)
screen.flip()
screen:waitVblanckStart(200)
screen.flip()
end
if x0 >= 210 and x0 <= 400 and y0 >= 20 and y0 <= 250 and pad:cross() then
screen:clear()
screen:print(1, 1, "Menu Español", blanco)
screen.flip()
screen:waitVblanckStart(200)
screen.flip()
end
Code: Select all
-- Bucle Principal --
while true do
if x0<0 then
x0=0
end
if x0>478 then
x0=478
end
if y0<0 then
y0=0
end
if y0>270 then
y0=270
end
x1 = x0
y1 = y0
-- Menu --
screen:blit(0,0,fondo)
screen:blit(10,20,icono1)
screen:blit(210,20,icono2)
-- Damos Efecto al pasar el Cursor Encima --
if x0 >= 10 and x0 <= 200 and y0 >= 20 and y0 <= 250 then
screen:blit(32,81,icono1sel)
end
if x0 >= 210 and x0 <= 400 and y0 >= 20 and y0 <= 250 then
screen:blit(190,81,icono2sel)
end
screen:blit(x1,y1,cursor)
screen.waitVblankStart()
screen.flip()
end
Code: Select all
if x0<0 then
x0=0
end
if x0>478 then
x0=478
end
if y0<0 then
y0=0
end
if y0>270 then
y0=270
end
Code: Select all
x1 = x0
y1 = y0
Code: Select all
screen:blit(0,0,fondo)
screen:blit(10,20,icono1)
screen:blit(210,20,icono2)
-- Damos Efecto al pasar el Cursor Encima --
if x0 >= 10 and x0 <= 200 and y0 >= 20 and y0 <= 250 then
screen:blit(32,81,icono1sel)
end
if x0 >= 210 and x0 <= 400 and y0 >= 20 and y0 <= 250 then
screen:blit(190,81,icono2sel)
end
screen:blit(x1,y1,cursor)
screen.waitVblankStart()
screen.flip()
end
Y ya esta, perdonar que este un poco mal explicado, tal vez mas alante lo explique mejor, pero ya sabeis, un programador aprende investigando
