Straw-man implementation of targets/sprites/clones

This commit is contained in:
Tim Mickel 2016-06-29 13:48:30 -04:00
parent 1a48e75341
commit 809528abdc
7 changed files with 99 additions and 45 deletions
src/sprites

17
src/sprites/sprite.js Normal file
View 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;