calculate tower angle

switch autocontrol for splashes
This commit is contained in:
root
2010-08-30 16:40:40 +04:00
parent 13f8040f4e
commit 3e6460abd4
5 changed files with 272 additions and 141 deletions

View File

@@ -72,6 +72,7 @@ void AD_Graphics::drawBackground(QPainter * p, const QRectF & )
p->drawRect(i*cellSize,j*cellSize,cellSize,cellSize); p->drawRect(i*cellSize,j*cellSize,cellSize,cellSize);
} }
} }
qDebug() << "t:" << data->curTowers.size();
for (QHash<QPoint, TowerType>::iterator i = data->curTowers.begin(); i != data->curTowers.end(); ++i) { for (QHash<QPoint, TowerType>::iterator i = data->curTowers.begin(); i != data->curTowers.end(); ++i) {
//qDebug() << "draw alien"; //qDebug() << "draw alien";
//p->rotate(-90); //p->rotate(-90);
@@ -80,7 +81,7 @@ void AD_Graphics::drawBackground(QPainter * p, const QRectF & )
//p->rotate(-90); //p->rotate(-90);
//p->translate(-rec.height()/2, -rec.width()/2); //p->translate(-rec.height()/2, -rec.width()/2);
QBrush brush; QBrush brush;
brush.setColor(Qt::darkGreen); brush.setColor(Qt::darkRed);
brush.setStyle(Qt::DiagCrossPattern); brush.setStyle(Qt::DiagCrossPattern);
p->translate((*i).pos * cellSize+QPointF(10,10)); p->translate((*i).pos * cellSize+QPointF(10,10));
p->rotate((*i).angle); p->rotate((*i).angle);
@@ -89,6 +90,7 @@ void AD_Graphics::drawBackground(QPainter * p, const QRectF & )
p->drawRect(QRect(-10,-10,20,20)); p->drawRect(QRect(-10,-10,20,20));
p->resetTransform(); p->resetTransform();
} }
qDebug() << "a:" << data->curAliens.size();
for (QHash<int, AlienType>::iterator i = data->curAliens.begin(); i != data->curAliens.end(); ++i) { for (QHash<int, AlienType>::iterator i = data->curAliens.begin(); i != data->curAliens.end(); ++i) {
//qDebug() << "draw alien"; //qDebug() << "draw alien";
//p->rotate(-90); //p->rotate(-90);
@@ -101,6 +103,7 @@ void AD_Graphics::drawBackground(QPainter * p, const QRectF & )
p->drawImage(QRect(-20,-20,40,40), images[itAliens][0]->at(0)); p->drawImage(QRect(-20,-20,40,40), images[itAliens][0]->at(0));
p->resetTransform(); p->resetTransform();
} }
qDebug() << "s:" << data->curSplashes.size();
for (QHash<int, SplashType>::iterator i = data->curSplashes.begin(); i != data->curSplashes.end(); ++i) { for (QHash<int, SplashType>::iterator i = data->curSplashes.begin(); i != data->curSplashes.end(); ++i) {
//qDebug() << "draw alien"; //qDebug() << "draw alien";
//p->rotate(-90); //p->rotate(-90);

View File

@@ -1,113 +1,241 @@
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>RunConfiguration0-BaseEnvironmentBase</variable>
<value type="int">2</value>
</data>
<data>
<variable>RunConfiguration0-CommandLineArguments</variable>
<valuelist type="QVariantList"/>
</data>
<data>
<variable>RunConfiguration0-ProFile</variable>
<value type="QString">aliendefender.pro</value>
</data>
<data>
<variable>RunConfiguration0-RunConfiguration.name</variable>
<value type="QString">aliendefender</value>
</data>
<data>
<variable>RunConfiguration0-UseDyldImageSuffix</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UseTerminal</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserEnvironmentChanges</variable>
<valuelist type="QVariantList"/>
</data>
<data>
<variable>RunConfiguration0-UserSetName</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserSetWorkingDirectory</variable>
<value type="bool">false</value>
</data>
<data>
<variable>RunConfiguration0-UserWorkingDirectory</variable>
<value type="QString"></value>
</data>
<data>
<variable>RunConfiguration0-type</variable>
<value type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
</data>
<data>
<variable>activeRunConfiguration</variable>
<value type="int">0</value> <value type="int">0</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.EditorSettings</variable> <variable>activebuildconfiguration</variable>
<value type="QString">Debug</value>
</data>
<data>
<variable>buildConfiguration-Debug</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="EditorConfiguration.Codec" type="QByteArray">System</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<value key="QtVersionId" type="int">0</value>
<value key="ToolChain" type="int">0</value>
<value key="buildConfiguration" type="int">2</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.Target.0</variable> <variable>buildConfiguration-Release</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Настольный компьютер</value> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value> <value key="QtVersionId" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value> <value key="buildConfiguration" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
<valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Отладка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/build-AD</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
<valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Релиз</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">C:/Users/Andrey/Desktop/aliendefender-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">9</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">aliendefender</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">aliendefender.pro</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">true</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString">C:\Users\Andrey\Desktop\aliendefender</value>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.TargetCount</variable> <variable>buildconfiguration-Debug-buildstep0</variable>
<value type="int">1</value> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wExeabp7q4,guid=18815993df3603fdc64a3f6d4c7b5822</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=gnome</value>
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-4vN5uf</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
<value type="QString">LOGNAME=andrey</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-andrey</value>
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1239</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-4vN5uf/ssh</value>
<value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-x9URui/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1283151906.338331-318132279</value>
</valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">/home/andrey/AD/aliendefender/aliendefender.pro</value>
<value type="QString">-spec</value>
<value type="QString">linux-g++</value>
<value type="QString">-r</value>
<value type="QString">CONFIG+=debug</value>
</valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value>
<value key="abstractProcess.enabled" type="bool">false</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/andrey/AD/aliendefender</value>
</valuemap>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable> <variable>buildconfiguration-Debug-buildstep1</variable>
<value type="int">4</value> <valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-wExeabp7q4,guid=18815993df3603fdc64a3f6d4c7b5822</value>
<value type="QString">DEFAULTS_PATH=/usr/share/gconf/gnome.default.path</value>
<value type="QString">DESKTOP_SESSION=gnome</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=gnome</value>
<value type="QString">GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString">GDM_LANG=ru_RU.UTF-8</value>
<value type="QString">GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-4vN5uf</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/home/andrey</value>
<value type="QString">LANG=ru_RU.UTF-8</value>
<value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
<value type="QString">LOGNAME=andrey</value>
<value type="QString">MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path</value>
<value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-andrey</value>
<value type="QString">PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString">PWD=/home/andrey</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SPEECHD_PORT=6561</value>
<value type="QString">SSH_AGENT_PID=1239</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/keyring-4vN5uf/ssh</value>
<value type="QString">USER=andrey</value>
<value type="QString">USERNAME=andrey</value>
<value type="QString">XAUTHORITY=/var/run/gdm/auth-for-andrey-x9URui/database</value>
<value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg</value>
<value type="QString">XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString">XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1283151906.338331-318132279</value>
</valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>
<valuelist key="abstractProcess.arguments" type="QVariantList">
<value type="QString">-w</value>
</valuelist>
<value key="abstractProcess.command" type="QString">/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool">true</value>
<value key="abstractProcess.workingDirectory" type="QString">/home/andrey/AD/aliendefender</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Debug-cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<value key="cleanConfig" type="bool">true</value>
<valuelist key="makeargs" type="QVariantList">
<value type="QString">clean</value>
</valuelist>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-buildstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-buildstep1</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data>
<variable>buildconfiguration-Release-cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
</valuemap>
</data>
<data>
<variable>buildconfigurations</variable>
<valuelist type="QVariantList">
<value type="QString">Debug</value>
<value type="QString">Release</value>
</valuelist>
</data>
<data>
<variable>buildstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
<value key="mkspec" type="QString"></value>
</valuemap>
</data>
<data>
<variable>buildstep1</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
</valuemap>
</data>
<data>
<variable>buildsteps</variable>
<valuelist type="QVariantList">
<value type="QString">trolltech.qt4projectmanager.qmake</value>
<value type="QString">trolltech.qt4projectmanager.make</value>
</valuelist>
</data>
<data>
<variable>cleanstep0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value>
<value key="clean" type="bool">true</value>
</valuemap>
</data>
<data>
<variable>cleansteps</variable>
<valuelist type="QVariantList">
<value type="QString">trolltech.qt4projectmanager.make</value>
</valuelist>
</data>
<data>
<variable>defaultFileEncoding</variable>
<value type="QByteArray">System</value>
</data>
<data>
<variable>project</variable>
<valuemap type="QVariantMap"/>
</data> </data>
</qtcreator> </qtcreator>

View File

@@ -2,9 +2,9 @@
<ADdata> <ADdata>
<aliens> <aliens>
<alien flying="true" speed="0.3" imageType="31" prise="15" id="2" score="12" name="Monstr" health="150"/> <alien flying="true" speed="0.3" imageType="31" prise="15" id="2" score="12" name="Monstr" health="150"/>
<alien flying="true" speed="0.15" imageType="-1078580008" prise="1" id="4" score="10" name="test" health="60"/> <alien flying="true" speed="0.05" imageType="-1078580008" prise="1" id="4" score="10" name="test" health="60"/>
<alien speed="0.21" imageType="1" prise="4" id="10" score="99" name="first" health="100"/> <alien speed="0.2" imageType="1" prise="4" id="10" score="99" name="first" health="100"/>
<alien regeneration="3" speed="0.5" imageType="1" prise="10" armor="1.5" id="12" score="99" name="MONSTR" health="100"/> <alien regeneration="3" speed="0.15" imageType="1" prise="10" armor="1.5" id="12" score="99" name="MONSTR" health="100"/>
</aliens> </aliens>
<maps> <maps>
<map width="16" imageType="1" height="16" id="1" data="AAAERHicY2BgEGAA4v///0hQgmFmAGlGcjCxZuCTHzUDuxkMDOr85JrBwKC0A8kMJlwYagYOeYgZ+NXgNwMtPEbNINIMIsynOO8DAG0r1Q0=" name="My Map" maxPlayers="2"/> <map width="16" imageType="1" height="16" id="1" data="AAAERHicY2BgEGAA4v///0hQgmFmAGlGcjCxZuCTHzUDuxkMDOr85JrBwKC0A8kMJlwYagYOeYgZ+NXgNwMtPEbNINIMIsynOO8DAG0r1Q0=" name="My Map" maxPlayers="2"/>
@@ -12,11 +12,11 @@
</maps> </maps>
<waves> <waves>
<wave prise="100" timeout="10" id="1"/> <wave prise="100" timeout="10" id="1"/>
<wave prise="200" timeout="5" id="2"/> <wave prise="200" timeout="10" id="2"/>
<wave prise="220" timeout="5" id="3"/> <wave prise="220" timeout="20" id="3"/>
<wave prise="220" timeout="2" id="4"/> <wave prise="220" timeout="5" id="4"/>
<wave prise="220" timeout="1" id="5"/> <wave prise="220" timeout="2" id="5"/>
<wave prise="220" timeout="10" id="6"/> <wave prise="220" timeout="20" id="6"/>
<wave prise="220" timeout="1" id="7"/> <wave prise="220" timeout="1" id="7"/>
<wave prise="220" timeout="1" id="8"/> <wave prise="220" timeout="1" id="8"/>
<wave prise="220" timeout="1" id="9"/> <wave prise="220" timeout="1" id="9"/>
@@ -28,7 +28,7 @@
</levels> </levels>
<waveParts> <waveParts>
<wavePart alien="10" count="10" wave="1"/> <wavePart alien="10" count="10" wave="1"/>
<wavePart alien="10" count="9" wave="2"/> <wavePart alien="12" count="5" wave="2"/>
<wavePart alien="10" count="1" wave="3"/> <wavePart alien="10" count="1" wave="3"/>
<wavePart alien="10" count="2" wave="3"/> <wavePart alien="10" count="2" wave="3"/>
<wavePart alien="12" count="3" wave="3"/> <wavePart alien="12" count="3" wave="3"/>
@@ -60,16 +60,16 @@
<waveOnLevel wave="6" level="1"/> <waveOnLevel wave="6" level="1"/>
</wavesOnLevels> </wavesOnLevels>
<splashes> <splashes>
<splash speed="0.2" imageType="1" lifetime="9999" id="1" name="rocket"/> <splash speed="0.5" imageType="1" lifetime="9999" id="1" name="rocket"/>
<splash speed="0.3" imageType="1" lifetime="9999" autoControl="true" id="2" name="smart rocket"/> <splash speed="0.3" imageType="1" lifetime="9999" autoControl="true" id="2" name="smart rocket"/>
<splash speed="0.8" imageType="2" lifetime="100" autoControl="true" id="3" name="bullet"/> <splash speed="1" imageType="2" lifetime="4" id="3" name="bullet"/>
<splash speed="1" imageType="3" lifetime="10" id="4" name="bum"/> <splash speed="1" imageType="3" lifetime="10" id="4" name="bum"/>
<splash speed="0" imageType="4" lifetime="10" id="5" name="smoke"/> <splash speed="0" imageType="4" lifetime="10" id="5" name="smoke"/>
</splashes> </splashes>
<towers> <towers>
<tower imageType="1" radius="10" expByKill="0.1" expByShot="0.15" buildTime="50" splash="1" reload="20" id="1" name="rocket launcher" cost="30" expByDamage="0.04"/> <tower imageType="1" radius="2" expByKill="0.1" expByShot="0.15" buildTime="25" splash="1" reload="30" id="1" name="rocket launcher" cost="30" expByDamage="0.04"/>
<tower imageType="2" radius="5" expByKill="0.2" expByShot="0.1" buildTime="25" splash="3" reload="5" id="2" name="gun" cost="10" expByDamage="0.1"/> <tower imageType="2" radius="5" expByKill="0.2" expByShot="0.1" buildTime="50" splash="3" reload="5" id="2" name="gun" cost="10" expByDamage="0.1"/>
<tower imageType="1" radius="10" expByKill="0.1" expByShot="0.15" buildTime="50" splash="2" reload="5" id="3" name="rocket launcher 2" cost="30" expByDamage="0.04"/> <tower imageType="1" radius="10" expByKill="0.1" expByShot="0.15" buildTime="100" splash="2" reload="10" id="3" name="rocket launcher 2" cost="30" expByDamage="0.04"/>
</towers> </towers>
<triggers> <triggers>
<trigger damage="5" childAim="noAim" delParent="true" type="onDestination" id="2" name="shot"/> <trigger damage="5" childAim="noAim" delParent="true" type="onDestination" id="2" name="shot"/>

View File

@@ -58,7 +58,7 @@ void Splashes::addSplash(srcSplashType src, int index, TowerType tw)
spl.AlienId = tw.aim; spl.AlienId = tw.aim;
else else
spl.AlienId = -1; spl.AlienId = -1;
spl.angle = tw.angle; spl.angle = tw.angle; // FIXME: tower not rotate
spl.pos = tw.pos; // FIXME: pos not in center or left-angle of tower spl.pos = tw.pos; // FIXME: pos not in center or left-angle of tower
spl.imgType = src.imgType; spl.imgType = src.imgType;
spl.life = 0; spl.life = 0;
@@ -80,7 +80,7 @@ void Splashes::update()
QList <int> deadIndexes; QList <int> deadIndexes;
for (int i=0; i<gameData->curSplashes.size(); i++) for (int i=0; i<gameData->curSplashes.size(); i++)
{ {
int curDead = -1; //int curDead = -1;
float arctg,angl; float arctg,angl;
SplashType spl = gameData->curSplashes.values().at(i); SplashType spl = gameData->curSplashes.values().at(i);
//bool isTowerSplash = false; //bool isTowerSplash = false;
@@ -90,46 +90,39 @@ void Splashes::update()
src = gameData->players.at(tw.PlayerId)->srcTowers.at(tw.src).splashes.at(spl.src); src = gameData->players.at(tw.PlayerId)->srcTowers.at(tw.src).splashes.at(spl.src);
spl.life++; spl.life++;
if (spl.life > src.lifetime) if (spl.life > src.lifetime)
{
deadIndexes.append(spl.id); deadIndexes.append(spl.id);
curDead = spl.id;
}
//isTowerSplash = true; //isTowerSplash = true;
//if (!isTowerSplash) //if (!isTowerSplash)
// src = gameData->srcSplashes.at(spl.src); // src = gameData->srcSplashes.at(spl.src);
if (distance2(spl.pos, spl.destination) < src.speed*src.speed)
{
deadIndexes.push_back(spl.id);
curDead = spl.id;
}
if (curDead < 0)
{
if (src.autoControl) if (src.autoControl)
{ {
if (distance2(spl.pos, spl.destination) < src.speed*src.speed)
deadIndexes.push_back(spl.id);
if (gameData->curAliens.contains(spl.AlienId)) if (gameData->curAliens.contains(spl.AlienId))
spl.destination = gameData->curAliens.value(spl.AlienId).pos; spl.destination = gameData->curAliens.value(spl.AlienId).pos;
arctg = std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y());
//if (tmpdy < 0) arctg=arctg+M_PI;
angl = 180.0f*(-arctg)/M_PI;
spl.angle = angl;
spl.pos.setX(spl.pos.x()
-src.speed*std::sin(arctg));
spl.pos.setY(spl.pos.y()
-src.speed*std::cos(arctg));
} else {
if (!gameData->map->rect().contains(spl.pos.toPoint()))
deadIndexes.push_back(spl.id);
spl.pos.setX(spl.pos.x()
-src.speed*std::sin(-spl.angle*M_PI/180.f));
spl.pos.setY(spl.pos.y()
-src.speed*std::cos(-spl.angle*M_PI/180.f));
} }
arctg = std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y());
//if (tmpdy < 0) arctg=arctg+M_PI;
angl = 180.0f*(-arctg)/M_PI;
spl.angle = angl;
spl.pos.setX(spl.pos.x()
-src.speed*std::sin(arctg));
spl.pos.setY(spl.pos.y()
-src.speed*std::cos(arctg));
}
// TODO: smooth splash rotate // TODO: smooth splash rotate
// TODO: activate trigger and more... // TODO: activate trigger and more...
gameData->curSplashes.insert(spl.id,spl); gameData->curSplashes.insert(spl.id,spl);
} }
for (int j=0; j<deadIndexes.size(); j++) for (int j=0; j<deadIndexes.size(); j++)
//delAlien(missIndex.at(j));
delSplash(deadIndexes.at(j)); delSplash(deadIndexes.at(j));
} }

View File

@@ -57,7 +57,7 @@ void Towers::update()
if ((*i).build < stw.buildTime) if ((*i).build < stw.buildTime)
{ {
(*i).build++; (*i).build++;
qDebug() << "building tower ..." << (*i).build; //qDebug() << "building tower ..." << (*i).build;
} else { } else {
if (!(gameData->curAliens.contains((*i).aim))) if (!(gameData->curAliens.contains((*i).aim)))
(*i).aim = -1; (*i).aim = -1;
@@ -81,6 +81,13 @@ void Towers::update()
//else (*i).aim = -1; //else (*i).aim = -1;
} }
} }
// TODO: calculate tower angl
if ((*i).aim > 0)
{
float arctg = std::atan2((*i).pos.x() - gameData->curAliens.value((*i).aim).pos.x(),(*i).pos.y() - gameData->curAliens.value((*i).aim).pos.y());
//if (tmpdy < 0) arctg=arctg+M_PI;
(*i).angle = 180.0f*(-arctg)/M_PI;
}
// TODO: smooth rotate tower to aim // TODO: smooth rotate tower to aim
if ((*i).reload < stw.reload) if ((*i).reload < stw.reload)
(*i).reload++; (*i).reload++;
@@ -90,10 +97,10 @@ void Towers::update()
{ {
(*i).reload = 0; (*i).reload = 0;
emit shot(stw.splashes.at(0), 0, (*i)); emit shot(stw.splashes.at(0), 0, (*i));
qDebug("shot!"); //qDebug("shot!");
} }
} }
} }
qDebug() << "aim=" << (*i).aim; //qDebug() << "aim=" << (*i).aim;
} }
} }