summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-08-08 19:30:17 +0200
committerjmoenig <jens@moenig.org>2013-08-08 19:30:17 +0200
commit08110770b0c7647c68278f734adf2ee199fa9b56 (patch)
treeae9a72084fefb85486eda6178bd51db8b01cbc1c
parent289dd6b2e69894546d47686cdadb8cc42aa6fd30 (diff)
downloadsnap-yow-08110770b0c7647c68278f734adf2ee199fa9b56.tar.gz
snap-yow-08110770b0c7647c68278f734adf2ee199fa9b56.zip
Nested Sprite synchronous / independent rotation
-rwxr-xr-xhistory.txt1
-rw-r--r--objects.js12
2 files changed, 9 insertions, 4 deletions
diff --git a/history.txt b/history.txt
index b13ecdf..081e901 100755
--- a/history.txt
+++ b/history.txt
@@ -1863,3 +1863,4 @@ ______
------
* Objects: Nested Sprite Scaling
* Objects: Nested Sprite Rotation
+* Objects: Nested Sprite synchronous / independent rotation
diff --git a/objects.js b/objects.js
index af57712..649a5bb 100644
--- a/objects.js
+++ b/objects.js
@@ -1175,9 +1175,11 @@ SpriteMorph.prototype.init = function (globals) {
this.idx = 0; // not to be serialized (!) - used for de-serialization
this.wasWarped = false; // not to be serialized, used for fast-tracking
- this.parts = []; // sprite nesting
- this.anchor = null; // sprite nesting
- this.nestingScale = 1; // sprite nesting
+ // sprite nesting properties
+ this.parts = [];
+ this.anchor = null;
+ this.nestingScale = 1;
+ this.rotatesWithAnchor = true;
SpriteMorph.uber.init.call(this);
@@ -2706,7 +2708,9 @@ SpriteMorph.prototype.setHeading = function (degrees) {
this.parts.forEach(function (part) {
var pos = new Point(part.xPosition(), part.yPosition()),
trg = pos.rotateBy(radians(turn), new Point(x, y));
- part.turn(turn);
+ if (part.rotatesWithAnchor) {
+ part.turn(turn);
+ }
part.gotoXY(trg.x, trg.y);
});
};