![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Slight Menu Problem within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; its easy to fix, i'm sure. Code: while true do screen:blit(0, 0, mmenu) pad = Controls.read() screen:print(180, 130, ">Start Game", ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() |
its easy to fix, i'm sure.
Code:
while true do screen:blit(0, 0, mmenu) pad = Controls.read() screen:print(180, 130, ">Start Game", red) screen:print(180, 140, "Credit", white) screen.flip() --This it to give the user the ability to choose options, but theres an error if pad:down() then screen:clear() screen:blit(0, 0, mmenu) screen:print(180, 130, "Start Game", white) screen:print(180, 140, ">Credit", red) screen.flip() if pad:up() then screen:clear() screen:blit(0, 0, mmenu) screen:print(180, 130, ">Start Game", red) screen:print(180, 140, "Credit", white) screen.flip() end end screen.waitVblankStart() end
__________________
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER] |
|
|
|
|
|
#2 |
![]() ![]() Developer
|
the code is correct, but the way you have it oriented will only have it printed to the screen if you hold up or down. make the up/down buttons add or subtract from a variable. then, in your main loop, use an if/then statement to check the variable, and act accordingly.
EXAMPLE Code:
while true do
screen:blit(0, 0, mmenu)
pad = Controls.read()
screen:print(180, 130, ">Start Game", red)
screen:print(180, 140, "Credit", white)
screen.flip()
--This it to give the user the ability to choose options, but theres an error
if pad:down() then
if menuitem < 1 then
menuitem = menuitem + 1
end
end
if pad:up() then
if menuitem > 0 then
menuitem = menuitem - 1
end
end
screen:clear()
screen:blit(0, 0, mmenu)
if menuitem == 0 then
screen:print(180, 130, ">Start Game", red)
screen:print(180, 140, "Credit", white)
elseif menuitem == 1 then
screen:print(180, 130, "Start Game", white)
screen:print(180, 140, ">Credit", red)
end
screen.flip()
screen.waitVblankStart()
end
__________________
Last edited by MasterQ; 02-15-2006 at 04:11 PM.. |
|
|
|
|
|
#5 |
![]() |
ohhh
i get it now well not really... i understand it, but i wouldnt be able to create that on my own. after looking and thinking at it for a while, then i should be able to do that by myself thanks
__________________
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER] |
|
|
|
|
|
#6 |
![]() ![]() ...in a dream...
|
Ya, I would just make an integer named 'menu' (imagine that? lol) and if UP is pressed, than add 1 to that integer, and if DOWN is pressed, than subtract 1 from that integer, and if that integer goes over/under how ever many items on your menu, then have it go back to the end/start. Then just do what he said and use an 'if' statement with a boolean in it to check if that integer is true to a certain number, and if it is true, then do whatever you want.
This is basically what MasterQ did, except it's in words to help you out.
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#7 |
![]() |
what happens now is when i press DOWN, it goes down (so far so good) BUT when i release the down button, it automatically goes back up.
and thats with the code MasterQ gave me.
__________________
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER] |
|
|
|
|
|
#8 |
![]() ![]() PSP Developer
Join Date: Oct 2005
Real First Name: Alex
Location: ~* Confidential *~
Just Played: N/A
Posts: 839
Trader Feedback: 0
|
Try this:
Code:
while true do
screen:blit(0, 0, mmenu)
pad = Controls.read()
screen:print(180, 130, " Start Game", white)
screen:print(180, 140, " Credit", white)
screen.flip()
--This it to give the user the ability to choose options, but theres an error
if pad:down() then
menuitem = menuitem + 1
if menuitem > 1 then
menuitem = 1
end
end
if pad:up() then
menuitem = menuitem - 1
if menuitem < 0 then
menuitem = 0
end
end
screen:clear()
screen:blit(0, 0, mmenu)
if menuitem == 0 then
screen:print(180, 130, ">Start Game", red)
screen:print(180, 140, " Credit", white)
elseif menuitem == 1 then
screen:print(180, 130, " Start Game", white)
screen:print(180, 140, ">Credit", red)
end
screen.flip()
screen.waitVblankStart()
end
__________________
![]() "Every team needs an idealistic person (whether they are a noob or a pro), my team doesn't have one cus im the idealistic founder."-me Anime/Manga and Fanfiction is my inspiration! Creator of: - PSPSDK makefile creator - Lua Prompt - Animated Sprite Class\Library for Lua - Gmax2PSP - |
|
|
|
|
|
#9 | |
![]() ![]() ...in a dream...
|
Quote:
Code:
while true do menu = 0 ya da ya da end Code:
menu = 0 while true do ya da ya da end
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
![]() |
| Tags |
| menu , problem , slight |
| Thread Tools | |
|
|