kopia lustrzana https://github.com/backface/turtlestitch
Nested Sprite synchronous / independent rotation
rodzic
289dd6b2e6
commit
08110770b0
|
@ -1863,3 +1863,4 @@ ______
|
||||||
------
|
------
|
||||||
* Objects: Nested Sprite Scaling
|
* Objects: Nested Sprite Scaling
|
||||||
* Objects: Nested Sprite Rotation
|
* Objects: Nested Sprite Rotation
|
||||||
|
* Objects: Nested Sprite synchronous / independent rotation
|
||||||
|
|
12
objects.js
12
objects.js
|
@ -1175,9 +1175,11 @@ SpriteMorph.prototype.init = function (globals) {
|
||||||
this.idx = 0; // not to be serialized (!) - used for de-serialization
|
this.idx = 0; // not to be serialized (!) - used for de-serialization
|
||||||
this.wasWarped = false; // not to be serialized, used for fast-tracking
|
this.wasWarped = false; // not to be serialized, used for fast-tracking
|
||||||
|
|
||||||
this.parts = []; // sprite nesting
|
// sprite nesting properties
|
||||||
this.anchor = null; // sprite nesting
|
this.parts = [];
|
||||||
this.nestingScale = 1; // sprite nesting
|
this.anchor = null;
|
||||||
|
this.nestingScale = 1;
|
||||||
|
this.rotatesWithAnchor = true;
|
||||||
|
|
||||||
SpriteMorph.uber.init.call(this);
|
SpriteMorph.uber.init.call(this);
|
||||||
|
|
||||||
|
@ -2706,7 +2708,9 @@ SpriteMorph.prototype.setHeading = function (degrees) {
|
||||||
this.parts.forEach(function (part) {
|
this.parts.forEach(function (part) {
|
||||||
var pos = new Point(part.xPosition(), part.yPosition()),
|
var pos = new Point(part.xPosition(), part.yPosition()),
|
||||||
trg = pos.rotateBy(radians(turn), new Point(x, y));
|
trg = pos.rotateBy(radians(turn), new Point(x, y));
|
||||||
part.turn(turn);
|
if (part.rotatesWithAnchor) {
|
||||||
|
part.turn(turn);
|
||||||
|
}
|
||||||
part.gotoXY(trg.x, trg.y);
|
part.gotoXY(trg.x, trg.y);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue