forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with controls!

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
MuffinKing



Joined: 13 Dec 2005
Posts: 5

PostPosted: Sat Dec 17, 2005 10:47 am    Post subject: Help with controls! Reply with quote

I hate double posting but people don't seem to see my first one... sigh. Anyway, I just want this piece of code:
Code:

if pointer_x >= 0 and pointer_x <= 98 and pointer_y >= 245 and pointer_y <= 272 and pad:cross() then
screen:blit(0,245,startpushed)
end

For it to stay blitted instead of letting go and it dissappear.. i want it to appear until i tell it to stop! Is there anyway to fix that??
Back to top
View user's profile Send private message
Dr. Vegetable



Joined: 14 Nov 2005
Posts: 171
Location: Boston, Massachusetts

PostPosted: Sat Dec 17, 2005 1:17 pm    Post subject: Reply with quote

Well, my knowledge of Lua is pretty skimpy, but usually what you need to do in a situation like this is to create a "flag" variable that indicates whether the image should be displayed, and then set or reset that flag based on the appropriate events. You didn't specify the circumstances under which the image should go away, but (for example) you could have it stay until you press the square by doing something like:

Code:

if pointer_x >= 0 and pointer_x <= 98 and pointer_y >= 245 and pointer_y <= 272 and pad:cross() then
showImage = 1
end

if pad:square() then
showImage = 0
end

if showImage > 0 then
screen:blit(0,245,startpushed)
end


This is untested code, but should give you some idea of how to proceed. Hope this helps!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
dragaron



Joined: 06 Dec 2005
Posts: 6

PostPosted: Sat Dec 17, 2005 3:43 pm    Post subject: Reply with quote

if showblit == true then do
if pointer_x >= 0 and pointer_x <= 98 and pointer_y >= 245 and pointer_y <= 272 and pad:cross() then
screen:blit(0,245,startpushed)
end
end


showblit = true (will show blit)
showblit = false (will not show blit)
_________________
He has showed you, O man, what is good.
And what does the LORD require of you?
To act justly and to love mercy
and to walk humbly with your God. (Micah 6:8)
Back to top
View user's profile Send private message
MuffinKing



Joined: 13 Dec 2005
Posts: 5

PostPosted: Sun Dec 18, 2005 8:10 am    Post subject: Reply with quote

Dr. Vegetable wrote:
Well, my knowledge of Lua is pretty skimpy, but usually what you need to do in a situation like this is to create a "flag" variable that indicates whether the image should be displayed, and then set or reset that flag based on the appropriate events. You didn't specify the circumstances under which the image should go away, but (for example) you could have it stay until you press the square by doing something like:

Code:

if pointer_x >= 0 and pointer_x <= 98 and pointer_y >= 245 and pointer_y <= 272 and pad:cross() then
showImage = 1
end

if pad:square() then
showImage = 0
end

if showImage > 0 then
screen:blit(0,245,startpushed)
end


This is untested code, but should give you some idea of how to proceed. Hope this helps!


OH THANK GOD!! IT WORKS!!!!! I just hate being a noob though, now to figure out how to make it work with one button instead of 2 >_<.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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