Sticks walls and corners

  • Hi,
    I got a problem. I'm trying to create a "saw" which is sticks the walls, but i don't know how to make this :
    alt text

    I'm using an FlxTilemap for the level, and I want the saw to go all around the level. I do not know if it's understandable...
    Maybe the better is to use FlxPath with raycasts ?

    Thanks for your help !

  • Solution 1. FlxG.collide(saw, level) and then check isTouching(FlxObject.LEFT), isTouching(FlxObject.UP) and so on. Based on them set current velocity.
    Solution 2 (better). At level launch: get yourself a starting tile and go tile-by-tile checking neighbour tiles for being the wall, like the saw, but ignoring positions between tiles. When you know your tile-by-tile path, you'll easily get point-by-point one to follow.

    If you need some details on how to analyze the tilemap tile-by-tile you can check here:

    BTW, by "not OK" you mean this is incorrect saw behaviour, or it's correct too, but you're not sure how to achieve?

  • I mean "I don't know how to make it" ^^
    I'll see your link, thank you :)

  • PS : Your 1st solution, that what I made. But, it doesn't works well in the 2nd case

Log in to reply