This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-11-08 23:45:16

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

◄Hidden Feature► Cloning Sprites in Flash Player

I just discovered that there are two hidden blocks in the flash player. If you make a block with the selector 'createClone' and run it in the flash player, it will create a clone of that sprite! The selector 'deleteClone' deletes the sprite it runs in. I made an example here.

To make the cloning blocks in Scratch, you need to add two blocks called 'clone me' and 'delete me' to the sprite blockspecs. Here is a tutorial on installing block.

http://img845.imageshack.us/img845/6443/cloneme.gif

Code:

Blockspec:
('clone me' #- #createClone)

Code:
createClone
    | t2 t3 |
    t2 _ self ownerThatIsA: ScratchFrameMorph.
    t2 ifNil: [t2 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
    t2 ifNil: [^ self].
    t3 _ self fullCopy.
    t3 objName: objName , ' clone'.
    t3 isClone: true.
    t3 blocksBin
        allMorphsDo: [:t4 | (t4 isKindOf: BlockMorph)
                ifTrue: [t4 stop]].
    t2 workPane addMorph: t3

http://img209.imageshack.us/img209/6596/deleteme.gif

Code:

Blockspec:
('delete me' #- #deleteClone) 

Code:
deleteClone
    self undoableDeleteSprite

There is also a hat block that is called when a clone is created and it's selector is 'whenCloned' and I am to lazy to create code for it ATM. Feel free to donate some code if you want.  tongue

Last edited by MathWizz (2011-11-13 22:57:58)


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#2 2011-11-09 00:15:24

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

Looks like the Flash Player slows down after about 50 clones. Nice find!

Offline

 

#3 2011-11-09 01:24:30

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

cool! i wonder how long will it take till ST will delete this post and update the flash player  big_smile

Offline

 

#4 2011-11-09 01:29:56

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

Awesomesauce.


Yawn.

Offline

 

#5 2011-11-09 02:55:12

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

I sense some cloning projects  smile


http://i.imgur.com/zeIZW.png

Offline

 

#6 2011-11-09 03:09:41

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

Can you give me the link to where you found the flash source?


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#7 2011-11-09 08:17:46

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

roijac wrote:

cool! i wonder how long will it take till ST will delete this post and update the flash player  big_smile

tongue

rookwood101 wrote:

I sense some cloning projects  smile

I'm planning on making a tower defense game.  big_smile

Last edited by MathWizz (2011-11-09 08:23:36)


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#8 2011-11-09 08:26:48

rabbit1131
Scratcher
Registered: 2009-10-16
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

MathWizz wrote:

roijac wrote:

cool! i wonder how long will it take till ST will delete this post and update the flash player  big_smile

tongue

rookwood101 wrote:

I sense some cloning projects  smile

I'm planning on making a tower defense game.  big_smile

Mmmhmmm... 1s1s will have a new meaning.


The Intergalactic Adventures of Revesilia! I hope you will partake in this gigantic undertaking, to build the sequel to the hit map The Adventures of Revesilia! The Intergalactic Adventures of Revesilia Map Builders Application thread! http://internetometer.com/image/35004.png

Offline

 

#9 2011-11-09 08:45:16

slinger
Scratcher
Registered: 2011-06-21
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

rabbit1131 wrote:

Mmmhmmm... 1s1s will have a new meaning.

No kidding.


http://s0.bcbits.com/img/buttons/bandcamp_130x27_blue.png

Offline

 

#10 2011-11-09 08:47:05

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

Updated. Now has a tutorial on making the new blocks.  big_smile


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#11 2011-11-09 10:01:30

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

roijac wrote:

cool! i wonder how long will it take till ST will delete this post and update the flash player  big_smile

You never know, maybe the Scratch Team purposely left it in there so we could find it and use it to our advantage.  wink

Offline

 

#12 2011-11-09 12:22:43

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

It's said that we can only use this until the team finds out.
I wish they'd keep it...  sad

Offline

 

#13 2011-11-09 12:26:20

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

Magnie wrote:

roijac wrote:

cool! i wonder how long will it take till ST will delete this post and update the flash player  big_smile

You never know, maybe the Scratch Team purposely left it in there so we could find it and use it to our advantage.  wink

Yeah, maybe they're preparing the player for 2.0!
(Duh, they're making the player because of 2.0. xP)

Offline

 

#14 2011-11-09 12:37:23

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

LS97 wrote:

It's said that we can only use this until the team finds out.
I wish they'd keep it...  sad

...?


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#15 2011-11-09 12:42:38

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

MathWizz wrote:

LS97 wrote:

It's said that we can only use this until the team finds out.
I wish they'd keep it...  sad

...?

I'm 80% sure they will remove the feature/disable it.

Anyhow, how do you explain this?

Offline

 

#16 2011-11-09 12:48:41

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

LS97 wrote:

Anyhow, how do you explain this?

Looks like both the main and the cloned sprites are moving so they stay on top of each other.


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#17 2011-11-09 12:58:59

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

MathWizz wrote:

LS97 wrote:

Anyhow, how do you explain this?

Looks like both the main and the cloned sprites are moving so they stay on top of each other.

Ah... that could be a problem. However I made a script for that purpose on purpose!
Never mind -- works now. Epic find!

Last edited by LS97 (2011-11-09 13:00:30)

Offline

 

#18 2011-11-09 22:18:25

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

This is really nice! Finally, a custom block that will work online!


I am currently http://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=imagehttp://blocks.scratchr.org/API.php?user=GP1&action=onlineStatus&type=text and I finally got over 1000 posts.

Offline

 

#19 2011-11-10 14:52:40

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

GP1 wrote:

Finally, a custom block that will work online!

...


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#20 2011-11-10 14:59:35

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

How did you find this? Did you decompile the Flash player? Can you post a link to the decompiled source?


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#21 2011-11-10 15:17:46

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

rubiks_cube_guy238 wrote:

How did you find this? Did you decompile the Flash player? Can you post a link to the decompiled source?

Sadly, no.  sad  I have a trial version of an SWF decompiler and cannot export anything.


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#22 2011-11-10 16:39:21

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

On the project.you asked me how I knew about this. Look at the forum new mod development, I bumped it for you  wink


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#23 2011-11-11 10:54:38

rabbit1131
Scratcher
Registered: 2009-10-16
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

Yoicks, this makes Tower Defense games easy now (0)-(-)


The Intergalactic Adventures of Revesilia! I hope you will partake in this gigantic undertaking, to build the sequel to the hit map The Adventures of Revesilia! The Intergalactic Adventures of Revesilia Map Builders Application thread! http://internetometer.com/image/35004.png

Offline

 

#24 2011-11-13 14:36:59

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

MathWizz wrote:

rubiks_cube_guy238 wrote:

How did you find this? Did you decompile the Flash player? Can you post a link to the decompiled source?

Sadly, no.  sad  I have a trial version of an SWF decompiler and cannot export anything.

Yes you can...

Ctrl+A.
Ctrl+C.
Ctrl+V.


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#25 2011-11-13 22:12:21

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: ◄Hidden Feature► Cloning Sprites in Flash Player

rubiks_cube_guy238 wrote:

Ctrl+A.
Ctrl+C.
Ctrl+V.

Already tried.  hmm


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

Board footer