Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 1 invisible), 643 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Shoot and remove an Enemie in LITE-C #291790
09/27/09 23:49
09/27/09 23:49
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
Hi,

I'm trying to shoot and remove an enemie using lite-c.
The player can shoot a rocket, if the rocket hits the enemie it should be removed. But it doesn't..

Could someone look at my code aand give my some advice?

Code:
//////////////////////////////////////////////////// Enemie one

function enemie_one_handle()
{
	wait(1);
	ptr_remove(me);
}

function enemie_one_management()
{
	my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY | ENABLE_SHOOT); // make entity sensitive for block and entity collision
   my.event = enemie_one_handle;
   
   my.pan += 180;
} 

function create_enemie_one()
{
	VECTOR enemie_start_position;
	
	enemie_start_position.x = ent_player.x+100;enemie_start_position.y = ent_player.y;enemie_start_position.z = ent_player.z;
	ent_create ("soldier.mdl", enemie_start_position, enemie_one_management);`
}

///////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////// Rocket

function rocket_handle()
{
	wait(1);
	ptr_remove(me);
}

function rocket_movement()
{
	my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // make entity sensitive for block and entity collision
   my.event = rocket_handle;
   
	VECTOR temp;
	
	// Set the rocket position and pan direction.
	vec_for_vertex(temp, ent_player, 361);
	my.x = temp.x;my.y = temp.y;my.z = temp.z;
	my.pan = ent_player.pan;
	
	while(1)
	{
		c_move(my,vector(30*time_step,0,0),nullvector,IGNORE_PASSABLE | GLIDE | EVENT_SHOOT); //moves the rocket
		wait(1);
	}
}

///////////////////////////////////////////////////////////////




The more you have.. the more you can lose...
Dont tell em all you know.....
Re: Shoot and remove an Enemie in LITE-C [Re: Paulo] #291794
09/28/09 02:25
09/28/09 02:25
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
try using ent_remove instead of ptr_remove

Re: Shoot and remove an Enemie in LITE-C [Re: badapple] #291812
09/28/09 08:25
09/28/09 08:25
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
No doesn't work. The program doesn't even reach the enemie_one_handle() function.


The more you have.. the more you can lose...
Dont tell em all you know.....
Re: Shoot and remove an Enemie in LITE-C [Re: Paulo] #291827
09/28/09 11:43
09/28/09 11:43
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
I've solved it using ACTIVATE_PUSH instead of EVENT_SHOOT or ACTIVATE_SHOOT in the c_move. Now it works, smells like a bug to me..


The more you have.. the more you can lose...
Dont tell em all you know.....

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