mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 23:42:23 -05:00
18 lines
457 B
JavaScript
18 lines
457 B
JavaScript
|
var Clone = require('./clone');
|
||
|
var Blocks = require('../engine/blocks');
|
||
|
|
||
|
function Sprite (blocks) {
|
||
|
// Sprites have: shared blocks, shared costumes, shared variables, etc.
|
||
|
if (!blocks) {
|
||
|
// Shared set of blocks for all clones.
|
||
|
blocks = new Blocks();
|
||
|
}
|
||
|
this.blocks = blocks;
|
||
|
this.clones = [];
|
||
|
|
||
|
// Initial single clone with the shared blocks.
|
||
|
this.clones.push(new Clone(this.blocks));
|
||
|
}
|
||
|
|
||
|
module.exports = Sprite;
|