Another newbie Morphic question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Another newbie Morphic question

mike clemow
Hi All,

I'll be perfectly frank: I'm making a simulation of Robotic Rubber
Duckies in a swimming pool.  Ideally, I'd like to import an image file
and have my "duckMorph" wear that image as a suit.  I have created a
sketchMorph, but I don't know how to programmatically instruct a morph
to look like that sketch.  I'm not sure I understand the differences
between sketchMorph and imageMorph.  I also am unsure whether I need
to use an image file read/writer, like PNGReadWriter in order to do
this.  In short, I don't know where to begin.

I'm still in the very early stages of this.  At the moment all I want
to do is create a morph and tell it to wear my duck-suit :) and then
I'm going to work that code into a proper duckMorph class with the
appropriate methods to simulate the actual robotic versions.

If someone could just point me in the right direction...

Thanks in advance,
Mike


--
http://clembie.livejournal.com
http://shadowofaculture.blogspot.com
http://deadlylittlepills.com
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Another newbie Morphic question

mike clemow
Hello,

Okay, answered my own question:

I subclassed ImageMorph, overriding the initialize method with:

initialize

        super initialize.
        self image: (Form fromFileNamed: 'ducky.png').

Now I can create a new DuckMorph.  Will Squeak support PNG
transparency?  I guess I could find that out myself.  :)

Cheers,
Mike



On 2/5/07, mike clemow <[hidden email]> wrote:

> Hi All,
>
> I'll be perfectly frank: I'm making a simulation of Robotic Rubber
> Duckies in a swimming pool.  Ideally, I'd like to import an image file
> and have my "duckMorph" wear that image as a suit.  I have created a
> sketchMorph, but I don't know how to programmatically instruct a morph
> to look like that sketch.  I'm not sure I understand the differences
> between sketchMorph and imageMorph.  I also am unsure whether I need
> to use an image file read/writer, like PNGReadWriter in order to do
> this.  In short, I don't know where to begin.
>
> I'm still in the very early stages of this.  At the moment all I want
> to do is create a morph and tell it to wear my duck-suit :) and then
> I'm going to work that code into a proper duckMorph class with the
> appropriate methods to simulate the actual robotic versions.
>
> If someone could just point me in the right direction...
>
> Thanks in advance,
> Mike
>
>
> --
> http://clembie.livejournal.com
> http://shadowofaculture.blogspot.com
> http://deadlylittlepills.com
>


--
http://clembie.livejournal.com
http://shadowofaculture.blogspot.com
http://deadlylittlepills.com
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Another newbie Morphic question

Brad Fuller-3
In reply to this post by mike clemow
mike clemow wrote:

> Hi All,
>
> I'll be perfectly frank: I'm making a simulation of Robotic Rubber
> Duckies in a swimming pool.  Ideally, I'd like to import an image file
> and have my "duckMorph" wear that image as a suit.  I have created a
> sketchMorph, but I don't know how to programmatically instruct a morph
> to look like that sketch.  I'm not sure I understand the differences
> between sketchMorph and imageMorph.  I also am unsure whether I need
> to use an image file read/writer, like PNGReadWriter in order to do
> this.  In short, I don't know where to begin.

It is recommended on the squeak wiki that ImageMorph should be used
instead of SketchMorph:

http://wiki.squeak.org/squeak/1372

I'm wondering why when you drop a JPG on the world it becomes a
SketchMorph and not an ImageMorph. Was it every thought to change this too?

>
> I'm still in the very early stages of this.  At the moment all I want
> to do is create a morph and tell it to wear my duck-suit :) and then
> I'm going to work that code into a proper duckMorph class with the
> appropriate methods to simulate the actual robotic versions.
>
> If someone could just point me in the right direction...
>
> Thanks in advance,
> Mike
>
>


--
brad fuller
www.bradfuller.com
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Another newbie Morphic question

mike clemow
Brad,

> I'm wondering why when you drop a JPG on the world it becomes a
> SketchMorph and not an ImageMorph.

Honestly, I hadn't even thought of dropping an image file onto the
world.  I had created a SketchMorph with the sketch editor at first.
Eventually, after reading the same entry you just mentioned on the
wiki, I changed my approached and subclassed ImageMorph, overriding
the initialize method with a minor change that used my rubber ducky
image as a form instead of the default image.

In the end, I decided to go back and do a few more morphic tutorials
using the immediate, incremental strategy (like the Counter Tutorial).
 I think this project is better suited for that way of programming,
and I clearly need a better grip on Morphic.  At least I have my ducks
in a row now.  :)

Thanks a bunch,
Mike

On 2/5/07, Brad Fuller <[hidden email]> wrote:

> mike clemow wrote:
> > Hi All,
> >
> > I'll be perfectly frank: I'm making a simulation of Robotic Rubber
> > Duckies in a swimming pool.  Ideally, I'd like to import an image file
> > and have my "duckMorph" wear that image as a suit.  I have created a
> > sketchMorph, but I don't know how to programmatically instruct a morph
> > to look like that sketch.  I'm not sure I understand the differences
> > between sketchMorph and imageMorph.  I also am unsure whether I need
> > to use an image file read/writer, like PNGReadWriter in order to do
> > this.  In short, I don't know where to begin.
>
> It is recommended on the squeak wiki that ImageMorph should be used
> instead of SketchMorph:
>
> http://wiki.squeak.org/squeak/1372
>
> I'm wondering why when you drop a JPG on the world it becomes a
> SketchMorph and not an ImageMorph. Was it every thought to change this too?
>
> >
> > I'm still in the very early stages of this.  At the moment all I want
> > to do is create a morph and tell it to wear my duck-suit :) and then
> > I'm going to work that code into a proper duckMorph class with the
> > appropriate methods to simulate the actual robotic versions.
> >
> > If someone could just point me in the right direction...
> >
> > Thanks in advance,
> > Mike
> >
> >
>
>
> --
> brad fuller
> www.bradfuller.com
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>


--
http://clembie.livejournal.com
http://shadowofaculture.blogspot.com
http://deadlylittlepills.com
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Another newbie Morphic question

Hilaire Fernandes-3
In reply to this post by mike clemow
mike clemow a écrit :

> Now I can create a new DuckMorph.  Will Squeak support PNG
> transparency?  I guess I could find that out myself.  :)

Yes, transparency and alpha-transparency as well. Just be sure to select
the 32bit depth for display mode in the World>Appearance menu.

Hilaire

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners