Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Simple, PAUSE() command. (Just copy&paste.)

AGK Developer
Years of Service
User Offline
Joined: 29th Dec 2015
Location: In the studio
Posted: 25th Dec 2016 22:57 Edited at: 25th Dec 2016 23:43
This function might be useful for newcomers to AppGameKit, wondering
"How can I just make the game wait for x amount of time?"

Here's a quick pause command I wrote and you're welcome to use it, if it helps!

VERSION 1: Super simple. Just works.

The command "Pause(3)" (without the quotes) will pause for 3 seconds.
Accepts decimal fractions, like 0.5 secs etc.
No need to reset timer.

To use it, copy and paste this function into your program:

Uses global variable 'delaytime#', declared elsewhere. Add this line to your main code.

That's it. Now you can use the pause command anywhere in your game!

VERSION 2: Vital extras. Needs additional code.

Exactly as before but with two important new ingredients! I have a situation where the player can access a settings menu at any time.

First, I added a global variable to track and ignore any time that passes while a menu is open, so it doesn't interfere with the pause function's timer.

Second, the code checks if the player is busy pressing GUI buttons during the pause. They should still respond and we need a function to handle that!

You'll need to add the extra code yourself, based on how your own game works! This is just to show how you can easily adapt the pause code and make it better.

(edited because there's no preview button!)
AGK Linux user.
Tessellatus - a game of chance for Android.

Login to post a reply

Server time is: 2023-10-03 02:06:31
Your offset time is: 2023-10-03 02:06:31