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
3 registered members (TipmyPip, AndrewAMD, NewbieZorro), 16,055 guests, and 7 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
Shooting a bullet #290633
09/20/09 13:25
09/20/09 13:25
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
Hi,

Im shooting a bullet, from 20 quands infront of the player and when the bullet hits a wall the bullet is removed. It works but, when i use ptr_removed(me) or ent_removed(me) to remove the bullet, the next bullet isnt created on the players x-as but I believe on the global x-as. It doesnt mather wich .pan the player has the bullet isnt created in front of the player.

This problem doesnt ocure when I dont remove the bullets.

Could anybody help me out?

Thanks

code:

Code:
function bullet_handle()
{
    switch (event_type)
    {
      case EVENT_BLOCK:
         wait(1);
         ptr_remove(me);
         return;
     case EVENT_ENTITY:
         //wait(1);
	 //ent_remove(me);
         return;
    }	
}

function move_bullet()
{
	//set(my,INVISIBLE);
	while(enet_ent_globpointer(my) == -1) {wait(1);} //wait until the entity gets a global pointer
	enet_send_angle(enet_ent_globpointer(my),-1);
	
	my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // make entity sensitive for block and entity collision
        my.event = bullet_handle;
	
	while(1)
	{
		c_move(my, vector(60 * time_step, 0, 0), nullvector, 0);
		wait(1);
	}
}

function shootWeapon()
{
	if(mouse_left == ON)
	{
		ENTITY* bullet;
		VECTOR* temp;
		if(players[cl_id] != NULL)
		{
			vec_set(temp,vector(20,0,29));
			vec_rotate(temp,vector(players[cl_id].pan,camera.tilt,players[cl_id].roll));
			vec_add(temp,players[cl_id].x);
			
			bullet = enet_ent_create(_str("Bullet.mdl"),temp,_str("move_bullet"));
			bullet.pan = players[cl_id].pan;
			bullet.tilt = camera.tilt;
		}
	}
}




The more you have.. the more you can lose...
Dont tell em all you know.....
Re: Shooting a bullet [Re: Paulo] #290878
09/22/09 04:48
09/22/09 04:48
Joined: Jul 2008
Posts: 2,110
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,110
Germany
Maybe ure bullets remove each other ?

I would try:

Code:
function move_bullet()
{
 MY.SKILL1 = 123;
 ...
 ..
}

function bullet_handle()
{
    switch (event_type)
    {
      case EVENT_BLOCK:
         wait(1);
         ptr_remove(me);
         return;
     case EVENT_ENTITY:
         IF(YOU!=NULL)&&(YOU.SKILL1==123) { Return; }
         wait(1);
	 ent_remove(me);
         return;
    }	
}



Or what do u mean with "next bullet isnt created" ?

Last edited by rayp; 09/22/09 04:52.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Shooting a bullet [Re: rayp] #290930
09/22/09 13:28
09/22/09 13:28
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
The next bullet wasnet created at the right position, but I've managed to solve this now. But thanks anyway !


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

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