private void Command_Collapse() { // Gravity after match found and cleared int temp = 0; for (int y = 18; y >= 0; y--) { for (int x = 0; x < 10; x++) { if (grid_base[x, y]) { temp = 0; while (y + temp + 1 < 20 && !grid_base[x, y + temp + 1]) { temp++; } if (temp != 0) { grid_base[x, y + temp] = true; grid_base[x, y] = false; grid_color[x, y + temp] = grid_color[x, y]; grid_color[x, y] = "empty"; } } } } clear.Clear(); alpha = 255; Check_Field(); JK.Noise("Explosion"); }
private void CheckForClearedLine(int id) { if (id == 0) { JK.Noise("Cleared"); Restart(); } if (id >= 1 && id <= 2) { if (cards_field[1].Y == -1 && cards_field[2].Y == -1) { score_points += 1000; } if (cards_field[3].Y == -1 && cards_field[4].Y == -1 && cards_field[5].Y == -1) { score_points += 500; } if (cards_field[6].Y == -1 && cards_field[7].Y == -1 && cards_field[8].Y == -1 && cards_field[9].Y == -1) { score_points += 400; } if (cards_field[10].Y == -1 && cards_field[11].Y == -1 && cards_field[12].Y == -1 && cards_field[13].Y == -1 && cards_field[14].Y == -1) { score_points += 300; } if (cards_field[15].Y == -1 && cards_field[16].Y == -1 && cards_field[17].Y == -1 && cards_field[18].Y == -1 && cards_field[19].Y == -1 && cards_field[20].Y == -1) { score_points += 200; } if (cards_field[21].Y == -1 && cards_field[22].Y == -1 && cards_field[23].Y == -1 && cards_field[24].Y == -1 && cards_field[25].Y == -1 && cards_field[26].Y == -1 && cards_field[27].Y == -1) { score_points += 100; } } }
private void Command_Collision() { for (int i = 0; i < 5; i++) { if (octanom_head.Get_GridPos() == 32 * point[i]) { JK.Noise("Coin"); score_points += 50 * game_difficulty; pointer = i; Command_Spawn_Point(); Command_Spawn_Tail(); } } if (octanom_tail.Count > 1) { foreach (Entity tail in octanom_tail) { if (octanom_head.Get_GridPos().X == tail.Get_GridPos().X&& octanom_head.Get_GridPos().Y - 16 < tail.Get_GridPos().Y&& tail.Get_GridPos().Y < octanom_head.Get_GridPos().Y + 16) { JK.Noise("Place"); won = true; } } } }
private void Compare() { result = 3; if (selector_player == 1 && (selector_comp == 4 || selector_comp == 3)) { result = 1; } if (selector_player == 2 && (selector_comp == 1 || selector_comp == 5)) { result = 1; } if (selector_player == 3 && (selector_comp == 2 || selector_comp == 4)) { result = 1; } if (selector_player == 4 && (selector_comp == 5 || selector_comp == 2)) { result = 1; } if (selector_player == 5 && (selector_comp == 3 || selector_comp == 1)) { result = 1; } if (selector_comp == 1 && (selector_player == 4 || selector_player == 3)) { result = 2; } if (selector_comp == 2 && (selector_player == 1 || selector_player == 5)) { result = 2; } if (selector_comp == 3 && (selector_player == 2 || selector_player == 4)) { result = 2; } if (selector_comp == 4 && (selector_player == 5 || selector_player == 2)) { result = 2; } if (selector_comp == 5 && (selector_player == 3 || selector_player == 1)) { result = 2; } lastPlayer = selector_player; lastComp = selector_comp; alpha = 1.00f; if (result == 1) { score_points++; JK.Noise("Cleared"); Restart(); } else { won = true; } }
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 Update3(GameTime gameTime) { if (match && !active_gameover) { JK.Noise("Cleared"); score_points = 1; GameOver(gameTime.TotalGameTime.TotalSeconds); } return("void"); }
public override string Update3(GameTime gameTime) { if (score_lives == 0 && !active_gameover) { GameOver(gameTime.TotalGameTime.TotalSeconds); } if (timer) { if (grid_main[(int)selected_A_pos.X, (int)selected_A_pos.Y] == grid_main[(int)selected_B_pos.X, (int)selected_B_pos.Y]) { alpha -= 0.05f; } time -= 5; if (time <= 0) { alpha = 1.00f; time = 100; if (grid_main[(int)selected_A_pos.X, (int)selected_A_pos.Y] == grid_main[(int)selected_B_pos.X, (int)selected_B_pos.Y]) { if (grid_main[(int)selected_A_pos.X, (int)selected_A_pos.Y] == "gold") { score_points += 4; } grid_main[(int)selected_A_pos.X, (int)selected_A_pos.Y] = "empty"; grid_main[(int)selected_B_pos.X, (int)selected_B_pos.Y] = "empty"; score_points++; } else { score_lives--; } bool temp = false; for (int x = 0; x < 13; x++) { for (int y = 0; y < 10; y++) { if (grid_main[x, y] != "empty") { temp = true; } } } if (!temp) { JK.Noise("Cleared"); Restart(); } selected_A = false; selected_B = false; timer = false; } } return("void"); }
private void Domino_Place() { JK.Noise("Place"); active_hold = true; grid_base[(int)tetromino[0].X, (int)tetromino[0].Y] = true; grid_base[(int)tetromino[1].X, (int)tetromino[1].Y] = true; grid_color[(int)tetromino[0].X, (int)tetromino[0].Y] = container_current[0]; grid_color[(int)tetromino[1].X, (int)tetromino[1].Y] = container_current[1]; score_points = score_points + 2 * game_difficulty; if (tetromino[1].Y == 0) { won = true; } container_current[0] = container_next[0]; container_current[1] = container_next[1]; container_next[0] = Domino_Roll(); container_next[1] = Domino_Roll(); Domino_Create(); Check_Field(); }
private void Command_Enter() { JK.Noise("Place"); if (!selected_A) { if (grid_main[(int)selector.X, (int)selector.Y] != "empty") { selected_A = true; selected_A_pos = new Vector2((int)selector.X, (int)selector.Y); } } else if (!selected_B) { if (grid_main[(int)selector.X, (int)selector.Y] != "empty" && selected_A_pos != new Vector2((int)selector.X, (int)selector.Y)) { selected_B = true; selected_B_pos = new Vector2((int)selector.X, (int)selector.Y); } } }
public override string Update3(GameTime gameTime) { if (!active_pause && !active_gameover) { octanom.Update(); bool win = true; foreach (Entity e in crate) { e.Update(); bool hp1 = true; foreach (Entity c in cross) { if (c.Get_Pos() == e.Get_Pos()) { hp1 = false; } } if (hp1) { e.Set_HP(1); win = false; } else { e.Set_HP(2); } } foreach (Entity e in cross) { e.Update(); } if (win && !active_gameover) { JK.Noise("Cleared"); score_points = crate.Count * 5; GameOver(gameTime.TotalGameTime.TotalSeconds); } Command_Move(gameTime); } return("void"); }
private void Command_Collision(Entity trianom) { if (!powerup) { if (octanom.Get_GridPos().X == trianom.Get_GridPos().X&& octanom.Get_GridPos().Y - 16 < trianom.Get_GridPos().Y&& trianom.Get_GridPos().Y < octanom.Get_GridPos().Y + 16) { score_lives--; JK.Noise("Explosion"); explosions.Add(new Entity(0, octanom.Get_Pos(), new Vector2(0, 0))); Command_Respawn(octanom); } if (octanom.Get_GridPos().Y == trianom.Get_GridPos().Y&& octanom.Get_GridPos().X - 16 < trianom.Get_GridPos().X&& trianom.Get_GridPos().X < octanom.Get_GridPos().X + 16) { score_lives--; JK.Noise("Explosion"); explosions.Add(new Entity(0, octanom.Get_Pos(), new Vector2(0, 0))); Command_Respawn(octanom); } } else { if (octanom.Get_GridPos().X == trianom.Get_GridPos().X&& octanom.Get_GridPos().Y - 16 < trianom.Get_GridPos().Y&& trianom.Get_GridPos().Y < octanom.Get_GridPos().Y + 16) { score_points = score_points + 200 * score_power_hit * score_power_hit; JK.Noise("Explosion"); explosions.Add(new Entity(0, trianom.Get_Pos(), new Vector2(0, 0))); Command_Respawn(trianom); } if (octanom.Get_GridPos().Y == trianom.Get_GridPos().Y&& octanom.Get_GridPos().X - 16 < trianom.Get_GridPos().X&& trianom.Get_GridPos().X < octanom.Get_GridPos().X + 16) { score_points = score_points + 200 * score_power_hit * score_power_hit; JK.Noise("Explosion"); explosions.Add(new Entity(0, trianom.Get_Pos(), new Vector2(0, 0))); Command_Respawn(trianom); } } }
private void Tetromino_Place() { JK.Noise("Place"); active_hold = true; grid_base[(int)tetromino[0].X, (int)tetromino[0].Y] = true; grid_base[(int)tetromino[1].X, (int)tetromino[1].Y] = true; grid_base[(int)tetromino[2].X, (int)tetromino[2].Y] = true; grid_base[(int)tetromino[3].X, (int)tetromino[3].Y] = true; grid_color[(int)tetromino[0].X, (int)tetromino[0].Y] = container_current; grid_color[(int)tetromino[1].X, (int)tetromino[1].Y] = container_current; grid_color[(int)tetromino[2].X, (int)tetromino[2].Y] = container_current; grid_color[(int)tetromino[3].X, (int)tetromino[3].Y] = container_current; score_points = score_points + 2 * game_difficulty; if (tetromino[0].Y == 0) { won = true; } container_current = container_next; string container_temp = container_next; if ((container_next = Tetromino_Roll()) == container_temp) { if (random.Next(2) == 0) { container_next = Tetromino_Roll(); } } Tetromino_Create(); line1 = -1; line2 = -1; line3 = -1; line4 = -1; for (int i = 19; i > -1; i--) { if (grid_base[0, i] && grid_base[1, i] && grid_base[2, i] && grid_base[3, i] && grid_base[4, i] && grid_base[5, i] && grid_base[6, i] && grid_base[7, i] && grid_base[8, i] && grid_base[9, i]) { score_lives++; score_points += 50 * game_difficulty; if (line1 == -1) { line1 = i; } else if (line2 == -1) { line2 = i; } else if (line3 == -1) { line3 = i; } else if (line4 == -1) { line4 = i; } alpha -= 5; } } if (score_lives > (1 + score_level) * 10) { score_level++; } if (line1 != -1 && line2 != -1 && line3 != -1 && line4 != -1) { score_points = score_points + 250 * game_difficulty * (score_level + 1); } }
private void Command_Collapse() { if (line4 != -1) { for (int i = line4; i > 0; i--) { grid_base[0, i] = grid_base[0, i - 1]; grid_base[1, i] = grid_base[1, i - 1]; grid_base[2, i] = grid_base[2, i - 1]; grid_base[3, i] = grid_base[3, i - 1]; grid_base[4, i] = grid_base[4, i - 1]; grid_base[5, i] = grid_base[5, i - 1]; grid_base[6, i] = grid_base[6, i - 1]; grid_base[7, i] = grid_base[7, i - 1]; grid_base[8, i] = grid_base[8, i - 1]; grid_base[9, i] = grid_base[9, i - 1]; grid_color[0, i] = grid_color[0, i - 1]; grid_color[1, i] = grid_color[1, i - 1]; grid_color[2, i] = grid_color[2, i - 1]; grid_color[3, i] = grid_color[3, i - 1]; grid_color[4, i] = grid_color[4, i - 1]; grid_color[5, i] = grid_color[5, i - 1]; grid_color[6, i] = grid_color[6, i - 1]; grid_color[7, i] = grid_color[7, i - 1]; grid_color[8, i] = grid_color[8, i - 1]; grid_color[9, i] = grid_color[9, i - 1]; } } if (line3 != -1) { for (int i = line3; i > 0; i--) { grid_base[0, i] = grid_base[0, i - 1]; grid_base[1, i] = grid_base[1, i - 1]; grid_base[2, i] = grid_base[2, i - 1]; grid_base[3, i] = grid_base[3, i - 1]; grid_base[4, i] = grid_base[4, i - 1]; grid_base[5, i] = grid_base[5, i - 1]; grid_base[6, i] = grid_base[6, i - 1]; grid_base[7, i] = grid_base[7, i - 1]; grid_base[8, i] = grid_base[8, i - 1]; grid_base[9, i] = grid_base[9, i - 1]; grid_color[0, i] = grid_color[0, i - 1]; grid_color[1, i] = grid_color[1, i - 1]; grid_color[2, i] = grid_color[2, i - 1]; grid_color[3, i] = grid_color[3, i - 1]; grid_color[4, i] = grid_color[4, i - 1]; grid_color[5, i] = grid_color[5, i - 1]; grid_color[6, i] = grid_color[6, i - 1]; grid_color[7, i] = grid_color[7, i - 1]; grid_color[8, i] = grid_color[8, i - 1]; grid_color[9, i] = grid_color[9, i - 1]; } } if (line2 != -1) { for (int i = line2; i > 0; i--) { grid_base[0, i] = grid_base[0, i - 1]; grid_base[1, i] = grid_base[1, i - 1]; grid_base[2, i] = grid_base[2, i - 1]; grid_base[3, i] = grid_base[3, i - 1]; grid_base[4, i] = grid_base[4, i - 1]; grid_base[5, i] = grid_base[5, i - 1]; grid_base[6, i] = grid_base[6, i - 1]; grid_base[7, i] = grid_base[7, i - 1]; grid_base[8, i] = grid_base[8, i - 1]; grid_base[9, i] = grid_base[9, i - 1]; grid_color[0, i] = grid_color[0, i - 1]; grid_color[1, i] = grid_color[1, i - 1]; grid_color[2, i] = grid_color[2, i - 1]; grid_color[3, i] = grid_color[3, i - 1]; grid_color[4, i] = grid_color[4, i - 1]; grid_color[5, i] = grid_color[5, i - 1]; grid_color[6, i] = grid_color[6, i - 1]; grid_color[7, i] = grid_color[7, i - 1]; grid_color[8, i] = grid_color[8, i - 1]; grid_color[9, i] = grid_color[9, i - 1]; } } if (line1 != -1) { for (int i = line1; i > 0; i--) { grid_base[0, i] = grid_base[0, i - 1]; grid_base[1, i] = grid_base[1, i - 1]; grid_base[2, i] = grid_base[2, i - 1]; grid_base[3, i] = grid_base[3, i - 1]; grid_base[4, i] = grid_base[4, i - 1]; grid_base[5, i] = grid_base[5, i - 1]; grid_base[6, i] = grid_base[6, i - 1]; grid_base[7, i] = grid_base[7, i - 1]; grid_base[8, i] = grid_base[8, i - 1]; grid_base[9, i] = grid_base[9, i - 1]; grid_color[0, i] = grid_color[0, i - 1]; grid_color[1, i] = grid_color[1, i - 1]; grid_color[2, i] = grid_color[2, i - 1]; grid_color[3, i] = grid_color[3, i - 1]; grid_color[4, i] = grid_color[4, i - 1]; grid_color[5, i] = grid_color[5, i - 1]; grid_color[6, i] = grid_color[6, i - 1]; grid_color[7, i] = grid_color[7, i - 1]; grid_color[8, i] = grid_color[8, i - 1]; grid_color[9, i] = grid_color[9, i - 1]; } } line1 = -1; line2 = -1; line3 = -1; line4 = -1; alpha = 255; JK.Noise("Explosion"); }
public override string Update2() { if (ButtonPressed(GhostKey.button_function_P1) == GhostState.pressed) { pressed_response = true; if (betting) { betting = false; cards_player.Add(new Vector3(random.Next(13) + 1, random.Next(4), 400)); cards_player.Add(new Vector3(random.Next(13) + 1, random.Next(4), 400)); cards_dealer.Add(new Vector3(random.Next(13) + 1, random.Next(4), 400)); cards_dealer.Add(new Vector3(random.Next(13) + 1, random.Next(4), 400)); JK.Noise("CardStart"); hiddencard = 400; value_player = 0; int ace = 0; foreach (Vector3 v in cards_player) { if (v.X == 13) { ace++; } else if (v.X <= 9) { value_player = value_player + (int)v.X + 1; } else { value_player = value_player + 10; } } if (ace > 0) { while (ace > 0) { if (value_player <= 10) { value_player = value_player + 11; } else { value_player = value_player + 1; } ace--; } } if (value_player == 21) { end = true; active_player = false; coins_plus = bet * 2; } } } if (ButtonPressed(GhostKey.button_ok_P1) == GhostState.pressed && !pressed_event_touch) { pressed_response = true; if (betting && !end) { if (selector_bet == 0) { bet = bet - Get_Bet(); if (bet < 0) { bet = 0; } } if (selector_bet == 1) { bet = bet + Get_Bet(); if (bet > coins_old) { bet = coins_old; } } } if (!betting && active_player) { if (selector_card == 0) { Add_Card(); } if (selector_card == 1) { active_player = false; } } } if (ButtonPressed(GhostKey.arrow_up_P1) == GhostState.pressed) { pressed_response = true; if (betting) { if (FM.purchased[FM.Convert("highroller")] == 1 ? betmulti < 4 : betmulti < 2) { betmulti++; } } } if (ButtonPressed(GhostKey.arrow_down_P1) == GhostState.pressed) { pressed_response = true; if (betting) { if (betmulti > 0) { betmulti--; } } } if (ButtonPressed(GhostKey.arrow_left_P1) == GhostState.pressed) { pressed_response = true; if (betting) { if (selector_bet > 0) { selector_bet--; } } else { if (selector_card > 0) { selector_card--; } } } if (ButtonPressed(GhostKey.arrow_right_P1) == GhostState.pressed) { pressed_response = true; if (betting) { if (selector_bet < 1) { selector_bet++; } } else { if (selector_card < 1) { selector_card++; } } } if (ButtonPressed(GhostKey.button_ok_P1) != GhostState.released) { pressed_response = true; if (!betting && active_player) { if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + SK.Collision_BlackJack_Hit().X, (int)SK.Position_DisplayEdge().Y + SK.Collision_BlackJack_Hit().Y, SK.Collision_BlackJack_Hit().Width, SK.Collision_BlackJack_Hit().Height))) { if (selector_card == 0) { Add_Card(); } else { selector_card = 0; } } if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + SK.Collision_BlackJack_Stand().X, (int)SK.Position_DisplayEdge().Y + SK.Collision_BlackJack_Stand().Y, SK.Collision_BlackJack_Stand().Width, SK.Collision_BlackJack_Stand().Height))) { if (selector_card == 1) { active_player = false; } else { selector_card = 1; } } } if (betting && !end) { if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Bet_Minus().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Bet_Minus().Y, SK.texture_casino_bet_minus.Width, SK.texture_casino_bet_minus.Height))) { bet = bet - Get_Bet(); if (bet < 0) { bet = 0; } selector_bet = 0; } if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Bet_Plus().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Bet_Plus().Y, SK.texture_casino_bet_plus.Width, SK.texture_casino_bet_plus.Height))) { bet = bet + Get_Bet(); if (bet > coins_old) { bet = coins_old; } selector_bet = 1; } if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Bet_Up1().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Bet_Up1().Y, SK.texture_casino_bet_up.Width, SK.texture_casino_bet_up.Height))) { if (FM.purchased[FM.Convert("highroller")] == 1 ? betmulti < 4 : betmulti < 2) { betmulti++; } } if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Bet_Up2().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Bet_Up2().Y, SK.texture_casino_bet_up.Width, SK.texture_casino_bet_up.Height))) { if (FM.purchased[FM.Convert("highroller")] == 1 ? betmulti < 4 : betmulti < 2) { betmulti++; } } if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Bet_Down1().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Bet_Down1().Y, SK.texture_casino_bet_down.Width, SK.texture_casino_bet_down.Height))) { if (betmulti > 0) { betmulti--; } } if (Collision_Button(false, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Bet_Down2().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Bet_Down2().Y, SK.texture_casino_bet_down.Width, SK.texture_casino_bet_down.Height))) { if (betmulti > 0) { betmulti--; } } } } if (control_mouse_new.LeftButton == ButtonState.Released && control_mouse_old.LeftButton == ButtonState.Released) { if (!betting && active_player) { if (Collision_Button(true, new Rectangle((int)SK.Position_DisplayEdge().X + SK.Collision_BlackJack_Hit().X, (int)SK.Position_DisplayEdge().Y + SK.Collision_BlackJack_Hit().Y, SK.Collision_BlackJack_Hit().Width, SK.Collision_BlackJack_Hit().Height))) { selector_card = 0; } if (Collision_Button(true, new Rectangle((int)SK.Position_DisplayEdge().X + SK.Collision_BlackJack_Stand().X, (int)SK.Position_DisplayEdge().Y + SK.Collision_BlackJack_Stand().Y, SK.Collision_BlackJack_Hit().Width, SK.Collision_BlackJack_Hit().Height))) { selector_card = 1; } } if (betting && !end) { if (Collision_Button(true, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Bet_Minus().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Bet_Minus().Y, SK.texture_casino_bet_minus.Width, SK.texture_casino_bet_minus.Height))) { selector_bet = 0; } if (Collision_Button(true, new Rectangle((int)SK.Position_DisplayEdge().X + (int)SK.Position_Bet_Plus().X, (int)SK.Position_DisplayEdge().Y + (int)SK.Position_Bet_Plus().Y, SK.texture_casino_bet_plus.Width, SK.texture_casino_bet_plus.Height))) { selector_bet = 1; } } } return("void"); }
private void Add_Card() { if (active_player) { JK.Noise("CardDraw"); value_player = 0; cards_player.Add(new Vector3(random.Next(13) + 1, random.Next(4), 400)); int ace = 0; foreach (Vector3 v in cards_player) { if (v.X == 13) { ace++; } else if (v.X <= 9) { value_player = value_player + (int)v.X + 1; } else { value_player = value_player + 10; } } if (ace > 0) { while (ace > 0) { if (value_player <= 10) { value_player = value_player + 11; } else { value_player = value_player + 1; } ace--; } } if (value_player > 21) { active_player = false; end = true; } } else { value_dealer = 0; int ace = 0; foreach (Vector3 v in cards_dealer) { if (v.X == 13) { ace++; } else if (v.X <= 9) { value_dealer = value_dealer + (int)v.X + 1; } else { value_dealer = value_dealer + 10; } } if (ace > 0) { while (ace > 0) { if (value_dealer <= 10) { value_dealer = value_dealer + 11; } else { value_dealer = value_dealer + 1; } ace--; } } if (value_dealer < 17) { value_dealer = 0; JK.Noise("CardDraw"); cards_dealer.Add(new Vector3(random.Next(13) + 1, random.Next(4), 400)); ace = 0; foreach (Vector3 v in cards_dealer) { if (v.X == 13) { ace++; } else if (v.X <= 9) { value_dealer = value_dealer + (int)v.X + 1; } else { value_dealer = value_dealer + 10; } } if (ace > 0) { while (ace > 0) { if (value_dealer <= 10) { value_dealer = value_dealer + 11; } else { value_dealer = value_dealer + 1; } ace--; } } } if (value_dealer > 16) { end = true; } } if (end) { if (value_dealer > 21) { coins_plus = bet; } else if (value_player > 21) { coins_plus = -bet; } else if (value_player == value_dealer && cards_player.Count > cards_dealer.Count) { coins_plus = bet; } else if (value_player == value_dealer && cards_player.Count == cards_dealer.Count) { coins_plus = 0; } else if (value_player == value_dealer && cards_player.Count < cards_dealer.Count) { coins_plus = -bet; } else if (value_player > value_dealer) { coins_plus = bet; } else if (value_player < value_dealer) { coins_plus = -bet; } } }
public override string Update3(GameTime gameTime) { bool tempwin = true; for (int y = 0; y < grid_main.GetLength(1); y++) { for (int x = 0; x < grid_main.GetLength(0); x++) { if (grid_main[x, y] == 1) { tempwin = false; } } } if (tempwin) { JK.Noise("Cleared"); alpha -= 0.02f; alphaUP = false; } if (alpha != 1) { if (alphaUP) { alpha += 0.02f; if (alpha >= 1) { alpha = 1; } } else { alpha -= 0.02f; if (alpha <= 0) { alphaUP = true; Restart(); } } } if (score_lives == 0 && !active_gameover) { GameOver(gameTime.TotalGameTime.TotalSeconds); } if (!active_pause && !active_gameover) { octanom.Update(); foreach (Entity e in boulders) { e.Update(); } Command_Move(); } foreach (Entity e in explosions) { if (e.Get_HP() > 15) { explosions.Remove(e); break; } } return("void"); }
private void Command_Move_Octanom(GameTime gameTime) { if (octanom.Get_Pos() == octanom.Get_Next() * 32) { string temp = "null"; if (octanom.Get_Vel().Y < 0) { temp = "Up"; } if (octanom.Get_Vel().Y > 0) { temp = "Down"; } if (octanom.Get_Vel().X < 0) { temp = "Left"; } if (octanom.Get_Vel().X > 0) { temp = "Right"; } if (grid_points[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y]) { grid_points[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y] = false; score_points = score_points + 10; } if (grid_power[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y]) { grid_power[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y] = false; JK.Noise("Coin"); score_points = score_points + 100; powerup = true; powerup_timer_start = gameTime.TotalGameTime.TotalMilliseconds; } if (temp_movement == "Up" && !grid_main[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y - 1]) { octanom.Set_Next(octanom.Get_Next() + new Vector2(0, -1)); octanom.Set_Vel(0, -2); temp_movement = "null"; if (octanom.Get_Next().Y == 0) { octanom.Set_Next(new Vector2(octanom.Get_Next().X, 21)); octanom.Set_Pos(octanom.Get_Pos().X, 32 * 23); } } else if (temp_movement == "Down" && !grid_main[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y + 1]) { octanom.Set_Next(octanom.Get_Next() + new Vector2(0, 1)); octanom.Set_Vel(0, 2); temp_movement = "null"; if (octanom.Get_Next().Y == 21) { octanom.Set_Next(new Vector2(octanom.Get_Next().X, 0)); octanom.Set_Pos(octanom.Get_Pos().X, 32); } } else if (temp_movement == "Left" && !grid_main[(int)octanom.Get_Next().X - 1, (int)octanom.Get_Next().Y]) { octanom.Set_Next(octanom.Get_Next() + new Vector2(-1, 0)); octanom.Set_Vel(-2, 0); temp_movement = "null"; if (octanom.Get_Pos().X == 0) { octanom.Set_Next(new Vector2(27, octanom.Get_Next().Y)); octanom.Set_Pos(32 * 28, octanom.Get_Pos().Y); } } else if (temp_movement == "Right" && !grid_main[(int)octanom.Get_Next().X + 1, (int)octanom.Get_Next().Y]) { octanom.Set_Next(octanom.Get_Next() + new Vector2(1, 0)); octanom.Set_Vel(2, 0); temp_movement = "null"; if (octanom.Get_Pos().X == 27 * 32) { octanom.Set_Next(new Vector2(1, octanom.Get_Next().Y)); octanom.Set_Pos(0, octanom.Get_Pos().Y); } } else { if (temp == "Up") { if (octanom.Get_Next().Y == 0) { octanom.Set_Next(new Vector2(octanom.Get_Next().X, 21)); octanom.Set_Pos(octanom.Get_Pos().X, 32 * 23); } } if (temp == "Down") { if (octanom.Get_Next().Y == 21) { octanom.Set_Next(new Vector2(octanom.Get_Next().X, 0)); octanom.Set_Pos(octanom.Get_Pos().X, 32); } } if (temp == "Left") { if (octanom.Get_Pos().X == 0) { octanom.Set_Next(new Vector2(27, octanom.Get_Next().Y)); octanom.Set_Pos(32 * 28, octanom.Get_Pos().Y); } } if (temp == "Right") { if (octanom.Get_Pos().X == 27 * 32) { octanom.Set_Next(new Vector2(1, octanom.Get_Next().Y)); octanom.Set_Pos(0, octanom.Get_Pos().Y); } } if (temp == "Up") { if (grid_main[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y - 1]) { octanom.Set_Vel(0, 0); JK.Noise("Place"); } else { octanom.Set_Next(octanom.Get_Next() + new Vector2(0, -1)); } } if (temp == "Down") { if (grid_main[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y + 1]) { octanom.Set_Vel(0, 0); JK.Noise("Place"); } else { octanom.Set_Next(octanom.Get_Next() + new Vector2(0, 1)); } } if (temp == "Left") { if (grid_main[(int)octanom.Get_Next().X - 1, (int)octanom.Get_Next().Y]) { octanom.Set_Vel(0, 0); JK.Noise("Place"); } else { octanom.Set_Next(octanom.Get_Next() + new Vector2(-1, 0)); } } if (temp == "Right") { if (grid_main[(int)octanom.Get_Next().X + 1, (int)octanom.Get_Next().Y]) { octanom.Set_Vel(0, 0); JK.Noise("Place"); } else { octanom.Set_Next(octanom.Get_Next() + new Vector2(1, 0)); } } } } }
public override string Update3(GameTime gameTime) { if (!active_pause && !active_gameover && !FM.active_transition) { octanom.Update(powerup); Command_Move_Octanom(gameTime); for (int i = 0; i < 4; i++) { string sa = Command_Move_Trianom(trianom[i]); if (sa == "up") { if (trianom[i].Get_Next().Y == 0) { trianom[i].Set_Next(new Vector2(trianom[i].Get_Next().X, 21)); trianom[i].Set_Pos(trianom[i].Get_Pos().X, SK.Position_Grid32().Y + 32 * 23); } else { trianom[i].Set_Next(new Vector2(trianom[i].Get_Next().X, trianom[i].Get_Next().Y - 1)); } } if (sa == "down") { if (trianom[i].Get_Next().Y == 21) { trianom[i].Set_Next(new Vector2(trianom[i].Get_Next().X, 0)); trianom[i].Set_Pos(trianom[i].Get_Pos().X, SK.Position_Grid32().Y - 32); } else { trianom[i].Set_Next(new Vector2(trianom[i].Get_Next().X, trianom[i].Get_Next().Y + 1)); } } if (sa == "left") { if (trianom[i].Get_Next().X == 0) { trianom[i].Set_Next(new Vector2(27, trianom[i].Get_Next().Y)); trianom[i].Set_Pos(SK.Position_Grid32().X + 32 * 28, trianom[i].Get_Pos().Y); } else { trianom[i].Set_Next(new Vector2(trianom[i].Get_Next().X - 1, trianom[i].Get_Next().Y)); } } if (sa == "right") { if (trianom[i].Get_Next().X == 27) { trianom[i].Set_Next(new Vector2(0, trianom[i].Get_Next().Y)); trianom[i].Set_Pos(SK.Position_Grid32().X - 32, trianom[i].Get_Pos().Y); } else { trianom[i].Set_Next(new Vector2(trianom[i].Get_Next().X + 1, trianom[i].Get_Next().Y)); } } trianom[i].Update(); Command_Collision(trianom[i]); } bool temp_break = false;; for (int x = 0; x < 28; x++) { for (int y = 0; y < 22; y++) { if (grid_points[x, y]) { temp_break = true; break; } } if (temp_break) { break; } } if (!temp_break) { JK.Noise("Cleared"); Restart(); } if (gameTime.TotalGameTime.TotalMilliseconds > powerup_timer_start + powerup_timer_break && powerup) { powerup = false; score_power_hit = 1; } } if (score_lives <= 0) { GameOver(gameTime.TotalGameTime.TotalSeconds); } foreach (Entity e in explosions) { if (e.Get_HP() > 15) { explosions.Remove(e); break; } } return("void"); }
private void Command_Move() { if (octanom.Get_Pos().X == octanom.Get_Next().X * 32 - octanom.Get_Next().Y * 32 && octanom.Get_Pos().Y == octanom.Get_Next().X * 32 + octanom.Get_Next().Y * 32) { octanom.Set_Vel(0, 0); foreach (Entity t in boulders) { if (octanom.Get_Next() == t.Get_Next() && octanom.Get_HP() > 0) { JK.Noise("Explosion"); explosions.Add(new Entity(0, octanom.Get_Pos(), new Vector2(0, 0))); score_lives--; //octanom.Set_HP(0); boulders.Remove(t); break; } } /*if(octanom.Get_HP() == 0) { * octanom.Set_Pos(0,0); * octanom.Set_Next(new Vector2(0, 0)); * octanom.Set_HP(1); * foreach(Entity t in boulders) { * if(t.Get_Next() == new Vector2(0, 0)) { * boulders.Remove(t); * break; * } * } * }*/ if (grid_main[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y] == 1) { grid_main[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y]++; score_points++; JK.Noise("Place"); } foreach (Entity t in boulders) { t.Set_Vel(0, 0); if (t.Get_Next().X == grid_main.GetLength(0) || t.Get_Next().Y == grid_main.GetLength(1)) { boulders.Remove(t); break; } else if (t.Get_Next().X >= 0 && t.Get_Next().Y >= 0) { if (grid_main[(int)t.Get_Next().X, (int)t.Get_Next().Y] == 0) { boulders.Remove(t); break; } } } if (temp_movement != "null") { looking = temp_movement; } if (temp_movement == "Up" && octanom.Get_Next().Y > 0) { if (grid_main[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y - 1] != 0) { octanom.Set_Vel(2, -2); octanom.Set_Next(new Vector2(octanom.Get_Next().X, octanom.Get_Next().Y - 1)); Create_Trianom(); } } if (temp_movement == "Down" && octanom.Get_Next().Y < grid_main.GetLength(1) - 1) { if (grid_main[(int)octanom.Get_Next().X, (int)octanom.Get_Next().Y + 1] != 0) { octanom.Set_Vel(-2, 2); octanom.Set_Next(new Vector2(octanom.Get_Next().X, octanom.Get_Next().Y + 1)); Create_Trianom(); } } if (temp_movement == "Left" && octanom.Get_Next().X > 0) { if (grid_main[(int)octanom.Get_Next().X - 1, (int)octanom.Get_Next().Y] != 0) { octanom.Set_Vel(-2, -2); octanom.Set_Next(new Vector2(octanom.Get_Next().X - 1, octanom.Get_Next().Y)); Create_Trianom(); } } if (temp_movement == "Right" && octanom.Get_Next().X < grid_main.GetLength(0) - 1) { if (grid_main[(int)octanom.Get_Next().X + 1, (int)octanom.Get_Next().Y] != 0) { octanom.Set_Vel(2, 2); octanom.Set_Next(new Vector2(octanom.Get_Next().X + 1, octanom.Get_Next().Y)); Create_Trianom(); } } if (octanom.Get_Vel().X != 0 || octanom.Get_Vel().Y != 0) { foreach (Entity t in boulders) { if (t.Get_Vel().X == 0 && t.Get_Vel().Y == 0) { if (t.Get_Next() == new Vector2(-1, 0)) { t.Set_Next(t.Get_Next() + new Vector2(1, 0)); t.Set_Vel(2, 2); } else if (t.Get_Next() == new Vector2(0, -1)) { t.Set_Next(t.Get_Next() + new Vector2(0, 1)); t.Set_Vel(-2, 2); } else { if (random.Next(2) == 0) { t.Set_Next(t.Get_Next() + new Vector2(0, 1)); t.Set_Vel(-2, 2); } else { t.Set_Next(t.Get_Next() + new Vector2(1, 0)); t.Set_Vel(2, 2); } } } } } temp_movement = "null"; } }
public override string Update3(GameTime gameTime) { if (!active_pause && !active_gameover) { octanom.Update(); foreach (Entity e in lilypad) { if (moving) { if (e.Get_Next().Y == octanom.Get_Next().Y || e.Get_Next().Y == octanom.Get_Pos().Y / 32) { } else { e.Update(); } } else { e.Update(); } } foreach (Entity e in trianom) { e.Update(); if (octanom.Get_Pos().X < e.Get_Pos().X + 16 && octanom.Get_Pos().X > e.Get_Pos().X - 16 && e.Get_Pos().Y == octanom.Get_Pos().Y) { octanom.Set_HP(0); JK.Noise("Explosion"); explosions.Add(new Entity(0, octanom.Get_Pos(), new Vector2(0, 0))); } } foreach (Entity e in crate) { e.Update(); } if (octanom.Get_Pos().X < -16 || octanom.Get_Pos().X > 28 * 32) { octanom.Set_HP(0); JK.Noise("Explosion"); explosions.Add(new Entity(0, octanom.Get_Pos(), new Vector2(0, 0))); } if (octanom.Get_HP() == 0 && !active_gameover) { GameOver(gameTime.TotalGameTime.TotalSeconds); } counter += 2; if (counter >= 32) { counter = 0; Summon(20); Summon(19); Summon(18); Summon(17); Summon(16); Summon(13); Summon(12); Summon(11); Summon(10); Summon(9); Summon(6); Summon(5); Summon(4); Summon(3); Summon(2); } foreach (Entity e in lilypad) { if (e.Get_Pos().X < -32 || e.Get_Pos().X > 28 * 32) { lilypad.Remove(e); break; } } foreach (Entity e in trianom) { if (e.Get_Pos().X < -32 || e.Get_Pos().X > 28 * 32) { lilypad.Remove(e); break; } } Command_Move(gameTime); } foreach (Entity e in explosions) { if (e.Get_HP() > 15) { explosions.Remove(e); break; } } return("void"); }
private void Add_Card(bool player) { if (player) { value_player = 0; JK.Noise("CardDraw"); cards_player.Add(new Vector3(random.Next(13) + 1, random.Next(4), 400)); foreach (Vector3 v in cards_player) { if (v.X == 13) { value_player += 1; } else if (v.X <= 9) { value_player = value_player + (int)v.X + 1; } } while (value_player >= 10) { value_player -= 10; } } bool temp_draw = false; if (cards_player.Count == 2 || value_dealer <= 3) { temp_draw = true; } else if (value_dealer == 4 && value_player <= 7) { temp_draw = true; } else if (value_dealer == 5 && value_player >= 4 && value_player <= 7) { temp_draw = true; } else if (value_dealer == 6 && value_player >= 6 && value_player <= 7) { temp_draw = true; } if (temp_draw) { JK.Noise("CardDraw"); cards_dealer.Add(new Vector3(random.Next(13) + 1, random.Next(4), 400)); value_dealer = 0; foreach (Vector3 v in cards_dealer) { if (v.X == 13) { value_dealer += 1; } else if (v.X <= 9) { value_dealer = value_dealer + (int)v.X + 1; } } while (value_dealer >= 10) { value_dealer -= 10; } } Result(); }
private void Command_Move(GameTime gameTime) { if (octanom_head.Get_Pos() == octanom_head.Get_Next() * 32) { Vector2 position = octanom_head.Get_Pos(); if (!active_move_tail) { active_move_tail = true; } // current moving direction string temp = "null"; // Cancels out moving in opposite direction (and running into own tail) if (octanom_head.Get_Vel().Y < 0) { temp = "Up"; if (temp_movement == "Down") { temp_movement = "null"; } } if (octanom_head.Get_Vel().Y > 0) { temp = "Down"; if (temp_movement == "Up") { temp_movement = "null"; } } if (octanom_head.Get_Vel().X < 0) { temp = "Left"; if (temp_movement == "Right") { temp_movement = "null"; } } if (octanom_head.Get_Vel().X > 0) { temp = "Right"; if (temp_movement == "Left") { temp_movement = "null"; } } // Updates Velocity if (temp_movement == "Up") { octanom_head.Set_Vel(0, -Speed()); } if (temp_movement == "Down") { octanom_head.Set_Vel(0, Speed()); } if (temp_movement == "Left") { octanom_head.Set_Vel(-Speed(), 0); } if (temp_movement == "Right") { octanom_head.Set_Vel(Speed(), 0); } // Updates Next() if (temp_movement == "Up" && octanom_head.Get_Next().Y != 0) { octanom_head.Set_Motion(0, -Speed()); temp_movement = "null"; } else if (temp_movement == "Up" && octanom_head.Get_Next().Y == 0) { octanom_head.Set_Motion(0, 0); temp_movement = "null"; } else if (temp_movement == "Down" && octanom_head.Get_Next().Y != 22) { octanom_head.Set_Motion(0, Speed()); temp_movement = "null"; } else if (temp_movement == "Down" && octanom_head.Get_Next().Y == 22) { octanom_head.Set_Motion(0, 0); temp_movement = "null"; } else if (temp_movement == "Left" && octanom_head.Get_Next().X != 0) { octanom_head.Set_Motion(-Speed(), 0); temp_movement = "null"; } else if (temp_movement == "Left" && octanom_head.Get_Next().X == 0) { octanom_head.Set_Motion(0, 0); temp_movement = "null"; } else if (temp_movement == "Right" && octanom_head.Get_Next().X != 27) { octanom_head.Set_Motion(Speed(), 0); temp_movement = "null"; } else if (temp_movement == "Right" && octanom_head.Get_Next().X == 27) { octanom_head.Set_Motion(0, 0); temp_movement = "null"; } else if (temp == "Up" && octanom_head.Get_Next().Y != 0) { octanom_head.Set_Next(octanom_head.Get_Next() + new Vector2(0, -1)); } else if (temp == "Up" && octanom_head.Get_Next().Y == 0) { JK.Noise("Place"); octanom_head.Set_Motion(0, 0); } else if (temp == "Down" && octanom_head.Get_Next().Y != 22) { octanom_head.Set_Next(octanom_head.Get_Next() + new Vector2(0, 1)); } else if (temp == "Down" && octanom_head.Get_Next().Y == 22) { JK.Noise("Place"); octanom_head.Set_Motion(0, 0); } else if (temp == "Left" && octanom_head.Get_Next().X != 0) { octanom_head.Set_Next(octanom_head.Get_Next() + new Vector2(-1, 0)); } else if (temp == "Left" && octanom_head.Get_Next().X == 0) { JK.Noise("Place"); octanom_head.Set_Motion(0, 0); } else if (temp == "Right" && octanom_head.Get_Next().X != 27) { octanom_head.Set_Next(octanom_head.Get_Next() + new Vector2(1, 0)); } else if (temp == "Right" && octanom_head.Get_Next().X == 27) { JK.Noise("Place"); octanom_head.Set_Motion(0, 0); } foreach (Entity tail in octanom_tail) { if (position.X > tail.Get_Pos().X) { tail.Set_Pos(position.X - 32, position.Y); tail.Set_Vel(Speed(), 0); } else if (position.X < tail.Get_Pos().X) { tail.Set_Pos(position.X + 32, position.Y); tail.Set_Vel(-Speed(), 0); } else if (position.Y > tail.Get_Pos().Y) { tail.Set_Pos(position.X, position.Y - 32); tail.Set_Vel(0, Speed()); } else if (position.Y < tail.Get_Pos().Y) { tail.Set_Pos(position.X, position.Y + 32); tail.Set_Vel(0, -Speed()); } position = tail.Get_Pos(); } } if (octanom_head.Get_Vel() == new Vector2(0, 0)) { active_move_tail = false; } }
private void Command_Move(GameTime gameTime) { if (octanom.Get_Pos() == octanom.Get_Next() * 32) { octanom.Set_Vel(0, 0); moving = false; if (field[(int)octanom.Get_Next().Y] == 2) { bool splash = true; foreach (Entity e in lilypad) { if (e.Get_Pos() == octanom.Get_Pos()) { splash = false; octanom.Set_Vel(e.Get_Vel().X, 0); if (temp_movement == "null") { if (e.Get_Vel().X > 0) { octanom.Set_Next(new Vector2(octanom.Get_Next().X + 1, octanom.Get_Next().Y)); } if (e.Get_Vel().X < 0) { octanom.Set_Next(new Vector2(octanom.Get_Next().X - 1, octanom.Get_Next().Y)); } } } } if (splash) { octanom.Set_HP(0); JK.Noise("Explosion"); explosions.Add(new Entity(0, octanom.Get_Pos(), new Vector2(0, 0))); } } if (octanom.Get_Next().Y < 2) { octanom.Set_Next(new Vector2(octanom.Get_Next().X, 22)); octanom.Set_Pos(octanom.Get_Pos().X, 22 * 32); map++; Build_Field(); } bool move = true; if (temp_movement == "Up") { if (field[(int)octanom.Get_Next().Y - 1] == 2 && counter != 0) { move = false; } else { moving = true; } } else if (temp_movement == "Down") { if (field[(int)octanom.Get_Next().Y + 1] == 2 && counter != 0) { move = false; } else { moving = true; } } else if (temp_movement == "Left" || temp_movement == "Right") { if (field[(int)octanom.Get_Next().Y] == 2 && counter != 0) { move = false; } else { moving = true; } } if (move) { if (temp_movement == "Up") { octanom.Set_Next(new Vector2(octanom.Get_Next().X, octanom.Get_Next().Y - 1)); octanom.Set_Vel(0, -2); } else if (temp_movement == "Down") { octanom.Set_Next(new Vector2(octanom.Get_Next().X, octanom.Get_Next().Y + 1)); octanom.Set_Vel(0, 2); } else if (temp_movement == "Left") { octanom.Set_Next(new Vector2(octanom.Get_Next().X - 1, octanom.Get_Next().Y)); octanom.Set_Vel(-2, 0); } else if (temp_movement == "Right") { octanom.Set_Next(new Vector2(octanom.Get_Next().X + 1, octanom.Get_Next().Y)); octanom.Set_Vel(2, 0); } temp_movement = "null"; } } }
private void Command_Unlock() { JK.Noise("Place"); score_lives++; int unlocked = 0; lamp[0] = "empty"; lamp[1] = "empty"; lamp[2] = "empty"; lamp[3] = "empty"; lamp[4] = "empty"; lamp[5] = "empty"; bool[] locked = new bool[6]; locked[0] = false; locked[1] = false; locked[2] = false; locked[3] = false; locked[4] = false; locked[5] = false; // search for green for (int i = 0; i < 6; i++) { if (slot[i] == bolt[i]) { unlocked++; lamp[i] = "green"; locked[i] = true; } } // search for yellow for (int i = 0; i < 6; i++) { if (lamp[i] != "green") // if not already green { for (int j = 0; j < 6; j++) { if (bolt[i] == slot[j] && !locked[j]) // finds a match in a different slot that isnt already used { lamp[i] = "yellow"; locked[j] = true; break; } } } } // colors red for (int i = 0; i < 6; i++) { if (lamp[i] == "empty") { lamp[i] = "red"; } } if (unlocked == 6) { won = true; } else { } }
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 string Update3(GameTime gameTime) { for (int i = 0; i < 4; i++) { if (alpha_player[i]) { if (alpha[i] < 1) { alpha[i] += Get_Speed(); } if (alpha[i] >= 1) { alpha[i] = 1.00f; alpha_player[i] = false; } } else { if (alpha[i] > 0) { alpha[i] -= Get_Speed(); } if (alpha[i] <= 0) { alpha[i] = 0.00f; } } } if (!active_player) { if (alpha_pos < color_simon.Count) { if (alpha[0] == 0 && alpha[1] == 0 && alpha[2] == 0 && alpha[3] == 0) { alpha_pos++; int temp = 0; foreach (int c in color_simon) { temp++; if (alpha_pos == temp) { alpha[c] += Get_Speed(); alpha_player[c] = true; break; } } if (alpha_pos == color_simon.Count) { active_player = true; } } } } if (!active_gameover) { if (alpha[0] == 0 && alpha[1] == 0 && alpha[2] == 0 && alpha[3] == 0) { if (result) { Restart(); } if (color_player.Count == color_simon.Count) { bool error = false; int index_simon = 0; foreach (int c1 in color_simon) { int index_player = 0; foreach (int c2 in color_player) { if (index_simon == index_player) { if (c1 != c2) { error = true; } } index_player++; } index_simon++; } if (error) { GameOver(gameTime.TotalGameTime.TotalSeconds); result = true; } else { result = true; alpha[0] += Get_Speed(); alpha_player[0] = true; alpha[1] += Get_Speed(); alpha_player[1] = true; alpha[2] += Get_Speed(); alpha_player[2] = true; alpha[3] += Get_Speed(); alpha_player[3] = true; JK.Noise("Cleared"); } } } } return("void"); }