 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
BrokenHeartedLoser
Joined: 10 Oct 2005 Posts: 11 Location: London, UK
|
Posted: Mon Oct 10, 2005 3:38 am Post subject: Options Problem |
|
|
i'm new to luaplayer and i would like some help knowing whats wrong with my options menu ever since i added it, it just closes down while using luaplayer for windows...
| Code: |
if pad:cross() then
ShowOptions()
end
end
|
would this be the way to show my option menu with a function?
here is what my option menu coding is
| Code: |
function ShowOptions()
screen:blit(0, 0, IMGOptionsMenu)
screen:blit(340, 84, IMGSlow)
screen:blit(356, 127, IMGNormal2)
screen:blit(366, 174, IMGFast)
screen:blit(366, 174, IMGBack)
if selectedOption == 1 then
screen:blit(340, 84, IMGSlow2)
screen:blit(356, 127, IMGNormal)
screen:blit(366, 174, IMGFast)
screen:blit(366, 174, IMGBack)
elseif selectedOption == 2 then
screen:blit(340, 84, IMGSlow)
screen:blit(356, 127, IMGNormal2)
screen:blit(366, 174, IMGFast)
screen:blit(366, 174, IMGBack)
elseif selectedOption == 3 then
screen:blit(340, 84, IMGSlow)
screen:blit(356, 127, IMGNormal)
screen:blit(366, 174, IMGFast2)
screen:blit(366, 174, IMGBack)
elseif selectedOption == 4 then
screen:blit(340, 84, IMGSlow)
screen:blit(356, 127, IMGNormal)
screen:blit(366, 174, IMGFast)
screen:blit(366, 174, IMGBack2)
end
screen.waitVblankStart()
screen.flip()
end
pad = Controls.read()
if pad:left() then
if selectedOption > 1 then
selectedOption=selectedOption-1
end
end
if pad:right() then
if selectedOption < 3 then
selectedOption=selectedOption+1
end
end
if pad:cross() then
if selectedOption == 1 then
ballspeed = 100
selectedOption == 4
elseif selectedOption == 2 then
ballspeed = 200
selectedOption == 4
elseif selectedOption == 3 then
ballspeed = 300
selectedOption == 4
elseif selectedOption == 4 then
Menu()
end
end
|
i know that all images are loaded and i know that 2 of them go into the same place i'll put them where i want after :P
and this is my varible for selectOption
| Code: |
selectedOption = 2 --[[
1 - slow;
2 - normal;
3 - fast;
4 - back;
]]-- |
once i get this working hopefully i can save the settings just like shine's snake :) |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Mon Oct 10, 2005 4:28 am Post subject: Re: Options Problem |
|
|
Looks like the code you quoted with your "ShowOptions" function is more code than just this function, but it is hard, because the idention is strange.
You can call it as a function, but when it returns, it will be displayed only once. If you like, you could take a look at the Snake game source code.
The best solution would be a general event based library, which removes the need of the game-loop, because looks like this makes it harder than needed for Lua Player beginners. This could be implemented in Lua and could look like just some class, where you need to overide onPaint, onCross, onLeft etc., only and then call some internal event loop, which is provided by the class. This is the point A LuaPlayer library for cooperative multitasking, clipping regions (windows), cursor, “mouse” and keyboard events, and stuff like that on http://wiki.ps2dev.org/psp:lua_player:todos , which doesn't mean that nevyn or I have to do the work alone :-) (we are busy for the next weeks with porting to different operating systems, preparing the conference talk, sound enhancements and OpenGL implementation) |
|
| Back to top |
|
 |
BrokenHeartedLoser
Joined: 10 Oct 2005 Posts: 11 Location: London, UK
|
Posted: Mon Oct 10, 2005 4:38 am Post subject: |
|
|
| yea i understand you guys are busy and yea i have checked out the snake source code but i was trying to find out a way to this with images without editting the snake source code...i've only been doing visual basic programming since this and that was easy heh |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|