PDA

View Full Version : Pause, and proxies


LordCthulu
10-02-2005, 05:11 PM
(Proxies, couldn't think of a better name at the moment..)



And also I was wondering how to do 2D barriers/proxies in Lua? I've seen them done in C, but can't really convert that over to Lua..
Any suggestions/ideas are appreciated :D

modsyn
10-02-2005, 06:05 PM
i'm not sure what you mean by proxies. but i can show you how i did my
pause.


function pause()
oPad = Controls.read()
while true do
nPad = Controls.read()
if nPad:start() then
if nPad~=oPad then
break
end
end
--pause, waiting for start
oPad=nPad
end
end

LordCthulu
10-02-2005, 06:25 PM
Edit: Hey it works.
Thanks a bunch! :D
Im actually using it for an intro before the game starts, but I called it pause.
But thanks a lot :D

modsyn
10-02-2005, 06:27 PM
Hm...that might work.
Let me try :)

it does work. lol (me being arrogant)

LordCthulu
10-02-2005, 06:35 PM
Haha. I tried before with something similar to yours, but it didn't work.
i think because I didnt do the
if xpad ~= ypad then
thing.

modsyn
10-02-2005, 06:37 PM
that's a killer because without it, hitting start once is actually like hitting start 10 times. i ran into that early on.

LordCthulu
10-02-2005, 07:13 PM
Haha yeah I learned that the hard way today. lol

Master Inuyasha
11-04-2005, 08:32 PM
i havent used the pause, but how do u make it so that when you pause, a pic saying puased comes up, then when u unpause, it goes off.

LordCthulu
11-04-2005, 08:48 PM
Heres an example:


pad = Controls.read()

if pad:start() then
while not pad:triangle() do
screen:blit(0, 0, pause_image)
end
end


that should work. im being harassed by people who want me on socom and on msn messenger so if yo uneed more help just pst

Master Inuyasha
11-04-2005, 09:22 PM
it doesnt work, all it does is not let me use any buttons!
and what is the while not pad:triangle, i dont get it!

LordCthulu
11-04-2005, 09:25 PM
When you hit start button, it should show the image on the screen until you hit the triangle button.
Here it is commented for you. OH! HAHA!! SORRY LOL! omg sorry. ok i admit this is my fault..but i was distracted. There...sorry I forgot to read the controls while in the while loop. my bad yo ><


pad = Controls.read()

if pad:start() then
while not pad:triangle() do
screen:blit(0, 0, pause_image)
pad = Controls.read()
end
end


Sorry hehe.
"while not pad:triangle() do"
That means, while pad doesn't equal triangle, do the following code.
It's like saying while pad ~= triangle.

Master Inuyasha
11-04-2005, 09:56 PM
cool, well ill check it out and see if it works!!!

EDIT
i changed pause_image to pause, add a new paue = Image.load("pause.png") and it still doesnt work!!! Somethings wrong? Maybe a false or true is needed after pause_image?

LordCthulu
11-04-2005, 09:59 PM
Omfg...ok dood. Once again, I admit, I am sorry. That code will work, but haha i so out of it. You need to use this...


pad = Controls.read()

if pad:start() then
while not pad:triangle() do
screen:blit(0, 0, pause_image)
pad = Controls.read()
screen.waitVblankStart()
screen.flip()
end
end



Sorry >< That, my friend will work. And if it doesnt..well..i'll do something really horrible and apologize ;P

Hehe...I guess I get to look like an ass for trying to multi-task too many things :lol:

However, theres a slight possibility if you use triangle in the main game after you exit the pause menu, it'll count as you hitting triangle in the main game.

Master Inuyasha
11-04-2005, 10:05 PM
my friend, it works!!! Now, if i change the triangle to start, do you think it may work? and you forgot something important, after pause_image you have to put false, like this screen:blit(0, 0, pause_image, false)

Thanks for helping!!!

LordCthulu
11-04-2005, 10:10 PM
Haha np..sorry about all the trouble, im so out of it...I can't even play Socom straight :(

Hehe you don't need to put false in there. I can't remember what the default value is though, it's probably true though if your putting in false.
Yeah you can change it to start, however if you do that, I would do something like this:


pad = Controls.read()

if pad ~= oldPad then
if pad:start() then
while not pad:start() do
screen:blit(0, 0, pause_image)
pad = Controls.read()
screen.waitVblankStart()
screen.flip()
end
end
end

oldPad = pad


Try that real quick. Might need to do the same thing in the while loop to make it not exit right after you hit start to enter though.

Master Inuyasha
11-04-2005, 10:11 PM
theres a glitch now, i kept the triangle, but now every like five seconds after you pause the screen flickers, i wonder why?

LordCthulu
11-04-2005, 10:14 PM
How big is your game right now? Is it really big? Big as in lines of code.

Where are you putting the pause script? It should go in your main game loop.

As far as the pause part goes...lemme think...post the pause part real fast, or the game loop (or PM if you want), unless you want to keep it private.

Master Inuyasha
11-04-2005, 10:17 PM
ill pm it, u can edit the pause part, the game isnt that big, as of now, but its going to be big. ALso the screen flicker, possible bug? And do u know how to make menus, where you can select them by pressing up and down on the dpad?

LordCthulu
11-04-2005, 10:18 PM
I ask for the code so I can check the pause part and see if I can figure out why it flickers. And I do believe in the other topic I bribed about my menu making skills ;)

Master Inuyasha
11-04-2005, 10:20 PM
really, forget bribing, help me!!! If u want the whole game, intant message me on aol, msn, or yahoo so we can talk menu making, or you can teach me.

AOL: Master InuYasha4
MSN: dragonspike444@yahoo.com
Yahoo: dragonspike444