jdeisenberg
02-11-2008, 05:22 PM
I have a world set up with the island/palmtree, a penguin, and a fish.
I want the penguin to be halfway between the tree and the fish (or very close to it), so I set up this loop:
penguin.move to palmtree
penguin.turn to face fish
while penguin.distance to fish != penguin.distance to palmtree
penguin.move 0.1 meter towards fish
Yes, I know that the penguin moves through the island. That doesn't bother me. What is worrisome is that the penguin moves all the way to the fish and starts bouncing back and forth. I am making some incredibly simple error, but for the life of me I cannot see what it is. The world is at http://evc-cit.info/alice/halfway.a2w
I want the penguin to be halfway between the tree and the fish (or very close to it), so I set up this loop:
penguin.move to palmtree
penguin.turn to face fish
while penguin.distance to fish != penguin.distance to palmtree
penguin.move 0.1 meter towards fish
Yes, I know that the penguin moves through the island. That doesn't bother me. What is worrisome is that the penguin moves all the way to the fish and starts bouncing back and forth. I am making some incredibly simple error, but for the life of me I cannot see what it is. The world is at http://evc-cit.info/alice/halfway.a2w