Professional Documents
Culture Documents
01 135222 064 101169100327 09012023 104108pm
01 135222 064 101169100327 09012023 104108pm
CSC-113
Term Project-Deliverable 2
You need to submit the initial project code including all the source files in visual C++ report covering the
five basic functional requirements that were claimed in your project report deliverable 1. Submit the
compressed folders of your source code with your project name.
GROUP 1:
Shaheer Atif : 01-135222-064
Sabika Nayab : 01-135222-075
Haseeb Ullah Khan : 01-135222-037
CODE:
#include<iostream>
#include<conio.h>
#include<dos.h>
#include <windows.h>
#include <time.h>
#define SCREEN_WIDTH 90
#define SCREEN_HEIGHT 26
#define WIN_WIDTH 70
COORD CursorPosition;
int enemyY[3];
int enemyX[3];
int enemyFlag[3];
int score = 0;
CursorPosition.X = x;
CursorPosition.Y = y;
SetConsoleCursorPosition(console, CursorPosition);
if (size == 0)
size = 20;
CONSOLE_CURSOR_INFO lpCursor{};
lpCursor.bVisible = visible;
lpCursor.dwSize = size;
SetConsoleCursorInfo(console, &lpCursor);
void drawBorder() {
for (int i = 0; i < SCREEN_HEIGHT; i++) {
system("color 0A");
if (enemyFlag[ind] == true) {
if (enemyFlag[ind] == true) {
eraseEnemy(ind);
enemyY[ind] = 1;
genEnemy(ind);
void drawCar() {
void eraseCar() {
int collision() {
return 1;
}
}
return 0;
void gameover() {
system("cls");
system("color 0A");
_getch();
void updateScore() {
gotoxy(WIN_WIDTH + 7, 5); cout << "Score: " << score << endl;
void instructions() {
system("color 0A");
system("cls");
_getch();
}
void play() {
system("color 0A");
carPos = -1 + WIN_WIDTH / 2;
score = 0;
enemyFlag[0] = 1;
enemyFlag[1] = 0;
enemyY[0] = enemyY[1] = 1;
system("cls");
drawBorder();
updateScore();
genEnemy(0);
genEnemy(1);
_getch;
while (1) {
if (_kbhit()) {
char ch = _getch();
carPos -= 4;
carPos += 4;
if (ch == 27) {
break;
drawCar();
drawEnemy(0);
drawEnemy(1);
if (collision() == 1) {
gameover();
return;
Sleep(50);
eraseCar();
eraseEnemy(0);
eraseEnemy(1);
if (enemyY[0] == 10)
if (enemyFlag[1] == 0)
enemyFlag[1] = 1;
if (enemyFlag[0] == 1)
enemyY[0] += 1;
if (enemyFlag[1] == 1)
enemyY[1] += 1;
resetEnemy(0);
score++;
updateScore();
resetEnemy(1);
score++;
updateScore();
int main()
setcursor(0, 0);
srand((unsigned)time(NULL));
do {
system("color 0A");
system("cls");
char op = _getche();
if (op == '1') {
play();
} while (1);
return 0;
}
OUTPUT:
COMPRESSED FILE OF SOURCE CODE:
ConsoleApplication7.zip