Thread: onwall and such
View Single Post
  #12  
Old 05-10-2006, 01:44 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by jake13jake
onwater/onwater2 checks for lava and water tiles
onwall/onwall2 checks for anything that should be blocking according to the default system (includes players/npcs).

onwall(x,y) tells you if the specified coordinate is blocked
onwall2(x,y,w,h) tells you if there is anything blocking within the specified area
That is pretty much exactly what I said, except you tried to add the 'players/npcs' thing, but left something out. If it is a no playerkilling zone (or the noplayersonwall() function is called, players are not counted as blocking.)

Quote:
Originally Posted by jake13jake
a little bit of redundancy here.
onwall2(player.x,player.y+1,1/16,2)==true
true == true returns true
false == true returns false
so you can just do: if (onwall2(x,y,w,h))
otherwise it would be doing a double comparison, which should be avoided, although it really won't matter much unless you're doing a long for loop or something.
It's not redundancy. You are not doing double comparisons. That is the exact same thing as if you leave it out.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")