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
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Another newbie question, With a simple answer. #138253
06/26/07 13:05
06/26/07 13:05
Joined: Jun 2007
Posts: 3
N
n30 Offline OP
Guest
n30  Offline OP
Guest
N

Joined: Jun 2007
Posts: 3
Hi there, I'm making a simple car game.
The problem is, The checkpoints.. I got i right that if collide, then make invisible and passable and light up the next one.

like:
Code:

var checknumb = 1;

function nextcheck
{
if (EVENT_TYPE == EVENT_impact)
{
snd_play (lo_wav, 60, 0);
my.passable = on;
checknumb +=1;
wait(2);
}

}

action Checkpoint_1{

my.invisible = on;
my.enable_impact = ON;
my.EVENT = nextcheck;
while(1){if (checknumb == 1){my.invisible = off;}else{my.invisible = on;}wait(1);}
}
action Checkpoint_2{

my.invisible = on;
my.enable_impact = ON;
my.EVENT = nextcheck;
while(1){if (checknumb == 2){my.invisible = off;}else{my.invisible = on;}wait(1);}
}
And so on..



It's workin but it uses enable_impact, that makes it collide for a sec, and loose speed.
I tried with my.passable.on but then enable_impact doesent work.

Help..

Re: Another newbie question, With a simple answer. [Re: n30] #138254
06/26/07 13:41
06/26/07 13:41
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
so maybe change to trigger with some small value to avoid colisions

and writing this:
while(1){if (checknumb == 1){my.invisible = off;}else{my.invisible = on;}wait(1);}
in every function takes memory and CPU

you may create one function with one loop
f.e. with simple function

action Checkpoint_1{
check_point_1 = me;
my.invisible = on;
..
...
}

function check_checkpoints
{
while(1)
{
if(checknumb == 1){check_point_1.invisible = off;}
if(checknumb == 2){check_point_2.invisible = off;}
...etc
wait(1);
}
}

Cheers

Last edited by tompo; 06/26/07 13:49.

Never say never.
Re: Another newbie question, With a simple answer. [Re: tompo] #138255
06/26/07 14:21
06/26/07 14:21
Joined: Jun 2007
Posts: 3
N
n30 Offline OP
Guest
n30  Offline OP
Guest
N

Joined: Jun 2007
Posts: 3
Thanks for the tip.

But the trigger doesent work, I have done like in the manual..

Code:

function nextcheck
{
if (event_type == EVENT_TRIGGER){
snd_play (lo_wav, 60, 0);
checknumb +=1;
wait(2);
}

}


action Checkpoint_1{
check_point_1 = me;


my.invisible = off;
my.trigger_range = 400;
my.ENABLE_TRIGGER = ON;
my.EVENT = nextcheck;
}

function check_checkpoints
{
while(1)
{
if(checknumb == 1){check_point_1.invisible = off;}
if(checknumb == 2){check_point_2.invisible = off;}
if(checknumb == 3){check_point_3.invisible = off;}
wait(1);
}
}



What is wrong? I tried to set range to the car too but with no luck..

Re: Another newbie question, With a simple answer. [Re: n30] #138256
06/26/07 14:35
06/26/07 14:35
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
1. be sure that in player's action you have also:
my.trigger_range = some_value;
my.ENABLE_TRIGGER = ON;

2. what kind of movement U are using to move the player?
trigger needs c_move

3. U may cutoff wait(2); in event function... it's looking useless

Last edited by tompo; 06/26/07 14:37.

Never say never.
Re: Another newbie question, With a simple answer. [Re: tompo] #138257
06/26/07 14:48
06/26/07 14:48
Joined: Jun 2007
Posts: 3
N
n30 Offline OP
Guest
n30  Offline OP
Guest
N

Joined: Jun 2007
Posts: 3
I'm using the user magazines Car physics.

Hm. Is there any other way to calculate range or collision?

Re: Another newbie question, With a simple answer. [Re: n30] #138258
06/26/07 14:54
06/26/07 14:54
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
yes...
simple vec_dist
so...
if(vec_dist(my.x,player.x) <100)
{
snd_play (lo_wav, 60, 0);
checknumb +=1;
}

Last edited by tompo; 06/26/07 14:56.

Never say never.

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