diff --git a/projects/flixel-desktop-habit-puzzle-game/source/HabitState.hx b/projects/flixel-desktop-habit-puzzle-game/source/HabitState.hx index 18fa768f..7bd30598 100644 --- a/projects/flixel-desktop-habit-puzzle-game/source/HabitState.hx +++ b/projects/flixel-desktop-habit-puzzle-game/source/HabitState.hx @@ -33,7 +33,7 @@ import jigsawx.math.Vec2; class HabitState extends FlxState { public function drawPieceShape( surface: FlxSprite, jig: JigsawPiece, c: FlxColor ) { - var points = [for (point in jig.getPoints()) new FlxPoint(jig.xy.x + point.x, jig.xy.y + point.y)]; + var points = [for (point in jig.getPoints()) new FlxPoint(point.x, point.y)]; points.push(points[0]); FlxSpriteUtil.drawPolygon( surface, diff --git a/projects/flixel-desktop-habit-puzzle-game/source/HabitState.kiss b/projects/flixel-desktop-habit-puzzle-game/source/HabitState.kiss index aa070a16..a9a84e96 100644 --- a/projects/flixel-desktop-habit-puzzle-game/source/HabitState.kiss +++ b/projects/flixel-desktop-habit-puzzle-game/source/HabitState.kiss @@ -78,26 +78,24 @@ (doFor y (range PUZZLE_HEIGHT) (doFor x (range PUZZLE_WIDTH) (startingPoints.push (new FlxPoint (+ rewardSprite.x (* x PIECE_WIDTH)) (+ rewardSprite.y (* y PIECE_HEIGHT)))))) - //(r.shuffle startingPoints) + (r.shuffle startingPoints) (set jigsaw j) - (doFor i (range (- p currentRewardFile.startingPoints)) + (doFor i (range (min TOTAL_PIECES (- p currentRewardFile.startingPoints))) (let [jig (nth jigsaw.jigs i) pos (nth startingPoints i) s (new FlxExtendedSprite pos.x pos.y) source (new FlxSprite) mask (new FlxSprite) sourceRect (new Rectangle jig.xy.x jig.xy.y jig.wh.x jig.wh.y)] - (-= pos.x jig.xy.x) - (-= pos.y jig.xy.y) (set s.draggable true) (s.enableMouseDrag false true) (source.makeGraphic (Std.int sourceRect.width) (Std.int sourceRect.height) FlxColor.TRANSPARENT true) (source.pixels.copyPixels rewardSprite.pixels sourceRect (new Point 0 0)) - (mask.makeGraphic graphicWidth graphicHeight FlxColor.TRANSPARENT true) + (mask.makeGraphic (Std.int sourceRect.width) (Std.int sourceRect.height) FlxColor.TRANSPARENT true) (drawPieceShape mask jig FlxColor.BLACK) - (FlxSpriteUtil.alphaMask s rewardSprite.pixels mask.pixels) + (FlxSpriteUtil.alphaMask s source.pixels mask.pixels) (set s.cameras [pieceCamera])