Thread: gani help
View Single Post
  #3  
Old 06-21-2002, 03:31 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Why use a whole sin-cos forumla? Distance formula would work too, and require far less effort.

just check all the players around you to see if they are in your area, and hit them if they are there. Rather then sending unneccessary actions to the server

NPC Code:

for(i=0;i<playerscount;i++) {
dist = ((players[i].x+1-playerx+1)^2+(players[i].y+1-playery+1)^2)^.5;
if(dist < 5) {
hitobjects power,players[i].x+1,players[i].y+1;
}
}


as long as there arent 100 players on the same level, you should have a problem with lag, and it would be far less error ridden than using something in a circle.

If you would like to only hit players in a certain area away from you, you could also try

if(dist in |3,5|) or so. People close to you wouldnt get hit, however people farther away would.

the blue text you must edit
__________________

subliminal message: 1+1=3