[Squeakland] [Q] [eToys] Object under?

Karl Ramberg karl.ramberg at chello.se
Wed Aug 20 11:32:13 UTC 2003



diegogomezdeck at consultar.com wrote:
> 
> Thanks John and Karl for the answers...
> 
> Reading my original email I realized I was not so clear in the question (
> definitively I have to improve my English :-| ).
> 
> What I was looking for is a way to get a reference to *any* morph under.
> The idea is to program a type of "garbage collector" that walk around the
> world and take any morph on the world (the garbage) and carries it to
> a "safe" place.
> 
> I mean something like this:
> 
>    lookForGarbage
>       self walkAround. "walk randomly over the world"
>       (self morphUnder = World)
>          ifTrue:[
>             self morphUnder owner: self.
>             self pauseScript: #lookForGarbage.
>             self startScript: #carryTheGarbageToASafePlace].
> 
> I hope this time I explained my needs better than before.

All morphs in world are accessed in world viewer>>collections.
You can check if you overlap any morph in 'world playerAtCursor' from
there. 
But self is also kept there so the script will be a little complicated.

Karl



More information about the Squeak-dev mailing list