 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
MuffinKing
Joined: 13 Dec 2005 Posts: 5
|
Posted: Sat Dec 17, 2005 10:47 am Post subject: Help with controls! |
|
|
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 |
|
 |
Dr. Vegetable
Joined: 14 Nov 2005 Posts: 171 Location: Boston, Massachusetts
|
Posted: Sat Dec 17, 2005 1:17 pm Post subject: |
|
|
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 |
|
 |
dragaron

Joined: 06 Dec 2005 Posts: 6
|
Posted: Sat Dec 17, 2005 3:43 pm Post subject: |
|
|
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 |
|
 |
MuffinKing
Joined: 13 Dec 2005 Posts: 5
|
Posted: Sun Dec 18, 2005 8:10 am Post subject: |
|
|
| 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 |
|
 |
|
|
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
|