Update index.js

This commit is contained in:
TheBrokenRail 2016-12-02 16:30:34 -05:00 committed by GitHub
parent f2a08b466d
commit 05a827c0ea

View file

@ -170,9 +170,16 @@ VirtualMachine.prototype.fromJSON = function (json) {
var i = 0; var i = 0;
for (; i < obj.sprites.length; i++) { for (; i < obj.sprites.length; i++) {
var blocks = new Blocks(); var blocks = new Blocks();
var z = null;
for (z in obj.sprites[i].sprite.blocks) {
blocks[z] = obj.sprites[i].sprite.blocks[z];
}
var sprite = new Sprite(blocks, this.runtime); var sprite = new Sprite(blocks, this.runtime);
var y = null; var y = null;
for (y in obj.sprites[i].sprite) { for (y in obj.sprites[i].sprite) {
if (y === 'blocks') {
continue;
}
sprite[y] = obj.sprites[i].sprite[y]; sprite[y] = obj.sprites[i].sprite[y];
} }
var target = sprite.createClone(); var target = sprite.createClone();