This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

danpost
danpost presents ...

2012/6/1

Line Following Demo

This is a demonstration of having an actor follow the edge of a specific color in the background of the world, or turn at specific colored dots. The color in this demo is 'blue'.

There are two view in this demo (shape view and dot view). Click on the 'dot view' object at the top-left corner of the screen to switch views.

In dot view: the actor will be guided by the one-pixel by one-pixel blue dots in the background of the world.
In shape view: the actor will, once moving onto a blue point, turn and follow the edge of the blue around the shape. You have two extra bars in this view to change the thickness of the diagonal lines drawn on the background. They are located in the top-right corner of the screen.

There are two other bar objects located in the top-left corner: one controls the method of movement (4-way or 8-way); and the other will change the 'hand' the 'follower' uses to follow the edge of the color in the world (essentially, changing the direction of movement). A third bar was added for controlling the speed. Click or click and hold in various places of the bar to see how it works.

In shape view, the thick blue ovalish shape is drawn first; then the black line; and finally, the blue lines.

The dot view was thrown in as an extra, to demonstrate the movement control gained by them using the same movement methods.

5041 views / 14 in the last 7 days

2 votes | 0 in the last 7 days

Tags: simulation demo with-source danpost edge-tracker line-follow

This scenario is a member of: Demos by danpost


open in greenfoot
Your browser does not support the canvas tag.
A new version of this scenario was uploaded on Fri Jun 01 09:53:15 UTC 2012 Minor fixes. Added world edge check while not on color yet. Also added 4 dots to control movement with.
A new version of this scenario was uploaded on Fri Jun 01 09:59:50 UTC 2012 Minor fixes. Added world edge check while not on color yet. Also added 4 dots to control movement with. Actor will now start in one of two locations. One to turn at dots, the other to follow the edge of blue color.
A new version of this scenario was uploaded on Sat Jun 02 18:22:28 UTC 2012 Added bars to click on, to change various aspects of the scenario.
A new version of this scenario was uploaded on Wed Jan 23 21:58:32 UTC 2013 A demonstration of an actor following a specified background color using various methods and shapes. Added speed control.
A new version of this scenario was uploaded on Wed Jan 23 22:03:53 UTC 2013 A demonstration of an actor following a specified background color using various methods and shapes. Added speed control.
A new version of this scenario was uploaded on 2020-10-31 12:26:32 UTC
A new version of this scenario was uploaded on 2020-10-31 12:38:32 UTC

Want to leave a comment? You must first log in.

Who likes this?

TomazVDSN paul10y