Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-14-2011, 06:55 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by kingcj View Post
Ok Thanks, the circle works fine, but I can't seem to getangle() to show the angle of said circle. I am unsure of how to get the angle of the circle.
Sorry I could also use a little help with delta x and delta y (Like if the mouse is in front of the player and the player is following it) I have tried getdir() but it only works for Right and Down.
getangle and getdir are quite simple after you understand it. You pass it the delta (final position minus the initial position) values between two points and it'll give you the angle/direction towards the final position.

PHP Code:
//#CLIENTSIDE
function onCreated() setTimer(0.05);

function 
onTimeout() {
  
temp.delta_x mousex player.x;
  
temp.delta_y mousey player.y;
  
temp.ang getangle(temp.delta_xtemp.delta_y);
  
temp.ndir getdir(temp.delta_xtemp.delta_y);
  
with (findimg(200)) {
    
player.cos(temp.ang) * 5;
    
player.sin(temp.ang) * 5;
    
image "block.png";
  }
  
with (findimg(201)) {
    
mousex;
    
mousey 0.5;
    
text temp.ang SPC radtodeg(temp.ang);
    
textshadow true;
  }
  
player.dir temp.ndir;
  
setTimer(0.05);

__________________
Quote:

Last edited by fowlplay4; 01-14-2011 at 05:16 PM..
Reply With Quote
Reply


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 10:36 PM.


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