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
0 registered members (), 18,561 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
How can i add one object at a time when two objects collided? #277218
07/08/09 11:46
07/08/09 11:46
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 add one object at a time when two objects collided?
because in the 3d game that i make the object which is hit will release multiple objects per hit.
But i think the release object and the one that hit collide also upon release. how do i fix this?
Any idea from you guys? please advise. laugh

here is my code:


// function : triggers bounce movement of the ball entity
//-------------------------------------------------------------------------------------------
void bounce_ball()
{
if (you)
{

if((you._ball==10) && (my._ball==10))
{

set(you,FLAG2);
set(my,FLAG2);


}
else
{
snd_play(explosion,100, 0);
effect(particle_ball,maxv(1,40*time_step),my.x,vector(0,0,5));
vec_to_angle(my.pan, bounce);
my.pan += 5 - random(10);
my.tilt = 0;
my.roll = 0;
my.z = 0;

}

}

return(0);

//
// effect(particle_ball,maxv(1,40*time_step),my.x,vector(0,0,5));
// vec_to_angle(my.pan, bounce);
// my.pan += 5 - random(10);
// my.tilt = 0;
// my.roll = 0;
// my.z = 0;
}



// function : release a ball when hit and explode when triggered by scan event or adds a new ball when collided
//-------------------------------------------------------------------------------------------
function release_ball()
{
if(event_type == EVENT_SCAN)
{
snd_play(explosion,100, 0);
effect(p_fountain,maxv(1,40*time_step),my.x,vector(0,0,5));
set (me, INVISIBLE);
ent_remove(my);
}

if(event_type == EVENT_IMPACT)
{
wait(-0.5);
tempbrick1[1] = my.x - 25;
tempbrick1[2] = my.y;
tempbrick1[3] = my.z;

ent_ball= ent_create("Bubble.mdl", vector(tempbrick1[1],tempbrick1[2],tempbrick1[3] ), move_ball); // create a new ball whet object is hit


ent_ball._ball=10;
ent_ball.ambient = 70;

wait(1);


}
return(0);

}





// function : moves the added ball
//--------------------------------------------------------------------------------------
action move_ball()
{
ballsInField+=1;

wait(1);

my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // the object is sensitive to block and entity collisions
my.event = bounce_ball;
my._ball = 10;

while(1)
{
c_move(me,vector(30*time_step,0,0),nullvector,IGNORE_PASSABLE | GLIDE | IGNORE_FLAG2 | ACTIVATE_PUSH); // moves the ball

if(my.x < ent_catcher.x )
{

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

wait(1);
}

ent_remove(my);

}

Re: How can i add one object at a time when two objects collided? [Re: uone] #277416
07/09/09 08:35
07/09/09 08:35
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
A simple but not-so-nice way would be to set the object that is newly created to passable for about one second.
Otherwise you could set a skill to OFF when it is being created and wait for a second, then set it to ON. In the event check if this skill is ON or OFF and only let it react (and creat a new object) if it's ON.

Btw, I think your return(0); doesn't do anything. I did that same mistake once :P... it's in a "void" function, which means the function doesn't return anything, so calling a "return" statement in that function doesn't work.


~"I never let school interfere with my education"~
-Mark Twain

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