Subversion Repositories QTron

Compare Revisions

Ignore whitespace Rev 8 → Rev 7

/bike.cpp
21,7 → 21,6
isReady = false;
hadGo = false;
dead = false;
collided = false;
 
colour.setBlue(0);
colour.setRed(0);
61,31 → 60,22
painter->drawLine(point1, point2);
}
 
if (!collided)
if (angle == 0)
{
collided = hasCollided();
 
if (angle == 0)
{
y -= velocity;
}
else if (angle == 90)
{
x += velocity;
}
else if (angle == 180)
{
y += velocity;
}
else if (angle == 270)
{
x -= velocity;
}
y -= velocity;
}
else
else if (angle == 90)
{
linePoints.clear();
x += velocity;
}
else if (angle == 180)
{
y += velocity;
}
else if (angle == 270)
{
x -= velocity;
}
 
if (angle == 0 || angle == 180)
{
162,14 → 152,6
hasHadGo = true;
}
 
bool Bike::hasCollided()
{
// Do collision detection here
// use linePoints
 
return false;
}
 
void Bike::reset()
{
x = rand() % 800;
184,7 → 166,6
isReady = true;
hadGo = false;
dead = false;
collided = false;
 
socket->write("RESET\n");
}
/bike.h
18,8 → 18,7
public:
Bike(QTcpSocket *sock, int i);
void draw(QPainter *painter);
void run(QList<Bike *> bikes);
bool hasCollided();
void run(QList<Bike *> bikes);
void reset();
bool isReady;
bool dead;
32,9 → 31,8
QList<QPoint> linePoints;
int id;
bool isDisconnected;
bool hasHadGo;
QColor colour;
bool collided;
bool hasHadGo;
QColor colour;
 
private:
QTcpSocket *socket;