&& doubt

hi

isnt this:


    if(!land.hitTestPoint(castx,casty,true))
    {
     if(!land.hitTestPoint(castx,castyc,true))
     {
      if( !land.hitTestPoint(castx,castyb,true))
      {
                   hero.x += speedx;
      }
     }
    }

suposed to equal this:


if(!land.hitTestPoint(castx,casty,true) && !land.hitTestPoint(castx,castyc,true)&& !land.hitTestPoint(castx,castyb,true))
    {
        hero.x += speedx;
    }

im getting erratic results from the second example.

you know why?

thank you.

thank you, that worked.

can you explain what’s the difference of not having a space?

The ActionScript parser steps through the spaces. Without the space there, it can’t see the logical AND (&&), and therefore skips over it, and your comparison falls on its ***. Outside of that, it probably ruins your hittest as well :slight_smile:

Happy coding :slight_smile:

thank you.