вызов метода 448 строка
Код: Выделить всё
OurCar->MoveCar(&MainMap);
Код: Выделить всё
class Car
{
float dir;
float speed;
float lth_half;
float wth_half;
float x;
float y;
float angle;
float dist;
public:
Car(float nx, float ny,float nwth, float nlth)
{
x = nx;
y = ny;
dir = 0.0;
speed = 0.0;
lth_half = nlth;
wth_half = nwth;
dist = sqrt(lth_half*lth_half +wth_half*wth_half);
angle = atan(wth_half/lth_half);
}
void MoveCar(Map *map);
void DrawCar();
float getX();
float getY();
float getDIR();
float getDIST();
float getANGLE();
float getWTH();
float getLTH();
};
Код: Выделить всё
void Car::MoveCar(Map *map)
{
float d_dir = 0.0;
if(GetAsyncKeyState(VK_UP))
speed = 0.01;
else if(GetAsyncKeyState(VK_DOWN))
speed = -0.01;
else
speed = 0.0;
if(GetAsyncKeyState(VK_LEFT) && speed)
d_dir = 1.0;
if(GetAsyncKeyState(VK_RIGHT) && speed)
d_dir = -1.0;
dir += d_dir;
x += cos(dir*PI/180.0)*speed;
y += sin(dir*PI/180.0)*speed;
if(map->CollisionCheck(this))
{
x -= cos(dir*PI/180.0)*speed;
y -= sin(dir*PI/180.0)*speed;
dir -= d_dir;
speed = 0.0;
}
}
[ATTACH]2324[/ATTACH]
Заранее Спасибо за Помощь.