Is there a way making an object that follows another object's collision polygon lines ?
<img src="http://new.tinygrab.com/bd08b53d3f9517b44e77f37d696f04c00981bb9abd.png" border="0" />
I don't have any idea about it. Any clue is greatly appreciated.
The easiest way I can think of is to give the moving object a value like "dir" which will go up, down, left, or right (1 - 4), and then a collision polygon of basically one pixel.
Then every tick, check the current dir value, if not touching your object at offset of 1px to the direction they are trying to go in, then add 1 to dir. (if dir = 4, then dir = 1, etc)
Then add an action to move in the direction they currently have set.
I think this would be a slow method though, and haven't tested it
Thanks for fast reply Jayjay! I will try it now.
Hmm that method I said didn't work so well for me when I gave it a try, but here's a basic example of another method to do it! (A third option is to put sprites at every join position of the base sprite to tell your tracer-object which way to turn!)
Develop games in your browser. Powerful, performant & highly capable.
Another option is to set an image point at each collision polygon point, and have the moving object cycle through each image point.
I'm hoping we eventually get expressions for X and Y coordinates of collision polygon points, as it would make things like this a whole lot easier.
Jayjay zatyka thanks for the examples guys I will look them
zatyka Thanks a lot! That's exactly what I need.