Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,388 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ACTIVATE_SONAR issue #277395
07/09/09 05:57
07/09/09 05:57
Joined: Jun 2009
Posts: 17
Cebu Philippines
U
uone Offline OP
Newbie
uone  Offline OP
Newbie
U

Joined: Jun 2009
Posts: 17
Cebu Philippines
How can i deactivate "ACTIVATE_SONAR" in c_move function in a certain time like after wait(-1)? is there any other way? please advise...

Re: ACTIVATE_SONAR issue [Re: uone] #277404
07/09/09 07:46
07/09/09 07:46
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
you need to use two different c_move instructions. One with ACTIVATE_SONAR and one without. like this:


Code:
var use_sonar = ON;
while(1)
{
   if(use_sonar == ON)
   {
      c_move(my, vector(time_step,0,0),ACTIIVATE_SONAR|IGNORE_PASSABLE);
   }
   else
   {
      c_move(my, vector(time_step,0,0),IGNORE_PASSABLE);
   }
   wait(1);
}



now use a function to switch use_sonar on and off, and there you go.
Is that what you mean?

Last edited by Germanunkol; 07/09/09 07:46.

~"I never let school interfere with my education"~
-Mark Twain
Re: ACTIVATE_SONAR issue [Re: Germanunkol] #277437
07/09/09 09:24
07/09/09 09:24
Joined: Jun 2009
Posts: 17
Cebu Philippines
U
uone Offline OP
Newbie
uone  Offline OP
Newbie
U

Joined: Jun 2009
Posts: 17
Cebu Philippines
yeah! thanks man it works now.
i also make a time_passed var to turn "var use_sonar = ON;" to OFF

here is my code:

var use_sonar = ON;
var time_passed = 0.3; // the loop will run for 0.3 seconds

while (1)

{
time_passed -= time_step / 16;

if(use_sonar == ON)
{

c_move(me,vector(30*time_step,0,0),nullvector,IGNORE_PASSABLE | GLIDE | IGNORE_FLAG2 | ACTIVATE_PUSH | ACTIVATE_SONAR);
}
else
{
c_move(me,vector(30*time_step,0,0),nullvector,IGNORE_PASSABLE | GLIDE | IGNORE_FLAG2 | ACTIVATE_PUSH);
}

if(time_passed<=0)
{
use_sonar = OFF;
}

if(trace_hit)
{
//my.event = bounce_off;
bounce_off();
}

if(my.x < ent_catcher.x )
{

wait(1);
reset(my, SHOW);
ballsInField-=1;
break;
}


wait (1);

}


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

Gamestudio download | 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