Pages: 1
Topic closed
Okay, so. I cannot figure out how to make one of my sprites get from one side of the screen to the other without touching a few sprites I put in the middle. I have a red dot chasing a black dot, and I do not want the red dot to touch the box like sprites I put between the black dot and red dot. Any ideas? anybody? If what I'm not saying is clear, I will try and rephrase.
Offline
I suppose, but what I guess I'm trying to figure out is, say there is a 10 x 10 layout of squares, and the black dot is in the lower left hand corner and the red dot is in the upper right hand corner. Is there any possible way to make the red dot pick the fastest path through the 10 x 10 without it touching any of the squares?
Offline
gargh wrote:
Okay, so. I cannot figure out how to make one of my sprites get from one side of the screen to the other without touching a few sprites I put in the middle. I have a red dot chasing a black dot, and I do not want the red dot to touch the box like sprites I put between the black dot and red dot. Any ideas? anybody? If what I'm not saying is clear, I will try and rephrase.
Try this:
Make a second sprite in front of the red dot that looks like a triangle with both sides a different color, like this:
Make sure the costume center is on the point of the triangle.
Now, give the sprite two variables like 'touching left' and 'touching right'. Add this script:
Then, add this script to the red dot:
Change the speed to your liking, and experiment with different heights and widths of the sensor and turning speeds, to see what works best.
Does this help?
Last edited by floppy_gunk (2011-01-14 17:37:48)
Offline
I suppose you could have more sensors on the sides, and make the red dot only follow the black dot if the side sensors aren't sensing anything. Although that might make way to more glitches.
Offline
Topic closed
Pages: 1