Wall detection / Grid (help)

larin555larin555 Member Posts: 14
edited November -1 in Working with GS (Mac)
How can I make a block detect that if there's the actor "wall" to his left or right, it won't move (block.position.X + 40 for instance)...Or if there's ground under it, it won't move.

The block uses gravity btw.

I'm using Codemonkey's grid demo.

Thanks a lot!

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    If you just want it to stop the movement, you could just use collide change the wall to non moveable and set restition to zero. Otherwise you might need to use magnitude. Like tsb said explaine xactly what your trying to do.
  • larin555larin555 Member Posts: 14
    Hello,

    I'm using Codemonkey's grid demo.
    I have put walls all around the scene.

    Here, you can see how it looks like :
    http://img820.imageshack.us/img820/7304/capturedcran20101210174.png

    The orange square is the main actor.
    Blue = Pushable block
    Green = Removable ground (only removable when the main actor collides with it)

    That's pretty much it.

    Like I said, i'm using codemonkey's grid demo. So when the character moves, it change his position to +40.
    I would like to know how can I make the character detect if there's something to his left/right/top/bottom.
    So depending on what the object is, he can move or not.

    I want it to not be able to go (let's say) x-40 or x+40 if there's the WALL actor to his left or right.

    Thanks a lot
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    You need magnitude for that. Im pretty sure firmaple has a magnitude demo, or someone does. Because if i just tell you what to do , you might not get it. Look up magnitude and you should be able to figure it out.
  • larin555larin555 Member Posts: 14
    I checked it out.
    I'm not sure to understand how to use the magnitude demo in my game.

    Can you try to explain it a little bit please?

    I forgot to specify that the main actor doesn't have gravity. The pushable block does...but the main actor doesn't.

    Thank you
Sign In or Register to comment.