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.
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
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.
Last edited by MathWizz (2011-11-13 22:57:58)
Offline
Looks like the Flash Player slows down after about 50 clones. Nice find!
Offline
Awesomesauce.
Offline
Can you give me the link to where you found the flash source?
Offline
roijac wrote:
cool! i wonder how long will it take till ST will delete this post and update the flash player
rookwood101 wrote:
I sense some cloning projects
I'm planning on making a tower defense game.
Last edited by MathWizz (2011-11-09 08:23:36)
Offline
MathWizz wrote:
roijac wrote:
cool! i wonder how long will it take till ST will delete this post and update the flash player
rookwood101 wrote:
I sense some cloning projects
I'm planning on making a tower defense game.
Mmmhmmm... 1s1s will have a new meaning.
Offline
roijac wrote:
cool! i wonder how long will it take till ST will delete this post and update the flash player
You never know, maybe the Scratch Team purposely left it in there so we could find it and use it to our advantage.
Offline
It's said that we can only use this until the team finds out.
I wish they'd keep it...
Offline
Magnie wrote:
roijac wrote:
cool! i wonder how long will it take till ST will delete this post and update the flash player
You never know, maybe the Scratch Team purposely left it in there so we could find it and use it to our advantage.
Yeah, maybe they're preparing the player for 2.0!
(Duh, they're making the player because of 2.0. xP)
Offline
MathWizz wrote:
LS97 wrote:
It's said that we can only use this until the team finds out.
I wish they'd keep it......?
I'm 80% sure they will remove the feature/disable it.
Anyhow, how do you explain this?
Offline
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
GP1 wrote:
Finally, a custom block that will work online!
Offline
How did you find this? Did you decompile the Flash player? Can you post a link to the decompiled source?
Offline
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. I have a trial version of an SWF decompiler and cannot export anything.
Offline
On the project.you asked me how I knew about this. Look at the forum new mod development, I bumped it for you
Offline
Yoicks, this makes Tower Defense games easy now (0)-(-)
Offline
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. I have a trial version of an SWF decompiler and cannot export anything.
Yes you can...
Ctrl+A.
Ctrl+C.
Ctrl+V.
Offline