[Squeakland] Copy an object programmatically.

Blake blake at kingdomrpg.com
Tue Mar 7 01:48:11 PST 2006

On Mon, 06 Mar 2006 07:20:10 -0800, Randy Heiland <heiland at indiana.edu>

> 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.

Yes, thank you. So you have to do everything with the base type first and
then replace with the variable?

> You might also want to get in the habit of doing things in a playfield
> instead of in the world.

Yeah, I noticed the problems with using the world pretty quickly.

More information about the Squeakland mailing list