Players and Costumes


This is working too with Etoys putting this code in a script written with smalltalk.

You just have to write self costume instead of self since in a script self will refer to the player and self costume will refer to the morph.

as example:

 

self costume say: 'something'

 

If you add a parameter of type text (menu of script viewer) you can make an easy to use tile: object's say:abc.

 

If this script is in a sketchMorph or a playfield, it is easy to let children draw characters and let them tell stories with Etoys too.


You can use

 

aMorph setBalloonText: 'some text'

 

to change the text displayed when you mouse over but the attached changeset

probably does something closer to what you want. I loaded it into a BotsInc

image and it seemed to work fine. From the comment in the changeset:

 

This changeset provides a somewhat generalized means of have a morph

communicate. Right now the default(and only) implementation uses

BalloonMorphs but the code is setup to use any object which understands

#string:for:. Text-To-Speech should be pretty easy to implement. These

methods provide options not available with showBalloon: which keeps the

balloon onscreen until a mouse event occurs. Also showBalloon: clears any

existing balloons so two morphs can't display balloons simultaneously with

showBalloon:(see example below). No unit tests are provided but the

following lines exercise the core capabilities.

 

e _ EllipseMorph new openInWorld.

e sayHelp

e say: 'something'

e say: 'something' duration: 7

e after: 2 say: 'something'

e after: 2 say: 'something' duration: 7

 

 

At some point the balloon morph could be returned so that it's contents and

the duration it stays on screen could be tested.

 

b_ RectangleMorph new openInWorld

b showBalloon: 'testing'.""is never seen""

e showBalloon: 'me too'