Witam, potrzebuję waszej pomocy z grą. Muszę zrobić tak by po dotknięciu "podłogi" przez piłeczkę wyskakiwał napis game over i byłby powrót do menu(na miejscu napisów "logo" ma być obrazek w kodzie ascii a zamiast słowa "instrukcja" będzie krótki tekst ale z tym sam już sobie poradzę). Był bym wdzięczny za pomoc.
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<iostream>
#include<stdio.h>
#include<conio.h>
#include<windows.h>
using namespace std;
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void logo()
{
gotoxy(0, 0);
gotoxy(1, 1);
cout << " logo" << endl;
cout << " logo" << endl;
cout << " logo" << endl;
cout << " logo" << endl;
cout << " logo" << endl;
Sleep(2000);
for (int i = 15; i > 1; i--)
{
gotoxy(1, i);
cout << " ";
Sleep(50);
}
system("cls");
}
void instrukcja()
{
gotoxy(0, 0);
cout << "instrukcja";
Sleep(2000);
system("cls");
}
int main()
{
logo();
instrukcja();
int wybor;
cout << "menu" << endl;
cout << endl;
cout << "2. Rozpocznij gre" << endl;
cout << "1. Wyjdz" << endl;
cin >> wybor;
system("cls");
if (wybor == 1)
{
exit(0);
}
if (wybor == 2)
{
int punkty = 0;
int kxp = 1, kx = 1, ky = 1;
int x = 3, y = 3, xp = 3;
logo();
char aa;
aa = 218;
gotoxy(1, 1);
cout << aa << endl;
aa = 191;
gotoxy(50, 1);
cout << aa << endl;
aa = 192;
gotoxy(1, 20);
cout << aa << endl;
aa = 217;
gotoxy(50, 20);
cout << aa << endl;
for (int i = 2; i < 50; i++)
{
aa = 196;
gotoxy(i, 1);
cout << aa << endl;
gotoxy(i, 20);
cout << aa << endl;
}
for (int i = 2; i < 20; i++)
{
aa = 179;
gotoxy(1, i);
cout << aa << endl;
gotoxy(50, i);
cout << aa << endl;
cout << endl;
}
char ee = 'q';
while (ee == 'q')
{
gotoxy(x, y);
cout << "o";
gotoxy(xp, 17);
aa = 196;
cout << aa << aa << aa << aa << aa;
Sleep(50);
gotoxy(x, y);
cout << " ";
gotoxy(xp, 17);
cout << " ";
if (xp > 44 || xp < 3)
{
kxp = -1 * kxp;
}
xp = xp + kxp;
if (x > 48 || x < 3)
{
kx = -1 * kx;
}
x = x + kx;
if (y > 18 || y < 3)
{
ky = -1 * ky;
}
y = y + ky;
if ((y == 17) && (x >= xp) && (x <= xp + 4))
{
ky = -1 * ky;
punkty = punkty + 1;
}
gotoxy(55, 5);
cout << punkty << endl;
char chr1;
while (_kbhit())
{
chr1 = _getch();
if (chr1 == ' ')
{
kxp = -1 * kxp;
}
if (chr1 == ' e')
{
ee == 'e';
}
}
}
}
if (wybor != 1 || wybor != 2)
{
cout << "Podaj 1 lub 2" << endl;
}
system("pause");
return 0;
}