View Single Post
  #5  
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