[Squeakland] Copy an object programmatically.
heiland at indiana.edu
Mon Mar 6 07:20:10 PST 2006
The key is that you can create a variable which is of type 'Player' (on the
variable's menu, select 'change value type' and choose 'Player'). E.g., I
created a player variable called 'clone1' for my sketch (actually I called
it 'clone', but apparently it conflicted with some reserved var, so a '1'
was appended). You can then
1) assign something to that var - e.g. 'sketch's copy', and
2) use that var on the left-hand of an assignment - e.g. replace the
'sketch' in 'sketch's x <- <value>' with 'sketch's clone'
Hopefully the attached image will help clarify.
You might also want to get in the habit of doing things in a playfield
instead of in the world.
Please copy the list if you still have problems.
> -----Original Message-----
> From: Blake [mailto:blake at kingdomrpg.com]
> Sent: Monday, March 06, 2006 5:26 AM
> To: Randy Heiland
> Subject: Re: [Squeakland] Copy an object programmatically.
> On Fri, 03 Mar 2006 03:56:35 -0800, Randy Heiland <heiland at indiana.edu>
> > Your question gets into the semantics of a 'copy' vs a 'sibling', but...
> Well, I think I understand that.
> > short answer:
> > http://squeakland.org/pipermail/squeakland/2005-August/002707.html
> I think what threw me is that it's called "ship's copy", which doesn't
> seem like an action.
> OK, so I make a copy and put it into the world with
> word include:ship's copy
> so how do I get a variable of ship's copy that I can set the starting
> location in the world? Or perhaps that's the wrong question. What do I do
> to get the newly created object to perform whatever actions are needed at
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 24128 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20060306/eef5f5a2/var-type-player-0001.jpg
More information about the Squeakland