Problem in Morph translation

Roland Bertuli Roland.Bertuli at sophia.inria.fr
Tue Jul 23 12:34:06 UTC 2002


Hi,
I am novice in Squeak, and i have a problem to translate Morph
I want to rotate a Morph and translate it forward. But it doesn't work.
In this exemple, the Morph has been rotate of 90 degrees, but it goes on
the right side, why?


Regards.


Roland
-------------- next part --------------
'From Squeak3.2gamma of 15 January 2002 [latest update: #4913] on 23 July 2002 at 2:31:58 pm'!
EllipseMorph subclass: #TestMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'NatureLife'!

!TestMorph methodsFor: 'as yet unclassified' stamp: 'rb 7/23/2002 14:29'!
forward: anInteger 
	| x y headingRad |
	"Translate a degree angle to in radian"
	headingRad _ self heading * Float pi / 180.
	x _ (headingRad cos * anInteger) asInteger.
	y _ (headingRad sin * anInteger) asInteger negated.
	Transcript show: x asString , '  ' , y asString;
		 cr.
	self move: x @ y! !

!TestMorph methodsFor: 'as yet unclassified' stamp: 'rb 7/23/2002 12:50'!
initialize
	super initialize.
	self rotationCenter: 0.5 at 0.5! !

!TestMorph methodsFor: 'as yet unclassified' stamp: 'rb 7/23/2002 13:46'!
move: aPoint 
	self position: self position + aPoint! !

!TestMorph methodsFor: 'as yet unclassified' stamp: 'rb 7/23/2002 13:19'!
step
	self heading: 90.
	self forward: 5! !

!TestMorph methodsFor: 'as yet unclassified' stamp: 'rb 7/23/2002 10:24'!
stepTime
	^ 1000! !


More information about the Squeak-dev mailing list