Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Pushing players at an angle. (https://forums.graalonline.com/forums/showthread.php?t=134265858)

Emera 02-28-2012 10:14 PM

Pushing players at an angle.
 
2 Attachment(s)
I'm trying to work on something where players who are in a certain vicinity to the player will be pushed away according to their distance and position to the player. I've managed to figure out a very simple method of doing so, but it's not as effective as I think it could be and only pushes in four directions according to my player's direction. The image attached will hopefully explain it better than I have, but if anybody could lend me a hand, I'll greatly appreciate it.

fowlplay4 02-28-2012 10:40 PM

Calculate the angle, move player based on that angle.

PHP Code:

temp.angle getangle(player.other.xplayer.other.y);
player.+= cos(temp.angle);
player.-= sin(temp.angle); 



All times are GMT +2. The time now is 05:15 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.