The Daily Click ::. Forums ::. Klik Coding Help ::. 360 Degree Missles
 

Post Reply  Post Oekaki 
 

Posted By Message

Ganymede Graphics

Possibly Insane

Registered
  17/04/2006
Points
  2711

GOTW JANUARY 2011
17th January, 2007 at 18:59:47 -

I've got a pretty damn annoying problem that i'm not sure how to fix. I'm also not sure on how i'm going to explain it, but i'll try my best.

Ok so i've got the character that follows the mouse, just setting position to Xmouse,Ymouse yanno that.
I've also got a missle that moves quite slowly and follows my character using a race car type movement. The movement is a 360 degree movement that i designed using sine and cosine of course that follow an alterable value that is set by the angle difference between the missle and character. Right now i've got the missle always pointing in the direction of the character so the is virtually no way of dodging the missle. What i want to happen, is make the missle have a limited turning circle instead of an instant turn.
For example if the missle is headed towards the character and you quickly move the character behind the missle, the missle would not face the character instantly, but it would do a slow circle until it was facing the character.
If anyone could give me an idea of how i would edit my engine to make it do this would be absolutely awsome.

 
Especially that.

Noyb



Registered
  31/05/2004
Points
  1117

VIP Member
17th January, 2007 at 19:13:21 -

Use two alterable variables to define the angle: angleMissile and angleToPlayer. angleToPlayer will be the angle to player, the one used in your original code. angleMissile will be the Missile's actual angle of movement.

+angleMissile < angleToPlayer
- angleMissile = angleMissile + radial velocity (a number measured in degrees / loop)

+angleMissile > angleToPlayer
- angleMissile = angleMissile - radial velocity

 
"Omg. Where did they get the idea to not use army guys? Are they taking drugs?" --Tim Schafer on originality in videogames

Reno



Registered
  11/01/2005
Points
  906
17th January, 2007 at 20:26:29 -

I know that there was a 360 engine pack which included a perfect 360 bullet engine that would probably help. I will look for it but for now I must og to the bathroom. I think I may be allergic to shellfish....

 
Reborn Again
   

Post Reply



 



Advertisement

Worth A Click