Gamestudio Links
Zorro Links
Newest Posts
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
3 registered members (AndrewAMD, Akow, 1 invisible), 1,499 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to freeze physics engine for pause? #233454
10/28/08 22:05
10/28/08 22:05
Joined: Sep 2004
Posts: 130
Italy
Alessandro Offline OP
Member
Alessandro  Offline OP
Member

Joined: Sep 2004
Posts: 130
Italy
Hi,

I'm implementing PAUSE functionality in my game, but the problems is the physics engine, even if I do not apply forces, it still acts already running forces. Is there any way to "freeze" the engine, so everything related to physics is frozen, and I will be able to unlock everything as soon as the user, for example, press key "P" ?

Re: How to freeze physics engine for pause? [Re: Alessandro] #233565
10/29/08 14:14
10/29/08 14:14
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
you can ent_next through the list of your entity's, and phent_enable them if they are phsyics entity's.

quick pseudocode (not tested, might have to fix this):
Code:
#define PHYSICAL_ENT skill1 // change this to the skill you want

void pause_PH_ents()
{
	ENTITY* pauser = ent_next(NULL); // retrieve first entity
 	while (pauser) // repeat until there are no more entities
	{ 
		if (pauser.PHYSICAL_ENT > 0) {
			phent_enable(pauser, 0); //make entity pause
 		}
		pauser = ent_next(pauser); //get next entity
	}
} 


that should do the trick. call this function to freeze your physics functions.
make sure that every physics entity you are using has:
Code:
my.PHYSICAL_ENT = 1;


that initialises it as being a physics entity for the freeze function.

if you need to unfreeze them, copy the function and set the second option in phent_enable to 1, instead of 0.

hope that helps.

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: How to freeze physics engine for pause? [Re: Helghast] #233674
10/29/08 21:17
10/29/08 21:17
Joined: Sep 2004
Posts: 130
Italy
Alessandro Offline OP
Member
Alessandro  Offline OP
Member

Joined: Sep 2004
Posts: 130
Italy
Thank you! You solution seems very good (I will try as soon as possible).
Thank you for your help!

Re: How to freeze physics engine for pause? [Re: Alessandro] #233680
10/29/08 21:39
10/29/08 21:39
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Just out of curiosity, doesn't freeze_mode work here?


Always learn from history, to be sure you make the same mistakes again...
Re: How to freeze physics engine for pause? [Re: Uhrwerk] #233684
10/29/08 21:59
10/29/08 21:59
Joined: Sep 2004
Posts: 130
Italy
Alessandro Offline OP
Member
Alessandro  Offline OP
Member

Joined: Sep 2004
Posts: 130
Italy
It works! freeze_mode works well!
Thank you! Both of you gave me precious information!


Last edited by Alessandro; 10/29/08 22:00.
Re: How to freeze physics engine for pause? [Re: Uhrwerk] #233748
10/30/08 10:42
10/30/08 10:42
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
because i like to do it the hard way, lol!
I didnt work with 3dgs for a while, about a year, so i forgot a lot of things XD
however, last time i checked freeze_mode, particles werent affected, so i hadda go and create my own custom function for freezing stuff in my game... but obviously physics arent particles :P

glad it works though smile

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/

Moderated by  HeelX, Spirit 

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