How to fire an object?

Posted By: pewpew

How to fire an object? - 01/15/09 11:38

Hey
Sorry about all the questions lol. I do use the search function before i ask a question to see if it has been answered before. But it tends to pick up every thread across the entire forum that contains the word "shoot"... which is quiet a few heh smile

I just have a simple question regarding shooting. I know that on_click activates the left mouse button. I am just wondering-
a) how to use left OR right click to fire
b) how to actually create a projectile from the middle of my tank (or any vehicle)

laugh
Posted By: croman

Re: How to fire an object? - 01/15/09 11:43

if(mouse_left == 1) or if(mouse_right == 1)

if(shoot)
{
bullet = ent_create("model.mdl", vector_pos, action_bullet);
vec_set(bullet.pan, tank.pan);
}

*action_bullet actually moves the bullet..ofc smile
Posted By: heinekenbottle

Re: How to fire an object? - 01/15/09 21:04

Also, I'd use flag2 on the bullet and the player tank so that the bullet ignores the tank.
Posted By: pewpew

Re: How to fire an object? - 01/15/09 23:01

awesome thanks again laugh laugh laugh
Posted By: pewpew

Re: How to fire an object? - 01/17/09 01:10

how do you make the bullets remove-on-impact?
the help menu says to use:

Code:
	me.emask |= ENABLE_IMPACT;
	me.event = game_bullet_collide;


then to have another function where:

Code:
function game_bullet_collide()
{
	if(event_type == EVENT_IMPACT)
	{
		ent_remove(me);
	}
}


doesnt seem to make bullets asplode frown
© 2023 lite-C Forums