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
Page 2 of 2 1 2
Re: Basic collision detection [Re: ribsribs] #130074
05/16/07 21:49
05/16/07 21:49
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
I can't see all the code but...
1. don't use proc_kill just ent_remove(me); break;
2. debris = my hasn't to be in a loop
3. check if in cometa function is cometa = me;

I'm not sure that I'm getting your point but...
Code:
 
entity* player; entity* cometa; entity* debris;

function player_event
{
if(event_type == event_entity)
{
if(you == landpad){Crash_detect.string="LANDPAD";}
if(you == debris){Crash_detect.string="ASTEROID"; you.pan += 180;}
if(you == cometa){Crash_detect.string="COMET"; ent_remove(you);}
}
if(event_type == null)
{
Crash_detect.visible = off;
}
}

action player
{
player = me;
my.enable_entity = on;
my.event = player_event;
}

action cometa_action
{
cometa = me;
my.enable_entity = on;
my.pan= random(360);
my.tilt= random(360);
c_setminmax(me);
while(me)
{
c_move(me,vector(1,0,0),nullvector,GLIDE | ACTIVATE_TRIGGER | IGNORE_SPRITES | IGNORE_PASSENTS | use_box);
wait(1);
}
}

action debris_action
{
debris = me;
my.enable_entity = on;
my.pan= random(360);
my.tilt= random(360);
c_setminmax(me);
while(me)
{
c_move(me,vector(1,0,0),nullvector,GLIDE | ACTIVATE_TRIGGER | IGNORE_SPRITES | IGNORE_PASSENTS | use_box);
wait(1);
}
}




Never say never.
Re: Basic collision detection [Re: tompo] #130075
05/16/07 22:44
05/16/07 22:44
Joined: May 2007
Posts: 46
R
ribsribs Offline OP
Newbie
ribsribs  Offline OP
Newbie
R

Joined: May 2007
Posts: 46
Thanks A LOT!
With slight adjustments, it's working just fine.

Although, Asteroids are not beeing detected

(i've changed debris to asteroid)


Could it be because they're created @ runtime ????

I will now post the functions for the asteroids



function asteroide()
{

asteroid = me;
my.enable_entity = on;
my.pan= random(360);
my.tilt= random(360);
c_setminmax(me);

while(me)
{
c_move(me,vector(1,0,0),nullvector,GLIDE | ACTIVATE_TRIGGER | IGNORE_SPRITES | IGNORE_PASSENTS | use_box);

wait(1);
}

}

function generate_asteroide()
{
while(n_asteroides>0)
{
ent_create("meteoro.mdl",vector((10000-random(20000)),(10000-random(20000)),(10000-random(20000))),asteroide);
n_asteroides-=1;

wait(1);
}

}



The detection is beeing performed by the same way that the landpad or the comets wich are working just fine. But, both landpad and spaceship are WED created entities, with actions. Asteroids are runtime created.

When xlander and an Asteroid touches, nothing happens.

Thanks again

Last edited by ribsribs; 05/16/07 22:45.
Re: Basic collision detection [Re: ribsribs] #130076
05/16/07 23:15
05/16/07 23:15
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
code is ok but have you added in player event
if(you == asteroid){do_something;} ?
Probably not

and better is use random(1000)-2000 looks better


Never say never.
Re: Basic collision detection [Re: tompo] #130077
05/16/07 23:47
05/16/07 23:47
Joined: May 2007
Posts: 46
R
ribsribs Offline OP
Newbie
ribsribs  Offline OP
Newbie
R

Joined: May 2007
Posts: 46
Well, i've set my.event to the collision detection lines, the ones that you gave me (and thank you ). The only link to this within the player action, it's the my.event, wich is directed to the collision lines, the function above:


function evento_colisoes
{
if((event_type == event_entity)&&(you == cometa)){Crash_detect.string="COMET"; }
if((event_type == event_entity)&&(you == asteroid)){Crash_detect.string="ASTEROID"; you.pan+=180; }
if((event_type == event_entity)&&(you == landpad)){Crash_detect.string="LANDPAD"; }


if(event_type == null)
{
Crash_detect.visible = off;
}
}



I'm out of time now, but tomorrow i will try this:

Add the asteroids via WED, attaching them behaviours.

Think that would solve it ?

Thanks again

Last edited by ribsribs; 05/16/07 23:48.
Page 2 of 2 1 2

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