public static void Lesson1(PuzzleBox box, MasterGrid grid) { controlLessonIndex = 1; introText = "" + "Look at all these bubbles inside Mister\n" + "Jellyfish! The colored ones are toxic! Let's\n" + "see if we can get rid of them.:" + "You can use the Left Control Stick to rotate\n" + "the bubbles in Mister Jellyfish's body.\n" + "Try it now!:" + "Perfect! Try to match up the colored bubbles\n" + "in his body with the bubbles in his tentacles!"; successText = "" + "Great job! When you aligned the bubbles in\n" + "his body with the bubbles in his tentacles,\n" + "the bubbles popped!"; Clear(box, grid); restrictions = ControlRestrictions.StickOnly; grid[0, 1] = new PuzzleNode(Color.Yellow); grid[3, 4] = new PuzzleNode(Color.Green); grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta); grid.queues[0, 1][0] = new PuzzleNode(Color.Red); grid.queues[3, 4][1] = new PuzzleNode(Color.Red); grid.queues[3, 4][0] = new PuzzleNode(Color.Magenta); grid[2, 4] = new PuzzleNode(Color.Orange); grid.queues[2, 4][1] = new PuzzleNode(Game.jellyBlue); box[0, 0, 2] = new PuzzleNode(Color.Yellow); box[0, 0, 0] = new PuzzleNode(Color.Green); box[0, 1, 2] = new PuzzleNode(Color.Orange); box[0, 1, 0] = new PuzzleNode(Game.jellyBlue); }
public static void Lesson5(PuzzleBox box, MasterGrid grid) { introText = "" + "This next lesson is tricky. Notice the two\n" + "yellow bubbles in Mister Jellyfish's body?:" + "They're right next to each other, but they\n" + "haven't popped!:" + "That's because to pop bubbles, you need to\n" + "match bubbles from the Jellyfish's body with\n" + "the bubbles in the tentacles.:" + "Try to align these two yellow bubbles with the\n" + "yellow bubble in the tentacle to form a\n" + "straight line."; successText = "" + "You got it. Remember, sets of bubbles will\n" + "only pop if they form a straight line. So be\n" + "careful!"; failureText = "" + "Almost! Only sets of bubbles that form a\n" + "straight line will match."; Clear(box, grid); grid[0, 1] = new PuzzleNode(Color.Yellow); box[0, 2, 2] = new PuzzleNode(Color.Yellow); box[0, 2, 1] = new PuzzleNode(Color.Yellow); restrictions = ControlRestrictions.None; }
public static void Lesson2(PuzzleBox box, MasterGrid grid) { controlLessonIndex = 0; introText = "" + "Instead of using the Left Control Stick, you\n" + "can use the Left and Right Shoulder Buttons.\n" + "Try it now!:" + "Good! This will perform a different type of\n" + "rotation. Use the Shoulder Buttons to match\n" + "these bubbles!"; successText = "" + "Nice! If you can master all 6 types of these\n" + "rotations, you'll do great!"; restrictions = ControlRestrictions.ShouldersOnly; Clear(box, grid); grid[0, 1] = new PuzzleNode(Color.Yellow); grid[3, 4] = new PuzzleNode(Color.Green); grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta); grid.queues[0, 1][0] = new PuzzleNode(Color.Red); grid.queues[3, 4][1] = new PuzzleNode(Color.Red); grid.queues[3, 4][0] = new PuzzleNode(Color.Magenta); grid[2, 4] = new PuzzleNode(Color.Orange); grid.queues[2, 4][1] = new PuzzleNode(Game.jellyBlue); box[0, 0, 2] = new PuzzleNode(Color.Yellow); box[0, 0, 0] = new PuzzleNode(Color.Green); box[0, 1, 2] = new PuzzleNode(Color.Orange); box[0, 1, 0] = new PuzzleNode(Game.jellyBlue); }
public static void Lesson4(PuzzleBox box, MasterGrid grid) { introText = "" + "Now let's try and put it together! To match\n" + "these bubbles, you'll need to use the Left and\n" + "Right Triggers to push and pull them.:" + "But, you'll also need to use the Left Control\n" + "Stick and Shoulder Buttons to rotate them!:" + "Try and match all the bubbles!"; successText = "" + "That's perfect!"; failureText = "BUG!"; Clear(box, grid); restrictions = ControlRestrictions.None; grid[0, 1] = new PuzzleNode(Color.Green); grid[2, 0] = new PuzzleNode(Color.Orange); grid[4, 2] = new PuzzleNode(Color.Magenta); grid[3, 4] = new PuzzleNode(Game.jellyBlue); grid[4, 1] = new PuzzleNode(Color.Yellow); grid[1, 4] = new PuzzleNode(Color.Red); box[0, 0, 0] = new PuzzleNode(Color.Red); box[2, 2, 2] = new PuzzleNode(Color.Yellow); box[1, 2, 2] = new PuzzleNode(Color.Magenta); box[0, 2, 0] = new PuzzleNode(Game.jellyBlue); box[0, 0, 1] = new PuzzleNode(Color.Green); box[2, 1, 1] = new PuzzleNode(Color.Orange); }
public static void Lesson7(PuzzleBox box, MasterGrid grid) { introText = "" + "Another advanced topic is bonus bubbles! You\n" + "may have noticed that when you match bubbles,\n" + "new ones slide in to take their place.:" + "But what happens if you match against two\n" + "bubbles in different tentacles at the same\n" + "time?:" + "This will create a bonus bubble of the same\n" + "color. Matching bonus bubbles will multiply\n" + "the score of the set by 2!:" + "Try rotating this orange bubble into the\n" + "lower left corner!"; successText = "" + "Great! In addition to this bubble being\n" + "worth bonus points, you popped 3 outer\n" + "bubbles with just one inner bubble.:" + "That's a useful skill!"; failureText = "" + "Oops! Try popping the bubbles in the lower\n" + "left corner first. This will give you a bonus\n" + "bubble!"; restrictions = ControlRestrictions.None; Clear(box, grid); grid[0, 3] = new PuzzleNode(Color.Orange); grid[1, 4] = new PuzzleNode(Color.Orange); grid[4, 1] = new PuzzleNode(Color.Orange); box[0, 2, 2] = new PuzzleNode(Color.Orange); }
public static void Lesson6(PuzzleBox box, MasterGrid grid) { introText = "" + "Scoring big sets is tricky. Lets practice some\n" + "more. Try to match all of the bubbles using sets\n" + "of 3 or more!"; successText = "" + "Awesome! These combos are worth way more points\n" + "than just matching two bubbles at a time.:" + "If you want to be a great Jellyfish doctor,\n" + "you'll need to master spotting when you can\n" + "match these kinds of sets!"; failureText = "" + "Oops! Remember, you need to rotate the bubbles\n" + "so that all of the same colored bubbles are in\n" + "a straight line!:" + "Use the Right Control Stick to look around and\n" + "get a better view of things!:" + "Finally, don't forget about using the Shoulder\n" + "Buttons for rotations."; Clear(box, grid); restrictions = ControlRestrictions.None; grid[1, 0] = new PuzzleNode(Color.Green); grid[0, 2] = new PuzzleNode(Game.jellyBlue); grid[4, 3] = new PuzzleNode(Color.Yellow); box[2, 0, 2] = new PuzzleNode(Color.Green); box[2, 1, 2] = new PuzzleNode(Color.Green); box[2, 2, 2] = new PuzzleNode(Color.Green); box[1, 2, 0] = new PuzzleNode(Game.jellyBlue); box[1, 2, 1] = new PuzzleNode(Game.jellyBlue); box[0, 0, 2] = new PuzzleNode(Color.Yellow); box[0, 1, 2] = new PuzzleNode(Color.Yellow); }
private static void MarkHelperVert(int start, int end, int y, PuzzleNode p) { p.marked = true; p.scoring = true; if (start < boxOffset && end > boxOffset + boxSize) { if (y <= centerIndex) { p.replace_top = true; p.replace_distance = 1 + centerIndex - start; } if (y >= centerIndex) { p.replace_bottom = true; p.replace_distance = end - centerIndex; } } else { if (start < boxOffset) { p.replace_top = true; p.replace_distance = end - start; } if (end > boxOffset + boxSize) { p.replace_bottom = true; p.replace_distance = end - start; } } }
public static void Lesson8(PuzzleBox box, MasterGrid grid) { introText = "" + "This technique will be especially important in\n" + "Challenge Mode. Try to match all the bubbles\n" + "here.:" + "To do so, you'll need to get the bonus bubbles\n" + "first again! Focus on the corners that contain\n" + "two bubbles of the same color.:" + "Also, don't forget the basics. Remember you can\n" + "use the left and right triggers to push and pull\n" + "the bubbles."; successText = "" + "Perfect! You're almost ready to get started\n" + "for real."; failureText = "" + "Oops! Remember, if you match one bubble against\n" + "two tentacles at the same time, it will be\n" + "replaced by a bonus bubble.:" + "You can reuse the bonus bubbles to make more\n" + "matches. Try getting the bonus bubbles first!"; restrictions = ControlRestrictions.None; Clear(box, grid); box[0, 1, 2] = new PuzzleNode(Color.Yellow); box[0, 0, 0] = new PuzzleNode(Color.Magenta); grid[3, 0] = new PuzzleNode(Color.Magenta); grid[4, 1] = new PuzzleNode(Color.Magenta); grid[1, 4] = new PuzzleNode(Color.Magenta); grid[0, 1] = new PuzzleNode(Color.Yellow); grid[1, 0] = new PuzzleNode(Color.Yellow); grid[3, 4] = new PuzzleNode(Color.Yellow); }
public static void Lesson9(PuzzleBox box, MasterGrid grid) { introText = "" + "Okay! Let's combine what we've learned about sets\n" + "and bonus bubbles. See those three green bubbles\n" + "in the upper right?:" + "If we can match our two green bubbles at the\n" + "bottom with them, we can pop 5 bubbles at once!:" + "They'll also get replaced by two bonus bubbles,\n" + "which we can use to get another set!"; successText = "Nice! That was worth a lot of points!"; failureText = "" + "Oops! This one is tricky. Don't forget to use\n" + "The shoulder buttons for rotations and the\n" + "triggers to push and pull the bubbles.:" + "Try and get match the bubbles in the upper\n" + "right first!"; restrictions = ControlRestrictions.None; Clear(box, grid); grid[3, 0] = new PuzzleNode(Color.Green); grid[4, 1] = new PuzzleNode(Color.Green); grid[4, 2] = new PuzzleNode(Color.Green); grid[0, 2] = new PuzzleNode(Color.Green); box[1, 2, 1] = new PuzzleNode(Color.Green); box[1, 2, 2] = new PuzzleNode(Color.Green); }
private static void MarkHelperHoriz(int start, int end, int x, PuzzleNode p) { p.marked = true; p.scoring = true; if (start < boxOffset && end > boxSize + boxOffset) { if (x <= centerIndex) { p.replace_distance = centerIndex + 1 - start; p.replace_left = true; } if (x >= centerIndex) { p.replace_distance = end - centerIndex; p.replace_right = true; } } else { if (start < boxOffset) { p.replace_distance = end - start; p.replace_left = true; } if (end > boxOffset + boxSize) { p.replace_distance = end - start; p.replace_right = true; } } }
public static void LoadLevel(string fileName, PuzzleBox box, MasterGrid grid) { String loadPath = "LevelData\\" + fileName; try { r = new StreamReader(TitleContainer.OpenStream(loadPath)); } catch (Exception e) { Console.WriteLine(e); } for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { if (grid.queues[x, y] != null) { grid.queues[x, y] = new List <PuzzleNode>(); } } } for (;;) { String s = r.ReadLine(); if (s == null) { return; } string[] data = s.Split(','); if (data[0] == "WIN") { } if (data[0] == "LOSE") { } if (data[0] == "BOX") { int x = Convert.ToInt32(data[1]); int y = Convert.ToInt32(data[2]); int z = Convert.ToInt32(data[3]); box[x, y, z] = new PuzzleNode(data[4]); } else if (data[0] == "GRID") { int x = Convert.ToInt32(data[1]); int y = Convert.ToInt32(data[2]); grid[x, y] = new PuzzleNode(data[3]); } else if (data[0] == "QUEUE") { int x = Convert.ToInt32(data[1]); int y = Convert.ToInt32(data[2]); int z = Convert.ToInt32(data[3]); grid.queues[x, y].Add(new PuzzleNode(data[4])); } } }
public static void Lesson0(PuzzleBox box, MasterGrid grid) { Clear(box, grid); box[1, 2, 2] = new PuzzleNode(Color.Red); box[0, 2, 2] = new PuzzleNode(Color.Red); grid[3, 0] = new PuzzleNode(Color.Red); }
public static void Lesson3(PuzzleBox box, MasterGrid grid) { controlLessonIndex = 0; introText = "" + "In addition, you can use the Left and Right\n" + "Triggers to push and pull the bubbles in the\n" + "Jellyfish's body. Try it now!:" + "Great! That way, you can change which layer of\n" + "bubbles aligns with the tentacles.:" + "Now, use the Left and Right Triggers to match\n" + "the bubbles!"; successText = "" + "Great! With the Left Control Stick, Shoulder\n" + "Buttons, and Triggers, you can reorient the\n" + "bubbles however you want!:" + "If you need a reminder of the controls, take a\n" + "look around the top and bottom left of the\n" + "screen for a review."; Clear(box, grid); restrictions = ControlRestrictions.TriggersOnly; grid[0, 1] = new PuzzleNode(Color.Red); grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta); grid[3, 0] = new PuzzleNode(Color.Yellow); grid[4, 3] = new PuzzleNode(Game.jellyBlue); grid[1, 4] = new PuzzleNode(Color.Green); box[0, 0, 0] = new PuzzleNode(Color.Magenta); box[1, 0, 0] = new PuzzleNode(Color.Red); box[2, 2, 0] = new PuzzleNode(Color.Green); box[1, 0, 2] = new PuzzleNode(Color.Yellow); box[2, 2, 2] = new PuzzleNode(Game.jellyBlue); }
public static bool Match(PuzzleNode p1, PuzzleNode p2) { if ((p1.color.R == 128 && p1.color.G == 128 && p1.color.B == 128) || p1.color == Color.Black) { return(false); } return(p1.color == p2.color); }
private void Edges() { arr[0, 2, 1] = new PuzzleNode(Color.Yellow); arr[0, 1, 2] = new PuzzleNode(Color.Yellow); arr[0, 1, 0] = new PuzzleNode(Color.Yellow); arr[0, 0, 1] = new PuzzleNode(Color.Yellow); arr[0, 1, 1] = new PuzzleNode(Color.Yellow); }
public static void LoadLevel(string fileName, PuzzleBox box, MasterGrid grid) { String loadPath = "LevelData\\"+fileName; try { r = new StreamReader(TitleContainer.OpenStream(loadPath)); } catch (Exception e) { Console.WriteLine(e); } for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { if (grid.queues[x, y] != null) grid.queues[x, y] = new List<PuzzleNode>(); } } for(;;) { String s = r.ReadLine(); if (s == null) return; string[] data = s.Split(','); if (data[0] == "WIN") { } if (data[0] == "LOSE") { } if (data[0] == "BOX") { int x = Convert.ToInt32(data[1]); int y = Convert.ToInt32(data[2]); int z = Convert.ToInt32(data[3]); box[x, y, z] = new PuzzleNode(data[4]); } else if (data[0] == "GRID") { int x = Convert.ToInt32(data[1]); int y = Convert.ToInt32(data[2]); grid[x, y] = new PuzzleNode(data[3]); } else if (data[0] == "QUEUE") { int x = Convert.ToInt32(data[1]); int y = Convert.ToInt32(data[2]); int z = Convert.ToInt32(data[3]); grid.queues[x, y].Add(new PuzzleNode(data[4])); } } }
public PuzzleNode Copy() { PuzzleNode newNode = new PuzzleNode(color); newNode.toggleColor = toggleColor; newNode.toggleOrb = toggleOrb; ClearMarking(); newNode.marked = true; return(newNode); }
private void WildCross() { for (int z = 0; z < size; z++) { arr[0, 1, z] = new PuzzleNode(Color.White); } for (int z = 0; z < size; z++) { arr[2, 1, z] = new PuzzleNode(Color.Yellow); } }
public static void Lesson10(PuzzleBox box, MasterGrid grid) { introText = "Almost done! Lets do one more.:" + "There are three blue bubbles in the back right \n" + "of Mister Jellyfish. There also 5 blue bubbles \n" + "in the right tentacles.:" + "If you can bring all three of those blue bubbles \n" + "to the front, you can get 3 bonus bubbles to use \n" + "for a second set!"; successText = "" + "Super! Looks like you're ready to get to work.\n" + "First, lets go over a few more quick things!:" + "There are three different types of Jellyfish\n" + "surgery to choose from, each of which poses\n" + "unique challenges.:" + "In Emergency mode, you'll race against the clock\n" + "to pop as many bubbles as you can.:" + "Scoring sets of 3 or more bubbles at a time is\n" + "key to getting a high score.:" + "Operation mode is similar, but you can relax and\n" + "take your time. However, you'll have a limited\n" + "number of moves to work with.:" + "Time isn't a factor, but you'll need to plan\n" + "your moves carefully and be efficient to get\n" + "a good score.:" + "Finally, Challenge mode will give you some\n" + "tricky puzzles to solve.:" + "You'll need to use what you've learned here to\n" + "pop all of the bubbles in each patient. If you make\n" + "a wrong move, you might get stuck!:" + "Luckily, in Challenge mode, you can press B to\n" + "undo your last move if you make a mistake.:" + "You'll be awarded a rating after each patient.\n" + "If you earn 3 stars, your patient will make a\n" + "full recovery and return to the sea!:" + "Try to save them all!\n"; failureText = "" + "Oops! Try to rotate all three blue bubbles in\n" + "back to the front right. Then use the three\n" + "bonus bubbles to make a second set.:" + "Don't forget you can use the Right Control Stick\n" + "to get a better view of bubbles in the back!"; restrictions = ControlRestrictions.None; Clear(box, grid); box[2, 0, 2] = new PuzzleNode(Game.jellyBlue); box[2, 1, 2] = new PuzzleNode(Game.jellyBlue); box[2, 2, 2] = new PuzzleNode(Game.jellyBlue); grid[3, 0] = new PuzzleNode(Game.jellyBlue); grid[3, 4] = new PuzzleNode(Game.jellyBlue); grid[4, 1] = new PuzzleNode(Game.jellyBlue); grid[4, 2] = new PuzzleNode(Game.jellyBlue); grid[4, 3] = new PuzzleNode(Game.jellyBlue); grid[1, 4] = new PuzzleNode(Game.jellyBlue); }
public void Draw() { Game.spriteBatch.Draw(background, new Rectangle(0, 0, Game.screenSizeX, Game.screenSizeY), Color.White); Game.spriteBatch.Draw(header, new Rectangle(headerX, headerY, headerWidth, headerHeight), Color.White); for (int i = 0; i < optionList.Count; i++) { if (i == selectedIndex) { PuzzleNode p = new PuzzleNode(Game.jellyBlue); p.screenX = optionListX - 25; p.screenY = optionListY + optionHeight / 2 + i * optionGap; if (state == MainMenuState.ANIMATEDOWN) { p.screenY -= (int)(optionGap * (1f - (float)animateTime / (float)250)); } if (state == MainMenuState.ANIMATEUP) { p.screenY += (int)(optionGap * (1f - (float)animateTime / (float)250)); } p.distance = 50; p.scale = 1f; OrbRenderer.DrawOrb(p, State.READY, 0f); Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.LightGreen); } else { Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.White); } } if (state == MainMenuState.DOCTORIN) { JellyfishRenderer.DrawJellyfish(doctorX + 800 - 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally); JellyfishRenderer.DrawJellyfish(doctorX + 600 - 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally); } else if (state == MainMenuState.DOCTOROUT) { JellyfishRenderer.DrawJellyfish(doctorX + 200 + 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally); JellyfishRenderer.DrawJellyfish(doctorX + 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally); } else { JellyfishRenderer.DrawJellyfish(doctorX + 200, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally); JellyfishRenderer.DrawJellyfish(doctorX, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally); } if (state == MainMenuState.READY) { JellyfishRenderer.DrawSpeechBubble2(speechX, speechY, 100, SpriteEffects.FlipHorizontally); Game.spriteBatch.DrawString(Game.spriteFont, optionList[selectedIndex].optionString, new Vector2(speechX - 255, speechY + 5), Color.Black); } Game.spriteBatch.DrawString(Game.spriteFont, "Created by Kevin Costello. Artwork by Rachel K Sreebny", new Vector2(creditsX, creditsY), Color.LightGray, 0, Vector2.Zero, .75f, SpriteEffects.None, 0); Game.spriteBatch.DrawString(Game.spriteFont, "Music by Kevin MacLeod", new Vector2(creditsX + 95, creditsY + 22), Color.LightGray, 0, Vector2.Zero, .75f, SpriteEffects.None, 0); }
private void AllRed() { for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { for (int z = 0; z < size; z++) { arr[x, y, z] = new PuzzleNode(Color.Red); } } } }
public void Blank() { for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { for (int z = 0; z < size; z++) { arr[x, y, z] = new PuzzleNode(Color.Gray); } } } }
private void Cross() { for (int z = 0; z < size; z++) { arr[0, 1, z] = new PuzzleNode(Color.Yellow); } for (int z = 0; z < size; z++) { arr[2, 1, z] = new PuzzleNode(Color.Orange); } arr[0, 0, 0] = new PuzzleNode(Color.Green); arr[0, 2, 2] = new PuzzleNode(Color.Pink); arr[0, 2, 1] = new PuzzleNode(Color.Pink); }
public void Draw() { if (enabled) { Game.spriteBatch.Draw(plus, new Rectangle(635, 70, 32, 32), Color.White); Game.spriteBatch.Draw(plus, new Rectangle(675, 70, 32, 32), Color.White); Game.spriteBatch.Draw(minus, new Rectangle(635, 105, 32, 32), Color.White); Game.spriteBatch.Draw(minus, new Rectangle(675, 105, 32, 32), Color.White); Game.spriteBatch.Draw(minus, new Rectangle(675, 140, 32, 32), Color.White); Game.spriteBatch.Draw(plus, new Rectangle(675, 175, 32, 32), Color.White); Game.spriteBatch.Draw(plus, new Rectangle(675, 210, 32, 32), Color.White); Game.spriteBatch.Draw(plus, new Rectangle(675, 245, 32, 32), Color.White); for (int j = 0; j < 6; j++) { PuzzleNode p; if (j == 0) { p = new PuzzleNode(Color.Blue); } else if (j == 1) { p = new PuzzleNode(Color.Yellow); } else if (j == 2) { p = new PuzzleNode(Color.Red); } else if (j == 3) { p = new PuzzleNode(Color.Green); } else if (j == 4) { p = new PuzzleNode(Color.Magenta); } else { p = new PuzzleNode(Color.Orange); } p.screenX = 740; p.screenY = 85 + j * 35; p.distance = 50; p.scale = 1f; OrbRenderer.DrawOrb(p, State.READY, 0f); } } }
private void RandomSetup() { Random r = new Random(); for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { for (int z = 0; z < size; z++) { arr[x, y, z] = new PuzzleNode(); arr[x, y, z].marked = true; } } } }
public static float GetSlideY(int y, PuzzleNode p, float animationPercentage) { float effectivePercentage = Math.Min(animationPercentage, (float)p.replace_distance); float slideY = (float)y; if (p.replace_top) { slideY -= p.replace_distance; slideY += effectivePercentage; } if (p.replace_bottom) { slideY += p.replace_distance; slideY -= effectivePercentage; } return(slideY); }
public static float GetSlideX(int x, PuzzleNode p, float animationPercentage) { float effectivePercentage = Math.Min(animationPercentage, (float)p.replace_distance); float slideX = (float)x; if (p.replace_left) { slideX -= p.replace_distance; slideX += effectivePercentage; } if (p.replace_right) { slideX += p.replace_distance; slideX -= effectivePercentage; } return(slideX); }
public static void SaveLevel(PuzzleBox box, MasterGrid grid) { try { w = new StreamWriter(TitleContainer.OpenStream(savePath)); } catch (Exception e) { Console.WriteLine(e); } for (int x = 0; x < boxSize; x++) { for (int y = 0; y < boxSize; y++) { for (int z = 0; z < boxSize; z++) { PuzzleNode p = box[x, y, z]; w.WriteLine("BOX," + x + "," + y + "," + z + "," + p.ToString()); } } } for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { PuzzleNode p = grid[x, y]; w.WriteLine("GRID," + x + "," + y + "," + p.ToString()); } } for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { if (grid.queues[x, y] != null) { for (int z = 0; z < grid.queues[x, y].Count; z++) { PuzzleNode p = grid.queues[x, y][z]; w.WriteLine("QUEUE," + x + "," + y + "," + z + "," + p.ToString()); } } } } w.Flush(); w.Close(); }
// Clears state. Called when returning to ready state. public static void Clear(PuzzleBox box, MasterGrid grid) { for (int x = 0; x < boxSize; x++) { for (int y = 0; y < boxSize; y++) { for (int z = 0; z < boxSize; z++) { box[x, y, z].ClearMarking(); } } } for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { //if (x == 0 || x == gridSize-1 || y == 0 || y == gridSize-1) if (grid.queues[x, y] != null) { for (int i = 0; i < grid[x, y].replace_distance; i++) { grid.queues[x, y].RemoveAt(0); if (Game.currentSettings.refillQueues) { PuzzleNode p = new PuzzleNode(); while (p.color == grid.queues[x, y][grid.queues[x, y].Count - 1].color) { p = new PuzzleNode(); } grid.queues[x, y].Add(p); } else { grid.queues[x, y].Add(new PuzzleNode(Color.Gray)); } } for (int i = 0; i < grid.queues[x, y].Count; i++) { grid.queues[x, y][i].ClearMarking(); } } grid[x, y].ClearMarking(); } } }
public void Rotate(ROTATION r) { PuzzleNode[, ,] newArr = new PuzzleNode[size, size, size]; for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { for (int z = 0; z < size; z++) { switch (r) { case (ROTATION.POSZ): newArr[x, y, z] = arr[y, size - 1 - x, z]; break; case (ROTATION.NEGZ): newArr[x, y, z] = arr[size - 1 - y, x, z]; break; case (ROTATION.POSY): newArr[x, y, z] = arr[size - 1 - z, y, x]; break; case (ROTATION.NEGY): newArr[x, y, z] = arr[z, y, size - 1 - x]; break; case (ROTATION.NEGX): newArr[x, y, z] = arr[x, size - 1 - z, y]; break; case (ROTATION.POSX): newArr[x, y, z] = arr[x, z, size - 1 - y]; break; default: newArr[x, y, z] = arr[x, y, z]; break; } } } } arr = newArr; }
// Clears state. Called when returning to ready state. public static void Clear(PuzzleBox box, MasterGrid grid) { for (int x = 0; x < boxSize; x++) { for (int y = 0; y < boxSize; y++) { for (int z = 0; z < boxSize; z++) { box[x, y, z].ClearMarking(); } } } for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { //if (x == 0 || x == gridSize-1 || y == 0 || y == gridSize-1) if(grid.queues[x,y]!=null) { for (int i = 0; i < grid[x, y].replace_distance; i++) { grid.queues[x, y].RemoveAt(0); if (Game.currentSettings.refillQueues) { PuzzleNode p = new PuzzleNode(); while (p.color == grid.queues[x, y][grid.queues[x, y].Count - 1].color) { p = new PuzzleNode(); } grid.queues[x, y].Add(p); } else grid.queues[x, y].Add(new PuzzleNode(Color.Gray)); } for (int i = 0; i < grid.queues[x, y].Count; i++) { grid.queues[x, y][i].ClearMarking(); } } grid[x, y].ClearMarking(); } } }
private void RandomSetup() { Random r = new Random(); for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { if (x < boxOffset && y < boxOffset || x >= boxOffset + boxSize && y >= boxOffset + boxSize || x < boxOffset && y >= boxOffset + boxSize || x >= boxOffset + boxSize && y < boxOffset) { arr[x, y] = new PuzzleNode(Color.Black); continue; } arr[x, y] = new PuzzleNode(); if (x == 0 || x == gridSize - 1 || y == 0 || y == gridSize - 1) { queues[x, y] = new List <PuzzleNode>(); Color prevColor = Color.Black; for (int i = 0; i < 10; i++) { if (Game.currentSettings.refillQueues) { PuzzleNode p = new PuzzleNode(); while (p.color == prevColor) { p = new PuzzleNode(); } queues[x, y].Add(p); prevColor = p.color; } else { queues[x, y].Add(new PuzzleNode(Color.Gray)); } } } } } }
public void Blank() { for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { arr[x, y] = new PuzzleNode(Color.Gray); if (queues[x, y] != null) { queues[x, y] = new List<PuzzleNode>(); queues[x, y].Add(new PuzzleNode(Color.Gray)); queues[x, y].Add(new PuzzleNode(Color.Gray)); queues[x, y].Add(new PuzzleNode(Color.Gray)); queues[x, y].Add(new PuzzleNode(Color.Gray)); queues[x, y].Add(new PuzzleNode(Color.Gray)); queues[x, y].Add(new PuzzleNode(Color.Gray)); } } } }
public void Draw() { if (enabled) { Game.spriteBatch.Draw(plus, new Rectangle(635, 70, 32, 32), Color.White); Game.spriteBatch.Draw(plus, new Rectangle(675, 70, 32, 32), Color.White); Game.spriteBatch.Draw(minus, new Rectangle(635, 105, 32, 32), Color.White); Game.spriteBatch.Draw(minus, new Rectangle(675, 105, 32, 32), Color.White); Game.spriteBatch.Draw(minus, new Rectangle(675, 140, 32, 32), Color.White); Game.spriteBatch.Draw(plus, new Rectangle(675, 175, 32, 32), Color.White); Game.spriteBatch.Draw(plus, new Rectangle(675, 210, 32, 32), Color.White); Game.spriteBatch.Draw(plus, new Rectangle(675, 245, 32, 32), Color.White); for (int j = 0; j < 6; j++) { PuzzleNode p; if (j == 0) p = new PuzzleNode(Color.Blue); else if (j == 1) p = new PuzzleNode(Color.Yellow); else if (j == 2) p = new PuzzleNode(Color.Red); else if (j == 3) p = new PuzzleNode(Color.Green); else if (j == 4) p = new PuzzleNode(Color.Magenta); else p = new PuzzleNode(Color.Orange); p.screenX = 740; p.screenY = 85 + j * 35; p.distance = 50; p.scale = 1f; OrbRenderer.DrawOrb(p, State.READY, 0f); } } }
public static void LessonBonus(PuzzleBox box, MasterGrid grid) { introText = "" + "We'll learn some advanced techniques soon,\n" + "but matching bubbles like this is the core\n" + "skill for any Jellyfish surgeon.:" + "So let's practice this some more!\n" + "Also, you can use the Right Control Stick at any\n" + "time to shift the camera angle.:" + "I like to set the camera so that all 27 bubbles\n" + "in the body are visible at the same time.:" + "But you should do whatever feels comfortable!\n" + "Now, match those bubbles!"; successText = "" + "Way to go! You're getting the hang of it!\n" + "Let's talk about some more advanced topics!"; failureText = "BUG!"; Clear(box, grid); restrictions = ControlRestrictions.None; grid[2, 0] = new PuzzleNode(Color.Red); grid[3, 0] = new PuzzleNode(Color.Orange); grid[3, 4] = new PuzzleNode(Color.Orange); grid.queues[3, 4][0] = new PuzzleNode(Game.jellyBlue); grid[0, 1] = new PuzzleNode(Color.Magenta); grid.queues[3, 0][1] = new PuzzleNode(Game.jellyBlue); grid[1, 0] = new PuzzleNode(Game.jellyBlue); grid[0, 2] = new PuzzleNode(Color.Yellow); grid.queues[0, 2][0] = (new PuzzleNode(Color.Red)); grid[4, 2] = new PuzzleNode(Color.Green); grid[2, 4] = new PuzzleNode(Color.Yellow); grid.queues[4, 2][0] = (new PuzzleNode(Color.Yellow)); grid.queues[4, 2][1] = (new PuzzleNode(Color.Red)); box[1, 1, 0] = new PuzzleNode(Color.Red); box[1, 0, 2] = new PuzzleNode(Color.Magenta); box[0, 2, 2] = new PuzzleNode(Game.jellyBlue); box[0, 1, 2] = new PuzzleNode(Color.Yellow); box[0, 0, 1] = new PuzzleNode(Color.Green); box[2, 0, 0] = new PuzzleNode(Color.Orange); box[2, 2, 2] = new PuzzleNode(Color.Orange); }
public static void Lesson9(PuzzleBox box, MasterGrid grid) { introText = "" + "Okay! Let's combine what we've learned about sets\n" + "and bonus bubbles. See those three green bubbles\n" + "in the upper right?:" + "If we can match our two green bubbles at the\n" + "bottom with them, we can pop 5 bubbles at once!:" + "They'll also get replaced by two bonus bubbles,\n" + "which we can use to get another set!"; successText = "Nice! That was worth a lot of points!"; failureText = "" + "Oops! This one is tricky. Don't forget to use\n"+ "The shoulder buttons for rotations and the\n"+ "triggers to push and pull the bubbles.:"+ "Try and get match the bubbles in the upper\n"+ "right first!"; restrictions = ControlRestrictions.None; Clear(box, grid); grid[3, 0] = new PuzzleNode(Color.Green); grid[4, 1] = new PuzzleNode(Color.Green); grid[4, 2] = new PuzzleNode(Color.Green); grid[0, 2] = new PuzzleNode(Color.Green); box[1, 2, 1] = new PuzzleNode(Color.Green); box[1, 2, 2] = new PuzzleNode(Color.Green); }
// Completely randomizes the entire box and grid. public static void Reset(PuzzleBox box, MasterGrid grid) { for (int x = 0; x < boxSize; x++) { for (int y = 0; y < boxSize; y++) { for (int z = 0; z < boxSize; z++) { //if (box[x, y, z].moveCountdownOrb == true) box[x, y, z].color = Color.Gray; //if (box[x, y, z].timeCountdownOrb == true) box[x, y, z].color = Color.Gray; box[x, y, z] = new PuzzleNode(); box[x, y, z].marked = true; //} } } } Random r = new Random(); for (int i = 0; i < Game.currentSettings.grayOrbStart;) { int x = r.Next(3); int y = r.Next(3); int z = r.Next(3); if (box[x, y, z].color != Color.Gray) { box[x, y, z] = new PuzzleNode(Color.Gray); box[x, y, z].marked = true; i++; } } for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { grid[x, y] = new PuzzleNode(); grid[x, y].marked = true; } } }
public static bool Match(PuzzleNode p1, PuzzleNode p2) { if ((p1.color.R==128 && p1.color.G ==128 && p1.color.B==128) || p1.color == Color.Black) return false; return p1.color == p2.color; }
private void RandomSetup() { Random r = new Random(); for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { if (x < boxOffset && y < boxOffset || x >= boxOffset + boxSize && y >= boxOffset + boxSize || x < boxOffset && y >= boxOffset + boxSize || x >= boxOffset+boxSize && y < boxOffset) { arr[x, y] = new PuzzleNode(Color.Black); continue; } arr[x, y] = new PuzzleNode(); if (x == 0 || x == gridSize - 1 || y == 0 || y == gridSize - 1) { queues[x, y] = new List<PuzzleNode>(); Color prevColor = Color.Black; for (int i = 0; i < 10; i++) { if (Game.currentSettings.refillQueues) { PuzzleNode p = new PuzzleNode(); while (p.color == prevColor) p = new PuzzleNode(); queues[x, y].Add(p); prevColor = p.color; } else { queues[x, y].Add(new PuzzleNode(Color.Gray)); } } } } } }
public PuzzleNode Copy() { PuzzleNode newNode = new PuzzleNode(color); newNode.toggleColor = toggleColor; newNode.toggleOrb = toggleOrb; ClearMarking(); newNode.marked = true; return newNode; }
public static void Lesson3(PuzzleBox box, MasterGrid grid) { controlLessonIndex = 0; introText = "" + "In addition, you can use the Left and Right\n" + "Triggers to push and pull the bubbles in the\n" + "Jellyfish's body. Try it now!:" + "Great! That way, you can change which layer of\n" + "bubbles aligns with the tentacles.:" + "Now, use the Left and Right Triggers to match\n"+ "the bubbles!"; successText = "" + "Great! With the Left Control Stick, Shoulder\n" + "Buttons, and Triggers, you can reorient the\n" + "bubbles however you want!:"+ "If you need a reminder of the controls, take a\n" + "look around the top and bottom left of the\n"+ "screen for a review."; Clear(box, grid); restrictions = ControlRestrictions.TriggersOnly; grid[0, 1] = new PuzzleNode(Color.Red); grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta); grid[3, 0] = new PuzzleNode(Color.Yellow); grid[4, 3] = new PuzzleNode(Game.jellyBlue); grid[1, 4] = new PuzzleNode(Color.Green); box[0, 0, 0] = new PuzzleNode(Color.Magenta); box[1, 0, 0] = new PuzzleNode(Color.Red); box[2, 2, 0] = new PuzzleNode(Color.Green); box[1, 0, 2] = new PuzzleNode(Color.Yellow); box[2, 2, 2] = new PuzzleNode(Game.jellyBlue); }
public static void Lesson2(PuzzleBox box, MasterGrid grid) { controlLessonIndex = 0; introText = "" + "Instead of using the Left Control Stick, you\n" + "can use the Left and Right Shoulder Buttons.\n" + "Try it now!:" + "Good! This will perform a different type of\n" + "rotation. Use the Shoulder Buttons to match\n" + "these bubbles!"; successText = "" + "Nice! If you can master all 6 types of these\n" + "rotations, you'll do great!"; restrictions = ControlRestrictions.ShouldersOnly; Clear(box,grid); grid[0, 1] = new PuzzleNode(Color.Yellow); grid[3, 4] = new PuzzleNode(Color.Green); grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta); grid.queues[0, 1][0] = new PuzzleNode(Color.Red); grid.queues[3, 4][1] = new PuzzleNode(Color.Red); grid.queues[3, 4][0] = new PuzzleNode(Color.Magenta); grid[2, 4] = new PuzzleNode(Color.Orange); grid.queues[2, 4][1] = new PuzzleNode(Game.jellyBlue); box[0, 0, 2] = new PuzzleNode(Color.Yellow); box[0, 0, 0] = new PuzzleNode(Color.Green); box[0, 1, 2] = new PuzzleNode(Color.Orange); box[0, 1, 0] = new PuzzleNode(Game.jellyBlue); }
private static ScoringSet CreateScoreHelperVert(int start, int end, int x, PuzzleNode p) { ScoringSet s = new ScoringSet(); s.start = start; s.end = end; s.drawX = p.screenX; s.drawY = p.screenY; s.color = p.color; s.x = x; s.y = -1; if (start < boxOffset) s.drawY -= 50; else s.drawY += 50; return s; }
public static void Lesson1(PuzzleBox box, MasterGrid grid) { controlLessonIndex = 1; introText = "" + "Look at all these bubbles inside Mister\n"+ "Jellyfish! The colored ones are toxic! Let's\n" + "see if we can get rid of them.:"+ "You can use the Left Control Stick to rotate\n" + "the bubbles in Mister Jellyfish's body.\n" + "Try it now!:" + "Perfect! Try to match up the colored bubbles\n" + "in his body with the bubbles in his tentacles!"; successText = "" + "Great job! When you aligned the bubbles in\n" + "his body with the bubbles in his tentacles,\n" + "the bubbles popped!"; Clear(box, grid); restrictions = ControlRestrictions.StickOnly; grid[0, 1] = new PuzzleNode(Color.Yellow); grid[3, 4] = new PuzzleNode(Color.Green); grid.queues[0, 1][1] = new PuzzleNode(Color.Magenta); grid.queues[0, 1][0] = new PuzzleNode(Color.Red); grid.queues[3, 4][1] = new PuzzleNode(Color.Red); grid.queues[3, 4][0] = new PuzzleNode(Color.Magenta); grid[2, 4] = new PuzzleNode(Color.Orange); grid.queues[2, 4][1] = new PuzzleNode(Game.jellyBlue); box[0, 0, 2] = new PuzzleNode(Color.Yellow); box[0, 0, 0] = new PuzzleNode(Color.Green); box[0, 1, 2] = new PuzzleNode(Color.Orange); box[0, 1, 0] = new PuzzleNode(Game.jellyBlue); }
public void Draw() { Game.spriteBatch.Draw(background, new Rectangle(0, 0, Game.screenSizeX, Game.screenSizeY), Color.White); Game.spriteBatch.Draw(header, new Rectangle(headerX, headerY, headerWidth, headerHeight), Color.White); for (int i = 0; i < optionList.Count; i++) { if (i == selectedIndex && state != GameOverMenuState.INITIALS) { PuzzleNode p = new PuzzleNode(Game.jellyBlue); p.screenX = optionListX-25; p.screenY = optionListY +optionHeight/2+ i * optionGap; if (state == GameOverMenuState.ANIMATEDOWN) p.screenY -= (int)(optionGap * (1f - (float)animateTime / (float)250)); if (state == GameOverMenuState.ANIMATEUP) p.screenY += (int)(optionGap * (1f - (float)animateTime / (float)250)); p.distance = 50; p.scale = 1f; OrbRenderer.DrawOrb(p, State.READY, 0f); Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.LightGreen); } else Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.White); } if (state == GameOverMenuState.DOCTORIN) { JellyfishRenderer.DrawJellyfish(doctorX + 800 - 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally); JellyfishRenderer.DrawJellyfish(doctorX + 600 - 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally); } else if (state == GameOverMenuState.DOCTOROUT) { JellyfishRenderer.DrawJellyfish(doctorX + 200 + 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally); JellyfishRenderer.DrawJellyfish(doctorX + 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally); } else { JellyfishRenderer.DrawJellyfish(doctorX+200, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally); JellyfishRenderer.DrawJellyfish(doctorX, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally); } if (Game.currentSettings.mode == GameMode.Puzzle) { TimeSpan t = new TimeSpan(0, 0, 0, 0, score); Game.spriteBatch.DrawString(Game.spriteFont, string.Format("TIME: {0}:{1:D2}", t.Minutes, t.Seconds), new Vector2(scoreX, scoreY), Color.LightGreen, 0, Vector2.Zero, 1.6f, SpriteEffects.None, 0); for (int i = 0; i < 3; i++) { Game.spriteBatch.Draw(emptyStar, new Rectangle(scoreX + 75 * i, scoreY + 50, 64, 64), Color.White); } Game.spriteBatch.Draw(star, new Rectangle(scoreX, scoreY + 50, 64, 64), Color.White); if (score <= Game.currentSettings.two_star) Game.spriteBatch.Draw(star, new Rectangle(scoreX + 75, scoreY + 50, 64, 64), Color.White); if (score <= Game.currentSettings.three_star) Game.spriteBatch.Draw(star, new Rectangle(scoreX + 150, scoreY + 50, 64, 64), Color.White); } else { Game.spriteBatch.DrawString(Game.spriteFont, "SCORE:" + score, new Vector2(scoreX, scoreY), Color.LightGreen, 0, Vector2.Zero, 1.6f, SpriteEffects.None, 0); for (int i = 0; i < 3; i++) { Game.spriteBatch.Draw(emptyStar, new Rectangle(scoreX + 75*i, scoreY + 50, 64, 64), Color.White); } Game.spriteBatch.Draw(star, new Rectangle(scoreX, scoreY + 50, 64, 64), Color.White); if(score >= Game.currentSettings.two_star) Game.spriteBatch.Draw(star, new Rectangle(scoreX + 75, scoreY + 50, 64, 64), Color.White); if (score >= Game.currentSettings.three_star) Game.spriteBatch.Draw(star, new Rectangle(scoreX + 150, scoreY + 50, 64, 64), Color.White); } if (levelData != null) { Game.spriteBatch.DrawString(Game.spriteFont, "High Scores", new Vector2(highScoreX, highScoreY), Color.LightGreen, 0, Vector2.Zero, 1.6f, SpriteEffects.None, 0); for (int i = 1; i < 6; i++) { if (i - 1 == rank) { if (Game.currentSettings.mode == GameMode.Puzzle) { TimeSpan t = new TimeSpan(0, 0, 0, 0, levelData.highScores[i - 1]); Game.spriteBatch.DrawString(Game.spriteFont, string.Format("{0}: {1}:{2:D2}", levelData.playerNames[i - 1], t.Minutes, t.Seconds), new Vector2(highScoreX, highScoreY + highScoreLine * (i + 1) + 4), Color.White, 0, Vector2.Zero, 1.5f, SpriteEffects.None, 0); } else Game.spriteBatch.DrawString(Game.spriteFont, i + ": " + levelData.playerNames[i - 1] + " - " + levelData.highScores[i - 1], new Vector2(highScoreX, highScoreY + highScoreLine * (i + 1) + 4), Color.White, 0, Vector2.Zero, 1.5f, SpriteEffects.None, 0); } else { if (Game.currentSettings.mode == GameMode.Puzzle) { TimeSpan t = new TimeSpan(0, 0, 0, 0, levelData.highScores[i - 1]); Game.spriteBatch.DrawString(Game.spriteFont, string.Format("{0}: {1}:{2:D2}", levelData.playerNames[i - 1], t.Minutes, t.Seconds), new Vector2(highScoreX, highScoreY + highScoreLine * (i + 1) + 5), Color.LightGreen, 0, Vector2.Zero, 1.4f, SpriteEffects.None, 0); } else Game.spriteBatch.DrawString(Game.spriteFont, i + ": " + levelData.playerNames[i - 1] + " - " + levelData.highScores[i - 1], new Vector2(highScoreX, highScoreY + highScoreLine * (i + 1) + 5), Color.LightGreen, 0, Vector2.Zero, 1.4f, SpriteEffects.None, 0); } } } if (currentCharacter > 2 || rank == -1) { JellyfishRenderer.DrawSpeechBubble2(speechX, speechY, 100, SpriteEffects.FlipHorizontally); Game.spriteBatch.DrawString(Game.spriteFont, congratulationsMessage, new Vector2(speechX - 260, speechY), Color.Black); } if (rank != -1 && currentCharacter <= 2) { JellyfishRenderer.DrawSpeechBubble2(speechX, speechY, 100, SpriteEffects.FlipHorizontally); Game.spriteBatch.DrawString(Game.spriteFont, "Way to go! You got a high score! Please enter", new Vector2(speechX-260, speechY), Color.Black); Game.spriteBatch.DrawString(Game.spriteFont, "your initials: ", new Vector2(speechX - 260, speechY+25), Color.Black); Game.spriteBatch.DrawString(Game.spriteFont, "" + initials[2], new Vector2(speechX - 70, speechY + 25), Color.Black,0,Vector2.Zero,1f,SpriteEffects.None,0); Game.spriteBatch.DrawString(Game.spriteFont, "" + initials[1], new Vector2(speechX - 95, speechY + 25), Color.Black, 0, Vector2.Zero, 1f, SpriteEffects.None, 0); Game.spriteBatch.DrawString(Game.spriteFont, "" + initials[0], new Vector2(speechX - 120, speechY + 25), Color.Black, 0, Vector2.Zero, 1f, SpriteEffects.None, 0); Game.spriteBatch.DrawString(Game.spriteFont, "^", new Vector2(speechX - 120 + 25 * currentCharacter, speechY + 45), Color.Black, 0, Vector2.Zero, 1f, SpriteEffects.None, 0); } }
//Identifies all scoring matches and marks them. public static List<ScoringSet> Solve(PuzzleBox box, MasterGrid grid) { Matcher.AddBoxToGrid(box, grid); List<ScoringSet> scoringSets = new List<ScoringSet>(); // Marking orbs #region InitialOrbMarking // Marking vertical lines for (int x = boxOffset; x < boxOffset+boxSize; x++) { int start_index = 0; int end_index = 0; PuzzleNode lastNode = new PuzzleNode(Color.Black); for (int y = 0; y < gridSize; y++) { if (grid[x, y] == null) continue; if (PuzzleNode.Match(lastNode, grid[x, y])) { lastNode = grid[x, y]; end_index++; } else { lastNode = grid[x, y]; if (StartEndHelper(start_index, end_index)) { ScoringSet s; if (start_index < boxOffset) s = CreateScoreHelperVert(start_index, end_index, x, grid[x, start_index]); else s = CreateScoreHelperVert(start_index, end_index, x, grid[x, y]); for (int i = start_index; i < end_index; i++) { s.multiplier *= grid[x, i].bonus; MarkHelperVert(start_index, end_index, i, grid[x, i]); } scoringSets.Add(s); } start_index = y; end_index = y + 1; } } if (StartEndHelper(start_index, end_index)) { ScoringSet s = CreateScoreHelperVert(start_index, end_index, x, grid[x, end_index-1]); for (int i = start_index; i < end_index; i++) { s.multiplier *= grid[x, i].bonus; MarkHelperVert(start_index, end_index, i, grid[x, i]); } scoringSets.Add(s); } } // Marking horizontal lines for (int y = boxOffset; y < boxOffset+boxSize; y++) { int start_index = 0; int end_index = 0; PuzzleNode lastNode = new PuzzleNode(Color.Black); for (int x = 0; x < gridSize; x++) { if (grid[x, y] == null) continue; if (PuzzleNode.Match(lastNode, grid[x, y])) { lastNode = grid[x, y]; end_index++; } else { lastNode = grid[x, y]; if (StartEndHelper(start_index, end_index)) { ScoringSet s; if(start_index < boxOffset) s = CreateScoreHelperHoriz(start_index, end_index, y, grid[start_index, y]); else s = CreateScoreHelperHoriz(start_index, end_index, y, grid[x, y]); for (int i = start_index; i < end_index; i++) { s.multiplier *= grid[i, y].bonus; MarkHelperHoriz(start_index, end_index, i, grid[i, y]); } scoringSets.Add(s); } start_index = x; end_index = x + 1; } } if (StartEndHelper(start_index, end_index)) { ScoringSet s = CreateScoreHelperHoriz(start_index, end_index, y, grid[end_index-1, y]); for (int i = start_index; i < end_index; i++) { s.multiplier *= grid[i, y].bonus; MarkHelperHoriz(start_index, end_index, i, grid[i, y]); } scoringSets.Add(s); } } #endregion // Extend wildcard markings #region ExtendWildcardMarkings for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { if (IsWildCard(grid[x, y])) { for (int i = x+1; i < gridSize; i++) { if (grid[i, y].marked) grid[i, y].replace_right = true; else break; } for (int i = x-1; i >= 0; i--) { if (grid[i, y].marked) grid[i, y].replace_left = true; else break; } for (int i = y+1; i < gridSize; i++) { if (grid[x, i].marked) grid[x, i].replace_bottom = true; else break; } for (int i = y-1; i >= 0; i--) { if (grid[x, i].marked) grid[x,i].replace_top = true; else break; } } } } #endregion // Mark non-scoring orbs as needing to be replaced #region MarkNonScoringOrbsForReplacement for (int x = boxOffset; x < boxOffset+boxSize; x++) { for (int y = 0; y < gridSize; y++) { if (grid[x, y].replace_bottom && !IsWildCard(grid[x, y])) { for (int i = y; i < gridSize; i++) { grid[x,i].marked = true; grid[x,i].replace_bottom = true; grid[x,i].replace_distance = grid[x, y].replace_distance; } break; } } for (int y = gridSize-1; y >=0; y--) { if (grid[x, y].replace_top && !IsWildCard(grid[x, y])) { for (int i = y; i >=0; i--) { grid[x, i].marked = true; grid[x, i].replace_top = true; grid[x, i].replace_distance = grid[x, y].replace_distance; } break; } } } for (int y = boxOffset; y < boxOffset+boxSize; y++) { for (int x = 0; x < gridSize; x++) { if (grid[x, y].replace_right && !IsWildCard(grid[x, y])) { for (int i = x; i < gridSize; i++) { grid[i, y].marked = true; grid[i, y].replace_right = true; grid[i, y].replace_distance = grid[x, y].replace_distance; } break; } } for (int x = gridSize-1; x >= 0; x--) { if (grid[x, y].replace_left && !IsWildCard(grid[x, y])) { for (int i = x; i >= 0; i--) { grid[i, y].marked = true; grid[i, y].replace_left = true; grid[i, y].replace_distance = grid[x, y].replace_distance; } break; } } } #endregion // fix replace distances #region FixReplaceDistances for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { if (IsWildCard(grid[x, y])) { if(grid[x,y].replace_right) for (int i = x; i < gridSize; i++) { if (grid[i, y].marked) grid[i, y].replace_distance--; else break; } if(grid[x,y].replace_left) for (int i = x; i >= 0; i--) { if (grid[i, y].marked) grid[i, y].replace_distance--; else break; } if(grid[x,y].replace_bottom) for (int i = y; i < gridSize; i++) { if (grid[x, i].marked) grid[x, i].replace_distance--; else break; } if(grid[x,y].replace_top) for (int i = y; i >= 0; i--) { if (grid[x, i].marked) grid[x, i].replace_distance--; else break; } } } } #endregion Matcher.SetBoxFromGrid(box, grid); return scoringSets; }
public static void Lesson0(PuzzleBox box, MasterGrid grid) { Clear(box, grid); box[1, 2, 2] = new PuzzleNode(Color.Red); box[0, 2, 2] = new PuzzleNode(Color.Red); grid[3,0] = new PuzzleNode(Color.Red); }
public GameStopCause Update(GameTime gameTime) { cooldown -= gameTime.ElapsedGameTime.Milliseconds; if (cooldown < 0) cooldown = 0; if (mode != ControlMode.EDITOR) { Matcher.UpdateTimeCountdown(puzzleBox, masterGrid, gameTime.ElapsedGameTime.Milliseconds); if (false == timer.Update(gameTime)) { Logger.totalScore = currentScore; Logger.LogGame(); return GameStopCause.END; } clock.Update(gameTime); } // Game state flow if (gameState == State.DESTROY || gameState == State.VANISH || gameState == State.NEWSET) { animateTime += gameTime.ElapsedGameTime.Milliseconds; if (animateTime > maxAnimateTime) animateTime = maxAnimateTime; } if (gameState == State.PAUSING || gameState == State.RESUMING) { animateTime += gameTime.ElapsedGameTime.Milliseconds; if (animateTime > 2*maxAnimateTime) animateTime = 2*maxAnimateTime; } if (gameState == State.REGENERATE) { animateTime += gameTime.ElapsedGameTime.Milliseconds; if (animateTime > maxAnimateTime * maxSlideDistance) animateTime = maxAnimateTime * maxSlideDistance; } if (gameState == State.MOVECOMPLETE) { if (mode == ControlMode.EDITOR) gameState = State.READY; else { if(Game.currentSettings.mode==GameMode.MoveChallenge) movesRemaining--; Matcher.UpdateToggleState(puzzleBox, masterGrid); gameState = State.VERIFY; } } if (gameState == State.VERIFY) { List<ScoringSet> scoreSet = Matcher.Solve(puzzleBox, masterGrid); if (scoreSet.Count > 0) SoundEffects.PlayScore(); foreach (ScoringSet s in scoreSet) { if (Game.currentSettings.loseType == LoseType.BADCOLOR) { if (s.color == Game.currentSettings.dangerColor) pendingResult = GameStopCause.LOSE_ERROR; } s.CalculateScore(); s.LogScore(); currentScore += s.score; scoreList.Add(s); } if (Matcher.AllGray(puzzleBox, masterGrid)) { if (Game.currentSettings.mode == GameMode.Tutorial) { TutorialStage.phase = TutorialPhase.Pass; return GameStopCause.TUTORIAL_PASS; } return GameStopCause.WIN; } maxSlideDistance = Matcher.GetMaxReplaceDistance(puzzleBox, masterGrid); if (0 == maxSlideDistance) { if (movesRemaining == 0) return GameStopCause.END; if (!Matcher.HasValidMove(puzzleBox, masterGrid)) { if (Game.currentSettings.mode == GameMode.Puzzle) { return GameStopCause.LOSE_STUCK; } else if (Game.currentSettings.mode == GameMode.Tutorial) { return GameStopCause.TUTORIAL_FAIL; } else { newPuzzleBox = new PuzzleBox(); newMasterGrid = new MasterGrid(); Matcher.Reset(newPuzzleBox, newMasterGrid); newPuzzleBox.activeZ = puzzleBox.activeZ; newCubeDistance = cubeDistance; gameState = State.VANISH; puzzleBox.Mark(); masterGrid.Mark(); animateTime = 0; } } else { Matcher.UpdateMoveCountdown(puzzleBox, masterGrid); gameState = State.READY; animateTime = 0; } } else { gameState = State.DESTROY; animateTime = 0; } } if (gameState == State.DESTROY && animateTime == maxAnimateTime) { if (pendingResult != GameStopCause.NONE) return pendingResult; for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { if (masterGrid[x, y].marked) { fragmentList.Add(new Fragment(masterGrid[x, y].screenX, masterGrid[x, y].screenY, Game.screenSizeX, Game.screenSizeY, masterGrid[x, y].scale, masterGrid[x, y].color)); } } } for (int y = 0; y < boxSize; y++) { for (int z = 0; z < boxSize; z++) { if (puzzleBox[0, y, z].marked) { fragmentList.Add(new Fragment(puzzleBox[0, y, z].screenX, puzzleBox[0, y, z].screenY, Game.screenSizeX, Game.screenSizeY, puzzleBox[0, y, z].scale, puzzleBox[0, y, z].color)); } } } // Regenerate orbs Matcher.Replace(puzzleBox, masterGrid); gameState = State.REGENERATE; animateTime = 0; } if (gameState == State.PAUSING && animateTime == 2 * maxAnimateTime) { gameState = State.RESUMING; animateTime = 0; SoundEffects.PlayMove(); return GameStopCause.PAUSE; } if (gameState == State.RESUMING && animateTime == 2 * maxAnimateTime) { //Matcher.Reset(puzzleBox,masterGrid); Matcher.Clear(puzzleBox, masterGrid); gameState = State.READY; animateTime = 0; if (Game.currentSettings.mode == GameMode.Tutorial && firstResume == true) { firstResume = false; return GameStopCause.TUTORIAL_TEXT; } } if (gameState == State.VANISH && animateTime == maxAnimateTime) { if (newPuzzleBox != null) { puzzleBox = newPuzzleBox.Copy(); masterGrid = newMasterGrid.Copy(); cubeDistance = newCubeDistance; newPuzzleBox = null; newMasterGrid = null; } gameState = State.NEWSET; animateTime = 0; } if (gameState == State.NEWSET && animateTime == maxAnimateTime) { Matcher.Clear(puzzleBox, masterGrid); gameState = State.READY; animateTime = 0; if (Game.currentSettings.mode == GameMode.Tutorial && firstResume==true) { firstResume = false; return GameStopCause.TUTORIAL_TEXT; } } if (gameState == State.REGENERATE && animateTime == maxAnimateTime * maxSlideDistance) { // Clear orbs Matcher.Clear(puzzleBox, masterGrid); gameState = State.VERIFY; } if (gameState == State.READY) { if(mode!=ControlMode.EDITOR) Matcher.UpdateTimeCountdown(puzzleBox, masterGrid, gameTime.ElapsedGameTime.Milliseconds); if (mode == ControlMode.NORMAL) { if (Keyboard.GetState().IsKeyDown(Keys.P) || GamePad.GetState(Game.playerIndex).IsButtonDown(Buttons.Start)) { gameState = State.PAUSING; savedShift = shift; animateTime = 0; } } if (mode == ControlMode.NORMAL || mode == ControlMode.EDITOR) { Vector2 stick = GamePad.GetState(Game.playerIndex).ThumbSticks.Left; GamePadState gamePadState = GamePad.GetState(Game.playerIndex); //if (gamePadState.IsConnected == false) //{ //gameState = State.PAUSING; //animateTime = 0; //} if (Keyboard.GetState().IsKeyDown(Keys.B) || gamePadState.IsButtonDown(Buttons.B)) { if (Game.currentSettings.mode == GameMode.Puzzle) { if (prevPuzzleBox == null) SoundEffects.PlayClick(); else { SoundEffects.PlayScore(); Back(); } } } if ((Keyboard.GetState().IsKeyDown(Keys.E) || gamePadState.IsButtonDown(Buttons.Y))) { if (cooldown == 0) { Game.gameSettings.soundEffectsEnabled = !Game.gameSettings.soundEffectsEnabled; cooldown = 250; } } if (cooldown==0 && (Keyboard.GetState().IsKeyDown(Keys.M) || gamePadState.IsButtonDown(Buttons.X))) { if (Game.gameSettings.musicEnabled) { Game.gameSettings.musicEnabled = false; MusicControl.Stop(); } else { Game.gameSettings.musicEnabled = true; if (Game.currentSettings.mode == GameMode.Tutorial) MusicControl.PlayMenuMusic(); else MusicControl.PlayGameMusic(); } cooldown = 250; } if(cooldown==0 && (Keyboard.GetState().IsKeyDown(Keys.OemPlus) || gamePadState.IsButtonDown(Buttons.Back))) { Game.gameSettings.displayControls = !Game.gameSettings.displayControls; cooldown = 250; } if ((TutorialStage.phase == TutorialPhase.None || TutorialStage.restrictions == ControlRestrictions.None || TutorialStage.restrictions == ControlRestrictions.StickOnly)) { if (gamePadState.IsButtonDown(Buttons.DPadLeft) || gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left) || stick.X < -Game.gameSettings.controlStickTrigger) { SoundEffects.PlayMove(); prevMasterGrid = masterGrid.Copy(); prevPuzzleBox = puzzleBox.Copy(); prevCubeDistance = cubeDistance; gameState = State.ROTATEPOSY; } if (gamePadState.IsButtonDown(Buttons.DPadRight) || gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Right) || stick.X > Game.gameSettings.controlStickTrigger) { SoundEffects.PlayMove(); prevMasterGrid = masterGrid.Copy(); prevPuzzleBox = puzzleBox.Copy(); prevCubeDistance = cubeDistance; gameState = State.ROTATENEGY; } if (gamePadState.IsButtonDown(Buttons.DPadUp) || gamePadState.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState().IsKeyDown(Keys.Up) || stick.Y > Game.gameSettings.controlStickTrigger) { SoundEffects.PlayMove(); prevMasterGrid = masterGrid.Copy(); prevPuzzleBox = puzzleBox.Copy(); prevCubeDistance = cubeDistance; gameState = State.ROTATEPOSX; } if (gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState().IsKeyDown(Keys.Down) || stick.Y < -Game.gameSettings.controlStickTrigger) { SoundEffects.PlayMove(); prevMasterGrid = masterGrid.Copy(); prevPuzzleBox = puzzleBox.Copy(); prevCubeDistance = cubeDistance; gameState = State.ROTATENEGX; } } if (TutorialStage.phase==TutorialPhase.None || TutorialStage.restrictions == ControlRestrictions.None || TutorialStage.restrictions == ControlRestrictions.ShouldersOnly) { if (Keyboard.GetState().IsKeyDown(Keys.S) || gamePadState.IsButtonDown(Buttons.RightShoulder)) { SoundEffects.PlayMove(); prevMasterGrid = masterGrid.Copy(); prevPuzzleBox = puzzleBox.Copy(); prevCubeDistance = cubeDistance; gameState = State.ROTATEPOSZ; } if (Keyboard.GetState().IsKeyDown(Keys.A) || gamePadState.IsButtonDown(Buttons.LeftShoulder)) { SoundEffects.PlayMove(); prevMasterGrid = masterGrid.Copy(); prevPuzzleBox = puzzleBox.Copy(); prevCubeDistance = cubeDistance; gameState = State.ROTATENEGZ; } } if (TutorialStage.phase == TutorialPhase.None || TutorialStage.restrictions == ControlRestrictions.None || TutorialStage.restrictions == ControlRestrictions.TriggersOnly) { if (Keyboard.GetState().IsKeyDown(Keys.Q) || gamePadState.IsButtonDown(Buttons.LeftTrigger) || gamePadState.IsButtonDown(Buttons.LeftTrigger)) { if (cubeDistance < spacing * 2) { SoundEffects.PlayMove(); prevMasterGrid = masterGrid.Copy(); prevPuzzleBox = puzzleBox.Copy(); prevCubeDistance = cubeDistance; cubeDistanceGoal = cubeDistance + spacing; gameState = State.PUSH; } } if (Keyboard.GetState().IsKeyDown(Keys.W) || gamePadState.IsButtonDown(Buttons.RightTrigger) || gamePadState.IsButtonDown(Buttons.RightTrigger)) { if (cubeDistance > 0) { SoundEffects.PlayMove(); prevMasterGrid = masterGrid.Copy(); prevPuzzleBox = puzzleBox.Copy(); prevCubeDistance = cubeDistance; cubeDistanceGoal = cubeDistance - spacing; gameState = State.PULL; } } } } if (mode == ControlMode.AUTOMATED) { int x = automator.Next(0, 8); if (x == 0) gameState = State.ROTATEPOSY; if (x == 1) gameState = State.ROTATEPOSZ; if (x == 2) gameState = State.ROTATEPOSX; if (x == 3) gameState = State.ROTATENEGX; if (x == 4) gameState = State.ROTATENEGY; if (x == 5) gameState = State.ROTATENEGZ; if (x == 6) { if (cubeDistance > 0) { cubeDistanceGoal = cubeDistance - spacing; gameState = State.PULL; } } if (x == 7) { if (cubeDistance < spacing * 2) { cubeDistanceGoal = cubeDistance + spacing; gameState = State.PUSH; } } } if (mode == ControlMode.EDITOR) { editorCooldown-=gameTime.ElapsedGameTime.Milliseconds; if (editorCooldown < 0) editorCooldown = 0; if (editorCooldown == 0) { if (Keyboard.GetState().IsKeyDown(Keys.NumPad1)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 2, 0]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad2)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 2, 1]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad3)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 2, 2]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad4)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 1, 0]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad5)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 1, 1]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad6)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 1, 2]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad7)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 0, 0]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad8)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 0, 1]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad9)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = puzzleBox[puzzleBox.activeZ, 0, 2]; selectedQueue = null; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.Insert)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[1, 0]; selectedQueue = masterGrid.queues[1, 0]; ; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.Home)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[2, 0]; selectedQueue = masterGrid.queues[2, 0]; ; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.PageUp)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[3, 0]; selectedQueue = masterGrid.queues[3, 0]; ; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.Delete)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[1, 4]; selectedQueue = masterGrid.queues[1, 4]; ; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.End)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[2, 4]; selectedQueue = masterGrid.queues[2, 4]; ; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.PageDown)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[3, 4]; selectedQueue = masterGrid.queues[3, 4]; ; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.OemCloseBrackets)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[4, 1]; selectedQueue = masterGrid.queues[4, 1]; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.OemQuotes)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[4, 2]; selectedQueue = masterGrid.queues[4, 2]; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.OemQuestion)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[4, 3]; selectedQueue = masterGrid.queues[4, 3]; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.OemOpenBrackets)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[0, 1]; selectedQueue = masterGrid.queues[0,1]; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.OemSemicolon)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[0, 2]; selectedQueue = masterGrid.queues[0, 2]; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.OemPeriod)) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedNode = masterGrid[0, 3]; selectedQueue = masterGrid.queues[0, 3]; selectedNode.selected = true; } if (Keyboard.GetState().IsKeyDown(Keys.M)) { if (selectedQueue != null) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedDepth++; if (selectedDepth >= selectedQueue.Count) selectedDepth = selectedQueue.Count - 1; selectedNode = selectedQueue[selectedDepth]; selectedNode.selected = true; editorCooldown = 250; } } if (Keyboard.GetState().IsKeyDown(Keys.N)) { if (selectedQueue != null) { puzzleBox.ClearSelection(); masterGrid.ClearSelection(); selectedDepth--; if (selectedDepth < 0) selectedDepth = 0; selectedNode = selectedQueue[selectedDepth]; selectedNode.selected = true; editorCooldown = 250; } } if (Keyboard.GetState().IsKeyDown(Keys.R)) { selectedNode.color = Color.Red; } if (Keyboard.GetState().IsKeyDown(Keys.G)) { selectedNode.color = Color.Green; } if (Keyboard.GetState().IsKeyDown(Keys.B)) { selectedNode.color = Game.jellyBlue; } if (Keyboard.GetState().IsKeyDown(Keys.Y)) { selectedNode.color = Color.Yellow; } if (Keyboard.GetState().IsKeyDown(Keys.P)) { selectedNode.color = Color.Magenta; } if (Keyboard.GetState().IsKeyDown(Keys.O)) { selectedNode.color = Color.DarkOrange; } if (Keyboard.GetState().IsKeyDown(Keys.X)) { selectedNode.color = Color.Gray; } if (Keyboard.GetState().IsKeyDown(Keys.F10)) { LevelLoader.SaveLevel(puzzleBox, masterGrid); } if (Keyboard.GetState().IsKeyDown(Keys.F5)) { mode = ControlMode.NORMAL; } if (Keyboard.GetState().IsKeyDown(Keys.F)) { if (selectedNode.toggleOrb == false) { selectedNode.toggleColor = Color.Gray; } selectedNode.toggleOrb = true; } if (Keyboard.GetState().IsKeyDown(Keys.C)) { if (selectedNode.moveCountdownOrb == false) { selectedNode.moveCountdownOrb = true; selectedNode.countdown = 10; } else selectedNode.moveCountdownOrb = false; } if(Keyboard.GetState().IsKeyDown(Keys.LeftShift)) { if(Keyboard.GetState().IsKeyDown(Keys.F)) { if (selectedNode.toggleOrb) { Color temp = selectedNode.color; selectedNode.color = selectedNode.toggleColor; selectedNode.toggleColor = temp; editorCooldown = 250; } } } if (Keyboard.GetState().IsKeyDown(Keys.T)) { if (selectedNode.timeCountdownOrb == false) { selectedNode.timeCountdownOrb = true; selectedNode.countdown = 10000; } else selectedNode.timeCountdownOrb = false; } if (Keyboard.GetState().IsKeyDown(Keys.OemPlus)) { if(selectedNode.moveCountdownOrb) selectedNode.countdown++; if (selectedNode.timeCountdownOrb) selectedNode.countdown += 1000; editorCooldown = 250; } if (Keyboard.GetState().IsKeyDown(Keys.OemMinus)) { if (selectedNode.moveCountdownOrb) selectedNode.countdown--; if (selectedNode.timeCountdownOrb) selectedNode.countdown -= 1000; editorCooldown = 250; } } } } // Update fragment animation positions for (int i = 0; i < fragmentList.Count; i++) { if (false == fragmentList[i].Update(gameTime)) { fragmentList.RemoveAt(i); } } // Update scoring animation positions for (int i = 0; i < scoreList.Count; i++) { if (false == scoreList[i].Update(gameTime)) { scoreList.RemoveAt(i); } } return GameStopCause.NONE; }
private static void MarkHelperVert(int start, int end, int y, PuzzleNode p) { p.marked = true; p.scoring = true; if (start < boxOffset && end > boxOffset+boxSize) { if (y <= centerIndex) { p.replace_top = true; p.replace_distance = 1+centerIndex - start; } if (y >= centerIndex) { p.replace_bottom = true; p.replace_distance = end - centerIndex; } } else { if (start < boxOffset) { p.replace_top = true; p.replace_distance = end - start; } if (end > boxOffset+boxSize) { p.replace_bottom = true; p.replace_distance = end - start; } } }
public static void Lesson5(PuzzleBox box, MasterGrid grid) { introText = "" + "This next lesson is tricky. Notice the two\n" + "yellow bubbles in Mister Jellyfish's body?:" + "They're right next to each other, but they\n" + "haven't popped!:" + "That's because to pop bubbles, you need to\n" + "match bubbles from the Jellyfish's body with\n" + "the bubbles in the tentacles.:" + "Try to align these two yellow bubbles with the\n" + "yellow bubble in the tentacle to form a\n"+ "straight line."; successText = "" + "You got it. Remember, sets of bubbles will\n" + "only pop if they form a straight line. So be\n" + "careful!"; failureText = "" + "Almost! Only sets of bubbles that form a\n" + "straight line will match."; Clear(box,grid); grid[0, 1] = new PuzzleNode(Color.Yellow); box[0, 2, 2] = new PuzzleNode(Color.Yellow); box[0, 2, 1] = new PuzzleNode(Color.Yellow); restrictions = ControlRestrictions.None; }
private static void MarkHelperHoriz(int start, int end, int x, PuzzleNode p) { p.marked = true; p.scoring = true; if (start < boxOffset && end > boxSize+boxOffset) { if (x <= centerIndex) { p.replace_distance = centerIndex+1 - start; p.replace_left = true; } if (x >= centerIndex) { p.replace_distance = end - centerIndex; p.replace_right = true; } } else { if (start < boxOffset) { p.replace_distance = end - start; p.replace_left = true; } if (end > boxOffset+boxSize) { p.replace_distance = end - start; p.replace_right = true; } } }
public static void Lesson6(PuzzleBox box, MasterGrid grid) { introText = "" + "Scoring big sets is tricky. Lets practice some\n" + "more. Try to match all of the bubbles using sets\n" + "of 3 or more!"; successText = "" + "Awesome! These combos are worth way more points\n" + "than just matching two bubbles at a time.:" + "If you want to be a great Jellyfish doctor,\n" + "you'll need to master spotting when you can\n" + "match these kinds of sets!"; failureText = "" + "Oops! Remember, you need to rotate the bubbles\n" + "so that all of the same colored bubbles are in\n" + "a straight line!:" + "Use the Right Control Stick to look around and\n" + "get a better view of things!:"+ "Finally, don't forget about using the Shoulder\n" + "Buttons for rotations."; Clear(box,grid); restrictions = ControlRestrictions.None; grid[1, 0] = new PuzzleNode(Color.Green); grid[0, 2] = new PuzzleNode(Game.jellyBlue); grid[4, 3] = new PuzzleNode(Color.Yellow); box[2, 0, 2] = new PuzzleNode(Color.Green); box[2, 1, 2] = new PuzzleNode(Color.Green); box[2, 2, 2] = new PuzzleNode(Color.Green); box[1, 2, 0] = new PuzzleNode(Game.jellyBlue); box[1, 2, 1] = new PuzzleNode(Game.jellyBlue); box[0, 0, 2] = new PuzzleNode(Color.Yellow); box[0, 1, 2] = new PuzzleNode(Color.Yellow); }
public static void Lesson7(PuzzleBox box, MasterGrid grid) { introText = "" + "Another advanced topic is bonus bubbles! You\n" + "may have noticed that when you match bubbles,\n" + "new ones slide in to take their place.:" + "But what happens if you match against two\n" + "bubbles in different tentacles at the same\n" + "time?:" + "This will create a bonus bubble of the same\n" + "color. Matching bonus bubbles will multiply\n" + "the score of the set by 2!:" + "Try rotating this orange bubble into the\n" + "lower left corner!"; successText = "" + "Great! In addition to this bubble being\n" + "worth bonus points, you popped 3 outer\n" + "bubbles with just one inner bubble.:" + "That's a useful skill!"; failureText = "" + "Oops! Try popping the bubbles in the lower\n" + "left corner first. This will give you a bonus\n" + "bubble!"; restrictions = ControlRestrictions.None; Clear(box,grid); grid[0, 3] = new PuzzleNode(Color.Orange); grid[1, 4] = new PuzzleNode(Color.Orange); grid[4, 1] = new PuzzleNode(Color.Orange); box[0, 2, 2] = new PuzzleNode(Color.Orange); }
public static void Lesson8(PuzzleBox box, MasterGrid grid) { introText = "" + "This technique will be especially important in\n" + "Challenge Mode. Try to match all the bubbles\n" + "here.:"+ "To do so, you'll need to get the bonus bubbles\n" + "first again! Focus on the corners that contain\n"+ "two bubbles of the same color.:"+ "Also, don't forget the basics. Remember you can\n"+ "use the left and right triggers to push and pull\n"+ "the bubbles."; successText = "" + "Perfect! You're almost ready to get started\n" + "for real."; failureText = "" + "Oops! Remember, if you match one bubble against\n" + "two tentacles at the same time, it will be\n" + "replaced by a bonus bubble.:" + "You can reuse the bonus bubbles to make more\n" + "matches. Try getting the bonus bubbles first!"; restrictions = ControlRestrictions.None; Clear(box, grid); box[0, 1, 2] = new PuzzleNode(Color.Yellow); box[0, 0, 0] = new PuzzleNode(Color.Magenta); grid[3, 0] = new PuzzleNode(Color.Magenta); grid[4, 1] = new PuzzleNode(Color.Magenta); grid[1, 4] = new PuzzleNode(Color.Magenta); grid[0, 1] = new PuzzleNode(Color.Yellow); grid[1, 0] = new PuzzleNode(Color.Yellow); grid[3, 4] = new PuzzleNode(Color.Yellow); }
public static void Lesson10(PuzzleBox box, MasterGrid grid) { introText = "Almost done! Lets do one more.:" + "There are three blue bubbles in the back right \n" + "of Mister Jellyfish. There also 5 blue bubbles \n" + "in the right tentacles.:" + "If you can bring all three of those blue bubbles \n" + "to the front, you can get 3 bonus bubbles to use \n" + "for a second set!"; successText = ""+ "Super! Looks like you're ready to get to work.\n" + "First, lets go over a few more quick things!:"+ "There are three different types of Jellyfish\n" + "surgery to choose from, each of which poses\n" + "unique challenges.:"+ "In Emergency mode, you'll race against the clock\n"+ "to pop as many bubbles as you can.:" + "Scoring sets of 3 or more bubbles at a time is\n"+ "key to getting a high score.:" + "Operation mode is similar, but you can relax and\n"+ "take your time. However, you'll have a limited\n"+ "number of moves to work with.:" + "Time isn't a factor, but you'll need to plan\n"+ "your moves carefully and be efficient to get\n"+ "a good score.:"+ "Finally, Challenge mode will give you some\n"+ "tricky puzzles to solve.:"+ "You'll need to use what you've learned here to\n"+ "pop all of the bubbles in each patient. If you make\n"+ "a wrong move, you might get stuck!:"+ "Luckily, in Challenge mode, you can press B to\n"+ "undo your last move if you make a mistake.:"+ "You'll be awarded a rating after each patient.\n"+ "If you earn 3 stars, your patient will make a\n"+ "full recovery and return to the sea!:"+ "Try to save them all!\n"; failureText = "" + "Oops! Try to rotate all three blue bubbles in\n" + "back to the front right. Then use the three\n" + "bonus bubbles to make a second set.:" + "Don't forget you can use the Right Control Stick\n" + "to get a better view of bubbles in the back!"; restrictions = ControlRestrictions.None; Clear(box, grid); box[2, 0, 2] = new PuzzleNode(Game.jellyBlue); box[2, 1, 2] = new PuzzleNode(Game.jellyBlue); box[2, 2, 2] = new PuzzleNode(Game.jellyBlue); grid[3, 0] = new PuzzleNode(Game.jellyBlue); grid[3, 4] = new PuzzleNode(Game.jellyBlue); grid[4, 1] = new PuzzleNode(Game.jellyBlue); grid[4, 2] = new PuzzleNode(Game.jellyBlue); grid[4, 3] = new PuzzleNode(Game.jellyBlue); grid[1, 4] = new PuzzleNode(Game.jellyBlue); }
public static bool IsWildCard(PuzzleNode p) { int count = 0; if (p.replace_bottom) count++; if (p.replace_top) count++; if (p.replace_left) count++; if (p.replace_right) count++; return count > 1; }