diff --git a/Makefile b/Makefile index 13ec6e7..7d76f8d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: aliendefender -# Generated by qmake (2.01a) (Qt 4.6.2) on: ?? ???? 29 09:41:29 2010 +# Generated by qmake (2.01a) (Qt 4.6.2) on: ?? ???? 30 01:35:39 2010 # Project: aliendefender.pro # Template: app # Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro diff --git a/adcore.cpp b/adcore.cpp index 98a94af..557afea 100644 --- a/adcore.cpp +++ b/adcore.cpp @@ -19,6 +19,8 @@ adCore::adCore(QObject *parent) : adaliens->AddAlien(0); for (int i=0; imapsize.width(),admap->mapsize.height()); i++) adtowers->AddTower(0,0,QPoint(i,i)); + for (int i=0; imapsize.height();i++) + adtowers->AddTower(1,0,QPoint(admap->mapsize.width()-2,i)); } diff --git a/aliens.cpp b/aliens.cpp index 3201228..1b32dde 100644 --- a/aliens.cpp +++ b/aliens.cpp @@ -36,6 +36,7 @@ void Aliens::AddAlien(int srcId) void Aliens::retrace(bool *OK) { qDebug("retarce!"); + gameData->map->removeAliensPath(); for (int i=0; icurAliens.size(); i++) { Alien al = gameData->curAliens.at(i); @@ -73,10 +74,10 @@ void Aliens::update() for (int i=0; icurAliens.size(); i++) { Alien al = gameData->curAliens.at(i); - qDebug() << i; + //qDebug() << i; //if (al.health < 0) emit AlienKill(); float tmpdx,tmpdy,angl,arctg = 0; - qDebug() << "path index" << al.pathIndex; + qDebug() <<"alien"<< i << " path index" << al.pathIndex << " pos" << al.pos; tmpdx = al.pos.x() - al.path.at(al.pathIndex).x(); tmpdy = al.pos.y() - al.path.at(al.pathIndex).y(); while (std::sqrt(tmpdx*tmpdx +tmpdy*tmpdy) < 2*al.speed) diff --git a/map.conf b/map.conf index 4544e54..d96209b 100644 --- a/map.conf +++ b/map.conf @@ -1,3 +1,3 @@ -cells path = example16x12.map +cells path = example16x16.map max players = 2 diff --git a/map.cpp b/map.cpp index 0428110..92ead4a 100644 --- a/map.cpp +++ b/map.cpp @@ -46,6 +46,17 @@ void Map::printMap() } +void Map::removeAliensPath() +{ + for (int i=0; i 1000 && Cells[i][j] < 2000) Cells[i][j]=Cells[i][j]-1000; + } + } +} + bool Map::addTowerOnMap(int playerId, QPoint pos) { if (playerId < 0 || playerId > maxPlayers) return false; @@ -237,8 +248,8 @@ int Map::WaveTrace(QPoint start, QPoint finish) } step++; } - //qDebug() << "trace false"; - qDebug() << TmpCells; + qDebug() << "trace false"; + //qDebug() << TmpCells; return -1; } diff --git a/map.h b/map.h index 143eb6d..876b445 100644 --- a/map.h +++ b/map.h @@ -47,6 +47,7 @@ public: int Id() const {return mapId;} bool addTowerOnMap(int playerId, QPoint pos); void delTowerOnMap(QPoint pos); + void removeAliensPath(); QVector CreatePath(QPoint start, QPoint finish); QSize size() const {return mapsize;} void ReadSettings();