Im having a little trouble with this script, it works fine and the angles are all good except that the bullet that the script fires is slower at 45 degree angles. When the angle gets closer to 90 degrees or 0 degrees the bullet goes WAY too fast. Im sure theres an easy mathematical solution but im not sure what it is, anyone have an idea? (Im aware of the other problems with this script such as firing from x = 0 or y = 0, ill fix them later, all I need is a solution to this problem and no other)
(Relevent code and entire project is here)
-Charles-
(Relevent code and entire project is here)
Code:
angle = (Math.atan2( ((Mouse.pixels[1]-240)*-1), (Mouse.pixels[0]-320) ))*57.3065
bullet.x_speed = (@bulletspeed / Math.sin(angle/57.3065)) #Set the x speed
bullet.y_speed = (@bulletspeed / Math.cos(angle/57.3065)) #set the y speed
Heres the entire project
http://www.box.net/shared/1npcv8f8kw
-Charles-