
08-17-2003, 07:40 AM
|
|
call me Chad, it's cooler
|
 |
Join Date: Aug 2002
Posts: 1,899
|
|
|
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] |
|
|
|