[etoys-dev] Forward direction (was Re: First draft of Etoys Reference Manual Glossary)

Edward Mokurai Cherlin mokurai at sugarlabs.org
Tue Sep 25 19:08:44 EDT 2012


On Tue, September 25, 2012 12:56 pm, karl ramberg wrote:
> On Mon, Sep 24, 2012 at 8:49 AM, Edward Mokurai Cherlin
> <mokurai at sugarlabs.org> wrote:

>> forward direction: What effect or use does it have?
>
> Each player has a direction arrow that can be changed by clicking on
> it while holding shift.
> If it's not visible you can check the box 'direction arrow' in halo menu.
> When you tell a player to move forward it will move in the direction
> of the arrow.

This turns out not to answer the question I asked. You are describing
the heading, not the forward direction.

Objects move in the direction of their heading, which is the direction
of the Halo arrow, but not necessarily the same as the forward
direction. Rotating the Morph with the Rotate handle in the Halo
changes the heading but not the forward direction. Turning on the
direction arrow, and then grabbing it with a shift-click and turning
it, changes both the forward direction and the heading. These two
values can be edited in the viewer as well. Editing the heading leaves
the forward direction unchanged. Editing the forward direction also
changes the heading. The command Object forward by 5 moves the Morph
in the heading direction. I see nothing in Etoys that makes use of the
forward direction.

In Squeak, we see for the Morph class:

heading
	"Return the receiver's heading (in eToy terms)"
	owner ifNil: [^ self forwardDirection].
	^ self forwardDirection + owner degreesOfFlex

forwardDirection: newDirection
	"Set the receiver's forward direction (in eToy terms)"
	self setProperty: #forwardDirection toValue: newDirection.

degreesOfFlex
	"Return any rotation due to flexing"
	"NOTE: because renderedMorph, which is used by the halo to set
heading, goes down through dropShadows as well as transformations, we
need this method (and its other implems) to come back up through such
a chain."
	^ 0.0

and so on.

Also in Squeak, I see 19 senders of forwardDirection in 12 classes,
which I do not feel ready to explore until after I learn rather more
Squeak and Smalltalk. I can feel it coming on. ^_^

-- 
Edward Mokurai (默雷/निशब्दगर्ज/نشبدگرج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks


More information about the etoys-dev mailing list