Ok I just want to know how to calculate an angle between two points, I think i should trignometric right? But how Could I calculate the angle let's say in this picture:
http://www.academiarpg.com/personal/dam ... s/img1.gif[/IMG]
This is what I did:
note: my trignometric is a bit rusty....lol
Thanx for your help!
http://www.academiarpg.com/personal/dam ... s/img1.gif[/IMG]
This is what I did:
Code:
if @point_right.y > @point_left.y
@oox = @point_right.x
@ooy = @point_left.y
@oposite = Math.sqrt(((@oox - @point_right.x)**2)+((@ooy - @point_right.y)**2))
@adjacent = Math.sqrt((@oox - @point_left.x)**2) + ((@ooy - @point_left.y**2))
@hypn = Math.sqrt(((@point_left.x - @point_right.x)**2)+((@point_left.y - @point_right.y)**2))
@sene = @oposite / @hypn
$game_player.angle = Math.cosh(@sene)
elsif @point_right.y < @point_left.y
@oox = @point_left.x
@ooy = @point_right.y
@oposite = Math.sqrt(((@oox - @point_left.x)**2)+((@ooy - @point_left.y)**2))
@adjacent = Math.sqrt((@oox - @point_right.x)**2) + ((@ooy - @point_right.y**2))
@hypn = Math.sqrt(((@point_left.x - @point_right.x)**2)+((@point_left.y - @point_right.y)**2))
@sene = @oposite / @hypn
$game_player.angle = Math.cosh(@sene)
else
@angle = 0
end
Thanx for your help!