Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / grenade formula

Author
Message
Turoid
20
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 24th Aug 2004 18:40
hi guys,

i'm making a game for the TGC compo and i have chosen to do sorched earth. I have the shooting and moving of the player and AI done, but i have no idea how to make that the enemy knows at what angle he must shoot. I have made a distance check, so it checks the distance between the player and the enemy. The thing i need is a formula that calculates what angle is needed by which distance to hit the player.

thanks in advance,

syntax error??? it isn't an error, it is a feature

Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 24th Aug 2004 19:38
try a binary search (thats any method that uses half the previous value to "home in" on it`s target), if the angle shoots past the player then subtract half of it, if its short then add half the angle, then if thats under then add half the angle, if its over then add half, repeat untill you hit the target, simple and effective, maybe too effective, you might like to muddle the issue by constantly varying the wind a bit or something.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster.

Login to post a reply

Server time is: 2024-09-22 22:30:39
Your offset time is: 2024-09-22 22:30:39