Thread: angle of player
View Single Post
  #11  
Old 08-17-2003, 07:40 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Um, find the vector parts of the player's position in regard to the center, then uset that to find the angle and the desired new pos of the player, then add the vector components to the player's pos to move them to the new pos... er, here

playerdx = playerx-centerx
playerdy = playery-centery
angle = getangle(playerdx,playerdy)
radius = (playerdx^2+playerdy^2)^.5
newposx = centerx+cos(angle+addangle)*(radius-subtractradius)
newposy = centery+sin(angle+addangle)*(radius-subtractradius)
dx = playerx-newposx
dy = playery-newposy
playerx+dx
playery+dy

[EDIT] forgot to make it go inwards [/EDIT]
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote