rotating pieces that mostly work
This commit is contained in:
@@ -25,6 +25,24 @@ class KissExtendedSprite extends flixel.addons.display.FlxExtendedSprite {
|
||||
mouseStartPos = FlxG.mouse.getWorldPosition();
|
||||
}
|
||||
|
||||
// Sleazy method just for Habit Puzzles
|
||||
public function rotate(deg:Float) {
|
||||
if (deg < 0) {
|
||||
deg += 360 * Math.ceil(Math.abs(deg / 360));
|
||||
}
|
||||
angle = angle + deg % 360;
|
||||
for (c in connectedSprites) {
|
||||
if (c != this) {
|
||||
c.angle = c.angle + deg % 360;
|
||||
|
||||
var thisCenter = new FlxPoint(x + origin.x, y + origin.y);
|
||||
var cCenter = new FlxPoint(c.x + c.origin.x, c.y + c.origin.y);
|
||||
var offset = cCenter.subtractPoint(thisCenter);
|
||||
c.origin.subtractPoint(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override function updateDrag() {
|
||||
var mouseTotalMovement = FlxG.mouse.getWorldPosition().subtractPoint(mouseStartPos);
|
||||
var nextPos = dragStartPos.copyTo().addPoint(mouseTotalMovement);
|
||||
|
Reference in New Issue
Block a user