Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 1 invisible), 620 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
pause game but camera active #258516
03/31/09 10:10
03/31/09 10:10
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
Hi.

using the freeze mode i am able to pause my running by pressing a key. but when that is done, the camera is not active. i want to pause everything except the camera. how can i do this ? anyone got a hint ?


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: pause game but camera active [Re: delinkx] #258524
03/31/09 12:09
03/31/09 12:09
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Lets say your existing camera code is started by calling Normal_Camera_Action();

With the code below, the Camera_OneFrame_Function() processes JUST ONE frame of your camera code,
and Normal_Camera_Action() calls it once a frame, just like a normal camera action.
When YOUR function eg Freezer turns the freeze on, Normal_Camera_Action() will freeze, stopping the camera.

BUT, if you keep calling Camera_OneFrame_Function() from INSIDE Freezer (once a frame),
it will appear to still be running normally.

This is a pretty rough example, but is shows what I mean, I hope.
Code:
//
action Normal_Camera_Action()
{
   while(1)
   {
      Camera_OneFrame_Function();
      wait(1);
   }
}
//
function Camera_OneFrame_Function()
{
   //normal contents of camera action while loop
   if(key_w)  camera.x += 5 * time_step;
   if(key_s)  camera.x -= 5 * time_step;
   if(key_a)  camera.y += 5 * time_step;
   if(key_d)  camera.y -= 5 * time_step;
}
//
function Freezer()
{
   freeze_mode = 2;
   while(freeze_mode==2)
   {
            //do whatever you need to do, if it happens here.
            if(key_esc)  freeze_mode = 0;  //eg to abort freeze mode 
      //
      Camera_OneFrame_Function();   //draw another frame
      wait(1);
   }
}
//

Lemme know how it goes.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: pause game but camera active [Re: EvilSOB] #258597
03/31/09 19:35
03/31/09 19:35
Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Shinobi Offline
User
Shinobi  Offline
User

Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Or add this code in your camera function ... wink

while(freeze_mode>0){wait(1);}

Re: pause game but camera active [Re: Shinobi] #258656
04/01/09 08:51
04/01/09 08:51
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
EVILSOB i guess u wanted to say:

Code:
//
action Normal_Camera_Action()
{
   while(1)
   {
      Camera_OneFrame_Function();
      wait(1);
   }
}
//
function Camera_OneFrame_Function()
{
   //normal contents of camera action while loop
   if(key_w)  camera.x += 5 * time_step;
   if(key_s)  camera.x -= 5 * time_step;
   if(key_a)  camera.y += 5 * time_step;
   if(key_d)  camera.y -= 5 * time_step;
}
//
function Freezer()
{
   freeze_mode = 2;
   while(freeze_mode==2)
   {
            //do whatever you need to do, if it happens here.
            if(key_esc)  freeze_mode = 0;  //eg to abort freeze mode 
      //
      Normal_Camera_Action();   //draw another frame
      wait(1);
   }
}
//



calling normal_camera_action to draw another frame.

I tried both .. still not working. If i do a step over, it does pass the code.. but on running it doesnt.

Shinobi: i did try tat but tat also doesnt work.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: pause game but camera active [Re: delinkx] #258659
04/01/09 09:05
04/01/09 09:05
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Should do. Maybe my example just doesnt do enough to be noticable.
Post your real camera action and I'll try again using it.

Then I can actually test it too. smile


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: pause game but camera active [Re: EvilSOB] #258662
04/01/09 09:49
04/01/09 09:49
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
i used the same as urs for now. and not the default one. anywys here is the code

Code:
function Camera_OneFrame_Function()
{
   //normal contents of camera action while loop
   if(key_w)  camera.x += 5 * time_step;
   if(key_s)  camera.x -= 5 * time_step;
   if(key_a)  camera.y += 5 * time_step;
   if(key_d)  camera.y -= 5 * time_step;
  while(freeze_mode>0){wait(1);}
}

action Normal_Camera_Action()
{
	 while(1)
	 {
	 	//default lite-c camera
	 	Camera_OneFrame_Function();
	 	
	 	wait(1);
	}
}

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

....
....
{other functions}
...
...

function main()
{
 //set video
 ..
 //set mouse
 ..
 
 //load level
 ..
 wait(2);

 Normal_Camera_Action();
 ..
 ..
 on_p = pause;
 ...
 call_functions();
}




A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: pause game but camera active [Re: delinkx] #258664
04/01/09 10:34
04/01/09 10:34
Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Shinobi Offline
User
Shinobi  Offline
User

Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
This should work ... the wait code was on the wrong place .... try this .

Code:
function Camera_OneFrame_Function()
{
   //normal contents of camera action while loop
   if(key_w)  camera.x += 5 * time_step;
   if(key_s)  camera.x -= 5 * time_step;
   if(key_a)  camera.y += 5 * time_step;
   if(key_d)  camera.y -= 5 * time_step;  
}

action Normal_Camera_Action()
{
	 while(1)
	 {
	 	//default lite-c camera
	 	Camera_OneFrame_Function();
	 	while(freeze_mode>0){wait(1);}
	 	wait(1);
	}
}

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


Re: pause game but camera active [Re: Shinobi] #258669
04/01/09 11:06
04/01/09 11:06
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
But my Camera_OneFrame_Function is junk I made up on the fly, not really useful.

But there is a problem with what you have. Here is how I see it "should" be done. ( Leave main() as it is)
Code:

function Camera_OneFrame_Function()
{
   //normal contents of camera action while loop
   if(key_w)  camera.x += 5 * time_step;
   if(key_s)  camera.x -= 5 * time_step;
   if(key_a)  camera.y += 5 * time_step;
   if(key_d)  camera.y -= 5 * time_step;
}


action Normal_Camera_Action()
{
	while(1)
	{
		//default lite-c camera
		Camera_OneFrame_Function();
		wait(1);
	}
}


function pause()
{
	if(freeze_mode == 2)	freeze_mode = 0;
	else			freeze_mode = 2;
	//
	while(freeze_mode==2)
	{
		//continue camera while frozen
		Camera_OneFrame_Function();
		wait(1);
	}
}





"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: pause game but camera active [Re: EvilSOB] #258775
04/02/09 03:51
04/02/09 03:51
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
the logic of the code is proper. and if u step through its proper. But once the freeze_mode is == 2, the keyboard entries are not working. so when control goes to check

if(key_w), then it alwys find it false. thats the problem here.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: pause game but camera active [Re: delinkx] #258781
04/02/09 04:48
04/02/09 04:48
Joined: Jan 2009
Posts: 36
Philippines
U
unknown_master Offline
Newbie
unknown_master  Offline
Newbie
U

Joined: Jan 2009
Posts: 36
Philippines
there are different bugs regarding in the freeze_mode=1; the game is freezed but when you set it to freeze_mode=0; the game is freezed already and cannot turn back again, that's why we do not include the freeze_mode in our developed game.










From: Anino Games Inc. Philippines

Page 1 of 3 1 2 3

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