fixed some bugs (clear path on map, ASCII game print;-)
This commit is contained in:
2
Makefile
2
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
|
||||
|
||||
@@ -19,6 +19,8 @@ adCore::adCore(QObject *parent) :
|
||||
adaliens->AddAlien(0);
|
||||
for (int i=0; i<qMin(admap->mapsize.width(),admap->mapsize.height()); i++)
|
||||
adtowers->AddTower(0,0,QPoint(i,i));
|
||||
for (int i=0; i<admap->mapsize.height();i++)
|
||||
adtowers->AddTower(1,0,QPoint(admap->mapsize.width()-2,i));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ void Aliens::AddAlien(int srcId)
|
||||
void Aliens::retrace(bool *OK)
|
||||
{
|
||||
qDebug("retarce!");
|
||||
gameData->map->removeAliensPath();
|
||||
for (int i=0; i<gameData->curAliens.size(); i++)
|
||||
{
|
||||
Alien al = gameData->curAliens.at(i);
|
||||
@@ -73,10 +74,10 @@ void Aliens::update()
|
||||
for (int i=0; i<gameData->curAliens.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)
|
||||
|
||||
2
map.conf
2
map.conf
@@ -1,3 +1,3 @@
|
||||
cells path = example16x12.map
|
||||
cells path = example16x16.map
|
||||
max players = 2
|
||||
|
||||
|
||||
15
map.cpp
15
map.cpp
@@ -46,6 +46,17 @@ void Map::printMap()
|
||||
}
|
||||
|
||||
|
||||
void Map::removeAliensPath()
|
||||
{
|
||||
for (int i=0; i<Cells.size(); i++)
|
||||
{
|
||||
for (int j=0; j<Cells[i].size(); j++)
|
||||
{
|
||||
if (Cells[i][j] > 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user