|
fire_bullet script some changes?
#248045
01/24/09 03:05
01/24/09 03:05
|
Joined: Jun 2007
Posts: 152 Norway
Darkyyes
OP
Member
|
OP
Member
Joined: Jun 2007
Posts: 152
Norway
|
the script that is given always shoot straight forward, how would it be if I want it to work with tilted cam as well? also is it possible to disable the fire_bullet() function to be triggered through some commands?
if (mouse_right == 1)
{
mouse_mode = 1;
my.pan = player.pan; // rotate the player using the mouse
camera.tilt = camera.tilt; // look down at the player
}
else
{
my.pan -= 6 * (mouse_force.x) * time_step; // rotate the player using the mouse
camera.tilt += mouse_force.y; // look down at the player
on_mouse_left = fire_bullets;
mouse_mode = 0;
}
the way my code is now, it will still fire bullets this is also the only place in my script the on_mouse_left is.
New to lite-c and gamestudio in general, thank you for reading. Com, A7 v7.7
|
|
|
Re: fire_bullet script some changes?
[Re: George]
#248061
01/24/09 10:05
01/24/09 10:05
|
Joined: Jun 2007
Posts: 152 Norway
Darkyyes
OP
Member
|
OP
Member
Joined: Jun 2007
Posts: 152
Norway
|
it works perfectly for me george. as when i hold right mouse button the camera wont tilt, its not fps camera. the reason why I want the "on_mouse_left = fire_bullets();" to be disabled when I hold the right mouse button is because I need it to click on panels thats why I enable mouse_mode. could you show me a way to disable the on_mouse_left only while I am holding pressing right mouse button? or someway to toogle between the modes?
New to lite-c and gamestudio in general, thank you for reading. Com, A7 v7.7
|
|
|
Re: fire_bullet script some changes?
[Re: George]
#248150
01/24/09 22:00
01/24/09 22:00
|
Joined: Jun 2007
Posts: 152 Norway
Darkyyes
OP
Member
|
OP
Member
Joined: Jun 2007
Posts: 152
Norway
|
Thanks George Got it to work as it should now. mouse button to work, but any fix for shooting problem? it shoot straight forward
action fire_bullets()
{
if (mouse_right == 1) return;
{
VECTOR trace_coords[3];
vec_set(trace_coords.x, vector(5000, 0, 0)); // trace 5000 quants in front of the player
// rotate "trace_coords"
vec_rotate(trace_coords.x, camera.pan);
vec_add(trace_coords.x, player.x); // add the resulting vector to player's position
snd_play(bullet_wav, 100, 0); // play the bullet sound
if (c_trace (player.x, trace_coords.x, IGNORE_ME + USE_POLYGON) > 0) // the "c_trace" ray has hit something?
{
if (you) // and the hit object is an entity?
{
if (you.skill1 == 99) // and the hit entity has its skill1 set to 99?
{
you.skill50 = 30; // 30 = maximum rotation speed
}
}
}
}
}
Last edited by Darkyyes; 01/24/09 23:35.
New to lite-c and gamestudio in general, thank you for reading. Com, A7 v7.7
|
|
|
Re: fire_bullet script some changes?
[Re: George]
#248392
01/26/09 16:05
01/26/09 16:05
|
Joined: Jun 2007
Posts: 152 Norway
Darkyyes
OP
Member
|
OP
Member
Joined: Jun 2007
Posts: 152
Norway
|
reason for
vec_rotate(trace_coords.x, camera.pan);
vec_add(trace_coords.x, player.x);
is that i want it to shoot from the player entity but aim exactly where my camera center is i can however change my player.pan and camera tilt with mouse but it will only shoot straight forward not downwards or upwards but what about the tilt of the camera? vec_add(trace_coords.x, camera.tilt); or vec_rotate(trace_coords.x, camera.tilt); or something? if he is going to be aiming up straight and down.
Last edited by Darkyyes; 01/26/09 16:14.
New to lite-c and gamestudio in general, thank you for reading. Com, A7 v7.7
|
|
|
|