Hey guys,
Im trying to make an RPG type game for a school project and I need help with a bit of code. Basically, im trying to make an arrow shoot from my archers bow(located in the middle of the screen) to the location of my cursor. Here’s my code:
In the MouseDown event:
dim angle as double
MpositionX = system.mousex-(canvas1.width/2)
MpositionY = (canvas1.height/2)-system.mousey
angle = atan2(MpositionY , MpositionX)*180/pi
Vh=5cos(angle)
Vv=5sin(angle)
In my timer:
ArrowPositionX=ArrowPositionX+Vh
ArrowPositionY=ArrowPositionY-Vv
the arrow just goes in a completely random direction.
does anyone know why??
thanks!!