diff options
| author | Code WvS <code-wvs@quantentunnel.de> | 2015-02-27 18:29:29 +0100 |
|---|---|---|
| committer | Code WvS <code-wvs@quantentunnel.de> | 2015-02-27 18:29:29 +0100 |
| commit | ce2d8c203d872a59ae329c7b4dae31c423dc7e4a (patch) | |
| tree | e901e02cd337f1d78023fe5534435de114305aff /objects.js | |
| parent | 1ce7a259f2182e9ddecff1a95a123495d7b293ea (diff) | |
| download | snap-yow-ce2d8c203d872a59ae329c7b4dae31c423dc7e4a.tar.gz snap-yow-ce2d8c203d872a59ae329c7b4dae31c423dc7e4a.zip | |
fix sprite costume bugs
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -1336,8 +1336,8 @@ SpriteMorph.prototype.init = function (globals) { this.variables = new VariableFrame(globals || null, this); this.scripts = new ScriptsMorph(this); this.customBlocks = []; - this.costume = new Costume(window.defaultCostume, "marker"); - this.costumes = new List([this.costume]); + this.costumes = new List(); + this.costume = null; this.sounds = new List(); this.normalExtent = new Point(60, 60); // only for costume-less situation this.scale = 1; @@ -1377,7 +1377,12 @@ SpriteMorph.prototype.init = function (globals) { this.isDown = false; // Snap! - YOW code - this.geoposition = window.map.getCenter(); + var markerCostume = new Costume(window.defaultCostume, "marker-" + this.name); + this.costumes.add(markerCostume); + this.costume = markerCostume; + + this.geoposition = [window.map.getCenter().lat, + window.map.getCenter().lng]; // TODO this is a bit hacky this.marker = L.spriteMarker(this.geoposition); @@ -2600,6 +2605,7 @@ SpriteMorph.prototype.addCostume = function (costume) { }; SpriteMorph.prototype.wearCostume = function (costume) { + if (costume == null) return; // Snap! YOW var x = this.xPosition ? this.xPosition() : null, y = this.yPosition ? this.yPosition() : null, isWarped = this.isWarped; @@ -2671,7 +2677,7 @@ SpriteMorph.prototype.doSwitchToCostume = function (id) { (id instanceof Array ? id[0] : null) ) ) { - this.costume = new Costume(window.defaultCostume, "marker"); + this.costume = null; } else { if (id === -1) { this.doWearPreviousCostume(); @@ -2683,7 +2689,7 @@ SpriteMorph.prototype.doSwitchToCostume = function (id) { if (costume === null) { num = parseFloat(id); if (num === 0) { - this.costume = new Costume(window.defaultCostume, "marker"); + this.costume = null; } else { costume = arr[num - 1] || null; } |
