My car is 8 tiles by 11 tiles at direction 0, and the equation I tried was:
PHP Code:
dx = (x+(8+vecx(prevdir)*3)/2) - playerx;
dy = (y+(8+vecy(prevdir)*3)/2) - playery;
playerx = (x+(8+vecx(dir)*3)/2) + dy + vecy(dir)*3;
playery = (y+(8+vecy(dir)*3)/2) + dx + vecx(dir)*3;
It works for directions 0 and 1, (which is probably just a coincidence) but the rest it throws the player off to some other position, sometimes not even in the car