SHARE
TWEET
Untitled
a guest
Jan 29th, 2018
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- function pointonslope(x,y)
- --returns true if x,y overlaps
- --some slope
- if not fget(mget(flr8(x),flr8(y)),1) then
- --tile isn't a slope
- return false
- end
- --define slope of tile
- px1=flr8(x)*8
- px2=px1+8
- py1=flr8(y)*8+8
- py2=py1-8
- if fget(mget(flr8(x),flr8(y)),2) then
- --halfstep up
- py2=py1-4
- end
- if fget(mget(flr8(x),flr8(y)),3) then
- --halfstep up 2
- py1-=4
- py2-=1
- end
- if fget(mget(flr8(x),flr8(y)),4) then
- --fullstep up
- --this is default so eh
- py2-=1
- end
- if fget(mget(flr8(x),flr8(y)),5) then
- --fullstep down
- py1=py2
- py2+=8
- py1-=1
- end
- if fget(mget(flr8(x),flr8(y)),6) then
- --halfstep down 2
- py1=py2
- py2+=4
- py1-=1
- end
- if fget(mget(flr8(x),flr8(y)),7) then
- --halfstep down
- py2=py1
- py1-=4
- end
- --now check if x,y is below
- --the line between p1 and p2
- t=(px2-x)/8
- ly=lerp(py1,py2,1-t)
- if (ly<=y) return true
- return false
- end
RAW Paste Data

