Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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 | 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