Hi everyone, I've just done a simple game in C++ (sth similar to impossible rush if you know it) using classes. At first building and running it, everything was perfect, but then running it many times, it started to get slower and slower. It wasn't working the way it did at first. This fact also had happened with other games of mine and I don't what could the reason be! Maybe the compiler? Please help me! thank you in advanvce!
by the way, I'm using code blocks and the compiler is GNU GCC Compiler!
Here's my code:
#include<iostream>
#include<windows.h>
#include<ctime>
#include<conio.h>
#define KEY_UP 72
#define KEY_DOWN 80
#define ENTER 13
using namespace std;
class rush
{
private:
char *map,A,C,B,D;
short x,z,t;
}
int main()
{
rush impossible;
cout<<"\t\t\tIMPOSSIBLE RUSH\n";
int ww=1,w=0,y=1;
while(ww==1)
{
while(w==1)
{
int arrow=0;
switch(arrow=getch())
{
case KEY_UP:
{y--;
w=0;
break;}
case KEY_DOWN:
{y++;
w=0;
break;}
case ENTER:
{ww=0;
w=0;
break;}
default:
break;
}
}
if(y%3==1)
{clearscreen();cout<<"\n\n\n\t\t <start>\n\t\t\t Hint \n\t\t Best score ";w=1;}
if(y%3==2)
{clearscreen();cout<<"\n\n\n\t\t start \n\t\t\t<Hint>\n\t\t Best score ";w=1;}
if(y%3==0)
{clearscreen();cout<<"\n\n\n\t\t start \n\t\t\t Hint \n\t\t <Best score>";w=1;}
}
if(y%3==2)
{
system("cls");
cout<<"\n\t\tHint\n\n\t\t Try, pressing space, to move the colours such that\n\t\t the color from the top of the square \n\t\tcould be the same with the ball colour.\n\t\t Good luck!!";
getch();
}
if(y%3==0)
{
system("cls");
cout<<"Best score: 35";
getch();
}
system("cls");
impossible.start();
}