BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Angle finder"
, by abraham
A function that finds the angle between two co-ordinates in 2D
Code
;This Function finds the angle from X and goes anti-clockwise from (EnX#,EnY#) to (OtX#,OtY#) and returns the angle as a decimal. ;This shouldn't cause to much slow down and can be used in real time. ;Create by Ben Parbury (Benparbury@hotmail.com) aka Abraham Function Direction#(OtX#,OtY#,EnX#,EnY#) Return ATan2(otX#-EnX#,otY#-EnY#)+90 (change 90 depending on what u wanna do with it) End Function And can be used to fire bullets from player to mouse position XVel#=Cos(Direction#(PlayerX#,NumY#,MouseX(),MouseY())) YVel#=-Sin(Direction#(PlayerX#,NumY#,MouseX(),MouseY()))
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations