'From Squeak3.1alpha of 28 February 2001 [latest update: #4326] on 7 September 2001 at 2:40:56 pm'!
"Change Set: PlayerVectorFix-tk
Date: 7 September 2001
Author: Ted Kaehler
By setting the preference #playersAreVectors to true, Players are treated like vectors.
This change fixes a bug in the minus (-) operator that caused an error when the geometry category is viewed.
Note that after setting #playersAreVectors to true in a project, setting it to false has no effect. It is stuck on. (Hope to fix this after Scott makes major changes.)"!
!Morph class methodsFor: 'scripting' stamp: 'tk 9/7/2001 14:27'!
additionsToViewerCategoryGeometry
| list |
list _ #(geometry
(
(slot scaleFactor 'The factor by which the object is magnified' number readWrite player getScaleFactor player setScaleFactor:)
(slot left 'The left edge' number readWrite player getLeft player setLeft:)
(slot right 'The right edge' number readWrite player getRight player setRight:)
(slot top 'The top edge' number readWrite player getTop player setTop:)
(slot bottom 'The bottom edge' number readWrite player getBottom player setBottom:)
(slot width 'The width' number readWrite player getWidth player setWidth:)
(slot height 'The height' number readWrite player getHeight player setHeight:)
(slot x 'The x coordinate' number readWrite player getX player setX:)
(slot y 'The y coordinate' number readWrite player getY player setY:)
(slot heading 'Which direction the object is facing. 0 is straight up' number readWrite player getHeading player setHeading:)
(slot distance 'The length of the vector connecting the origin to the object''s position' number readWrite player getDistance player setDistance:)
(slot theta 'The angle between the positive x-axis and the vector connecting the origin to the object''s position' number readWrite player getTheta player setTheta: )
)
).
Preferences playersAreVectors ifTrue: [
list at: 2 put: (list second, #(
(command + 'Adds two players together, treating each as a vector from the origin.' player)
(command - 'Subtracts one player from another, treating each as a vector from the origin.' player)
(command * 'Multiply a player by a number, treating the Player as a vector from the origin.' number)
(command / 'Divide a player by a number, treating the Player as a vector from the origin.' number)
(command incr: 'Each Player is a vector from the origin. Increase one by the amount of the other.' player)
(command decr: 'Each Player is a vector from the origin. Decrease one by the amount of the other.' player)
(command multBy: 'A Player is a vector from the origin. Multiply its length by the factor.' number)
(command dividedBy: 'A Player is a vector from the origin. Divide its length by the factor.' number)
))].
^ list
! !