Thread: angle of player
View Single Post
  #4  
Old 08-17-2003, 06:11 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
if (created) {
drawoverplayer;
dontblock;
centerx = 30.5;
centery = 32;
pull = .3;
timeout=.05;
}
if (timeout) {

//angle=??
radius=((playerx-centerx)^2+(playery-centery)^2)^.5;
x = centerx + sin(angle/180*pi)*radius;
y = centery + cos(angle/180*pi)*radius;

if (playerswimming){
if (playerx>centerx){playerx-=pull;}
if (playerx<centerx){playerx+=pull;}
if (playery>centery){playery-=pull;}
if (playery<centery){playery+=pull;}
}

This is the npc so far.
The only += and -= are going to be in the pull.
I haven't added the pull that is going to attract to the npc's x and y yet, but that's simple.
I also haven't put restrictions as to how wide of an area it affects, but that's simple too.
I want the angle to be playerangle+degrees... that's the one thing I'm stuck on.
If you're wondering why I'm using drawoverplayer and don't block, it's because I'm using an image to test the movements.
Reply With Quote