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 (AndrewAMD), 15,995 guests, and 5 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
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 | 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