[etoys-dev] Etoys: Morphic-kfr.97.mcz

Bert Freudenberg bert at freudenbergs.de
Tue Dec 4 16:56:56 EST 2012


On 2012-12-04, at 15:18, Bert Freudenberg <bert at freudenbergs.de> wrote:

> 
> On 2012-12-04, at 13:48, karl ramberg <karlramberg at gmail.com> wrote:
> 
>> Hi
>> 
>> I found a issue with the filter implementation that I'm looking for a solution for.
>> 
>> Once a filter is added in a ScriptEditor it will not remove it self from the SketchMorph before a removeFilter is sent.
>> So if the filter is pulled out of the ScriptEditor it is still active.
>> 
>> Karl
> 
> 
> Oh, I only now tried your code. From reading it I thought you had added 6 new slots. Instead you made the filters be commands, which is not as flexible.
> 
> Here's what I thought we would do: Give the player a new numeric slot, named blur, with default value 0. When setting its value to anything other than 0, a filter is added, when setting it back to 0, the filter gets removed. Similar for the 5 other filters.
> 
> That way we don't need a "removeFilters" command, and you can easily play with the filters in the viewer because they show the current amount.
> 
> Your SketchMorph code can be exactly the same, it's just how filters get added and removed that would change. An improvement would be however if you did not add an instance variable, but stored the filters in a property. Most of the SketchMorphs will not need filtering.
> 
> - Bert -

(new version)

Yes! Isn't that much more fun to play with? We don't even need a script! :)

You need to use "self costume renderedMorph" otherwise it breaks under rotation.

Also, it's a good idea to check for #isSketchMorph and return 0 in the getter / ignore the value in the setter otherwise. It can always happen that the messages are sent to a player whose costume is not a sketch.

- Bert -




More information about the etoys-dev mailing list