Results 1 to 3 of 3

Thread: menu help!!

  
  1. #1
    re_animate is offline -Hacks Smarty
    Join Date
    Jan 2007
    Posts
    119
    Rep Power
    13

    Default

    hey guys,
    im learning PSP LUA and need some help, i want to make a start up menu for my psp game...

    i have 3 images

    start.png, help.png, exit.png

    they are all the same just each one has the menu item it is selecting highlighted eg start.png would have the word 'start' in a different color so u know its selected etc...

    how do i get the menu to scroll the picture i want by me pressing the D-Pad buttons?

    and x being to select them?

    plz show the code you have used many thanx

    Im not a nerd! im a lvl 19 paladin


    W00t

  2. #2
    splodger15 is offline -Hacks Newbie
    Join Date
    Aug 2006
    Posts
    39
    Rep Power
    14

    Default

    Well here is a basic menu it just prints the text to the screen and allows a scrolling ability through the menu in a different colour

    Code:
    Black = Color.new(0, 0, 0)
    Red = Color.new(255, 0, 0)
    
    -----Loads images--------
    Background = Image.load("images/menu.png")
    
    
    -----loads files-----
    LoadA = loadfile(".lua")
    LoadB = loadfile(".lua")
    LoadC = loadfile(".lua")
    
    
    
    while true do
    
    current = 1
    oldpad = Controls.read()
    
    while true do
    
    pad = Controls.read()
    screen:clear()
    
    ----prints to the screen-------
    screen:blit(0, 0, Background)
    screen:print(200, 130, "Start Game", Black)
    screen:print(200, 140, "Help", Black)
    screen:print(200, 150, "Exit", Black)
    
    -----this code is so that when you highlight an option in a menu it turns red-----
    if current == 1 then
    screen:print(200, 130, "Start Game", Red)
    end
    
    if current == 2 then
    screen:print(200, 140, "Help", Red)
    end
    
    if current == 3 then
    screen:print(200, 150, "Exit", Red)
    end
    
    
    -----this makes it so that you can scroll through your menu----
    if pad:up() and oldpad:up() ~= pad:up() then
    current = current-1
    end
    
    if pad:down() and oldpad:down() ~= pad:down() then
    current = current+1
    end
    
    if current == 4 then
    current = 1
    end
    
    if current == 0 then
    current = 3
    end
    
    -----this is to select your menu options------
    if pad:cross() and current == 1 then
    LoadA()
    end
    
    if pad:cross() and current == 2 then
    LoadB()
    end
    
    if pad:cross() and current == 3 then
    LoadC()
    end
    
    screen.waitVblankStart()
    screen:flip()
    oldpad = pad
    
    end
    
    end
    Join my PSP site here: http://splodger15.forum5.com/

  3. #3
    lua scripter is offline -Hacks Newbie
    Join Date
    Aug 2008
    Posts
    14
    Rep Power
    0

    Default

    heres one this works great

    Code:
    white = Color.new(255,255,255)
    red = Color.new(255,0,0)
    black = Color.new(0,0,0)
    oldpad = Controls.read()
    font = Font.load("font.ttf")
    
    -- Font Stuff
    
    font:setPixelSizes(0,15)
    
    
    
    ms = 1
    mms = 5
    
    
    
    while true do
    screen:clear()
    pad = Controls.read()
    
    if pad:up() and not oldpad:up() then
    ms = ms - 1
    end
    
    if pad:down() and not oldpad:down() then
    ms = ms + 1
    end
    
    if ms > mms then
    ms = 1
    elseif ms <= 0 then
    ms = mms
    end
    
    mc = { white,white,white,white,white }
    mc[ms] = red
    screen:fontPrint(font,200,200,"New Game",mc[1])
    screen:fontPrint(font,200,210,"Continue",mc[2])
    screen:fontPrint(font,200,220,"Options",mc[3])
    screen:fontPrint(font,200,230,"Credits",mc[4])
    screen:fontPrint(font,200,240,"Quit",mc[5])
    
    if pad:cross() and not oldpad:cross() and ms == 1 then
    --First option code goes here.
    end
    
    if pad:cross() and not oldpad:cross() and ms == 2 then
    --Second option code goes here.
    end
    
    if pad:cross() and not oldpad:cross() and ms == 3 then
    --Third option code goes here.
    end
    
    if pad:cross() and not oldpad:cross() and ms == 4 then
    --Fourth option code goes here.
    end
    
    if pad:cross() and not oldpad:cross() and ms == 5 then
    --Fifth option code goes here.
    end
    
    screen.flip()
    screen.waitVblankStart()
    oldpad = pad
    end

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •