![]() |
Moving the player along an angle.
I'm trying to move the player along an angle from point A to point B using getangle(). However I'm not quite sure how to pull out a set of coordinates that are along that angle. Though I dont suppose there would be any way to somehow use move() on the actual player as an alternative is there?
Any advice? |
Quote:
|
Basically look up trigonometry on wikipedia, I am sure they have useful diagrams, I was going to post one but it appears I lost it. Also probably more like -cos
|
PHP Code:
|
otoh if you know the destination you can just take the vector to there, normalise it and then multiply it with how far you want to move
distx = 32 - player.x; disty = 32 - player.y; sqrtdist = sqrt(distx^2 + disty^2); dx = r * distx / sqrtdist; dy = r * disty / sqrtdist; |
Thanks guys, I think I've got it working now :)
|
| All times are GMT +2. The time now is 10:38 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.