Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-17-2003, 05:42 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
angle of player

I've been trying to script a kind of vortex that pulls with a spiraling effect. I've been able to get around several problems, but I just hit a wall. The problem is I don't know how to get the players angle. Someone suggested using getangle, but I don't quite know how it works very well. Another person sent me a whole mess of equations, which I doubt would work, but if it were to I wouldn't know the right function for inverse tangent.

first person said:
angle = getangle(playerx-centerx,playery-centery)

second person said:
prime = tan-((playery-centery)/(playerx-centerx));
if ((playerx-centerx)>=0 && (playery-centery)>=0) {angle = prime;}
if ((playerx-centerx)<=0 && (playery-centery)>=0) {angle = 180 - prime;}
if ((playerx-centerx)<=0 && (playery-centery)<=0) {angle = 180 + prime;}
if ((playerx-centerx)>=0 && (playery-centery)<=0){ angle = 360 - prime;}

Does anyone have a clue as to so they can help me out a little?
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:23 AM.


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