public PlayScene() : base(2, 2, 1) { //get next puzzle image string puzzleImage = JigsawCore.GetNextImage(); canvas = new Canvas(); canvas.Initialize(Core.game.Content); this.Add(canvas); completedPieces = new GameObjectGroup(); carriedPieces = new GameObjectGroup(); puzzle = new Puzzle(completedPieces, carriedPieces); puzzle.Create(puzzleImage, 250, canvas); this.Add(completedPieces); this.Add(puzzle); this.Add(carriedPieces); player1 = new Player(puzzle, PlayerIndex.One, typeof(SparkleParticle)); player1.Initialize(Core.game.Content); player2 = new Player(puzzle, PlayerIndex.Two, typeof(SparkleParticle)); player2.Initialize(Core.game.Content); this.Add(player2); this.Add(player1); idleTimer.NotifyMe(); }
public void Create(string imageSource, int roughSize, Canvas canvas) { //load info Texture2D texture = Core.game.dynamicContentManager.Load<Texture2D>(imageSource); _canvas = canvas; _canvas.setSize((texture.Width * PuzzlePiece.SCALE_FACTOR), (texture.Height * PuzzlePiece.SCALE_FACTOR)); Vector2 finalDim = chopUp(roughSize, texture); _canvas.setSize(finalDim.X, finalDim.Y); distributePieces(); //initialize with number of pieces -- to detect win condition _numberOfPieces = Count; _flickerBounceNotifier.NotifyMe(); }