Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Munchor on January 07, 2011, 09:44:22 am

Title: Pause game
Post by: Munchor on January 07, 2011, 09:44:22 am
Hey, I know that some of you have made games with pausing systems that work with a key to pause the game.

How does that work? How do you do it?

I wanted to implement it in uPong and was wondering how.

Thanks much!
Title: Re: Pause game
Post by: Fast Crash on January 07, 2011, 09:48:51 am
If getkey(Y)
Repeat getkey(X)
End:End

?
Title: Re: Pause game
Post by: Munchor on January 07, 2011, 09:52:40 am
If getkey(Y)
Repeat getkey(X)
End:End

?

Code: [Select]
If getKey(9)
Repeat getKey(9)
End:End

For the ENTER Key... I have to try it yet, thanks.


EDIT: It doesn't work, probably it is only getting the getKey, no actualing stopping the game.
Title: Re: Pause game
Post by: Fast Crash on January 07, 2011, 09:55:26 am
don't do it with the same key ( it will directly exit from the loop )

try it

Code: [Select]
If getkey(9)
While getkey-9
End:End
Title: Re: Pause game
Post by: Munchor on January 07, 2011, 10:03:04 am
don't do it with the same key ( it will directly exit from the loop )

try it

Code: [Select]
If getkey(9)
While getkey-9
End:End

That works more or less :S It pauses the game, but when I put it back on, it only lasts 1 second and then is paused again :S
Title: Re: Pause game
Post by: Fast Crash on January 07, 2011, 10:04:47 am
hmmm ok try this :P

Code: [Select]
!If getkey-9
Repeat getkey-9
End:End
Title: Re: Pause game
Post by: Michael_Lee on January 07, 2011, 10:19:07 am
This is what I do -

Code: [Select]
While getkey(0)
    Dispgraph[r]
End

Repeat getKey(0)
    Dispgraph[r]
End

Title: Re: Pause game
Post by: c.sprinkle on January 07, 2011, 10:22:37 am
I use:
Code: [Select]
If getKey(45
Repeat getKey
DispGraph[r]
End
End
Title: Re: Pause game
Post by: Fast Crash on January 07, 2011, 10:25:13 am
I use APD command for the "pause"
Title: Re: Pause game
Post by: Ashbad on January 07, 2011, 01:20:02 pm
me:

Code: [Select]
Repeat getkey(0)
Dispgraph[r]
End
Repeat getKey(0)-1
Dispgraph[r]
End

Title: Re: Pause game
Post by: AngelFish on January 07, 2011, 01:54:42 pm
Me:

Quote
Repeat getkey-9
Dispgraphrr
End

You don't really need anything more complicated.
Title: Re: Pause game
Post by: Deep Toaster on January 07, 2011, 01:59:19 pm
I use APD command for the "pause"

What's that?

This is what I do -

Code: [Select]
While getkey(0)
    Dispgraph[r]
End

Repeat getKey(0)
    Dispgraph[r]
End



This is pretty much what I use. It's really nice because it doesn't go forward when the button's still held down. Plus you can use the second loop to do some nice effects.
Title: Re: Pause game
Post by: Munchor on January 07, 2011, 02:01:43 pm
@Deep_Thought: Me too.

@Michael_Lee: Yours works perfectly! Thank you very much. +1
Title: Re: Pause game
Post by: Ashbad on January 07, 2011, 02:03:57 pm
@Michael_Lee: Yours works perfectly! Thank you very much. +1

Can I have a +1 too for being awesome?
Title: Re: Pause game
Post by: yunhua98 on January 07, 2011, 02:10:16 pm
you can also make a teacher key by doing this if you don't have greyscale for the second method in parentheses.
Code: [Select]
If getkey(X)
Repeat getkey(X) and getkey(Y)
(Here you can set the contrast to 0 or do this)
Copy(L6,L3,768)
ClrDraw
End
Copy(L3,L6,768)
Title: Re: Pause game
Post by: Munchor on January 07, 2011, 02:13:19 pm
you can also make a teacher key by doing this if you don't have greyscale for the second method in parentheses.
Code: [Select]
If getkey(X)
Repeat getkey(X) and getkey(Y)
(Here you can set the contrast to 0 or do this)
Copy(L6,L3,768)
ClrDraw
End
Copy(L3,L6,768)

You gave me a great idea!! How to change the contrast in Axe? I only have a little text saying "Paused", I want to change the contrast, it would be cool.
Title: Re: Pause game
Post by: AngelFish on January 07, 2011, 02:15:52 pm
If you are using Greyscale, then you can do

Quote
If getkey(X)
Copy(L1-56,L5,56
Copy(L6,L1-56,768
Rect(0,0,96,64
Repeat getkey(x)
Dispgraphrr
End
Copy(L1-56,L6,768
Copy(L5,L1-56,56
End

Or

Quote
Shade(0)

EDIT: Accidentally answered your question, Scout.

Title: Re: Pause game
Post by: Munchor on January 07, 2011, 02:16:49 pm
If you are using Greyscale, then you can do

Quote
Copy(L1-56,L5,56
Copy(L6,L1-56
Rect(0,0,96,64
Dispgraphrr

Or

Quote
Shade(0)

Uh, accidentally answered your question, Scout.


But I'm not using a greyscale, so the second one :D
Title: Re: Pause game
Post by: AngelFish on January 07, 2011, 02:21:02 pm
Okay then. What project is this for?
Title: Re: Pause game
Post by: Munchor on January 07, 2011, 02:23:20 pm
Okay then. What project is this for?

uPong. However, I'm probably adding greysacle...
Title: Re: Pause game
Post by: Fast Crash on January 07, 2011, 02:42:06 pm
Rather than Shade(0)

Use APD !!!

Code: [Select]
If getkey(9)
sub(SD)
End
...
Lbl SD
Asm(3E01D303FB76FDCB09A6C9)
Return
Title: Re: Pause game
Post by: c.sprinkle on January 07, 2011, 02:45:54 pm
Thanks for that code. I've wanted to add a APD function for a while.
Title: Re: Pause game
Post by: AngelFish on January 07, 2011, 03:22:38 pm
Rather than Shade(0)

Use APD !!!

Code: [Select]
If getkey(9)
sub(SD)
End
...
Lbl SD
Asm(3E01D303FB76FDCB09A6C9)
Return

 You'll lose all of your data in L1 if you go into APD.
Title: Re: Pause game
Post by: Quigibo on January 07, 2011, 03:41:08 pm
Couldn't you do L1->DispGraph to avoid that?  Or possibly Copy(L1,L6,768)?  Not entirely sure how APD works...
Title: Re: Pause game
Post by: AngelFish on January 07, 2011, 03:45:26 pm
I think APD overwrites L1 with a bitmap image of the screen. You'd have to copy your data elsewhere first, because storing L1 in L6 after APD would just result in a corrupted version of the same thing being written to the buffer.
Title: Re: Pause game
Post by: Fast Crash on January 07, 2011, 03:47:42 pm
why copy the buffer if you just use APD ?
Title: Re: Pause game
Post by: ztrumpet on January 07, 2011, 05:20:49 pm
Here's what I do:
If getKey(Key)
While getKey(Key)
End
Repeat getKey(Key)
End
While getKey(Key)
End
End
Title: Re: Pause game
Post by: Fast Crash on January 07, 2011, 05:28:31 pm
Nice :)