Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (monarch), 1,259 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Built in a pause in the game #201312
04/08/08 11:22
04/08/08 11:22
Joined: Feb 2008
Posts: 23
BW, Germany
X
xakac Offline OP
Newbie
xakac  Offline OP
Newbie
X

Joined: Feb 2008
Posts: 23
BW, Germany
Hi!
How can i built a pause-function in my game?
I just tried this but it doesn`t work \:\( Can anybody help me, please!

Here is my code:
........
// Pause
function pause(){
wait(1);
freeze_mode = 2;
mouse_mode = 1;
pausenPanel.flags = VISIBLE | OVERLAY;
}

// Play
function weiter(){
wait(1);
pausenPanel.flags &= ~VISIBLE;
mouse_mode = 0;
freeze_mode = 0;
}
......
on_p = pause(); // Short-Key to get pause
......

Last edited by xakac; 04/08/08 11:23.
Re: Built in a pause in the game [Re: xakac] #201319
04/08/08 11:52
04/08/08 11:52
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
By writing on_p = pause(); you assign the return value of the function pause to on_p. What you originally wanted to do is assigning the function pause to on_p. Simply ommit the brackets like in "on_p = pause;" and you should be fine. Ensure theassignment happens inside a function, e.g. in your main function.


Always learn from history, to be sure you make the same mistakes again...
Re: Built in a pause in the game [Re: Uhrwerk] #201340
04/08/08 13:05
04/08/08 13:05
Joined: Feb 2008
Posts: 23
BW, Germany
X
xakac Offline OP
Newbie
xakac  Offline OP
Newbie
X

Joined: Feb 2008
Posts: 23
BW, Germany
OK Thanks!
I made it in this way:

function spielStarten(){
...
on_p = pause; // Short-Key to get pause
}

Now, if i press "p", the game stops, it is OK.
But i cannot return to the game again \:\( and i cannot press buttons on the panel that is viewed by the function pause()...

Re: Built in a pause in the game [Re: xakac] #201342
04/08/08 13:29
04/08/08 13:29
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl

 Code:
function pause()
{
	if(freeze_mode == 0)
	{
		freeze_mode = 2;
	}
	else
	{
		freeze_mode = 0;
	}
}

function main()
{
	on_p = pause;
...



"empty"

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1