Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, VoroneTZ, 1 invisible), 1,578 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
c_move collision other entity pointer? #308964
02/06/10 04:51
02/06/10 04:51
Joined: Jan 2010
Posts: 40
Adelaide, Australia
Sub_Game Offline OP
Newbie
Sub_Game  Offline OP
Newbie

Joined: Jan 2010
Posts: 40
Adelaide, Australia
My weapons are moving and colliding with entities and remove themselves but I can't seem to make them remove the entity that has been struck.

This is my latest attempt, code from the weapon action:
Code:
if(HIT_TARGET && run_time > 1 )
{
  if(c_scan(my.x, my.pan, vector(360, 360, 10), SCAN_ENTS | IGNORE_PASSABLE | IGNORE_WORLD | IGNORE_ME)!=0)
    ent_remove(you);
			
  ent_remove(me);

  return;
}


Is this a good way of getting the pointer to the other entity?


This shows 4 weapons moving towards the target sub in foreground. When the weapons collide they are removed but the target sub is not.

Any help would be appreciated.


A7 Commercial
First person submarine combat simulator project
http://alexanderforeman.webs.com/fightersubgame.htm
Re: c_move collision other entity pointer? [Re: Sub_Game] #308969
02/06/10 06:40
02/06/10 06:40
Joined: Jan 2010
Posts: 40
Adelaide, Australia
Sub_Game Offline OP
Newbie
Sub_Game  Offline OP
Newbie

Joined: Jan 2010
Posts: 40
Adelaide, Australia
OK - I've managed to get this working with:

Code:
function unit_hit()
{
  if(you.UNIT_TYPE == UNIT_TYPE_TORPEDO) my.STATE = UNITSTATE_HIT;
}

action unit_action()
{ my.event = unit_hit;
  my.emask |= ENABLE_IMPACT; //you = other object pointer

  while(1)
  { 	move_friction=0;
        unit_physics(act_unit);
  	c_move(my, vector(unit_data[act_unit][UNIT_DATA_SPEED]*time_step,0,0), vector(unit_data[act_unit][UNIT_DATA_X_FORCE]*time_step,unit_data[act_unit][UNIT_DATA_Y_FORCE]*time_step,unit_data[act_unit][UNIT_DATA_Z_FORCE]*time_step), IGNORE_PASSABLE | GLIDE);
  	
  	//sink the sub
  	if(my.STATE == UNITSTATE_HIT)
  	{
		//my.STATE = UNITSTATE_NORMAL;
		unit_data[act_unit][UNIT_DATA_Z_FORCE]-=time_step;
		unit_data[act_unit][UNIT_DATA_POWER] = 0;
			
			
	}
  		
  	wait(1);	
}




A7 Commercial
First person submarine combat simulator project
http://alexanderforeman.webs.com/fightersubgame.htm

Moderated by  HeelX, Spirit 

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