Initial Commit
This commit is contained in:
152
Console Games/Ascii Showdown/AsciiShowdown_AI.cs
Normal file
152
Console Games/Ascii Showdown/AsciiShowdown_AI.cs
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Console_Games.Ascii_Showdown {
|
||||||
|
class AsciiShowdown_AI {
|
||||||
|
//you can have it fire a horizontal line of bullets, or fire every third step, or fire a bunch in a straight line
|
||||||
|
//give it shooting patterns that it can cycle through based on situation
|
||||||
|
|
||||||
|
List<int> lastDirection = new List<int>(); //0 left, 1 right
|
||||||
|
List<int> lastMode = new List<int>(); //last movetype stored in last index
|
||||||
|
Random rnd = new Random();
|
||||||
|
|
||||||
|
int type = 0;
|
||||||
|
int iterationsOfType = 0;
|
||||||
|
|
||||||
|
bool lineOfSight = true;
|
||||||
|
int lastKnownPos = 0;
|
||||||
|
|
||||||
|
public int cX { get; set; }
|
||||||
|
public int cY { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public char[,] moveCPU(char[,] grid, int width, int uX, int uY, bool boost) {
|
||||||
|
if (grid[uX, uY - 2] == '█') { //checks if user is hiding
|
||||||
|
uX = lastKnownPos;
|
||||||
|
lineOfSight = false;
|
||||||
|
} else {
|
||||||
|
lineOfSight = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
type = getAItype(grid, width, uX, uY, boost);
|
||||||
|
|
||||||
|
if (type == 0) {
|
||||||
|
|
||||||
|
return grid;
|
||||||
|
|
||||||
|
} else if (type == 1) { //defensive, retreat and shoot every 8th
|
||||||
|
|
||||||
|
if (iterationsOfType % 8 == 0) {
|
||||||
|
grid[cX, cY + 1] = '▼';
|
||||||
|
}
|
||||||
|
if (iterationsOfType % 4 == 0) {
|
||||||
|
if (cX < uX) {
|
||||||
|
grid = moveRight(grid, width);
|
||||||
|
} else {
|
||||||
|
grid = moveLeft(grid, width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (type == 2) { //aggressive
|
||||||
|
|
||||||
|
} else if (type == 3) { //try to break walls
|
||||||
|
|
||||||
|
} else if (type == 4) { //try to block off player
|
||||||
|
|
||||||
|
} else if (type == 5) { //retreat and not shoot
|
||||||
|
|
||||||
|
if (iterationsOfType % 2 == 0) {
|
||||||
|
if (cX < 3) {
|
||||||
|
grid = moveRight(grid, width);
|
||||||
|
} else if (cX > width - 4) {
|
||||||
|
grid = moveLeft(grid, width);
|
||||||
|
} else if (cX > uX) {
|
||||||
|
grid = moveRight(grid, width);
|
||||||
|
} else {
|
||||||
|
grid = moveLeft(grid, width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (type == 6) { //blanket shot
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
iterationsOfType++;
|
||||||
|
|
||||||
|
return grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getAItype(char[,] grid, int width, int uX, int uY, bool boost) {
|
||||||
|
if (lastMode.Count > 1 && lastMode[lastMode.Count - 1] != lastMode[lastMode.Count - 2]) {
|
||||||
|
iterationsOfType = 0;
|
||||||
|
}
|
||||||
|
if (!lineOfSight) {
|
||||||
|
wonder(grid, width);
|
||||||
|
lastMode.Add(0); //wander
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (boost) {
|
||||||
|
lastMode.Add(5); //retreat and not shoot
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
lastMode.Add(1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[,] wonder(char[,] grid, int width) {
|
||||||
|
if (iterationsOfType % 4 == 0) {
|
||||||
|
int shoot = rnd.Next(1, 5);
|
||||||
|
int move = rnd.Next(0, 2);
|
||||||
|
if (shoot == 1) {
|
||||||
|
grid[cX, cY + 1] = '▼';
|
||||||
|
}
|
||||||
|
if (move == 1) {
|
||||||
|
grid = moveLeft(grid, width);
|
||||||
|
} else {
|
||||||
|
grid = moveRight(grid, width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iterationsOfType++;
|
||||||
|
return grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[,] moveLeft(char[,] grid, int width) {
|
||||||
|
if (cX - 1 > 0) {
|
||||||
|
lastDirection.Add(0);
|
||||||
|
grid[cX, cY] = ' ';
|
||||||
|
cX--;
|
||||||
|
grid[cX, cY] = '☻';
|
||||||
|
}
|
||||||
|
return grid;
|
||||||
|
}
|
||||||
|
private char[,] moveRight(char[,] grid, int width) {
|
||||||
|
if (cX + 1 < width - 1) {
|
||||||
|
lastDirection.Add(1);
|
||||||
|
grid[cX, cY] = ' ';
|
||||||
|
cX++;
|
||||||
|
grid[cX, cY] = '☻';
|
||||||
|
}
|
||||||
|
return grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
lastDirection.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* string lastdir = "";
|
||||||
|
for (int i = 0; i < lastDirection.Count; i++) {
|
||||||
|
lastdir += lastDirection[i];
|
||||||
|
}
|
||||||
|
string lastmode = "";
|
||||||
|
for (int i = 0; i < lastMode.Count; i++) {
|
||||||
|
lastmode += lastMode[i];
|
||||||
|
}
|
||||||
|
Console.SetCursorPosition(0, 22);
|
||||||
|
Console.WriteLine("Last direction: " + lastdir);
|
||||||
|
Console.WriteLine("Last mode: " + lastmode);
|
||||||
|
Console.WriteLine("Iterations of mode: " + iterationsOfType); */
|
||||||
|
}
|
||||||
|
}
|
||||||
118
Console Games/Ascii Showdown/AsciiShowdown_Draw.cs
Normal file
118
Console Games/Ascii Showdown/AsciiShowdown_Draw.cs
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Console_Games.Ascii_Showdown {
|
||||||
|
class AsciiShowdown_Draw {
|
||||||
|
public int width { get; set; }
|
||||||
|
public int height { get; set; }
|
||||||
|
public int indent { get; set; }
|
||||||
|
|
||||||
|
public void drawGrid(char[,] grid, int indent) {
|
||||||
|
try {
|
||||||
|
Console.SetCursorPosition(indent, indent - 3);
|
||||||
|
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
if (grid[i, j] == '☺') {
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
} else if (grid[i, j] == '☻') {
|
||||||
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
|
} else {
|
||||||
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
|
}
|
||||||
|
Console.Write(grid[i, j]);
|
||||||
|
}
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.SetCursorPosition(indent, j + indent - 2);
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
public void drawStats(int chealth, int uhealth, int bullets, int walls, bool boost) {
|
||||||
|
try {
|
||||||
|
int drawX = width + indent + 10;
|
||||||
|
|
||||||
|
Console.SetCursorPosition(drawX, 6);
|
||||||
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
|
|
||||||
|
Console.WriteLine("╔════════════════╗");
|
||||||
|
Console.SetCursorPosition(drawX, 7);
|
||||||
|
if (chealth > 9) {
|
||||||
|
Console.WriteLine("║CPU healh: {0} ║", chealth);
|
||||||
|
} else {
|
||||||
|
Console.WriteLine("║CPU healh: {0} ║", chealth);
|
||||||
|
}
|
||||||
|
Console.SetCursorPosition(drawX, 8);
|
||||||
|
Console.WriteLine("╚════════════════╝");
|
||||||
|
|
||||||
|
Console.SetCursorPosition(drawX, 14);
|
||||||
|
Console.WriteLine("╔════════════════╗");
|
||||||
|
Console.SetCursorPosition(drawX, 15);
|
||||||
|
if (uhealth > 9) {
|
||||||
|
Console.WriteLine("║Health: {0} ║", uhealth);
|
||||||
|
} else {
|
||||||
|
Console.WriteLine("║Health: {0} ║", uhealth);
|
||||||
|
}
|
||||||
|
Console.SetCursorPosition(drawX, 16);
|
||||||
|
if (bullets > 99) {
|
||||||
|
Console.WriteLine("║Bullets: {0} ║", bullets);
|
||||||
|
} else if (bullets > 9) {
|
||||||
|
Console.WriteLine("║Bullets: {0} ║", bullets);
|
||||||
|
} else {
|
||||||
|
Console.WriteLine("║Bullets: {0} ║", bullets);
|
||||||
|
}
|
||||||
|
Console.SetCursorPosition(drawX, 17);
|
||||||
|
if (walls > 9) {
|
||||||
|
Console.WriteLine("║Walls: {0} ║", walls);
|
||||||
|
} else {
|
||||||
|
Console.WriteLine("║Walls: {0} ║", walls);
|
||||||
|
}
|
||||||
|
Console.SetCursorPosition(drawX, 18);
|
||||||
|
if (boost) {
|
||||||
|
Console.Write("║Boost: ");
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.Write("ON");
|
||||||
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
|
Console.Write(" ║");
|
||||||
|
Console.WriteLine();
|
||||||
|
} else {
|
||||||
|
Console.Write("║Boost: ");
|
||||||
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
|
Console.Write("OFF");
|
||||||
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
|
Console.Write(" ║");
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
Console.SetCursorPosition(drawX, 19);
|
||||||
|
Console.WriteLine("╚════════════════╝");
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGrid(char[,] grid, char[,] oldGrid, int indent) {
|
||||||
|
try {
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
if (grid[i, j] != oldGrid[i, j]) {
|
||||||
|
if (grid[i, j] == '☺') {
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
} else if (grid[i, j] == '☻') {
|
||||||
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
|
} else {
|
||||||
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
|
}
|
||||||
|
Console.SetCursorPosition(i + indent, j + indent - 3);
|
||||||
|
Console.Write(grid[i, j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateStats(int chealth, int uhealth, int bullets, int walls, bool boost) {
|
||||||
|
int drawX = width + indent + 10;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
407
Console Games/Ascii Showdown/AsciiShowdown_Game.cs
Normal file
407
Console Games/Ascii Showdown/AsciiShowdown_Game.cs
Normal file
@@ -0,0 +1,407 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Console_Games {
|
||||||
|
class AsciiShowdown_Game {
|
||||||
|
//Dictionary<Point, char> dic = new Dictionary<Point, char>();
|
||||||
|
|
||||||
|
Random rnd = new Random();
|
||||||
|
Ascii_Showdown.AsciiShowdown_Draw draw = new Ascii_Showdown.AsciiShowdown_Draw();
|
||||||
|
Ascii_Showdown.AsciiShowdown_AI ai = new Ascii_Showdown.AsciiShowdown_AI();
|
||||||
|
|
||||||
|
int uhealth = 10, chealth = 30, bullets = 500, walls = 20;
|
||||||
|
bool boost = false;
|
||||||
|
int boostime = 100, cooldown = 200, boostimeon = 0, cooldowntime = 200;
|
||||||
|
|
||||||
|
int width = 40;
|
||||||
|
int height = 20;
|
||||||
|
int indent = 5;
|
||||||
|
|
||||||
|
int uX;
|
||||||
|
int uY;
|
||||||
|
|
||||||
|
public int cX;
|
||||||
|
public int cY;
|
||||||
|
|
||||||
|
bool HAULT = false;
|
||||||
|
int WINNER = 0;
|
||||||
|
char[,] grid;
|
||||||
|
char[,] oldGrid;
|
||||||
|
static readonly string defaultGrid =
|
||||||
|
"████████████████████████████████████████" + // █: wall
|
||||||
|
"█ ☻ █" + // ☻: cpu
|
||||||
|
"█ █" + // ☺: user
|
||||||
|
"█ █" + // ▲: user's bullet
|
||||||
|
"█ █" + // ▼: cpu's bullet
|
||||||
|
"█ █" + //boomerang(array): boomerang
|
||||||
|
"█ █" + //wall(array): user's wall
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ ☺ █" +
|
||||||
|
"████████████████████████████████████████";
|
||||||
|
|
||||||
|
|
||||||
|
public void initializeGame() {
|
||||||
|
Console.Clear();
|
||||||
|
Console.SetWindowSize(80, 30);
|
||||||
|
HAULT = false;
|
||||||
|
|
||||||
|
dispose();
|
||||||
|
|
||||||
|
draw.width = width;
|
||||||
|
draw.height = height;
|
||||||
|
draw.indent = indent;
|
||||||
|
|
||||||
|
grid = new char[width, height];
|
||||||
|
|
||||||
|
bool boost = false;
|
||||||
|
|
||||||
|
grid = stringToArray(defaultGrid);
|
||||||
|
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
if (grid[i, j] == '☺') {
|
||||||
|
uX = i;
|
||||||
|
uY = j;
|
||||||
|
} else if (grid[i, j] == '☻') {
|
||||||
|
cX = i;
|
||||||
|
cY = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("The game has successfully loaded!");
|
||||||
|
Console.WriteLine("To play:");
|
||||||
|
Console.WriteLine("W or up arrow to shoot");
|
||||||
|
Console.WriteLine("A or left arrow to move left");
|
||||||
|
Console.WriteLine("D or right arrow to move right");
|
||||||
|
Console.WriteLine("O to use your boost powerup this will only last for 5 seconds with a 10 second cooldown");
|
||||||
|
Console.WriteLine("P to place a wall this will only be able to survive 4 enemy or freindly shots before breaking");
|
||||||
|
Console.WriteLine("Press Q to Quit at any time");
|
||||||
|
|
||||||
|
Console.WriteLine("Press any key to continue...");
|
||||||
|
Console.ReadKey();
|
||||||
|
Console.Clear();
|
||||||
|
|
||||||
|
draw.drawGrid(grid, indent);
|
||||||
|
draw.drawStats(chealth, uhealth, bullets, walls, boost);
|
||||||
|
gameLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gameLoop() {
|
||||||
|
while (WINNER == 0 && HAULT == false) {
|
||||||
|
oldGrid = getOldGrid(grid);
|
||||||
|
|
||||||
|
if (boost) {
|
||||||
|
boostimeon++;
|
||||||
|
if (boostimeon == boostime) {
|
||||||
|
boost = false;
|
||||||
|
boostimeon = 0;
|
||||||
|
cooldown = 0;
|
||||||
|
}
|
||||||
|
} else if (cooldown < cooldowntime) {
|
||||||
|
cooldown++;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ConsoleKeyInfo> keys = new List<ConsoleKeyInfo>();
|
||||||
|
while (Console.KeyAvailable) {
|
||||||
|
var key = Console.ReadKey(true);
|
||||||
|
keys.Add(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
moveColideandStuff();
|
||||||
|
|
||||||
|
ai.cX = cX;
|
||||||
|
ai.cY = cY;
|
||||||
|
grid = ai.moveCPU(grid, width, uX, uY, boost);
|
||||||
|
cX = ai.cX;
|
||||||
|
cY = ai.cY;
|
||||||
|
|
||||||
|
keyPressed(keys);
|
||||||
|
|
||||||
|
//game logic calls
|
||||||
|
|
||||||
|
if (bullets == 0 || uhealth == 0) {
|
||||||
|
WINNER = 2;
|
||||||
|
break;
|
||||||
|
} else if (chealth == 0) {
|
||||||
|
WINNER = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckAndResetWindowSize();
|
||||||
|
draw.updateGrid(grid, oldGrid, indent);
|
||||||
|
draw.drawStats(chealth, uhealth, bullets, walls, boost);
|
||||||
|
Thread.Sleep(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WINNER == 1) {
|
||||||
|
Console.Clear();
|
||||||
|
Console.WriteLine("You win!");
|
||||||
|
Console.WriteLine("Press any key to continue");
|
||||||
|
Console.ReadKey();
|
||||||
|
initializeGame();
|
||||||
|
} else if (WINNER == 2) {
|
||||||
|
Console.Clear();
|
||||||
|
Console.WriteLine("You loose :(");
|
||||||
|
Console.WriteLine("Press any key to continue");
|
||||||
|
Console.ReadKey();
|
||||||
|
initializeGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose();
|
||||||
|
gameLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void keyPressed(List<ConsoleKeyInfo> keys) {
|
||||||
|
try {
|
||||||
|
if (keys.Count >= 1) {
|
||||||
|
var key = keys[keys.Count - 1];
|
||||||
|
|
||||||
|
switch (key.KeyChar) {
|
||||||
|
case 'W':
|
||||||
|
case 'w':
|
||||||
|
if (boost) {
|
||||||
|
grid[uX - 1, uY - 1] = '▲';
|
||||||
|
grid[uX, uY - 1] = '▲';
|
||||||
|
grid[uX + 1, uY - 1] = '▲';
|
||||||
|
bullets += -3;
|
||||||
|
} else {
|
||||||
|
grid[uX, uY - 1] = '▲';
|
||||||
|
bullets--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
case 'd':
|
||||||
|
if (uX + 1 < width - 1) {
|
||||||
|
grid[uX, uY] = ' ';
|
||||||
|
grid[uX + 1, uY] = '☺';
|
||||||
|
uX++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'A':
|
||||||
|
case 'a':
|
||||||
|
if (uX - 1 > 0) {
|
||||||
|
grid[uX, uY] = ' ';
|
||||||
|
grid[uX - 1, uY] = '☺';
|
||||||
|
uX--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
case 'p':
|
||||||
|
if (walls > 0 && grid[uX, uY - 2] != '█') {
|
||||||
|
grid[uX, uY - 2] = '█';
|
||||||
|
walls--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'O':
|
||||||
|
case 'o':
|
||||||
|
if (boost) {
|
||||||
|
boost = false;
|
||||||
|
boostimeon = 0;
|
||||||
|
} else if (!boost && cooldown == cooldowntime) {
|
||||||
|
cooldown = 0;
|
||||||
|
|
||||||
|
boost = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Q':
|
||||||
|
case 'q':
|
||||||
|
dispose();
|
||||||
|
HAULT = true;
|
||||||
|
UserInterface ui = new UserInterface();
|
||||||
|
ui.programStart();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (key.Key) {
|
||||||
|
case ConsoleKey.UpArrow:
|
||||||
|
if (boost) {
|
||||||
|
grid[uX - 1, uY - 1] = '▲';
|
||||||
|
grid[uX, uY - 1] = '▲';
|
||||||
|
grid[uX + 1, uY - 1] = '▲';
|
||||||
|
bullets += -3;
|
||||||
|
} else {
|
||||||
|
grid[uX, uY - 1] = '▲';
|
||||||
|
bullets--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ConsoleKey.RightArrow:
|
||||||
|
if (uX + 1 < width - 1) {
|
||||||
|
grid[uX, uY] = ' ';
|
||||||
|
grid[uX + 1, uY] = '☺';
|
||||||
|
uX++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ConsoleKey.LeftArrow:
|
||||||
|
if (uX - 1 > 0) {
|
||||||
|
grid[uX, uY] = ' ';
|
||||||
|
grid[uX - 1, uY] = '☺';
|
||||||
|
uX--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ConsoleKey.Spacebar:
|
||||||
|
if (boost) {
|
||||||
|
grid[uX - 1, uY - 1] = '▲';
|
||||||
|
grid[uX, uY - 1] = '▲';
|
||||||
|
grid[uX + 1, uY - 1] = '▲';
|
||||||
|
bullets += -3;
|
||||||
|
} else {
|
||||||
|
grid[uX, uY - 1] = '▲';
|
||||||
|
bullets--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void moveColideandStuff() {
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
if (grid[i, j] == '▲') { //if the target is a user bullet
|
||||||
|
if (j > 1) { //if the target is not on a border
|
||||||
|
if (grid[i, j - 1] == '█' && j > 1) { //if the target has hit a wall which isnt the border, damage wall
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j - 1] = '▓';
|
||||||
|
} else if (grid[i, j - 1] == '▓') { //wall dameging
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j - 1] = '▒';
|
||||||
|
} else if (grid[i, j - 1] == '▒') {
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j - 1] = '░';
|
||||||
|
} else if (grid[i, j - 1] == '░') {
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j - 1] = '*';
|
||||||
|
} else if (grid[i, j - 1] == '☻') { //if the target has hit the CPU
|
||||||
|
chealth--;
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
flashScreenEnemyHit();
|
||||||
|
} else { //if else, move forward
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j - 1] = '▲';
|
||||||
|
}
|
||||||
|
} else { //if the target is on a wall, destroy it
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
}
|
||||||
|
} else if (grid[i, j] == '▼') { //if the target is a CPU bullet
|
||||||
|
if (j < height - 2) { //if the target is not on a lower border
|
||||||
|
if (grid[i, j + 1] == '█' && j > 1) { //if the target has hit a wall which isnt the border, damage wall
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j + 1] = '▓';
|
||||||
|
} else if (grid[i, j + 1] == '▓') { //wall dameging
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j + 1] = '▒';
|
||||||
|
} else if (grid[i, j + 1] == '▒') {
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j + 1] = '░';
|
||||||
|
} else if (grid[i, j + 1] == '░') {
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j + 1] = '*';
|
||||||
|
} else if (grid[i, j + 1] == '☺') { //if the target has hit the user
|
||||||
|
uhealth--;
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
flashScreenPlayerHit();
|
||||||
|
} else { //if else, move forward
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
grid[i, j + 1] = 'v';
|
||||||
|
}
|
||||||
|
} else { //if the target is on a wall, destroy it
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
}
|
||||||
|
} else if (grid[i, j] == '*') { //if its an explosion, delete it
|
||||||
|
grid[i, j] = ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
if (grid[i, j] == 'v') {
|
||||||
|
grid[i, j] = '▼';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[,] stringToArray(string toload) {
|
||||||
|
for (int i = 0; i < height; i++) {
|
||||||
|
for (int j = 0; j < width; j++) {
|
||||||
|
grid[j, i] = toload[i * width + j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[,] getOldGrid(char[,] currentGrid) {
|
||||||
|
char[,] oldGrid = new char[width, height];
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
oldGrid[i, j] = currentGrid[i, j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return oldGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void flashScreenEnemyHit() {
|
||||||
|
Console.Clear();
|
||||||
|
Console.BackgroundColor = ConsoleColor.Red;
|
||||||
|
Console.Clear();
|
||||||
|
Console.BackgroundColor = ConsoleColor.Black;
|
||||||
|
Console.Clear();
|
||||||
|
draw.drawGrid(grid, indent);
|
||||||
|
draw.drawStats(chealth, uhealth, bullets, walls, boost);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void flashScreenPlayerHit() {
|
||||||
|
Console.Clear();
|
||||||
|
Console.BackgroundColor = ConsoleColor.Green;
|
||||||
|
Console.Clear();
|
||||||
|
Console.BackgroundColor = ConsoleColor.Black;
|
||||||
|
Console.Clear();
|
||||||
|
draw.drawGrid(grid, indent);
|
||||||
|
draw.drawStats(chealth, uhealth, bullets, walls, boost);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckAndResetWindowSize() {
|
||||||
|
try {
|
||||||
|
if (Console.WindowWidth != 80 || Console.WindowHeight != 30) {
|
||||||
|
Console.SetWindowSize(80, 30);
|
||||||
|
Console.Clear();
|
||||||
|
draw.drawGrid(grid, indent);
|
||||||
|
draw.drawStats(chealth, uhealth, bullets, walls, boost);
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
ai.dispose();
|
||||||
|
|
||||||
|
uhealth = 10;
|
||||||
|
chealth = 30;
|
||||||
|
bullets = 500;
|
||||||
|
walls = 20;
|
||||||
|
boost = false;
|
||||||
|
boostime = 100;
|
||||||
|
cooldown = 200;
|
||||||
|
boostimeon = 0;
|
||||||
|
cooldowntime = 200;
|
||||||
|
|
||||||
|
width = 40;
|
||||||
|
height = 20;
|
||||||
|
indent = 5;
|
||||||
|
|
||||||
|
HAULT = false;
|
||||||
|
WINNER = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,11 +42,20 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Ascii Showdown\AsciiShowdown_AI.cs" />
|
||||||
|
<Compile Include="Ascii Showdown\AsciiShowdown_Draw.cs" />
|
||||||
|
<Compile Include="Ascii Showdown\AsciiShowdown_Game.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Space Invaders\SpaceInvaders_Draw.cs" />
|
||||||
|
<Compile Include="Space Invaders\SpaceInvaders_Game.cs" />
|
||||||
|
<Compile Include="Tetris\Tetris_Draw.cs" />
|
||||||
|
<Compile Include="Tetris\Tetris_Game.cs" />
|
||||||
|
<Compile Include="UserInterface.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -7,6 +7,10 @@ using System.Threading.Tasks;
|
|||||||
namespace Console_Games {
|
namespace Console_Games {
|
||||||
class Program {
|
class Program {
|
||||||
static void Main(string[] args) {
|
static void Main(string[] args) {
|
||||||
|
Console.OutputEncoding = Encoding.UTF8;
|
||||||
|
|
||||||
|
UserInterface ui = new UserInterface();
|
||||||
|
ui.atLaunch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
Console Games/Space Invaders/SpaceInvaders_Draw.cs
Normal file
10
Console Games/Space Invaders/SpaceInvaders_Draw.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Console_Games {
|
||||||
|
class SpaceInvaders_Draw {
|
||||||
|
}
|
||||||
|
}
|
||||||
126
Console Games/Space Invaders/SpaceInvaders_Game.cs
Normal file
126
Console Games/Space Invaders/SpaceInvaders_Game.cs
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Console_Games {
|
||||||
|
class SpaceInvaders_Game {
|
||||||
|
//👾 👽 █ ▲ ▼ ☺ * |
|
||||||
|
|
||||||
|
int width = 29;
|
||||||
|
int height = 25;
|
||||||
|
|
||||||
|
bool lost = false;
|
||||||
|
bool hault = false;
|
||||||
|
|
||||||
|
int score = 0;
|
||||||
|
int enemyCount = 55;
|
||||||
|
int enemyRows = 5;
|
||||||
|
int enemyCols = 11;
|
||||||
|
int enemySpeed = 1;
|
||||||
|
int speedMultiplier = 2;
|
||||||
|
|
||||||
|
int pWalls = 10;
|
||||||
|
|
||||||
|
public readonly string gridString = "" +
|
||||||
|
"███████████████████" +
|
||||||
|
"█ 👾👾👾👾👾👾👾👾👾👾👾 █" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"" +
|
||||||
|
"";
|
||||||
|
|
||||||
|
char[,] grid;
|
||||||
|
char[,] oldGrid;
|
||||||
|
|
||||||
|
|
||||||
|
public void initializeGame() {
|
||||||
|
Console.Clear();
|
||||||
|
grid = new char[width, height];
|
||||||
|
oldGrid = new char[width, height];
|
||||||
|
|
||||||
|
grid = stringToArray(gridString);
|
||||||
|
|
||||||
|
gameLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gameLoop() {
|
||||||
|
|
||||||
|
while (!lost && !hault) {
|
||||||
|
oldGrid = getOldGrid(grid);
|
||||||
|
List<ConsoleKeyInfo> keys = new List<ConsoleKeyInfo>();
|
||||||
|
while (Console.KeyAvailable) {
|
||||||
|
var key = Console.ReadKey(true);
|
||||||
|
keys.Add(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// game logic
|
||||||
|
|
||||||
|
keyPressed(keys);
|
||||||
|
|
||||||
|
Thread.Sleep(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void keyPressed(List<ConsoleKeyInfo> keys) {
|
||||||
|
if (keys.Count >= 1) {
|
||||||
|
var key = keys[keys.Count - 1];
|
||||||
|
|
||||||
|
switch (key.KeyChar) {
|
||||||
|
case 'Q':
|
||||||
|
case 'q':
|
||||||
|
dispose();
|
||||||
|
hault = true;
|
||||||
|
UserInterface ui = new UserInterface();
|
||||||
|
ui.programStart();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[,] stringToArray(string toload) {
|
||||||
|
for (int i = 0; i < height; i++) {
|
||||||
|
for (int j = 0; j < width; j++) {
|
||||||
|
grid[j, i] = toload[i * width + j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[,] getOldGrid(char[,] currentGrid) {
|
||||||
|
char[,] oldGrid = new char[width, height];
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
oldGrid[i, j] = currentGrid[i, j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return oldGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
width = 29;
|
||||||
|
height = 25;
|
||||||
|
|
||||||
|
lost = false;
|
||||||
|
hault = false;
|
||||||
|
|
||||||
|
score = 0;
|
||||||
|
enemyCount = 55;
|
||||||
|
enemyRows = 5;
|
||||||
|
enemyCols = 11;
|
||||||
|
enemySpeed = 1;
|
||||||
|
speedMultiplier = 2;
|
||||||
|
|
||||||
|
pWalls = 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
Console Games/Tetris/Tetris_Draw.cs
Normal file
26
Console Games/Tetris/Tetris_Draw.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Console_Games {
|
||||||
|
class Tetris_Draw {
|
||||||
|
public void drawGrid() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawStats() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGrid() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateStats() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
126
Console Games/Tetris/Tetris_Game.cs
Normal file
126
Console Games/Tetris/Tetris_Game.cs
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Console_Games {
|
||||||
|
class Tetris_Game {
|
||||||
|
int width = 29;
|
||||||
|
int height = 25;
|
||||||
|
|
||||||
|
bool lost = false;
|
||||||
|
bool hault = false;
|
||||||
|
|
||||||
|
public readonly string gridString = "" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█ █" +
|
||||||
|
"█████████████████████████████";
|
||||||
|
|
||||||
|
char[,] grid;
|
||||||
|
char[,] oldGrid;
|
||||||
|
|
||||||
|
|
||||||
|
public void initializeGame() {
|
||||||
|
Console.Clear();
|
||||||
|
grid = new char[width, height];
|
||||||
|
oldGrid = new char[width, height];
|
||||||
|
|
||||||
|
grid = stringToArray(gridString);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gameLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gameLoop() {
|
||||||
|
while (!lost && !hault) {
|
||||||
|
oldGrid = getOldGrid(grid);
|
||||||
|
List<ConsoleKeyInfo> keys = new List<ConsoleKeyInfo>();
|
||||||
|
while (Console.KeyAvailable) {
|
||||||
|
var key = Console.ReadKey(true);
|
||||||
|
keys.Add(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkRows();
|
||||||
|
|
||||||
|
moveDown();
|
||||||
|
|
||||||
|
keyPressed(keys);
|
||||||
|
|
||||||
|
Thread.Sleep(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void keyPressed(List<ConsoleKeyInfo> keys) {
|
||||||
|
if (keys.Count >= 1) {
|
||||||
|
var key = keys[keys.Count - 1];
|
||||||
|
|
||||||
|
switch (key.KeyChar) {
|
||||||
|
case 'Q':
|
||||||
|
case 'q':
|
||||||
|
dispose();
|
||||||
|
hault = true;
|
||||||
|
UserInterface ui = new UserInterface();
|
||||||
|
ui.programStart();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkRows() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void moveDown() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[,] stringToArray(string toload) {
|
||||||
|
for (int i = 0; i < height; i++) {
|
||||||
|
for (int j = 0; j < width; j++) {
|
||||||
|
grid[j, i] = toload[i * width + j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private char[,] getOldGrid(char[,] currentGrid) {
|
||||||
|
char[,] oldGrid = new char[width, height];
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
for (int j = 0; j < height; j++) {
|
||||||
|
oldGrid[i, j] = currentGrid[i, j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return oldGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
97
Console Games/UserInterface.cs
Normal file
97
Console Games/UserInterface.cs
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Console_Games {
|
||||||
|
class UserInterface {
|
||||||
|
public int startHeight;
|
||||||
|
public int startWidth;
|
||||||
|
|
||||||
|
public void atLaunch() {
|
||||||
|
startHeight = Console.WindowHeight;
|
||||||
|
startWidth = Console.WindowWidth;
|
||||||
|
programStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void programStart() {
|
||||||
|
Console.Clear();
|
||||||
|
Console.CursorVisible = false;
|
||||||
|
|
||||||
|
int offsetFromLeft = 1;
|
||||||
|
int offsetFromTop = 2;
|
||||||
|
|
||||||
|
string[] gameList = new string[3];
|
||||||
|
gameList[0] = "Ascii Showdown";
|
||||||
|
gameList[1] = "Space Invaders";
|
||||||
|
gameList[2] = "Tetris";
|
||||||
|
|
||||||
|
int numberOfGames = gameList.Length;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
selectGame(numberOfGames, offsetFromLeft, offsetFromTop, gameList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setHUD(int GameAmmount) {
|
||||||
|
Console.SetCursorPosition(0, 0);
|
||||||
|
Console.WriteLine("Select a console game to play:");
|
||||||
|
|
||||||
|
for (int i = 2; i < GameAmmount + 2; i++) {
|
||||||
|
Console.SetCursorPosition(0, i);
|
||||||
|
Console.Write("|");
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.SetCursorPosition(0, GameAmmount + 3);
|
||||||
|
Console.WriteLine("Copyright™ Benjamin Kyd 2018");
|
||||||
|
Console.WriteLine("Press Q to quit...");
|
||||||
|
Console.SetCursorPosition(0, Console.WindowHeight - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectGame(int numGames, int offsetLeft, int offsetTop, string[] gameList) {
|
||||||
|
|
||||||
|
if (Console.WindowHeight == startHeight || Console.WindowWidth == startWidth) {
|
||||||
|
Console.SetWindowSize(startWidth, startHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.Clear();
|
||||||
|
setHUD(numGames);
|
||||||
|
for (int i = 0; i < gameList.Length; i++) {
|
||||||
|
Console.SetCursorPosition(offsetLeft, offsetTop + i);
|
||||||
|
|
||||||
|
if (gameList[i].Length <= 6) {
|
||||||
|
Console.Write(" " + gameList[i] + "\t\t (" + (i + 1) + ")");
|
||||||
|
} else {
|
||||||
|
Console.Write(" " + gameList[i] + "\t (" + (i + 1) + ")");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//List<AsciiShowdown_Game> showdown = new List<AsciiShowdown_Game>();
|
||||||
|
|
||||||
|
//Console.WriteLine("\n█ █ █ █ █ \n👾 👾 👾 👾 👾");
|
||||||
|
|
||||||
|
var response = Console.ReadKey();
|
||||||
|
switch (response.KeyChar) {
|
||||||
|
case 'Q':
|
||||||
|
case 'q':
|
||||||
|
Environment.Exit(0);
|
||||||
|
break;
|
||||||
|
case '1':
|
||||||
|
AsciiShowdown_Game showdown = new AsciiShowdown_Game();
|
||||||
|
showdown.initializeGame();
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
break;
|
||||||
|
case '3':
|
||||||
|
Tetris_Game tetris = new Tetris_Game();
|
||||||
|
tetris.initializeGame();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user