public void write_Box() { for (Int32 y = 0; y < Game_Logic.display_x; y++) { for (Int32 x = 0; x < Game_Logic.display_x; x++) { if (game_Score[x, y] == 0) { if (count == choice_Box) { if (Game_Rundom.ran() > 10) { game_Score[x, y] = 2; } else { game_Score[x, y] = 4; } } count++; } } } count = 0; }
public Game_Logic() //виводить на екран рандомні числа { choice_Box = Game_Rundom.box_rand(free_Box); free_Box--; write_Box(); choice_Box = Game_Rundom.box_rand(free_Box); free_Box--; write_Box(); }
public void move_Box_Left() //реагування на зміщення { plas_Left_Buttn(); for (int y = 0; y < display_x; y++) { for (int x = 0; x < display_y; x++) { if (game_Score[x, y] == 0 && x < 3) { if (game_Score[x + 1, y] == 0 && x + 1 < 3) { if (game_Score[x + 2, y] == 0 && x + 2 < 3) { if (game_Score[x + 3, y] != 0 && x == 0) { game_Score[x, y] = game_Score[x + 3, y]; game_Score[x + 3, y] = 0; } } else { game_Score[x, y] = game_Score[x + 2, y]; game_Score[x + 2, y] = 0; } } else { game_Score[x, y] = game_Score[x + 1, y]; game_Score[x + 1, y] = 0; } } } } choice_Box = Game_Rundom.box_rand(free_Box); free_Box--; write_Box(); }
public void move_Box_Down() //реагування на зміщення { plas_Down_Buttn(); for (int y = 3; y > 0; y--) { for (int x = 0; x < display_x; x++) { if (game_Score[x, y] == 0 && y > 0) { if (game_Score[x, y - 1] == 0 && y > 1) { if (game_Score[x, y - 2] == 0 && y > 2) { if (game_Score[x, y - 3] != 0 && y == 3) { game_Score[x, y] = game_Score[x, y - 3]; game_Score[x, y - 3] = 0; } } else { game_Score[x, y] = game_Score[x, y - 2]; game_Score[x, y - 2] = 0; } } else { game_Score[x, y] = game_Score[x, y - 1]; game_Score[x, y - 1] = 0; } } } } choice_Box = Game_Rundom.box_rand(free_Box); free_Box--; write_Box(); }
public void move_Box_Up() //реагування на зміщення { plas_Up_Buttn(); for (int y = 0; y < display_y; y++) { for (int x = 0; x < display_x; x++) { if (game_Score[x, y] == 0 && y < 3) { if (game_Score[x, y + 1] == 0 && y + 1 < 3) { if (game_Score[x, y + 2] == 0 && y + 2 < 3) { if (game_Score[x, y + 3] != 0 && y == 0) { game_Score[x, y] = game_Score[x, y + +3]; game_Score[x, y + 3] = 0; } } else { game_Score[x, y] = game_Score[x, y + 2]; game_Score[x, y + 2] = 0; } } else { game_Score[x, y] = game_Score[x, y + 1]; game_Score[x, y + 1] = 0; } } } } choice_Box = Game_Rundom.box_rand(free_Box); free_Box--; write_Box(); }
public void move_Box_Right() //реагування на зміщення { plas_Right_Buttn(); for (int y = 0; y < display_x; y++) { for (int x = 3; x > 0; x--) { if (game_Score[x, y] == 0 && x > 0) { if (game_Score[x - 1, y] == 0 && x > 1) { if (game_Score[x - 2, y] == 0 && x > 2) { if (game_Score[x - 3, y] != 0 && x == 3) { game_Score[x, y] = game_Score[x - 3, y]; game_Score[x - 3, y] = 0; } } else { game_Score[x, y] = game_Score[x - 2, y]; game_Score[x - 2, y] = 0; } } else { game_Score[x, y] = game_Score[x - 1, y]; game_Score[x - 1, y] = 0; } } } } choice_Box = Game_Rundom.box_rand(free_Box); free_Box--; write_Box(); }