Thread: Player on Npc
View Single Post
  #1  
Old 03-02-2011, 09:15 AM
kingcj kingcj is offline
Registered User
kingcj's Avatar
Join Date: Apr 2006
Location: TN
Posts: 114
kingcj will become famous soon enough
Send a message via MSN to kingcj
Player on Npc

I've tried a variety of different ways, but they all seem inconsistent so I'll just show and ask. I'm trying to detect the player on an npc, which really seems easy enough but for some reason acts very strange with this code.

PHP Code:
if (player.x > this.x && player.x < this.x+2 && player.y > this.y && player.y < this.y+2) 
Now I am doing this check in a timeout and clientside, and yes I did set a timer. What I see it doing is checking for the player inside these positions.
What it actually does is, sometimes it checks for the player.
My Timer is set at .1 so that's not the problem. Also i've played with the plus and minus from the this.x and this.y, but it just seems that it doesn't always catch the player on top of the npc which would be these coordinates.
Any suggestions would be awesome.
__________________
Zie

"It is not necessary to change. Survival is not mandatory." - W. Edwards Deming
Reply With Quote