View Single Post
  #4  
Old 02-24-2002, 05:50 AM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
um...

it gives u the value you have to add or substract to do movement to one of the 4 specified dirs:

dir 0 (up)
vecx(0) = 0
vecy(0) = -1

dir 1 (left)
vecx(1) =-1
vecy(1) = 0

dir 2 (down)
vecx(2)=0
vecy(2)=1

dir 3 (right)
vecx(3)=1
vecy(3)=0

so that means if u use playerdir instead of the numbers
x=playerx+vecx(playerdir);
y=playery+vecy(playerdir);

will always give u the tile 1 field in front of the player

to get it exactly in the middle front of the player u have to add 1.5 to x and 2 to y:

x=playerx+1.5+vecx(playerdir);
y=playery+2+vecy(playerdir);
__________________
No Webhost at the moment
Reply With Quote