Thread: onwall and such
View Single Post
  #9  
Old 05-10-2006, 12:01 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Shaun
Not quite...

onwall2(x,y,width,height) returns a boolean value (true or false value).

So if you wanted to see if the left side of a player was blocking, for example, it would look something like this:

if (onwall2(player.x,player.y+1,1/16,2)==true) {
player.blockleft = true;
}
else {
player.blockleft = false;
}
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.