fix bug in del tower and some ui changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by Qt Creator 2.2.84, 2011-08-21T21:34:49. -->
|
<!-- Written by Qt Creator 2.2.84, 2011-08-27T23:06:35. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
|||||||
@@ -181,3 +181,13 @@ void AD_Graphics::mouseMoveEvent(QMouseEvent *event)
|
|||||||
focus_item = 0;
|
focus_item = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AD_Graphics::alienKilled(int id)
|
||||||
|
{
|
||||||
|
if (select_al != 0) if (select_al->id() == id) select_al = 0;
|
||||||
|
QPainter p(mapimg);
|
||||||
|
p.translate((core->addata->aliens->curAliens[id].pos+QPointF(0.5,0.5))*cellSize);
|
||||||
|
p.drawImage(core->addata->bloodrect, *(core->addata->blood));
|
||||||
|
p.end();
|
||||||
|
resetCachedContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void selectTower(ADItem * item) {select_tow = item;}
|
void selectTower(ADItem * item) {select_tow = item;}
|
||||||
void setBuilding(bool arg) {m_building = arg;}
|
void setBuilding(bool arg) {m_building = arg;}
|
||||||
void alienKilled(int id) {if (select_al != 0) if (select_al->id() == id) select_al = 0;}
|
void alienKilled(int id);
|
||||||
void towerKilled(QPoint id) {if (select_tow != 0) if (select_tow->tid() == id) {select_tow = 0; emit selected_tower_changed(QPoint());}}
|
void towerKilled(QPoint id) {focus_item = 0; if (select_tow != 0) if (select_tow->tid() == id) {select_tow = 0; emit selected_tower_changed(QPoint());}}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawBackground(QPainter * p, const QRectF &);
|
void drawBackground(QPainter * p, const QRectF &);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by Qt Creator 2.2.84, 2011-08-21T21:34:49. -->
|
<!-- Written by Qt Creator 2.2.84, 2011-08-28T15:53:16. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
|||||||
150
data2.xml
150
data2.xml
@@ -3,9 +3,10 @@
|
|||||||
<aliens>
|
<aliens>
|
||||||
<alien speed="0.05" imageType="1" prise="1" id="1" score="12" name="Monstr 1" health="15"/>
|
<alien speed="0.05" imageType="1" prise="1" id="1" score="12" name="Monstr 1" health="15"/>
|
||||||
<alien speed="0.02" imageType="1" prise="100" id="4" score="10" name="test" health="1000"/>
|
<alien speed="0.02" imageType="1" prise="100" id="4" score="10" name="test" health="1000"/>
|
||||||
<alien speed="0.03" imageType="1" prise="4" id="10" score="99" name="first" health="50"/>
|
<alien speed="0.1" imageType="1" prise="2" id="2" score="99" name="monstr 2" health="30"/>
|
||||||
<alien regeneration="3" speed="0.01" imageType="1" prise="10" armor="1.5" id="12" score="99" name="MMMM" health="200"/>
|
<alien speed="0.05" imageType="1" prise="5" id="3" score="99" name="monstr 3" health="100"/>
|
||||||
<alien speed="0.05" imageType="1" prise="10" id="33" score="99" name="Mega Alien" health="888"/>
|
<alien speed="0.15" imageType="1" prise="5" id="5" score="99" name="super monstr" health="200" armor="10"/>
|
||||||
|
<alien speed="0.05" imageType="1" prise="100" id="6" score="10" name="test" health="1000" regeneration="20"/>
|
||||||
</aliens>
|
</aliens>
|
||||||
<maps>
|
<maps>
|
||||||
<map width="16" imageType="10" height="16" id="1" data="AAAERHicY2BgEGAA4v///0hQgmFmAGlGcjCxZuCTHzUDuxkMDOr85JrBwKC0A8kMJlwYagYOeYgZ+NXgNwMtPEbNINIMIsynOO8DAG0r1Q0=" name="My Map" maxPlayers="2"/>
|
<map width="16" imageType="10" height="16" id="1" data="AAAERHicY2BgEGAA4v///0hQgmFmAGlGcjCxZuCTHzUDuxkMDOr85JrBwKC0A8kMJlwYagYOeYgZ+NXgNwMtPEbNINIMIsynOO8DAG0r1Q0=" name="My Map" maxPlayers="2"/>
|
||||||
@@ -17,33 +18,103 @@
|
|||||||
<wave prise="7" timeout="30" id="2"/>
|
<wave prise="7" timeout="30" id="2"/>
|
||||||
<wave prise="10" timeout="30" id="3"/>
|
<wave prise="10" timeout="30" id="3"/>
|
||||||
<wave prise="20" timeout="30" id="4"/>
|
<wave prise="20" timeout="30" id="4"/>
|
||||||
<wave prise="50" timeout="10" id="5"/>
|
<wave prise="20" timeout="10" id="5"/>
|
||||||
<wave prise="100" timeout="20" id="6"/>
|
<wave prise="20" timeout="20" id="6"/>
|
||||||
<wave prise="200" timeout="5" id="7"/>
|
<wave prise="20" timeout="5" id="7"/>
|
||||||
<wave prise="1000" timeout="50" id="8"/>
|
<wave prise="20" timeout="50" id="8"/>
|
||||||
|
<wave prise="20" timeout="10" id="9"/>
|
||||||
|
<wave prise="20" timeout="10" id="10"/>
|
||||||
|
<wave prise="20" timeout="10" id="11"/>
|
||||||
|
<wave prise="20" timeout="10" id="12"/>
|
||||||
|
<wave prise="20" timeout="10" id="13"/>
|
||||||
|
<wave prise="20" timeout="10" id="14"/>
|
||||||
|
<wave prise="20" timeout="10" id="16"/>
|
||||||
|
<wave prise="20" timeout="10" id="17"/>
|
||||||
|
<wave prise="20" timeout="10" id="18"/>
|
||||||
|
<wave prise="20" timeout="10" id="19"/>
|
||||||
|
<wave prise="20" timeout="10" id="20"/>
|
||||||
|
<wave prise="20" timeout="10" id="21"/>
|
||||||
|
<wave prise="20" timeout="10" id="22"/>
|
||||||
|
<wave prise="20" timeout="10" id="23"/>
|
||||||
|
<wave prise="20" timeout="10" id="24"/>
|
||||||
|
<wave prise="20" timeout="10" id="25"/>
|
||||||
|
<wave prise="20" timeout="10" id="26"/>
|
||||||
|
<wave prise="20" timeout="10" id="27"/>
|
||||||
|
<wave prise="20" timeout="3" id="28"/>
|
||||||
|
<wave prise="20" timeout="5" id="29"/>
|
||||||
|
<wave prise="20" timeout="1" id="30"/>
|
||||||
</waves>
|
</waves>
|
||||||
<levels>
|
<levels>
|
||||||
<level map="3" id="1" score="286154272" name="First Level"/>
|
<level map="3" id="1" score="22896048" name="First Level"/>
|
||||||
</levels>
|
</levels>
|
||||||
<waveParts>
|
<waveParts>
|
||||||
<wavePart alien="1" count="1" wave="1"/>
|
<wavePart alien="1" count="1" wave="1"/>
|
||||||
<wavePart alien="1" count="2" wave="2"/>
|
<wavePart alien="1" count="2" wave="2"/>
|
||||||
<wavePart alien="1" count="3" wave="3"/>
|
<wavePart alien="1" count="3" wave="3"/>
|
||||||
<wavePart alien="1" count="5" wave="4"/>
|
<wavePart alien="2" count="3" wave="4"/>
|
||||||
<wavePart alien="1" count="20" wave="5"/>
|
<wavePart alien="1" count="5" wave="5"/>
|
||||||
<wavePart alien="4" count="1" wave="6"/>
|
<wavePart alien="2" count="5" wave="6"/>
|
||||||
<wavePart alien="4" count="10" wave="7"/>
|
<wavePart alien="2" count="10" wave="7"/>
|
||||||
<wavePart alien="4" count="100" wave="8"/>
|
<wavePart alien="1" count="30" wave="8"/>
|
||||||
|
<wavePart alien="4" count="1" wave="9"/>
|
||||||
|
<wavePart alien="3" count="3" wave="10"/>
|
||||||
|
<wavePart alien="3" count="5" wave="11"/>
|
||||||
|
<wavePart alien="3" count="10" wave="12"/>
|
||||||
|
<wavePart alien="3" count="10" wave="13"/>
|
||||||
|
<wavePart alien="2" count="10" wave="13"/>
|
||||||
|
<wavePart alien="4" count="3" wave="14"/>
|
||||||
|
<wavePart alien="3" count="30" wave="15"/>
|
||||||
|
<wavePart alien="3" count="50" wave="16"/>
|
||||||
|
<wavePart alien="4" count="5" wave="17"/>
|
||||||
|
<wavePart alien="4" count="10" wave="18"/>
|
||||||
|
<wavePart alien="4" count="30" wave="19"/>
|
||||||
|
<wavePart alien="5" count="1" wave="20"/>
|
||||||
|
<wavePart alien="4" count="50" wave="21"/>
|
||||||
|
<wavePart alien="5" count="3" wave="22"/>
|
||||||
|
<wavePart alien="5" count="10" wave="23"/>
|
||||||
|
<wavePart alien="1" count="10" wave="24"/>
|
||||||
|
<wavePart alien="2" count="10" wave="24"/>
|
||||||
|
<wavePart alien="3" count="10" wave="24"/>
|
||||||
|
<wavePart alien="4" count="10" wave="24"/>
|
||||||
|
<wavePart alien="5" count="10" wave="24"/>
|
||||||
|
<wavePart alien="6" count="1" wave="25"/>
|
||||||
|
<wavePart alien="6" count="3" wave="26"/>
|
||||||
|
<wavePart alien="6" count="10" wave="27"/>
|
||||||
|
<wavePart alien="5" count="300" wave="28"/>
|
||||||
|
<wavePart alien="6" count="100" wave="29"/>
|
||||||
|
<wavePart alien="6" count="1000" wave="30"/>
|
||||||
</waveParts>
|
</waveParts>
|
||||||
<wavesOnLevels>
|
<wavesOnLevels>
|
||||||
<waveOnLevel wave="8" level="1"/>
|
|
||||||
<waveOnLevel wave="7" level="1"/>
|
|
||||||
<waveOnLevel wave="6" level="1"/>
|
|
||||||
<waveOnLevel wave="5" level="1"/>
|
|
||||||
<waveOnLevel wave="4" level="1"/>
|
|
||||||
<waveOnLevel wave="3" level="1"/>
|
|
||||||
<waveOnLevel wave="2" level="1"/>
|
|
||||||
<waveOnLevel wave="1" level="1"/>
|
<waveOnLevel wave="1" level="1"/>
|
||||||
|
<waveOnLevel wave="2" level="1"/>
|
||||||
|
<waveOnLevel wave="3" level="1"/>
|
||||||
|
<waveOnLevel wave="4" level="1"/>
|
||||||
|
<waveOnLevel wave="5" level="1"/>
|
||||||
|
<waveOnLevel wave="6" level="1"/>
|
||||||
|
<waveOnLevel wave="7" level="1"/>
|
||||||
|
<waveOnLevel wave="8" level="1"/>
|
||||||
|
<waveOnLevel wave="9" level="1"/>
|
||||||
|
<waveOnLevel wave="10" level="1"/>
|
||||||
|
<waveOnLevel wave="11" level="1"/>
|
||||||
|
<waveOnLevel wave="12" level="1"/>
|
||||||
|
<waveOnLevel wave="13" level="1"/>
|
||||||
|
<waveOnLevel wave="14" level="1"/>
|
||||||
|
<waveOnLevel wave="15" level="1"/>
|
||||||
|
<waveOnLevel wave="16" level="1"/>
|
||||||
|
<waveOnLevel wave="17" level="1"/>
|
||||||
|
<waveOnLevel wave="18" level="1"/>
|
||||||
|
<waveOnLevel wave="19" level="1"/>
|
||||||
|
<waveOnLevel wave="20" level="1"/>
|
||||||
|
<waveOnLevel wave="21" level="1"/>
|
||||||
|
<waveOnLevel wave="22" level="1"/>
|
||||||
|
<waveOnLevel wave="23" level="1"/>
|
||||||
|
<waveOnLevel wave="24" level="1"/>
|
||||||
|
<waveOnLevel wave="25" level="1"/>
|
||||||
|
<waveOnLevel wave="26" level="1"/>
|
||||||
|
<waveOnLevel wave="27" level="1"/>
|
||||||
|
<waveOnLevel wave="28" level="1"/>
|
||||||
|
<waveOnLevel wave="29" level="1"/>
|
||||||
|
<waveOnLevel wave="30" level="1"/>
|
||||||
</wavesOnLevels>
|
</wavesOnLevels>
|
||||||
<splashes>
|
<splashes>
|
||||||
<splash speed="0.2" imageType="5" lifetime="9999" ZValue="0" compositionMode="Source" animSpeed="1" id="1" name="rocket"/>
|
<splash speed="0.2" imageType="5" lifetime="9999" ZValue="0" compositionMode="Source" animSpeed="1" id="1" name="rocket"/>
|
||||||
@@ -57,47 +128,48 @@
|
|||||||
<splash speed="0.5" imageType="16" lifetime="100" ZValue="1.4013e-45" autoControl="true" compositionMode="Source" animSpeed="9.30575e-29" id="9" name="burn" keepOnAlien="true"/>
|
<splash speed="0.5" imageType="16" lifetime="100" ZValue="1.4013e-45" autoControl="true" compositionMode="Source" animSpeed="9.30575e-29" id="9" name="burn" keepOnAlien="true"/>
|
||||||
</splashes>
|
</splashes>
|
||||||
<towers>
|
<towers>
|
||||||
<tower imageType="8" radius="12" expByKill="0.1" expByShot="0.15" buildTime="50" splash="2" reload="15" id="1" name="rocket launcher 2" cost="5" expByDamage="0.04"/>
|
<tower imageType="8" radius="12" expByKill="0.1" expByShot="0.15" buildTime="500" splash="2" reload="10" id="1" name="rocket launcher 2" cost="4000" expByDamage="0.04"/>
|
||||||
<tower imageType="2" radius="3" expByKill="0.2" expByShot="0.1" buildTime="25" splash="3" reload="50" id="2" name="tower 1" cost="7" expByDamage="0.1"/>
|
<tower imageType="2" radius="3" expByKill="0.2" expByShot="0.1" buildTime="25" splash="3" reload="50" id="2" name="tower 1" cost="10" expByDamage="0.1"/>
|
||||||
<tower imageType="3" radius="5" expByKill="0.1" expByShot="0.15" buildTime="20" splash="1" reload="50" id="3" name="rocket launcher" cost="3" expByDamage="0.04"/>
|
<tower imageType="3" radius="5" expByKill="0.1" expByShot="0.15" buildTime="200" splash="1" reload="50" id="3" name="rocket launcher" cost="1000" expByDamage="0.04"/>
|
||||||
<tower imageType="12" radius="3" expByKill="0.2" expByShot="0.1" buildTime="25" splash="3" reload="35" id="4" name="tower 1-2" cost="15" expByDamage="0.1"/>
|
<tower imageType="12" radius="3" expByKill="0.2" expByShot="0.1" buildTime="50" splash="3" reload="35" id="4" name="tower 1-2" cost="150" expByDamage="0.1"/>
|
||||||
<tower imageType="13" radius="4" expByKill="0.2" expByShot="0.1" buildTime="25" splash="3" reload="15" id="5" name="tower 1-3" cost="25" expByDamage="0.1"/>
|
<tower imageType="13" radius="4" expByKill="0.2" expByShot="0.1" buildTime="100" splash="3" reload="15" id="5" name="tower 1-3" cost="250" expByDamage="0.1"/>
|
||||||
<tower imageType="14" radius="3" expByKill="0.2" expByShot="0.1" buildTime="20" splash="8" reload="20" id="6" name="firethrower" cost="10" expByDamage="0.1"/>
|
<tower imageType="14" radius="3" expByKill="0.2" expByShot="0.1" buildTime="20" splash="8" reload="20" id="6" name="firethrower" cost="90000" expByDamage="0.1"/>
|
||||||
</towers>
|
</towers>
|
||||||
<triggers>
|
<triggers>
|
||||||
<trigger damage="2" childAim="noAim" radius="2" count="1" type="onAlienInRadius" id="1" name="fire shot"/>
|
<trigger damage="2" childAim="noAim" radius="2" count="1" type="onDestination" id="1" name="fire shot"/>
|
||||||
<trigger damage="5" childAim="noAim" delParent="true" count="1" type="onDestination" id="2" name="shot"/>
|
<trigger damage="5" childAim="noAim" delParent="true" count="1" type="onDestination" id="2" name="shot"/>
|
||||||
<trigger damage="1" childAim="noAim" radius="2.5" delParent="true" count="1" type="onDestination" id="3" name="explosion"/>
|
<trigger damage="25" childAim="noAim" radius="2.5" delParent="true" count="1" type="onDestination" id="3" name="explosion"/>
|
||||||
<trigger childAim="noAim" count="1" type="onTimer" id="4" name="smoke" timer="3"/>
|
<trigger childAim="noAim" count="1" type="onTimer" id="4" name="smoke" timer="3"/>
|
||||||
<trigger damage="20" childAim="noAim" delParent="true" type="onDestination" id="5" name="shot"/>
|
<trigger damage="20" childAim="noAim" delParent="true" type="onDestination" id="5" name="shot"/>
|
||||||
<trigger damage="0.2" childAim="parentAim" type="onTimer" id="6" name="burn" timer="2"/>
|
<trigger damage="0.2" childAim="parentAim" type="onTimer" id="6" name="burn" timer="2"/>
|
||||||
</triggers>
|
</triggers>
|
||||||
<chains>
|
<chains>
|
||||||
<chain tower="1" trigger="3" child="4" parent="2"/>
|
|
||||||
<chain tower="1" trigger="4" child="5" parent="2"/>
|
<chain tower="1" trigger="4" child="5" parent="2"/>
|
||||||
|
<chain tower="1" trigger="3" child="4" parent="2"/>
|
||||||
<chain tower="2" trigger="2" child="7" parent="3"/>
|
<chain tower="2" trigger="2" child="7" parent="3"/>
|
||||||
<chain tower="3" trigger="3" child="4" parent="1"/>
|
|
||||||
<chain tower="3" trigger="4" child="5" parent="1"/>
|
<chain tower="3" trigger="4" child="5" parent="1"/>
|
||||||
|
<chain tower="3" trigger="3" child="4" parent="1"/>
|
||||||
<chain tower="4" trigger="2" child="7" parent="3"/>
|
<chain tower="4" trigger="2" child="7" parent="3"/>
|
||||||
<chain tower="5" trigger="5" parent="3"/>
|
<chain tower="5" trigger="5" parent="3"/>
|
||||||
<chain tower="6" trigger="6" parent="9"/>
|
|
||||||
<chain tower="6" trigger="1" child="9" parent="8"/>
|
<chain tower="6" trigger="1" child="9" parent="8"/>
|
||||||
|
<chain tower="6" trigger="6" parent="9"/>
|
||||||
</chains>
|
</chains>
|
||||||
<towersOnLevels>
|
<towersOnLevels>
|
||||||
<towerOnLevel tower="6" level="1"/>
|
|
||||||
<towerOnLevel tower="5" level="1"/>
|
|
||||||
<towerOnLevel tower="4" level="1"/>
|
|
||||||
<towerOnLevel tower="3" level="1"/>
|
|
||||||
<towerOnLevel tower="2" level="1"/>
|
|
||||||
<towerOnLevel tower="1" level="1"/>
|
<towerOnLevel tower="1" level="1"/>
|
||||||
|
<towerOnLevel tower="2" level="1"/>
|
||||||
|
<towerOnLevel tower="3" level="1"/>
|
||||||
|
<towerOnLevel tower="4" level="1"/>
|
||||||
|
<towerOnLevel tower="5" level="1"/>
|
||||||
|
<towerOnLevel tower="6" level="1"/>
|
||||||
</towersOnLevels>
|
</towersOnLevels>
|
||||||
<morphs>
|
<morphs>
|
||||||
<morph from="2" expRequired="0" to="4" cost="10"/>
|
<morph from="2" expRequired="0" to="4" cost="10"/>
|
||||||
<morph from="4" expRequired="0.5" to="5" cost="40"/>
|
<morph from="4" expRequired="0.5" to="5" cost="40"/>
|
||||||
<morph from="5" expRequired="10" to="3" cost="100"/>
|
<morph from="3" expRequired="10" to="1" cost="500"/>
|
||||||
<morph from="5" expRequired="10" to="1" cost="200"/>
|
<morph from="5" expRequired="10" to="3" cost="150"/>
|
||||||
</morphs>
|
</morphs>
|
||||||
<animations>
|
<animations>
|
||||||
|
<animation pathes="images/Splashes/Blood.png" id="17" name="blood"/>
|
||||||
<animation pathes="images/Aliens/Al_00_0.png;images/Aliens/Al_00_1.png;images/Aliens/Al_00_2.png;images/Aliens/Al_00_3.png;images/Aliens/Al_00_4.png;images/Aliens/Al_00_5.png;images/Aliens/Al_00_6.png;images/Aliens/Al_00_7.png;images/Aliens/Al_00_8.png;images/Aliens/Al_00_9.png;images/Aliens/Al_00_10.png;images/Aliens/Al_00_11.png;images/Aliens/Al_00_12.png;images/Aliens/Al_00_13.png;images/Aliens/Al_00_14.png;images/Aliens/Al_00_15.png;images/Aliens/Al_00_16.png;images/Aliens/Al_00_17.png;images/Aliens/Al_00_18.png;images/Aliens/Al_00_19.png" id="1" name="alien"/>
|
<animation pathes="images/Aliens/Al_00_0.png;images/Aliens/Al_00_1.png;images/Aliens/Al_00_2.png;images/Aliens/Al_00_3.png;images/Aliens/Al_00_4.png;images/Aliens/Al_00_5.png;images/Aliens/Al_00_6.png;images/Aliens/Al_00_7.png;images/Aliens/Al_00_8.png;images/Aliens/Al_00_9.png;images/Aliens/Al_00_10.png;images/Aliens/Al_00_11.png;images/Aliens/Al_00_12.png;images/Aliens/Al_00_13.png;images/Aliens/Al_00_14.png;images/Aliens/Al_00_15.png;images/Aliens/Al_00_16.png;images/Aliens/Al_00_17.png;images/Aliens/Al_00_18.png;images/Aliens/Al_00_19.png" id="1" name="alien"/>
|
||||||
<animation pathes="images/Towers/00_0.png" id="2" name="tower 1"/>
|
<animation pathes="images/Towers/00_0.png" id="2" name="tower 1"/>
|
||||||
<animation pathes="images/Towers/01_0.png" id="3" name="rocket tower 1"/>
|
<animation pathes="images/Towers/01_0.png" id="3" name="rocket tower 1"/>
|
||||||
@@ -106,7 +178,7 @@
|
|||||||
<animation pathes="images/Splashes/smoke_0001.png;images/Splashes/smoke_0002.png;images/Splashes/smoke_0003.png;images/Splashes/smoke_0004.png;images/Splashes/smoke_0005.png;images/Splashes/smoke_0006.png;images/Splashes/smoke_0007.png;images/Splashes/smoke_0008.png;images/Splashes/smoke_0009.png;images/Splashes/smoke_0010.png;images/Splashes/smoke_0011.png;images/Splashes/smoke_0012.png;images/Splashes/smoke_0013.png;images/Splashes/smoke_0014.png;images/Splashes/smoke_0015.png;images/Splashes/smoke_0016.png;images/Splashes/smoke_0017.png;images/Splashes/smoke_0018.png;images/Splashes/smoke_0019.png;images/Splashes/smoke_0020.png;images/Splashes/smoke_0021.png;images/Splashes/smoke_0022.png;images/Splashes/smoke_0023.png;images/Splashes/smoke_0024.png;images/Splashes/smoke_0025.png;images/Splashes/smoke_0026.png;images/Splashes/smoke_0027.png;images/Splashes/smoke_0028.png;images/Splashes/smoke_0029.png" id="6" name="smoke"/>
|
<animation pathes="images/Splashes/smoke_0001.png;images/Splashes/smoke_0002.png;images/Splashes/smoke_0003.png;images/Splashes/smoke_0004.png;images/Splashes/smoke_0005.png;images/Splashes/smoke_0006.png;images/Splashes/smoke_0007.png;images/Splashes/smoke_0008.png;images/Splashes/smoke_0009.png;images/Splashes/smoke_0010.png;images/Splashes/smoke_0011.png;images/Splashes/smoke_0012.png;images/Splashes/smoke_0013.png;images/Splashes/smoke_0014.png;images/Splashes/smoke_0015.png;images/Splashes/smoke_0016.png;images/Splashes/smoke_0017.png;images/Splashes/smoke_0018.png;images/Splashes/smoke_0019.png;images/Splashes/smoke_0020.png;images/Splashes/smoke_0021.png;images/Splashes/smoke_0022.png;images/Splashes/smoke_0023.png;images/Splashes/smoke_0024.png;images/Splashes/smoke_0025.png;images/Splashes/smoke_0026.png;images/Splashes/smoke_0027.png;images/Splashes/smoke_0028.png;images/Splashes/smoke_0029.png" id="6" name="smoke"/>
|
||||||
<animation pathes="images/Splashes/Shot_0.png" id="7" name="shot"/>
|
<animation pathes="images/Splashes/Shot_0.png" id="7" name="shot"/>
|
||||||
<animation pathes="images/Towers/01_6.png" id="8" name="rocket tower 2"/>
|
<animation pathes="images/Towers/01_6.png" id="8" name="rocket tower 2"/>
|
||||||
<animation pathes="images/Splashes/expl_blood_00.png;images/Splashes/expl_blood_01.png;images/Splashes/expl_blood_02.png;images/Splashes/expl_blood_03.png;images/Splashes/expl_blood_04.png;images/Splashes/expl_blood_05.png;images/Splashes/expl_blood_06.png;images/Splashes/expl_blood_07.png;images/Splashes/expl_blood_08.png;images/Splashes/expl_blood_09.png" id="9" name="blood"/>
|
<animation pathes="images/Splashes/expl_blood_00.png;images/Splashes/expl_blood_01.png;images/Splashes/expl_blood_02.png;images/Splashes/expl_blood_03.png;images/Splashes/expl_blood_04.png;images/Splashes/expl_blood_05.png;images/Splashes/expl_blood_06.png;images/Splashes/expl_blood_07.png;images/Splashes/expl_blood_08.png;images/Splashes/expl_blood_09.png" id="9" name="expl_blood"/>
|
||||||
<animation pathes="images/Interface/select_tower_0000.png;images/Interface/select_tower_0001.png;images/Interface/select_tower_0002.png;images/Interface/select_tower_0003.png;images/Interface/select_tower_0004.png;images/Interface/select_tower_0005.png;images/Interface/select_tower_0006.png;images/Interface/select_tower_0007.png;images/Interface/select_tower_0008.png;images/Interface/select_tower_0009.png;images/Interface/select_tower_0010.png;images/Interface/select_tower_0011.png;images/Interface/select_tower_0012.png;images/Interface/select_tower_0013.png;images/Interface/select_tower_0014.png;images/Interface/select_tower_0015.png;images/Interface/select_tower_0016.png;images/Interface/select_tower_0017.png;images/Interface/select_tower_0018.png;images/Interface/select_tower_0019.png;images/Interface/select_tower_0020.png;images/Interface/select_tower_0021.png;images/Interface/select_tower_0022.png;images/Interface/select_tower_0023.png;images/Interface/select_tower_0024.png;images/Interface/select_tower_0025.png;images/Interface/select_tower_0026.png;images/Interface/select_tower_0027.png;images/Interface/select_tower_0028.png;images/Interface/select_tower_0029.png;images/Interface/select_tower_0030.png;images/Interface/select_tower_0031.png;images/Interface/select_tower_0032.png;images/Interface/select_tower_0033.png;images/Interface/select_tower_0034.png;images/Interface/select_tower_0035.png;images/Interface/select_tower_0036.png;images/Interface/select_tower_0037.png;images/Interface/select_tower_0038.png;images/Interface/select_tower_0039.png;images/Interface/select_tower_0040.png;images/Interface/select_tower_0041.png;images/Interface/select_tower_0042.png;images/Interface/select_tower_0043.png;images/Interface/select_tower_0044.png;images/Interface/select_tower_0045.png;images/Interface/select_tower_0046.png;images/Interface/select_tower_0047.png;images/Interface/select_tower_0048.png;images/Interface/select_tower_0049.png;images/Interface/select_tower_0050.png" id="10" name="tower select"/>
|
<animation pathes="images/Interface/select_tower_0000.png;images/Interface/select_tower_0001.png;images/Interface/select_tower_0002.png;images/Interface/select_tower_0003.png;images/Interface/select_tower_0004.png;images/Interface/select_tower_0005.png;images/Interface/select_tower_0006.png;images/Interface/select_tower_0007.png;images/Interface/select_tower_0008.png;images/Interface/select_tower_0009.png;images/Interface/select_tower_0010.png;images/Interface/select_tower_0011.png;images/Interface/select_tower_0012.png;images/Interface/select_tower_0013.png;images/Interface/select_tower_0014.png;images/Interface/select_tower_0015.png;images/Interface/select_tower_0016.png;images/Interface/select_tower_0017.png;images/Interface/select_tower_0018.png;images/Interface/select_tower_0019.png;images/Interface/select_tower_0020.png;images/Interface/select_tower_0021.png;images/Interface/select_tower_0022.png;images/Interface/select_tower_0023.png;images/Interface/select_tower_0024.png;images/Interface/select_tower_0025.png;images/Interface/select_tower_0026.png;images/Interface/select_tower_0027.png;images/Interface/select_tower_0028.png;images/Interface/select_tower_0029.png;images/Interface/select_tower_0030.png;images/Interface/select_tower_0031.png;images/Interface/select_tower_0032.png;images/Interface/select_tower_0033.png;images/Interface/select_tower_0034.png;images/Interface/select_tower_0035.png;images/Interface/select_tower_0036.png;images/Interface/select_tower_0037.png;images/Interface/select_tower_0038.png;images/Interface/select_tower_0039.png;images/Interface/select_tower_0040.png;images/Interface/select_tower_0041.png;images/Interface/select_tower_0042.png;images/Interface/select_tower_0043.png;images/Interface/select_tower_0044.png;images/Interface/select_tower_0045.png;images/Interface/select_tower_0046.png;images/Interface/select_tower_0047.png;images/Interface/select_tower_0048.png;images/Interface/select_tower_0049.png;images/Interface/select_tower_0050.png" id="10" name="tower select"/>
|
||||||
<animation pathes="images/Interface/select_alien_0000.png;images/Interface/select_alien_0001.png;images/Interface/select_alien_0002.png;images/Interface/select_alien_0003.png;images/Interface/select_alien_0004.png;images/Interface/select_alien_0005.png;images/Interface/select_alien_0006.png;images/Interface/select_alien_0007.png;images/Interface/select_alien_0008.png;images/Interface/select_alien_0009.png;images/Interface/select_alien_0010.png;images/Interface/select_alien_0011.png;images/Interface/select_alien_0012.png;images/Interface/select_alien_0013.png;images/Interface/select_alien_0014.png;images/Interface/select_alien_0015.png;images/Interface/select_alien_0016.png;images/Interface/select_alien_0017.png;images/Interface/select_alien_0018.png;images/Interface/select_alien_0019.png;images/Interface/select_alien_0020.png;images/Interface/select_alien_0021.png;images/Interface/select_alien_0022.png;images/Interface/select_alien_0023.png;images/Interface/select_alien_0024.png;images/Interface/select_alien_0025.png;images/Interface/select_alien_0026.png;images/Interface/select_alien_0027.png;images/Interface/select_alien_0028.png;images/Interface/select_alien_0029.png;images/Interface/select_alien_0030.png;images/Interface/select_alien_0031.png;images/Interface/select_alien_0032.png;images/Interface/select_alien_0033.png;images/Interface/select_alien_0034.png;images/Interface/select_alien_0035.png;images/Interface/select_alien_0036.png;images/Interface/select_alien_0037.png;images/Interface/select_alien_0038.png;images/Interface/select_alien_0039.png;images/Interface/select_alien_0040.png;images/Interface/select_alien_0041.png;images/Interface/select_alien_0042.png;images/Interface/select_alien_0043.png;images/Interface/select_alien_0044.png;images/Interface/select_alien_0045.png;images/Interface/select_alien_0046.png;images/Interface/select_alien_0047.png;images/Interface/select_alien_0048.png;images/Interface/select_alien_0049.png;images/Interface/select_alien_0050.png" id="11" name="alien select"/>
|
<animation pathes="images/Interface/select_alien_0000.png;images/Interface/select_alien_0001.png;images/Interface/select_alien_0002.png;images/Interface/select_alien_0003.png;images/Interface/select_alien_0004.png;images/Interface/select_alien_0005.png;images/Interface/select_alien_0006.png;images/Interface/select_alien_0007.png;images/Interface/select_alien_0008.png;images/Interface/select_alien_0009.png;images/Interface/select_alien_0010.png;images/Interface/select_alien_0011.png;images/Interface/select_alien_0012.png;images/Interface/select_alien_0013.png;images/Interface/select_alien_0014.png;images/Interface/select_alien_0015.png;images/Interface/select_alien_0016.png;images/Interface/select_alien_0017.png;images/Interface/select_alien_0018.png;images/Interface/select_alien_0019.png;images/Interface/select_alien_0020.png;images/Interface/select_alien_0021.png;images/Interface/select_alien_0022.png;images/Interface/select_alien_0023.png;images/Interface/select_alien_0024.png;images/Interface/select_alien_0025.png;images/Interface/select_alien_0026.png;images/Interface/select_alien_0027.png;images/Interface/select_alien_0028.png;images/Interface/select_alien_0029.png;images/Interface/select_alien_0030.png;images/Interface/select_alien_0031.png;images/Interface/select_alien_0032.png;images/Interface/select_alien_0033.png;images/Interface/select_alien_0034.png;images/Interface/select_alien_0035.png;images/Interface/select_alien_0036.png;images/Interface/select_alien_0037.png;images/Interface/select_alien_0038.png;images/Interface/select_alien_0039.png;images/Interface/select_alien_0040.png;images/Interface/select_alien_0041.png;images/Interface/select_alien_0042.png;images/Interface/select_alien_0043.png;images/Interface/select_alien_0044.png;images/Interface/select_alien_0045.png;images/Interface/select_alien_0046.png;images/Interface/select_alien_0047.png;images/Interface/select_alien_0048.png;images/Interface/select_alien_0049.png;images/Interface/select_alien_0050.png" id="11" name="alien select"/>
|
||||||
<animation pathes="images/Towers/00_1.png" id="12" name="tower 1-2"/>
|
<animation pathes="images/Towers/00_1.png" id="12" name="tower 1-2"/>
|
||||||
|
|||||||
39
form.cpp
39
form.cpp
@@ -10,14 +10,24 @@ Form::Form(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
graphics = new AD_Graphics(&core);
|
graphics = new AD_Graphics(&core);
|
||||||
ui->widget->layout()->addWidget(graphics);
|
ui->widget->layout()->addWidget(graphics);
|
||||||
TouchButtFrame * tbf = new TouchButtFrame();
|
tbf = new TouchButtFrame();
|
||||||
tbf->setOrientation(Qt::Vertical);
|
tbf->setOrientation(Qt::Vertical);
|
||||||
morphtbf = new TouchButtFrame();
|
morphtbf = new TouchButtFrame();
|
||||||
morphtbf->setOrientation(Qt::Vertical);
|
morphtbf->setOrientation(Qt::Vertical);
|
||||||
tbf->addButton(tr("delete"));
|
tbf->addButton(tr("delete"));
|
||||||
foreach (srcTowerType i, core.addata->players.at(0)->srcTowers)
|
foreach (srcTowerType i, core.addata->players.at(0)->srcTowers)
|
||||||
{
|
{
|
||||||
tbf->addButton(i.name);
|
QPixmap pix(32,32);
|
||||||
|
pix.fill(Qt::transparent);
|
||||||
|
QPainter p;
|
||||||
|
p.begin(&pix);
|
||||||
|
//p.fillRect(pix.rect(),Qt::transparent);
|
||||||
|
p.setRenderHints(QPainter::SmoothPixmapTransform);
|
||||||
|
p.drawImage(pix.rect(),*(i.image));
|
||||||
|
p.end();
|
||||||
|
cursors.append(pix);
|
||||||
|
tbf->addButton(i.name+tr("\n %1 $").arg(i.cost));
|
||||||
|
tbf->Button(cursors.size())->setIcon(QIcon(pix));
|
||||||
//QPushButton * butt = new QPushButton(i.name);
|
//QPushButton * butt = new QPushButton(i.name);
|
||||||
//towerButtons << butt;
|
//towerButtons << butt;
|
||||||
//butt->setAutoDefault(true);
|
//butt->setAutoDefault(true);
|
||||||
@@ -30,7 +40,7 @@ Form::Form(QWidget *parent) :
|
|||||||
connect(tbf,SIGNAL(click(int)),tbf,SLOT(set_green(int)));
|
connect(tbf,SIGNAL(click(int)),tbf,SLOT(set_green(int)));
|
||||||
connect(morphtbf,SIGNAL(click(int)),this,SLOT(towerMorph(int)));
|
connect(morphtbf,SIGNAL(click(int)),this,SLOT(towerMorph(int)));
|
||||||
connect(graphics,SIGNAL(add_tow(QPoint)),this,SLOT(add_tow(QPoint)));
|
connect(graphics,SIGNAL(add_tow(QPoint)),this,SLOT(add_tow(QPoint)));
|
||||||
connect(core.adtowers,SIGNAL(tower_killed(QPoint)),graphics,SLOT(towerKilled(QPoint)));
|
// connect(core.adtowers,SIGNAL(tower_killed(QPoint)),graphics,SLOT(towerKilled(QPoint)));
|
||||||
connect(core.addata->aliens,SIGNAL(alien_killed(int)),graphics,SLOT(alienKilled(int)));
|
connect(core.addata->aliens,SIGNAL(alien_killed(int)),graphics,SLOT(alienKilled(int)));
|
||||||
connect(graphics,SIGNAL(cancel()),this,SLOT(cancel()));
|
connect(graphics,SIGNAL(cancel()),this,SLOT(cancel()));
|
||||||
connect(graphics,SIGNAL(selected_tower_changed(QPoint)),this,SLOT(selectedTowerChanged(QPoint)));
|
connect(graphics,SIGNAL(selected_tower_changed(QPoint)),this,SLOT(selectedTowerChanged(QPoint)));
|
||||||
@@ -55,7 +65,9 @@ void Form::towerBuild(int index)
|
|||||||
buildTowerId = index-1;
|
buildTowerId = index-1;
|
||||||
if (index == 0) buildTowerId = -9;
|
if (index == 0) buildTowerId = -9;
|
||||||
graphics->setBuilding(true);
|
graphics->setBuilding(true);
|
||||||
setCursor(Qt::CrossCursor);
|
if (index != 0)
|
||||||
|
setCursor(QCursor(cursors.at(index-1)));
|
||||||
|
else setCursor(Qt::ForbiddenCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -64,8 +76,8 @@ void Form::add_tow(QPoint pnt)
|
|||||||
if (buildTowerId == -1) return;
|
if (buildTowerId == -1) return;
|
||||||
if (buildTowerId == -9)
|
if (buildTowerId == -9)
|
||||||
{
|
{
|
||||||
|
graphics->towerKilled(pnt);
|
||||||
core.adtowers->delTower(pnt);
|
core.adtowers->delTower(pnt);
|
||||||
emit tower_killed();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.adtowers->addTower(0,buildTowerId,pnt);
|
core.adtowers->addTower(0,buildTowerId,pnt);
|
||||||
@@ -82,6 +94,13 @@ void Form::cancel()
|
|||||||
|
|
||||||
void Form::timerEvent(QTimerEvent *)
|
void Form::timerEvent(QTimerEvent *)
|
||||||
{
|
{
|
||||||
|
for (int i=1; i<tbf->buttCount(); ++i)
|
||||||
|
{
|
||||||
|
bool b = core.adtowers->canBuild(i-1,0);
|
||||||
|
tbf->Button(i)->setEnabled(b);
|
||||||
|
if (b) tbf->set_green(i);
|
||||||
|
else tbf->set_red(i);
|
||||||
|
}
|
||||||
QString twstr;
|
QString twstr;
|
||||||
QString alstr;
|
QString alstr;
|
||||||
if (!graphics->selectedTower().isNull())
|
if (!graphics->selectedTower().isNull())
|
||||||
@@ -93,7 +112,12 @@ void Form::timerEvent(QTimerEvent *)
|
|||||||
twstr += tr("\n reload %1/%2\n alien %3").arg(tw.reload).arg(tw.src->reload).arg(tw.aim);
|
twstr += tr("\n reload %1/%2\n alien %3").arg(tw.reload).arg(tw.src->reload).arg(tw.aim);
|
||||||
twstr += tr("\n cost %1\n radius %2").arg(tw.src->cost).arg(tw.src->radius-1);
|
twstr += tr("\n cost %1\n radius %2").arg(tw.src->cost).arg(tw.src->radius-1);
|
||||||
for (int i=0; i<tw.src->morphs.size(); ++i)
|
for (int i=0; i<tw.src->morphs.size(); ++i)
|
||||||
morphtbf->Button(i)->setEnabled(core.adtowers->canMorph(tw.pos,i));
|
{
|
||||||
|
bool m = core.adtowers->canMorph(tw.pos,i);
|
||||||
|
morphtbf->Button(i)->setEnabled(m);
|
||||||
|
if (m) morphtbf->set_green(i);
|
||||||
|
else morphtbf->set_red(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (graphics->selectedAlien() != -1)
|
if (graphics->selectedAlien() != -1)
|
||||||
{
|
{
|
||||||
@@ -111,6 +135,7 @@ void Form::timerEvent(QTimerEvent *)
|
|||||||
+ tr("\n towers %1").arg(core.addata->curTowers.size())
|
+ tr("\n towers %1").arg(core.addata->curTowers.size())
|
||||||
+ tr("\n splashes %1").arg(core.addata->curSplashes.size())
|
+ tr("\n splashes %1").arg(core.addata->curSplashes.size())
|
||||||
+ twstr + alstr);
|
+ twstr + alstr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -126,7 +151,7 @@ void Form::selectedTowerChanged(QPoint id)
|
|||||||
if (id.isNull()) return;
|
if (id.isNull()) return;
|
||||||
srcTowerType * t = core.addata->curTowers[id].src;
|
srcTowerType * t = core.addata->curTowers[id].src;
|
||||||
piForeachCA(i, t->morphs)
|
piForeachCA(i, t->morphs)
|
||||||
morphtbf->addButton(i.morph->name);
|
morphtbf->addButton(i.morph->name+tr("\n %1 $, %2 exp").arg(i.cost).arg(i.expRequired));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
7
form.h
7
form.h
@@ -35,10 +35,11 @@ private:
|
|||||||
int buildTowerId;
|
int buildTowerId;
|
||||||
AD_Core core;
|
AD_Core core;
|
||||||
AD_Graphics * graphics;
|
AD_Graphics * graphics;
|
||||||
TouchButtFrame * morphtbf;
|
TouchButtFrame * morphtbf, * tbf;
|
||||||
|
QList<QPixmap> cursors;
|
||||||
|
|
||||||
signals:
|
//signals:
|
||||||
void tower_killed();
|
// void tower_killed();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FORM_H
|
#endif // FORM_H
|
||||||
|
|||||||
54
form.ui
54
form.ui
@@ -13,7 +13,7 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="4,1">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="4,0,1">
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -26,6 +26,21 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gbTowers">
|
||||||
|
<property name="title">
|
||||||
|
<string>Towers</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
@@ -41,43 +56,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QScrollArea" name="saTowers">
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>135</width>
|
|
||||||
<height>324</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="gbTowers">
|
|
||||||
<property name="title">
|
|
||||||
<string>Towers</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pbNextWave">
|
<widget class="QPushButton" name="pbNextWave">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ public:
|
|||||||
QList <AnimationType> curAnimations;
|
QList <AnimationType> curAnimations;
|
||||||
AnimationType towerSelect;
|
AnimationType towerSelect;
|
||||||
AnimationType alienSelect;
|
AnimationType alienSelect;
|
||||||
|
QImage * blood;
|
||||||
|
QRectF bloodrect;
|
||||||
Map * map;
|
Map * map;
|
||||||
Aliens * aliens;
|
Aliens * aliens;
|
||||||
int curWave;
|
int curWave;
|
||||||
|
|||||||
14
loader.cpp
14
loader.cpp
@@ -1,7 +1,6 @@
|
|||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
|
|
||||||
Loader::Loader(QObject *parent) :
|
Loader::Loader()
|
||||||
QObject(parent)
|
|
||||||
{
|
{
|
||||||
doc = new QDomDocument("data");
|
doc = new QDomDocument("data");
|
||||||
qDebug() << createMapExample();
|
qDebug() << createMapExample();
|
||||||
@@ -351,7 +350,7 @@ Game_Data * Loader::loadlevel(int id)
|
|||||||
if (wplist.isEmpty())
|
if (wplist.isEmpty())
|
||||||
{
|
{
|
||||||
qCritical() << tr("Error wave %1 is empty!").arg(tbw.id);
|
qCritical() << tr("Error wave %1 is empty!").arg(tbw.id);
|
||||||
return 0;
|
//return 0;
|
||||||
}
|
}
|
||||||
for (int j=0; j<wplist.size(); j++)
|
for (int j=0; j<wplist.size(); j++)
|
||||||
{
|
{
|
||||||
@@ -490,6 +489,7 @@ Game_Data * Loader::loadlevel(int id)
|
|||||||
gd->players[i]->srcTowers[j].splashes[k].images = gd->curAnimations.at(gd->players.at(i)->srcTowers.at(j).splashes.at(k).imgType).images;
|
gd->players[i]->srcTowers[j].splashes[k].images = gd->curAnimations.at(gd->players.at(i)->srcTowers.at(j).splashes.at(k).imgType).images;
|
||||||
}
|
}
|
||||||
gd->towerSelect.images = gd->alienSelect.images = 0;
|
gd->towerSelect.images = gd->alienSelect.images = 0;
|
||||||
|
gd->blood = 0;
|
||||||
for (QHash<int,tbAnimation>::iterator i = animations.begin();
|
for (QHash<int,tbAnimation>::iterator i = animations.begin();
|
||||||
i != animations.end(); ++i)
|
i != animations.end(); ++i)
|
||||||
{
|
{
|
||||||
@@ -509,7 +509,15 @@ Game_Data * Loader::loadlevel(int id)
|
|||||||
anim.images->append(new QImage(i->pathes.at(k)));
|
anim.images->append(new QImage(i->pathes.at(k)));
|
||||||
gd->alienSelect = anim;
|
gd->alienSelect = anim;
|
||||||
}
|
}
|
||||||
|
if (i->name == "blood")
|
||||||
|
{
|
||||||
|
gd->blood = new QImage(i->pathes.at(0));
|
||||||
|
QSize size = gd->blood->size();
|
||||||
|
qDebug() << size;
|
||||||
|
gd->bloodrect = QRectF(QPointF(-(size.width()/2),-(size.height()/2)),size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (gd->blood == 0) gd->blood = new QImage();
|
||||||
if (gd->towerSelect.images == 0)
|
if (gd->towerSelect.images == 0)
|
||||||
{
|
{
|
||||||
AnimationType anim;
|
AnimationType anim;
|
||||||
|
|||||||
8
loader.h
8
loader.h
@@ -6,6 +6,7 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QXmlSchema>
|
#include <QXmlSchema>
|
||||||
#include <QXmlSchemaValidator>
|
#include <QXmlSchemaValidator>
|
||||||
|
#include <QObject>
|
||||||
#include "adcore.h"
|
#include "adcore.h"
|
||||||
|
|
||||||
struct tbHeader
|
struct tbHeader
|
||||||
@@ -142,9 +143,8 @@ struct tbAnimation : tbHeader
|
|||||||
|
|
||||||
class Loader : public QObject
|
class Loader : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
explicit Loader(QObject *parent = 0);
|
Loader();
|
||||||
void save(QString filename);
|
void save(QString filename);
|
||||||
void load(QString filename);
|
void load(QString filename);
|
||||||
Game_Data * loadlevel(int id);
|
Game_Data * loadlevel(int id);
|
||||||
@@ -164,10 +164,6 @@ public:
|
|||||||
QMultiHash <int,tbTowerOnLevel> levTowers;
|
QMultiHash <int,tbTowerOnLevel> levTowers;
|
||||||
QMultiHash <int,tbUpgrade> upgrades;
|
QMultiHash <int,tbUpgrade> upgrades;
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDomDocument * doc;
|
QDomDocument * doc;
|
||||||
QFile * file;
|
QFile * file;
|
||||||
|
|||||||
2
main.cpp
2
main.cpp
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
|
// QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setStyle("cleanlooks");
|
a.setStyle("cleanlooks");
|
||||||
Form f;
|
Form f;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class TouchButtFrame : public QFrame
|
|||||||
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
|
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
|
||||||
public:
|
public:
|
||||||
TouchButtFrame(QWidget * parent = 0,
|
TouchButtFrame(QWidget * parent = 0,
|
||||||
QColor red = Qt::red, QColor green = Qt::green, QColor white = Qt::white, QColor push = Qt::yellow,
|
QColor red = Qt::darkRed, QColor green = Qt::green, QColor white = Qt::white, QColor push = Qt::yellow,
|
||||||
Qt::Orientation orientation = Qt::Horizontal);
|
Qt::Orientation orientation = Qt::Horizontal);
|
||||||
void setButtons(const QStringList &captions);
|
void setButtons(const QStringList &captions);
|
||||||
QStringList buttons();
|
QStringList buttons();
|
||||||
|
|||||||
27
towers.cpp
27
towers.cpp
@@ -56,20 +56,24 @@ bool Towers::addTower(int playerId, int srcId, QPoint pos)
|
|||||||
|
|
||||||
void Towers::delTower(QPoint pos)
|
void Towers::delTower(QPoint pos)
|
||||||
{
|
{
|
||||||
QPoint p;
|
// qDebug("del tower start");
|
||||||
if (gameData->curTowers.contains(pos)) p = pos;
|
// QPoint p;
|
||||||
if (gameData->curTowers.contains(pos+QPoint(1,0))) p = pos+QPoint(1,0);
|
// if (gameData->curTowers.contains(pos)) p = pos;
|
||||||
if (gameData->curTowers.contains(pos+QPoint(1,1))) p = pos+QPoint(1,1);
|
// if (gameData->curTowers.contains(pos+QPoint(1,0))) p = pos+QPoint(1,0);
|
||||||
if (gameData->curTowers.contains(pos+QPoint(0,1))) p = pos+QPoint(0,1);
|
// if (gameData->curTowers.contains(pos+QPoint(1,1))) p = pos+QPoint(1,1);
|
||||||
if (gameData->curTowers.contains(p))
|
// if (gameData->curTowers.contains(pos+QPoint(0,1))) p = pos+QPoint(0,1);
|
||||||
|
if (gameData->curTowers.contains(pos))
|
||||||
{
|
{
|
||||||
tower_killed(pos);
|
// qDebug()<< "del tower contain" << pos;
|
||||||
TowerType * t = &(gameData->curTowers[p]);
|
// emit tower_killed(pos);
|
||||||
gameData->map->delTowerOnMap(t->PlayerId,p);
|
TowerType * t = &(gameData->curTowers[pos]);
|
||||||
|
gameData->map->delTowerOnMap(t->PlayerId,pos);
|
||||||
|
gameData->players[t->PlayerId]->money += t->src->cost/2;
|
||||||
scene->removeItem(t->item);
|
scene->removeItem(t->item);
|
||||||
delete t->item;
|
delete t->item;
|
||||||
gameData->curTowers.remove(p);
|
gameData->curTowers.remove(pos);
|
||||||
}
|
}
|
||||||
|
// qDebug("del tower end");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -137,8 +141,9 @@ void Towers::update()
|
|||||||
bool Towers::morphTower(QPoint id, int index)
|
bool Towers::morphTower(QPoint id, int index)
|
||||||
{
|
{
|
||||||
if (!canMorph(id, index)) return false;
|
if (!canMorph(id, index)) return false;
|
||||||
tower_killed(id);
|
// tower_killed(id);
|
||||||
TowerType & t(gameData->curTowers[id]);
|
TowerType & t(gameData->curTowers[id]);
|
||||||
|
gameData->players[t.PlayerId]->money -= t.src->morphs[index].cost;
|
||||||
t.src = t.src->morphs[index].morph;
|
t.src = t.src->morphs[index].morph;
|
||||||
t.build = 0;
|
t.build = 0;
|
||||||
t.reload = 0;
|
t.reload = 0;
|
||||||
|
|||||||
3
towers.h
3
towers.h
@@ -11,6 +11,7 @@ public:
|
|||||||
bool addTower(int playerId, int srcId, QPoint pos);
|
bool addTower(int playerId, int srcId, QPoint pos);
|
||||||
void delTower(QPoint pos);
|
void delTower(QPoint pos);
|
||||||
bool morphTower(QPoint id, int index);
|
bool morphTower(QPoint id, int index);
|
||||||
|
bool canBuild(int id, int player) {return gameData->players[player]->money >= gameData->players[player]->srcTowers[id].cost;}
|
||||||
bool canMorph(QPoint id, int index) {return gameData->players[gameData->curTowers[id].PlayerId]->money >= gameData->curTowers[id].src->morphs[index].cost &&
|
bool canMorph(QPoint id, int index) {return gameData->players[gameData->curTowers[id].PlayerId]->money >= gameData->curTowers[id].src->morphs[index].cost &&
|
||||||
gameData->curTowers[id].experience >= gameData->curTowers[id].src->morphs[index].expRequired;}
|
gameData->curTowers[id].experience >= gameData->curTowers[id].src->morphs[index].expRequired;}
|
||||||
void update();
|
void update();
|
||||||
@@ -18,7 +19,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void shot(const TowerType &tow);
|
void shot(const TowerType &tow);
|
||||||
void tower_killed(QPoint id);
|
// void tower_killed(QPoint id);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user