mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-01 08:59:51 -04:00
Straw-man implementation of targets/sprites/clones
This commit is contained in:
parent
1a48e75341
commit
809528abdc
7 changed files with 99 additions and 45 deletions
src/sprites
17
src/sprites/sprite.js
Normal file
17
src/sprites/sprite.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
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;
|
Loading…
Add table
Add a link
Reference in a new issue