Ok George (or anybody) now i need some help
function kick_ball() // moves the ball when the player presses the left mouse button
{
if (club.invisible) {return;} // don't hit the ball if the club is invisible
while ((joy_3) && (shot_time.x < 1000)) // wait until the player releases the mouse button or the shot power has reached its max was mouse_left
{
shot_time.x += 50 * time_step; // increase the power of the shot
club.tilt = -shot_time.x / 20; // and tilt the club backwards accordingly
wait (1);
}
while (joy_3) // wait until the player releases the left mouse button
{
if (shot_time.x >= 1000) // a max power shot is on its way?
{
club.tilt = -shot_time.x / 20; // then keep the club in its proper position!
}
wait (1);
}
number_of_shots += 1; // increase the number of shots
shot_time.y = 0;
shot_time.z = 0;
vec_rotate (shot_time, club.pan); // rotate shot_time in the direction pointer by the club
phent_addvelcentral (ball, shot_time); // and add a linear velocity to the ball
snd_play (ball_wav, 100, 0); // play the ball impact sound
shot_time = 0; // and then reset the shot power
}
}
//function hit_ball()
//{
// while(1)
// {
// if (joy_3 == on)
// {
// kick_ball();
// }
// }
//}//
on_mouse_left = kick_ball; // press the left mouse button to strike the ball//
using the above code i can now use joystick(gamepad) button 3 to kick ball but only if mouse left is also clicked. I tried to use function hit ball so that only the joystick or gamepad was used but it won't work. What am i missing? I understand if this is moved to another area as i'm not sure it should be posted here. Thank you in advance for any help!!