Hi,
I'd like to get a reference to the morph under the given object. The same idea behind color-under but with a reference to a morph instead to a color.
Is it possible?
TIA,
Diego
Use the "overlaps" tile; a sample script, looked at in text mode, would look like this:
script1 self forward: 5. (self overlaps: Ellipse1) ~~ false ifTrue: [self beep: 'coyote']
Best,
John
-----Original Message----- From: squeakland-bounces@squeakland.org [mailto:squeakland-bounces@squeakland.org]On Behalf Of diegogomezdeck@consultar.com Sent: Tuesday, August 19, 2003 5:25 PM To: squeak-dev@lists.squeakfoundation.org Cc: squeakland@squeakland.org Subject: [Squeakland] [Q] [eToys] Object under?
Hi,
I'd like to get a reference to the morph under the given object. The same idea behind color-under but with a reference to a morph instead to a color.
Is it possible?
TIA,
Diego
_______________________________________________ Squeakland mailing list Squeakland@squeakland.org http://squeakland.org/mailman/listinfo/squeakland
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.
Cheers,
Diego
Use the "overlaps" tile; a sample script, looked at in text mode, would look like this:
script1 self forward: 5. (self overlaps: Ellipse1) ~~ false ifTrue: [self beep: 'coyote']
Best,
John
-----Original Message----- From: squeakland-bounces@squeakland.org Sent: Tuesday, August 19, 2003 5:25 PM To: squeak-dev@lists.squeakfoundation.org Cc: squeakland@squeakland.org Subject: [Squeakland] [Q] [eToys] Object under?
Hi,
I'd like to get a reference to the morph under the given object. The same idea behind color-under but with a reference to a morph instead to a color.
Is it possible?
TIA,
Diego
diegogomezdeck@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
diegogomezdeck@consultar.com wrote:
Hi,
I'd like to get a reference to the morph under the given object. The same idea behind color-under but with a reference to a morph instead to a color.
Is it possible?
At least in 3.6 there is a test called 'overlaps' and it is a very good collision detector. You can fx. paint gears that that turn when the teeth overlaps the other gears teeth. Lots of fun :-)
Karl
squeakland@lists.squeakfoundation.org