private void Command_Grid_Enter() { if (grid_cover[(int)selector.X, (int)selector.Y]) { if (active_flag) { if (grid_flag[(int)selector.X, (int)selector.Y]) { grid_flag[(int)selector.X, (int)selector.Y] = false; } else { grid_flag[(int)selector.X, (int)selector.Y] = true; } } else { grid_cover[(int)selector.X, (int)selector.Y] = false; if (grid_base[(int)selector.X, (int)selector.Y] == 9) { grid_base[(int)selector.X, (int)selector.Y] = 10; JK.Noise("Explosion"); explosions.Add(new Entity(0, new Vector2(SK.Position_Grid64().X + selector.X * 64, SK.Position_Grid64().Y + selector.Y * 64), new Vector2(0, 0))); Uncover_Bombs(); won = true; } else { if (grid_base[(int)selector.X, (int)selector.Y] == 0) { JK.Noise("Place"); FieldList.Add(selector); Uncover_Tiles(); } bool temp = false; for (int i = 0; i < 10; i++) { for (int j = 0; j < 13; j++) { if (grid_base[j, i] != 9) { if (grid_cover[j, i]) { temp = true; } } } } if (!temp) { alpha = 0.00f; JK.Noise("Cleared"); } } } } }
public override string Update2() { if (ButtonPressed(GhostKey.button_function_P1) == GhostState.pressed) { if (active_flag) { active_flag = false; } else { active_flag = true; } pressed_response = true; } if (ButtonPressed(GhostKey.button_ok_P1) == GhostState.pressed) { Command_Grid_Enter(); pressed_response = true; } if (ButtonPressed(GhostKey.arrow_up_P1) == GhostState.pressed) { if (SK.orientation <= 2) { if (selector.Y > 0) { selector.Y--; } pressed_response = true; } else { if (selector.X < 12) { selector.X++; } pressed_response = true; } } if (ButtonPressed(GhostKey.arrow_down_P1) == GhostState.pressed) { if (SK.orientation <= 2) { if (selector.Y < 9) { selector.Y++; } pressed_response = true; } else { if (selector.X > 0) { selector.X--; } pressed_response = true; } } if (ButtonPressed(GhostKey.arrow_left_P1) == GhostState.pressed) { if (SK.orientation <= 2) { if (selector.X > 0) { selector.X--; } pressed_response = true; } else { if (selector.Y > 0) { selector.Y--; } pressed_response = true; } } if (ButtonPressed(GhostKey.arrow_right_P1) == GhostState.pressed) { if (SK.orientation <= 2) { if (selector.X < 12) { selector.X++; } pressed_response = true; } else { if (selector.Y < 9) { selector.Y++; } pressed_response = true; } } if (SK.orientation <= 2) { for (int x = 0; x < 13; x++) { for (int y = 0; y < 10; y++) { if (pressed_event_touch) { if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Grid64().X + 64 * x, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Grid64().Y + 64 * y, 64, 64))) { if (selector == new Vector2(x, y)) { Command_Grid_Enter(); } else { selector = new Vector2(x, y); } } } else { if (Collision_Button(true, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Grid64().X + 64 * x, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Grid64().Y + 64 * y, 64, 64))) { selector = new Vector2(x, y); } } } } } else { for (int x = 0; x < 10; x++) { for (int y = 0; y < 13; y++) { if (pressed_event_touch) { if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Grid64().X + 64 * x, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Grid64().Y + 64 * y, 64, 64))) { if (selector == new Vector2(12 - y, x)) { Command_Grid_Enter(); } else { selector = new Vector2(12 - y, x); } } } else { if (Collision_Button(true, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Grid64().X + 64 * x, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Grid64().Y + 64 * y, 64, 64))) { selector = new Vector2(12 - y, x); } } } } } return("null"); }
public override string Update2() { if (beta == 1.00f) { if (ButtonPressed(GhostKey.button_function_P1) == GhostState.pressed) { pressed_response = true; } if (ButtonPressed(GhostKey.button_ok_P1) == GhostState.pressed) { Command_Enter(); pressed_response = true; } if (ButtonPressed(GhostKey.arrow_up_P1) == GhostState.pressed) { if (SK.orientation <= 2) { if (selector.Y > 0) { selector.Y--; } pressed_response = true; } else { if (selector.X < 12) { selector.X++; } pressed_response = true; } } if (ButtonPressed(GhostKey.arrow_down_P1) == GhostState.pressed) { if (SK.orientation <= 2) { if (selector.Y < 9) { selector.Y++; } pressed_response = true; } else { if (selector.X > 0) { selector.X--; } pressed_response = true; } } if (ButtonPressed(GhostKey.arrow_left_P1) == GhostState.pressed) { if (SK.orientation <= 2) { if (selector.X > 0) { selector.X--; } pressed_response = true; } else { if (selector.Y > 0) { selector.Y--; } pressed_response = true; } } if (ButtonPressed(GhostKey.arrow_right_P1) == GhostState.pressed) { if (SK.orientation <= 2) { if (selector.X < 12) { selector.X++; } pressed_response = true; } else { if (selector.Y < 9) { selector.Y++; } pressed_response = true; } } if (selected_A && selected_B && !timer) { timer = true; } if (SK.orientation <= 2) { for (int x = 0; x < 13; x++) { for (int y = 0; y < 10; y++) { if (pressed_event_touch) { if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Grid64().X + 64 * x, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Grid64().Y + 64 * y, 64, 64))) { if (selector == new Vector2(x, y)) { JK.Noise("Place"); if (!selected_A) { if (grid_main[x, y] != "empty") { selected_A = true; selected_A_pos = new Vector2(x, y); } } else if (!selected_B) { if (grid_main[x, y] != "empty" && selected_A_pos != new Vector2(x, y)) { selected_B = true; selected_B_pos = new Vector2(x, y); } } } else { selector = new Vector2(x, y); } } } else { if (Collision_Button(true, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Grid64().X + 64 * x, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Grid64().Y + 64 * y, 64, 64))) { selector = new Vector2(x, y); } } } } } else { for (int x = 0; x < 10; x++) { for (int y = 0; y < 13; y++) { if (pressed_event_touch) { if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Grid64().X + 64 * x, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Grid64().Y + 64 * y, 64, 64))) { if (selector == new Vector2(12 - y, x)) { JK.Noise("Place"); if (!selected_A) { if (grid_main[12 - y, x] != "empty") { selected_A = true; selected_A_pos = new Vector2(12 - y, x); } } else if (!selected_B) { if (grid_main[12 - y, x] != "empty" && selected_A_pos != new Vector2(12 - y, x)) { selected_B = true; selected_B_pos = new Vector2(12 - y, x); } } } else { selector = new Vector2(12 - y, x); } } } else { if (Collision_Button(true, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Grid64().X + 64 * x, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Grid64().Y + 64 * y, 64, 64))) { selector = new Vector2(12 - y, x); } } } } } } else { beta += 0.05f; if (beta >= 1) { beta = 1.00f; } } return("null"); }
public override void Draw2() { if (SK.orientation <= 2) { for (int y = 0; y < 10; y++) { for (int x = 0; x < 13; x++) { int i = grid_base[x, y]; if (grid_flag[x, y]) { i = 12; spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * x, 64 * y), new Rectangle(1, 1 + i + (64 * i), 64, 64), Color.White, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } else if (grid_cover[x, y]) { i = 11; spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * x, 64 * y), new Rectangle(1, 1 + i + (64 * i), 64, 64), Color.White, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } else { spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * x, 64 * y), new Rectangle(1, 1 + i + (64 * i), 64, 64), Color.White, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } } } foreach (Entity E in explosions) { float x = E.Get_GridPos().X; float y = E.Get_GridPos().Y; Color color = Color.White; spriteBatch.Draw(SK.texture_spritesheet_explosion, SK.Position_DisplayEdge() + new Vector2((int)(SK.Position_Grid64().X + 32 * x), (int)(SK.Position_Grid64().Y + 32 * y)), new Rectangle(1 + E.Get_HP() / 2 + (64 * E.Get_HP() / 2), 1, 64, 64), color, 0.0f, new Vector2(0, 0), 2F, SpriteEffects.None, 0.0f); E.Change_HP(1); } spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2((int)(64 * selector.X), (int)(64 * selector.Y)), new Rectangle(1, 1 + 11 + (64 * 11), 64, 64), Color.Yellow * 0.25f, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } else { for (int x = 0; x < 13; x++) { for (int y = 0; y < 10; y++) { int i = grid_base[x, y]; if (grid_flag[x, y]) { i = 12; spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * y, 64 * (12 - x)), new Rectangle(1, 1 + i + (64 * i), 64, 64), Color.White, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } else if (grid_cover[x, y]) { i = 11; spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * y, 64 * (12 - x)), new Rectangle(1, 1 + i + (64 * i), 64, 64), Color.White, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } else { spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * y, 64 * (12 - x)), new Rectangle(1, 1 + i + (64 * i), 64, 64), Color.White, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } } } foreach (Entity E in explosions) { float x = E.Get_GridPos().X; float y = E.Get_GridPos().Y; Color color = Color.White; spriteBatch.Draw(SK.texture_spritesheet_explosion, SK.Position_DisplayEdge() + new Vector2((int)(SK.Position_Grid64().X + 32 * y), (int)(SK.Position_Grid64().Y + 32 * (12 - x))), new Rectangle(1 + E.Get_HP() / 2 + (64 * E.Get_HP() / 2), 1, 64, 64), color, 0.0f, new Vector2(0, 0), 2F, SpriteEffects.None, 0.0f); E.Change_HP(1); } spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2((int)(64 * selector.Y), (int)(64 * (12 - selector.X))), new Rectangle(1, 1 + 11 + (64 * 11), 64, 64), Color.Yellow * 0.25f, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } if (alpha < 1) { if (SK.orientation <= 2) { for (int y = 0; y < 10; y++) { for (int x = 0; x < 13; x++) { int i = 11; spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * x, 64 * y), new Rectangle(1, 1 + i + (64 * i), 64, 64), Color.White * alpha, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } } } else { for (int x = 0; x < 13; x++) { for (int y = 0; y < 10; y++) { int i = 11; spriteBatch.Draw(SK.texture_spritesheet_minesweeper, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * y, 64 * (12 - x)), new Rectangle(1, 1 + i + (64 * i), 64, 64), Color.White * alpha, 0.0f, new Vector2(0, 0), 1F, SpriteEffects.None, 0.0f); } } } } }
public override void Draw2() { if (SK.orientation <= 2) { for (int x = 0; x < 13; x++) { for (int y = 0; y < 10; y++) { if (selected_A && selected_A_pos == new Vector2(x, y)) { spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * x, 64 * y), Get_Mino_Texture(grid_main[x, y], 1, 64), Color.White * alpha); } else if (selected_B && selected_B_pos == new Vector2(x, y)) { spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * x, 64 * y), Get_Mino_Texture(grid_main[x, y], 1, 64), Color.White * alpha); } else { if (grid_main[x, y] != "empty") { spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * x, 64 * y), new Rectangle(0, 0, 64, 64), Color.White * beta); } } } } spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * selector.X, 64 * selector.Y), new Rectangle(0, 0, 64, 64), Color.Violet * 0.25f); } else { for (int x = 0; x < 13; x++) { for (int y = 0; y < 10; y++) { if (selected_A && selected_A_pos == new Vector2(x, y)) { spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * y, 64 * (12 - x)), Get_Mino_Texture(grid_main[x, y], 1, 64), Color.White * alpha); } else if (selected_B && selected_B_pos == new Vector2(x, y)) { spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * y, 64 * (12 - x)), Get_Mino_Texture(grid_main[x, y], 1, 64), Color.White * alpha); } else { if (grid_main[x, y] != "empty") { spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * y, 64 * (12 - x)), new Rectangle(0, 0, 64, 64), Color.White * beta); } } } } spriteBatch.Draw(SK.texture_spritesheet_minos_64x, SK.Position_DisplayEdge() + SK.Position_Grid64() + new Vector2(64 * selector.Y, 64 * (12 - selector.X)), new Rectangle(0, 0, 64, 64), Color.Violet * 0.25f); } }