i'm doing a game for my c++ course and there is something wrong with a class
the error comes up in class hero...function jumpright
#include <iostream.h>
#include <conio.h>
#include <afx.h>
#define rows 48
#define cols 80
class screen
{
private:
char x[rows][cols];
public:
screen()
{
int i,j;
for(i=0;i<rows;i++)
{
for(j=0;j<cols;j++)
{
x[i][j]=' ';
}
}
for(i=0;i<cols;i++)
{
x[0][i]='#';
}
for(i=0;i<cols;i++)
{
x[rows-1][i]='#';
}
}
void setcell(int i,int c,char t)
{
x[i][c]=t;
}
void show()
{
system("cls");
for(int i=0;i<rows;i++)
{
for(int j=0;j<cols;j++)
{
cout<<x[i][j];
}
}
cout.flush();
}
};
class hero
{
private:
int posr;
int posc;
int health;
int direction;
int speed;
public:
hero()
{
posr=rows-4;
posc=3;
health =5;
direction =1;
speed =0;
}
void drawhero(screen &x)
{
char t=1;
{
x.setcell(posr,posc,t);
x.setcell(posr+1,posc,'|');
x.setcell(posr+1,posc-1,'-');
x.setcell(posr+1,posc+1,' -');
x.setcell(posr+2,posc-1,'|');
x.setcell(posr+2,posc+1,'|');
}
}
void delhero(screen &x)
{
{
x.setcell(posr,posc,' ');
x.setcell(posr+1,posc,' ');
x.setcell(posr+1,posc-1,' ');
x.setcell(posr+1,posc+1,' ');
x.setcell(posr+2,posc-1,' ');
x.setcell(posr+2,posc+1,' ');
}
}
void moveright(screen &x)
{
if(posc<cols-2)
{
delhero(x);
posc++;
drawhero(x);
}
}
void moveleft(screen &x)
{
if(posc>1)
{
delhero(x);
posc--;
drawhero(x);
}
}
void hit()
{
health--;
}
int gethealth()
{
return health;
}
void jumpright(screen &x, game &t)
{
delhero(x);
posc+=2;
posr--;
drawhero(x);
automove();
Sleep(100);
show();
delhero(x);
posc++;
drawhero(x);
automove();
Sleep(50);
show();
delhero(x);
posc+=2;
posr++;
drawhero(x);
automove();
}
};
class game
{
screen x;
hero bob;
public:
game()
{
int t;
t= bob.gethealth();
cout<<t;
}
void automove()
{
cout<<"teet"<<endl;
}
void usermove(char t,game &nagy)
{
if(t=='a')
bob.moveleft(x);
if(t=='d')
bob.moveright(x);
if(t=='e')
bob.jumpright(x);
}
void show()
{
bob.drawhero(x);
x.show();
}
int run()
{
return 1;
}
};
void main()
{
char t;
game nagy;
nagy.show();
while (nagy.run())
{
t=getch();
nagy.usermove(t,nagy);
nagy.show();
}
}