]> khamidou — GitHub mirrors - Bug_Attack.git/commitdiff
New version whith khamidou's fork included.
authorcboissie <clemzbox@gmail.com>
Mon, 30 May 2011 01:11:26 +0000 (03:11 +0200)
committercboissie <clemzbox@gmail.com>
Mon, 30 May 2011 01:11:26 +0000 (03:11 +0200)
Now you can play with all the 4 basics turrets
You can pause the game (wip)
And stop/replay when you lose/win (wip)

18 files changed:
Bug_Attack.pro.user
defenser.cpp
defenser.h
enemy.cpp
enemy.h
enemyfactory.cpp
enemyfactory.h
mainwindow.cpp
mainwindow.ui
map.cpp
map.h
media/textures/ennemies/moustique1.png [moved from media/textures/ennemies/moustiquevolant1.png with 100% similarity]
media/textures/ennemies/moustique2.png [moved from media/textures/ennemies/moustiquevolant2.png with 100% similarity]
player.cpp
player.h
projectile.cpp
projectile.h
types.h

index 3e15d28210f60bd573ea16110ad45717143c7732..b89cd7cf7e1301e2931d28b21c8702ff03917c22 100644 (file)
 <!DOCTYPE QtCreatorProject>
 <qtcreator>
  <data>
-  <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">Bug_Attack.pro</value>
- </data>
- <data>
-  <variable>RunConfiguration0-RunConfiguration.name</variable>
-  <value type="QString">Bug_Attack</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>
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
   <value type="int">0</value>
  </data>
  <data>
-  <variable>activebuildconfiguration</variable>
-  <value type="QString">Debug</value>
- </data>
- <data>
-  <variable>buildConfiguration-Debug</variable>
-  <valuemap type="QVariantMap">
-   <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="addQDumper" type=""></value>
-   <value key="buildConfiguration" type="int">2</value>
-  </valuemap>
- </data>
- <data>
-  <variable>buildConfiguration-Release</variable>
-  <valuemap type="QVariantMap">
-   <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value>
-   <value key="QtVersionId" type="int">0</value>
-   <value key="addQDumper" type=""></value>
-   <value key="buildConfiguration" type="int">0</value>
-  </valuemap>
- </data>
- <data>
-  <variable>buildconfiguration-Debug-buildstep0</variable>
-  <valuemap type="QVariantMap">
-   <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
-   <valuelist key="abstractProcess.Environment" type="QVariantList">
-    <value type="QString">COLORTERM=gnome-terminal</value>
-    <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-4ATZ8FsiM4,guid=b3b5e8064b425952320809474de0d837</value>
-    <value type="QString">DEFAULTS_PATH=/usr/share/gconf/wmii.default.path</value>
-    <value type="QString">DESKTOP_SESSION=wmii</value>
-    <value type="QString">DISPLAY=:0.0</value>
-    <value type="QString">DVDCSS_CACHE=/home/karim/.dvdcss/</value>
-    <value type="QString">DVDCSS_METHOD=key</value>
-    <value type="QString">DVDCSS_RAW_DEVICE=/dev/rdvd</value>
-    <value type="QString">DVDCSS_VERBOSE=0</value>
-    <value type="QString">EDITOR=emacs -nw</value>
-    <value type="QString">GDMSESSION=wmii</value>
-    <value type="QString">GDM_KEYBOARD_LAYOUT=fr       oss</value>
-    <value type="QString">GDM_LANG=fr_FR.utf8</value>
-    <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-lbcNed</value>
-    <value type="QString">GNOME_KEYRING_PID=1553</value>
-    <value type="QString">GROUP=karim</value>
-    <value type="QString">GTK_MODULES=canberra-gtk-module</value>
-    <value type="QString">HOME=/home/karim</value>
-    <value type="QString">HOST=darkstar</value>
-    <value type="QString">HOSTTYPE=i486-linux</value>
-    <value type="QString">LANG=fr_FR.utf8</value>
-    <value type="QString">LANGUAGE=</value>
-    <value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
-    <value type="QString">LESS=-Q</value>
-    <value type="QString">LOGNAME=karim</value>
-    <value type="QString">MACHTYPE=i486</value>
-    <value type="QString">MANDATORY_PATH=/usr/share/gconf/wmii.mandatory.path</value>
-    <value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-karim</value>
-    <value type="QString">OSTYPE=linux</value>
-    <value type="QString">PATH=/usr/bin:/home/karim/proglangs/go/bin:/home/karim/usrbin:/home/karim/proglangs/go/bin:/home/karim/usrbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
-    <value type="QString">PWD=/home/karim/Documents/Cours/LO21/projet/Bug_Attack</value>
-    <value type="QString">QTDIR=/usr/share/qt4</value>
-    <value type="QString">REMOTEHOST=</value>
-    <value type="QString">SHELL=/bin/tcsh</value>
-    <value type="QString">SHLVL=2</value>
-    <value type="QString">SPEECHD_PORT=7560</value>
-    <value type="QString">SSH_AGENT_PID=1606</value>
-    <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-WHnVlH1571/agent.1571</value>
-    <value type="QString">TERM=xterm</value>
-    <value type="QString">USER=karim</value>
-    <value type="QString">USERNAME=karim</value>
-    <value type="QString">VENDOR=intel</value>
-    <value type="QString">VISUALWORKS=/home/karim/vw7.7.1nc</value>
-    <value type="QString">WINDOWID=35651588</value>
-    <value type="QString">WMII_9MENU=wmii9menu -font 'fixed' -nf '#888888' -nb '#222222' -sf '#ffffff' -sb '#285577' -br '#4c7899'</value>
-    <value type="QString">WMII_ADDRESS=unix!/tmp/ns.karim.:0/wmii</value>
-    <value type="QString">WMII_CONFPATH=/home/karim/.wmii-3.5:/etc/X11/wmii-3.5</value>
-    <value type="QString">WMII_FOCUSCOLORS=#ffffff #285577 #4c7899</value>
-    <value type="QString">WMII_FONT=fixed</value>
-    <value type="QString">WMII_MENU=dmenu -b -fn 'fixed' -nf '#888888' -nb '#222222' -sf '#ffffff' -sb '#285577'</value>
-    <value type="QString">WMII_NORMCOLORS=#888888 #222222 #333333</value>
-    <value type="QString">WMII_NS_DIR=/tmp/ns.karim.:0</value>
-    <value type="QString">WMII_TERM=x-terminal-emulator</value>
-    <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-karim-ZS7TdS/database</value>
-    <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-wmii:/etc/xdg</value>
-    <value type="QString">XDG_SESSION_COOKIE=8d773db3cd1c3e1862d910494c27a514-1306581046.982572-757318715</value>
-    <value type="QString">no_proxy=0.0.0.0, 127.0.0.1, localhost</value>
-   </valuelist>
-   <valuelist key="abstractProcess.arguments" type="QVariantList">
-    <value type="QString">/home/karim/Documents/Cours/LO21/projet/Bug_Attack/Bug_Attack.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/karim/Documents/Cours/LO21/projet/Bug_Attack</value>
-  </valuemap>
- </data>
- <data>
-  <variable>buildconfiguration-Debug-buildstep1</variable>
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
   <valuemap type="QVariantMap">
-   <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
-   <valuelist key="abstractProcess.Environment" type="QVariantList">
-    <value type="QString">COLORTERM=gnome-terminal</value>
-    <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-4ATZ8FsiM4,guid=b3b5e8064b425952320809474de0d837</value>
-    <value type="QString">DEFAULTS_PATH=/usr/share/gconf/wmii.default.path</value>
-    <value type="QString">DESKTOP_SESSION=wmii</value>
-    <value type="QString">DISPLAY=:0.0</value>
-    <value type="QString">DVDCSS_CACHE=/home/karim/.dvdcss/</value>
-    <value type="QString">DVDCSS_METHOD=key</value>
-    <value type="QString">DVDCSS_RAW_DEVICE=/dev/rdvd</value>
-    <value type="QString">DVDCSS_VERBOSE=0</value>
-    <value type="QString">EDITOR=emacs -nw</value>
-    <value type="QString">GDMSESSION=wmii</value>
-    <value type="QString">GDM_KEYBOARD_LAYOUT=fr       oss</value>
-    <value type="QString">GDM_LANG=fr_FR.utf8</value>
-    <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-lbcNed</value>
-    <value type="QString">GNOME_KEYRING_PID=1553</value>
-    <value type="QString">GROUP=karim</value>
-    <value type="QString">GTK_MODULES=canberra-gtk-module</value>
-    <value type="QString">HOME=/home/karim</value>
-    <value type="QString">HOST=darkstar</value>
-    <value type="QString">HOSTTYPE=i486-linux</value>
-    <value type="QString">LANG=fr_FR.utf8</value>
-    <value type="QString">LANGUAGE=</value>
-    <value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
-    <value type="QString">LESS=-Q</value>
-    <value type="QString">LOGNAME=karim</value>
-    <value type="QString">MACHTYPE=i486</value>
-    <value type="QString">MANDATORY_PATH=/usr/share/gconf/wmii.mandatory.path</value>
-    <value type="QString">ORBIT_SOCKETDIR=/tmp/orbit-karim</value>
-    <value type="QString">OSTYPE=linux</value>
-    <value type="QString">PATH=/usr/bin:/home/karim/proglangs/go/bin:/home/karim/usrbin:/home/karim/proglangs/go/bin:/home/karim/usrbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
-    <value type="QString">PWD=/home/karim/Documents/Cours/LO21/projet/Bug_Attack</value>
-    <value type="QString">QTDIR=/usr/share/qt4</value>
-    <value type="QString">REMOTEHOST=</value>
-    <value type="QString">SHELL=/bin/tcsh</value>
-    <value type="QString">SHLVL=2</value>
-    <value type="QString">SPEECHD_PORT=7560</value>
-    <value type="QString">SSH_AGENT_PID=1606</value>
-    <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-WHnVlH1571/agent.1571</value>
-    <value type="QString">TERM=xterm</value>
-    <value type="QString">USER=karim</value>
-    <value type="QString">USERNAME=karim</value>
-    <value type="QString">VENDOR=intel</value>
-    <value type="QString">VISUALWORKS=/home/karim/vw7.7.1nc</value>
-    <value type="QString">WINDOWID=35651588</value>
-    <value type="QString">WMII_9MENU=wmii9menu -font 'fixed' -nf '#888888' -nb '#222222' -sf '#ffffff' -sb '#285577' -br '#4c7899'</value>
-    <value type="QString">WMII_ADDRESS=unix!/tmp/ns.karim.:0/wmii</value>
-    <value type="QString">WMII_CONFPATH=/home/karim/.wmii-3.5:/etc/X11/wmii-3.5</value>
-    <value type="QString">WMII_FOCUSCOLORS=#ffffff #285577 #4c7899</value>
-    <value type="QString">WMII_FONT=fixed</value>
-    <value type="QString">WMII_MENU=dmenu -b -fn 'fixed' -nf '#888888' -nb '#222222' -sf '#ffffff' -sb '#285577'</value>
-    <value type="QString">WMII_NORMCOLORS=#888888 #222222 #333333</value>
-    <value type="QString">WMII_NS_DIR=/tmp/ns.karim.:0</value>
-    <value type="QString">WMII_TERM=x-terminal-emulator</value>
-    <value type="QString">XAUTHORITY=/var/run/gdm/auth-for-karim-ZS7TdS/database</value>
-    <value type="QString">XDG_CONFIG_DIRS=/etc/xdg/xdg-wmii:/etc/xdg</value>
-    <value type="QString">XDG_SESSION_COOKIE=8d773db3cd1c3e1862d910494c27a514-1306581046.982572-757318715</value>
-    <value type="QString">no_proxy=0.0.0.0, 127.0.0.1, localhost</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/karim/Documents/Cours/LO21/projet/Bug_Attack</value>
+   <value key="EditorConfiguration.Codec" type="QByteArray">System</value>
   </valuemap>
  </data>
  <data>
-  <variable>buildconfiguration-Debug-cleanstep0</variable>
+  <variable>ProjectExplorer.Project.Target.0</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>
+   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
+   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
+   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" 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"></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">Debug</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">/home/clement/Projects/Bug_Attack-build-desktop</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</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"></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 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">Release</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">/home/clement/Projects/Bug_Attack-build-desktop</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</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">Bug_Attack</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">Bug_Attack.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">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
   </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>
+  <variable>ProjectExplorer.Project.TargetCount</variable>
+  <value type="int">1</value>
  </data>
  <data>
-  <variable>project</variable>
-  <valuemap type="QVariantMap"/>
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+  <value type="int">4</value>
  </data>
 </qtcreator>
index 11fed1d89c1e8187f7d95e8b760337664992f9e3..691d5f86fa648e165b22d13b8a1f83c2845640a5 100644 (file)
@@ -1,8 +1,7 @@
-#include <iostream>
-#include <typeinfo>
 #include <math.h>
 #include "defenser.h"
 #include "projectile.h"
+#include <iostream>
 
 /**
 * DEFENSER
@@ -12,6 +11,9 @@ Defenser::Defenser(int posx,int posy,int level,Map* map)
     :Entity(posx,posy),_level(level),_map(map)
 {
     this->setIsSelected(true); // Appel à la méthode pour rafraichir l'affichage
+    // Met le compteur interne à 0 et relie le FPS au tir
+    _shootTimerStep = 0;
+    // QObject::connect(&map->gameTimer,SIGNAL(timeout()), this,SLOT(shootTarget()));
 }
 
 
@@ -28,6 +30,54 @@ void Defenser::increaseLevel(void) {
     this->updateStats();
 }
 
+void Defenser::advance(int phase) {
+    if(!phase)
+        return;
+
+    // Détection des ennemis aux alentours
+    QList<Enemy*> enemies = _map->getEnemyList();
+
+    QList<Enemy*>::iterator i;
+
+    // Recherche des ennemis de la map (tire sur tous les types d'ennemis)
+    for(i = enemies.begin() ; i != enemies.end() ; ++i) {
+
+            float targetX = (*i)->x();
+            float targetY = (*i)->y();
+
+            if(    (_targetType | (*i)->getType()) == _targetType &&
+                    sqrt(pow(fabs(this->x()-16 - targetX - ((*i)->getSize()-1)*16),2)
+                    +pow(fabs(this->y()-16 - targetY - ((*i)->getSize()-1)*16),2)
+                )  <= _range)
+            {
+                // Si le défenseur ne tirait pas encore
+                if(!_isShooting) {
+                    this->setIsShooting(true); // Modification via la méthode pour les effets visuels
+                }
+                // Actualise la position de la cible
+                this->setTarget(targetX+(*i)->getSize()*16,targetY+(*i)->getSize()*16);
+                // Tire
+                this->shootTarget();
+
+                return; // On vise la première cible rencontrée
+
+            } // end distanceTest
+
+    } //eof
+    // Si aucun monstre n'a été rencontré
+    this->setIsShooting(false);  // Modification via la méthode pour les effets visuels
+
+} // eom
+
+QRectF Defenser::boundingRect(void) const {
+    return QRectF(-32,-32,_range,_range);
+}
+
+void Defenser::setTarget(float targetX,float targetY) {
+    // Sauvegarde la position de la cible courante
+    _targetX = targetX;
+    _targetY = targetY;
+}
 
 void Defenser::setIsShooting(bool state) {
 
@@ -52,6 +102,12 @@ void Defenser::setIsShooting(bool state) {
 }
 
 
+bool Defenser::isShooting(void) const { return _isShooting;}
+
+// On considère que par défaut seules trois améliorations sont possibles
+// Cette méthode est néanmoins virtuelle pour cas particulier(s)
+bool Defenser::isLevelMax(void) const { return _level==3; }
+
 /**
 * PISTOLET A EAU
 **/
@@ -60,13 +116,9 @@ WaterGun::WaterGun(int posx,int posy,int level,Map* map)
     : Defenser(posx,posy,level,map)
 {
     // Type de cible
-    _target = TYPE::T_RAMPANT & TYPE::T_VOLANT;
-    _shootTimerStep = 0;
-    _rate = 4 - _level/2;
+    _targetType = DEFAULT_TARGET_TYPE;
     // Caractéristiques
     this->updateStats();
-
-    QObject::connect(&map->gameTimer,SIGNAL(timeout()), this,SLOT(shootTarget()));
 }
 
 int WaterGun::getCost(int level) const{
@@ -75,9 +127,9 @@ int WaterGun::getCost(int level) const{
     if(level == -1) level = _level;
 
     switch(level) {
-        case 1: return 8;
-        case 2: return 20;
-        default: return 45;
+        case 1: return BASIC_COST;
+        case 2: return INTERMEDIATE_COST;
+        default: return HIGHEST_COST;
     }
 }
 
@@ -98,9 +150,6 @@ QString WaterGun::getInfos(void) const {
     return infos;
 }
 
-bool WaterGun::isShooting(void) const { return _isShooting;}
-
-bool WaterGun::isLevelMax(void) const { return _level==3; }
 
 void WaterGun::updateStats(void) {
 
@@ -110,17 +159,98 @@ void WaterGun::updateStats(void) {
 
 }
 
-QRectF WaterGun::boundingRect(void) const {
-    return QRectF(-32,-32,_range,_range);
+
+void WaterGun::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+
+    // Si la tourelle est selectionnée, on dessine un halo autour
+    if(_isSelected) {
+        painter->setBrush(QBrush(Qt::yellow));
+        painter->drawRect(-2,-2,36,36);
+    }
+
+    // Dessine la tourelle
+    painter->setBrush(QBrush(Qt::blue));
+    painter->drawRect(0,0,32,32);
+
+    // Dessine la portée de la tourelle
+    painter->setBrush(QBrush(Qt::blue,Qt::NoBrush));
+    painter->drawEllipse((-_range/32)*16+16,(-_range/32)*16+16,_range,_range);
 }
 
-void WaterGun::setTarget(float targetX,float targetY) {
-    // Sauvegarde la position de la cible courante
-    _targetX = targetX;
-    _targetY = targetY;
+void WaterGun::shootTarget(void) {
+    if (!isShooting())
+        return;
+
+    _shootTimerStep+= 1;
+
+    if (_shootTimerStep < (GAME::FPS / _rate))
+        return;
+
+    _shootTimerStep = 0;
+
+    // Créé un nouveau projectile au niveau du centre de la tourelle
+    Projectile* shot = new ProjectileWater(this->x()+14,this->y()+14,_targetX,_targetY,_power, _map);
+    _map->addItem(shot);
+
 }
 
-void WaterGun::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+
+/**
+* LANCE PIERRE
+**/
+
+Slingshot::Slingshot(int posx,int posy,int level,Map* map)
+    : Defenser(posx,posy,level,map)
+{
+    // Type de cible
+    _targetType = DEFAULT_TARGET_TYPE;
+    _shootTimerStep = 0;
+    // Caractéristiques
+    this->updateStats();
+}
+
+int Slingshot::getCost(int level) const{
+
+    // Si aucune valeur en argument, alors on affiche le coût du niveau courant
+    if(level == -1) level = _level;
+
+    switch(level) {
+        case 1: return BASIC_COST;
+        case 2: return INTERMEDIATE_COST;
+        default: return HIGHEST_COST;
+    }
+}
+
+QString Slingshot::getInfos(void) const {
+
+    // Infos générales
+    QString infos = "Lance-pierres de niveau ";
+    infos+= QString::number(_level);
+    // Amélioration
+    if(!this->isLevelMax()) {
+        infos+= "\n- Amelioration : ";
+        infos+= QString::number(this->getCost(_level+1));
+    }
+    // Revente
+    infos+= "\n- Revente : ";
+    infos+= QString::number(this->getCost(_level)/2);
+
+    return infos;
+}
+
+
+
+void Slingshot::updateStats(void) {
+
+    _range = (3.0f + _level/2.0f)*32.0f;
+    _rate = 1;
+    _power = 10 * _level * sqrt(_level); // level ^ 1.5
+
+}
+
+
+
+void Slingshot::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
 
     // Si la tourelle est selectionnée, on dessine un halo autour
     if(_isSelected) {
@@ -129,7 +259,7 @@ void WaterGun::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget
     }
 
     // Dessine la tourelle
-    painter->setBrush(QBrush(Qt::red));
+    painter->setBrush(QBrush(Qt::gray));
     painter->drawRect(0,0,32,32);
 
     // Dessine la portée de la tourelle
@@ -137,47 +267,101 @@ void WaterGun::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget
     painter->drawEllipse((-_range/32)*16+16,(-_range/32)*16+16,_range,_range);
 }
 
-void WaterGun::advance(int phase) {
-    if(!phase)
+void Slingshot::shootTarget(void) {
+    if (!isShooting())
         return;
 
-    // Détection des ennemis aux alentours
-    QList<Enemy*> enemies = _map->getEnemyList();
+    _shootTimerStep+= 1;
 
-    QList<Enemy*>::iterator i;
+    if (_shootTimerStep < (GAME::FPS / _rate))
+        return;
 
-    // Recherche des ennemis de la map (tire sur tous les types d'ennemis)
-    for(i = enemies.begin() ; i != enemies.end() ; ++i) {
+    _shootTimerStep = 0;
 
-            float targetX = (*i)->x();
-            float targetY = (*i)->y();
+    // Créé un nouveau projectile au niveau du centre de la tourelle
+    Projectile* shot = new ProjectileStone(this->x()+14,this->y()+14,_targetX,_targetY,_power, _map);
+    _map->addItem(shot);
 
-            if(sqrt(pow(fabs(this->x()-16 - targetX - ((*i)->getSize()-1)*16),2)
-                    +pow(fabs(this->y()-16 - targetY - ((*i)->getSize()-1)*16),2)
-                )  <= _range)
-            {
-                // Si le défenseur ne tirait pas encore
-                if(!_isShooting) {
-                    this->setIsShooting(true); // Modification via la méthode pour les effets visuels
-                }
-                // Actualise la position de la cible
-                this->setTarget(targetX+(*i)->getSize()*16,targetY+(*i)->getSize()*16);
+}
 
-                return; // On vise la première cible rencontrée
 
-            } // end distanceTest
+/**
+* PAINTBALL
+**/
 
-    } //eof    
-    // Si aucun monstre n'a été rencontré
-    this->setIsShooting(false);  // Modification via la méthode pour les effets visuels
+Paintball::Paintball(int posx,int posy,int level,Map* map)
+    : Defenser(posx,posy,level,map)
+{
+    // Type de cible
+    _targetType = DEFAULT_TARGET_TYPE;
+    _shootTimerStep = 0;
+    // Caractéristiques
+    this->updateStats();
+}
 
-} // eom
+int Paintball::getCost(int level) const{
 
-void WaterGun::shootTarget(void) {
+    // Si aucune valeur en argument, alors on affiche le coût du niveau courant
+    if(level == -1) level = _level;
+
+    switch(level) {
+        case 1: return BASIC_COST;
+        case 2: return INTERMEDIATE_COST;
+        default: return HIGHEST_COST;
+    }
+}
+
+QString Paintball::getInfos(void) const {
+
+    // Infos générales
+    QString infos = "Paint-ball de niveau ";
+    infos+= QString::number(_level);
+    // Amélioration
+    if(!this->isLevelMax()) {
+        infos+= "\n- Amelioration : ";
+        infos+= QString::number(this->getCost(_level+1));
+    }
+    // Revente
+    infos+= "\n- Revente : ";
+    infos+= QString::number(this->getCost(_level)/2);
+
+    return infos;
+}
+
+
+
+void Paintball::updateStats(void) {
+
+    _range = (4.0f + _level/2.0f)*32.0f;
+    _rate = 2;
+    _power = 4 * _level * sqrt(_level); // level ^ 1.5
+
+}
+
+
+
+void Paintball::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+
+    // Si la tourelle est selectionnée, on dessine un halo autour
+    if(_isSelected) {
+        painter->setBrush(QBrush(Qt::yellow));
+        painter->drawRect(-2,-2,36,36);
+    }
+
+    // Dessine la tourelle
+    painter->setBrush(QBrush(Qt::white));
+    painter->drawRect(0,0,32,32);
+
+    // Dessine la portée de la tourelle
+    painter->setBrush(QBrush(Qt::blue,Qt::NoBrush));
+    painter->drawEllipse((-_range/32)*16+16,(-_range/32)*16+16,_range,_range);
+}
+
+void Paintball::shootTarget(void) {
     if (!isShooting())
         return;
 
-    _shootTimerStep+= 1; /* pas très sur de ça */
+    _shootTimerStep+= 1;
 
     if (_shootTimerStep < (GAME::FPS / _rate))
         return;
@@ -185,8 +369,103 @@ void WaterGun::shootTarget(void) {
     _shootTimerStep = 0;
 
     // Créé un nouveau projectile au niveau du centre de la tourelle
-    Projectile* shot = new Projectile(this->x()+14,this->y()+14,_targetX,_targetY,5,_power, _map);
+    Projectile* shot = new ProjectilePaintball(this->x()+14,this->y()+14,_targetX,_targetY,_power, _map);
     _map->addItem(shot);
 
 }
 
+
+
+/**
+* PAINTBALL
+**/
+
+Bowling::Bowling(int posx,int posy,int level,Map* map)
+    : Defenser(posx,posy,level,map)
+{
+    // Type de cible
+    _targetType = DEFAULT_TARGET_TYPE;
+    _shootTimerStep = 0;
+    // Caractéristiques
+    this->updateStats();
+}
+
+int Bowling::getCost(int level) const{
+
+    // Si aucune valeur en argument, alors on affiche le coût du niveau courant
+    if(level == -1) level = _level;
+
+    switch(level) {
+        case 1: return BASIC_COST;
+        case 2: return INTERMEDIATE_COST;
+        default: return HIGHEST_COST;
+    }
+}
+
+QString Bowling::getInfos(void) const {
+
+    // Infos générales
+    QString infos = "Joueur de petanque de niveau ";
+    infos+= QString::number(_level);
+    // Amélioration
+    if(!this->isLevelMax()) {
+        infos+= "\n- Amelioration : ";
+        infos+= QString::number(this->getCost(_level+1));
+    }
+    // Revente
+    infos+= "\n- Revente : ";
+    infos+= QString::number(this->getCost(_level)/2);
+
+    return infos;
+}
+
+
+
+void Bowling::updateStats(void) {
+
+    _range = (3.0f + _level/2.0f)*32.0f;
+    _rate = 0.5;
+    _power = 15 * _level * sqrt(_level); // level ^ 1.5
+
+}
+
+
+
+void Bowling::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+
+    // Si la tourelle est selectionnée, on dessine un halo autour
+    if(_isSelected) {
+        painter->setBrush(QBrush(Qt::yellow));
+        painter->drawRect(-2,-2,36,36);
+    }
+
+    // Dessine la tourelle
+    painter->setBrush(QBrush(Qt::black));
+    painter->drawRect(0,0,32,32);
+
+    // Dessine la portée de la tourelle
+    painter->setBrush(QBrush(Qt::blue,Qt::NoBrush));
+    painter->drawEllipse((-_range/32)*16+16,(-_range/32)*16+16,_range,_range);
+}
+
+void Bowling::shootTarget(void) {
+    if (!isShooting())
+        return;
+
+    _shootTimerStep+= 1;
+
+    if (_shootTimerStep < (GAME::FPS / _rate))
+        return;
+
+    _shootTimerStep = 0;
+
+    // Créé un nouveau projectile au niveau du centre de la tourelle
+    Projectile* shot = new ProjectileBowling(this->x()+14,this->y()+14,_targetX,_targetY,_power, _map);
+    _map->addItem(shot);
+
+}
+
+
+
+
+
index c53ddc8ff86892fdd58fe752988d883a3718e866..cc7041ca594794db7d3320af506c8b29242d6640 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef DEFENSER_H
 #define DEFENSER_H
 
-#include <QTimer>
 #include "map.h"
 #include "entity.h"
 
@@ -21,16 +20,21 @@ public:
     virtual int getCost(int level = -1) const = 0;
     virtual QString getInfos(void) const = 0;
     void increaseLevel(void);
-    virtual bool isLevelMax(void) const = 0;
     bool isSelected(void) const;
+    virtual bool isLevelMax(void) const;
     void setIsShooting(bool state);
+    void setTarget(float targetX,float targetY);
+    QRectF boundingRect(void) const;
+    bool isShooting(void) const;
 
 protected:
     virtual void updateStats(void) = 0;
+    virtual void advance(int phase);
+    virtual void shootTarget(void) = 0;
 
     int _shootTimerStep;
     int _level;
-    int _target; // combinaison de TYPE::ENTITY
+    int _targetType; // combinaison de TYPE::ENTITY
     float _rate;
     float _range;
     int _power;
@@ -57,25 +61,108 @@ class WaterGun : public Defenser
 {
     Q_OBJECT
 
+    void shootTarget(void);
+
 public:
+
+    static const int DEFAULT_TARGET_TYPE = TYPE::T_RAMPANT | TYPE::T_VOLANT;
+    static const int BASIC_COST = 8;
+    static const int INTERMEDIATE_COST = 20;
+    static const int HIGHEST_COST = 45;
+
     WaterGun(int posx,int posy,int level,Map* map);
     int getCost(int level = -1) const;
-    QString getInfos(void) const;
-    bool isShooting(void) const;
-    bool isLevelMax(void) const;
+    QString getInfos(void) const;   
     void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
-    void setTarget(float targetX,float targetY);
-    QRectF boundingRect(void) const;
-    static int getBasicCost(void) { return 8; }
+    static int getBasicCost(void) { return BASIC_COST; }
+
 
 
 protected:
-    void advance(int phase);
     void updateStats(void);
+};
+
+/**
+* LANCE PIERRE
+**/
+
+
+class Slingshot : public Defenser
+{
+    Q_OBJECT
 
-public slots:
     void shootTarget(void);
 
+public:
+
+    static const int DEFAULT_TARGET_TYPE = TYPE::T_VOLANT;
+    static const int BASIC_COST = 12;
+    static const int INTERMEDIATE_COST = 25;
+    static const int HIGHEST_COST = 60;
+
+    Slingshot(int posx,int posy,int level,Map* map);
+    int getCost(int level = -1) const;
+    QString getInfos(void) const;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
+    static int getBasicCost(void) { return BASIC_COST; }
+
+protected:
+    void updateStats(void);
 };
 
+/**
+* PAINTBALL
+**/
+
+
+class Paintball : public Defenser
+{
+    Q_OBJECT
+
+    void shootTarget(void);
+
+public:
+
+    static const int DEFAULT_TARGET_TYPE = TYPE::T_RAMPANT | TYPE::T_VOLANT;
+    static const int BASIC_COST = 12;
+    static const int INTERMEDIATE_COST = 25;
+    static const int HIGHEST_COST = 60;
+
+    Paintball(int posx,int posy,int level,Map* map);
+    int getCost(int level = -1) const;
+    QString getInfos(void) const;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
+    static int getBasicCost(void) { return BASIC_COST; }
+
+protected:
+    void updateStats(void);
+};
+
+/**
+* PETANQUE
+**/
+
+
+class Bowling : public Defenser
+{
+    Q_OBJECT
+
+    void shootTarget(void);
+
+public:
+
+    static const int DEFAULT_TARGET_TYPE = TYPE::T_RAMPANT;
+    static const int BASIC_COST = 15;
+    static const int INTERMEDIATE_COST = 40;
+    static const int HIGHEST_COST = 80;
+
+    Bowling(int posx,int posy,int level,Map* map);
+    int getCost(int level = -1) const;
+    QString getInfos(void) const;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
+    static int getBasicCost(void) { return BASIC_COST; }
+
+protected:
+    void updateStats(void);
+};
 #endif // DEFENSER_H
index 42a448f281f798b3e923b93138e1dabf135c72dc..143c474f4dacfc3114a13cc01847c399048123ca 100644 (file)
--- a/enemy.cpp
+++ b/enemy.cpp
@@ -9,6 +9,8 @@
 Enemy::Enemy(Map* map,int posx,int posy, float size):Entity(posx,posy),_map(map),_size(size){
     // Positionne l'ennemi bien au centre du chemin
     this->setPos(this->x() - (_size-1)*16,this->y() - (_size-1)*16);
+    // Désactive tout malus
+    _malusCounter = 0;
     // Repertorie cet ennemi depuis la map
     _map->addEnemy(this);
 
@@ -19,6 +21,15 @@ int Enemy::getHP(void) const { return _hp; }
 int Enemy::getResistance(void) const { return _resistance; }
 TYPE::ENTITY Enemy::getType(void) const { return _type; }
 
+void Enemy::setSpeedMalus(float percent, int seconds) {
+    _malusCounter = GAME::FPS * seconds;
+    if(percent >= 0 && percent <= 1)
+        _speedMalus = percent; // Applique un pourcentage réducteur
+    else
+        _speedMalus = 0; // Par défaut on arrête l'ennemi
+}
+
+
 float Enemy::getSize(void) const { return _size; }
 void Enemy::hurt(int damages){
 
@@ -27,7 +38,7 @@ void Enemy::hurt(int damages){
     // Si ses HP sont tombés à zéro, on le détruit
     if(_hp <= 0) {
         // Indique que la mort est provoquée par le joueur
-        emit killedByPlayer(this->getResistance()); // TODO choisir le gain
+        emit killedByPlayer(this->getSize()); // TODO choisir le gain
         // Retire de l'indexation de la map
         emit enemyDestroyed(this);
         return;
@@ -82,11 +93,20 @@ void Enemy::advance(int phase) {
 
 
 
-    // Déplacement normal
+    /// Déplacement
+    // Calcul d'éventuels malus
+    float speedMalus = 1;  // Si aucun malus, cette valeur restera à 1, soit aucune modification
+    if(_malusCounter > 0) {
+        _malusCounter--;
+        speedMalus = _speedMalus;
+    }
+
+    // Recherche de la direction à suivre
     QPointF dirVect = currentTile.getDirection();
 
-    float new_x = this->x() + _speed*dirVect.x();
-    float new_y = this->y() + _speed*dirVect.y();
+    // Application de la vitesse
+    float new_x = this->x() + _speed*dirVect.x()*speedMalus;
+    float new_y = this->y() + _speed*dirVect.y()*speedMalus;
 
     this->setPos(new_x,new_y);
 
@@ -133,7 +153,7 @@ void Enemy::reachGoal(void) {
 Cafard::Cafard(Map* map,int posx,int posy, float size):Enemy(map,posx,posy,size)
 {
     // Données du cafard
-    _type = TYPE::T_RAMPANT;
+    _type = DEFAULT_TYPE;
     _hp = 10*size*size;
     _hpMax = _hp;
     _resistance = 5*size*size;
@@ -177,7 +197,7 @@ void Cafard::advance(int phase) {
 Fourmi::Fourmi(Map* map,int posx,int posy, float size):Enemy(map,posx,posy,size)
 {
     // Données de la fourmi
-    _type = TYPE::T_RAMPANT;
+    _type = DEFAULT_TYPE;
     _hp = 5*size*size;
     _hpMax = _hp;
     _resistance = size*size;
@@ -233,7 +253,7 @@ void Fourmi::advance(int phase) {
 Guepe::Guepe(Map* map,int posx,int posy, float size):Enemy(map,posx,posy,size)
 {
     // Données de la guepe
-    _type = TYPE::T_VOLANT;
+    _type = DEFAULT_TYPE;
     _hp = 7*size*size;
     _hpMax = _hp;
     _resistance = 4*size*size;
@@ -299,7 +319,7 @@ void Guepe::advance(int phase) {
 Moustique::Moustique(Map* map,int posx,int posy, float size):Enemy(map,posx,posy,size)
 {
     // Données du moustique
-    _type = TYPE::T_VOLANT;
+    _type = DEFAULT_TYPE;
     _hp = 6*size*size;
     _hpMax = _hp;
 
@@ -307,7 +327,7 @@ Moustique::Moustique(Map* map,int posx,int posy, float size):Enemy(map,posx,posy
 
     // Images et animations
     for(int i = 0; i < 2; ++i) {
-        QPixmap* animTemp = new QPixmap("./media/textures/ennemies/guepe" + QString::number(i+1) + ".png");
+        QPixmap* animTemp = new QPixmap("./media/textures/ennemies/moustique" + QString::number(i+1) + ".png");
         *animTemp = animTemp->scaled(size*32,size*32);
         _animPixmap.push_back(animTemp);
     }
diff --git a/enemy.h b/enemy.h
index ae2c2a4d4329a5fac93c78ba91b3d12693f9ec73..01eb0c36e628e0704e7f75a08ade956b1a68061c 100644 (file)
--- a/enemy.h
+++ b/enemy.h
@@ -23,7 +23,7 @@ public:
     TYPE::ENTITY getType(void) const;
     float getSize(void) const;
     virtual void hurt(int damages);
-
+    void setSpeedMalus(float percent,int seconds);
     void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
     QRectF boundingRect(void) const;
 
@@ -34,6 +34,11 @@ protected:
     int _hpMax;
     int _resistance;
     float _speed;
+
+    // Malus
+    float _speedMalus;
+    int _malusCounter;
+
     TYPE::ENTITY _type;
 
     virtual void advance(int phase);
@@ -56,6 +61,9 @@ class Cafard : public Enemy
 
 
 public:
+
+    const static TYPE::ENTITY DEFAULT_TYPE = TYPE::T_RAMPANT;
+
     Cafard(Map* map,int posx,int posy, float size);
     void hurt(int damages);
 
@@ -73,6 +81,9 @@ class Fourmi : public Enemy
 
 
 public:
+
+    const static TYPE::ENTITY DEFAULT_TYPE = TYPE::T_RAMPANT;
+
     Fourmi(Map* map,int posx,int posy, float size);
     void hurt(int damages);
 
@@ -94,6 +105,9 @@ class Guepe : public Enemy
 
 
 public:
+
+    const static TYPE::ENTITY DEFAULT_TYPE = TYPE::T_VOLANT;
+
     Guepe(Map* map,int posx,int posy, float size);
     void hurt(int damages);
 
@@ -115,6 +129,9 @@ class Moustique : public Enemy
 
 
 public:
+
+    const static TYPE::ENTITY DEFAULT_TYPE = TYPE::T_VOLANT;
+
     Moustique(Map* map,int posx,int posy, float size);
     void hurt(int damages);
 
index 0136f38d094104b12ba471c1bd0fe7d96e46a2a4..4d751c48dcd7aa27857b686c903c27e1ebb789f5 100644 (file)
@@ -139,7 +139,27 @@ void EnemyFactory::produceWave(void){
 
     _waveTimerStep = 0;
     // Vérifie s'il reste des vagues à produire
-    if(_mapWaves.empty()){      
+    if(_mapWaves.empty()){
+        if(_currentMap->getEnemyList().empty()) {
+
+            //!-- BLOC DE FIN DE PARTIE : Victoire
+            QMessageBox msgBox;
+            msgBox.setText("Fin de partie");
+            msgBox.setInformativeText("Vous avez gagné.");
+
+            QPushButton *restartButton = msgBox.addButton(tr("Rejouer"), QMessageBox::ActionRole);
+            QPushButton *quitButton = msgBox.addButton(tr("Quitter"), QMessageBox::ActionRole);
+            msgBox.exec();
+
+            if (msgBox.clickedButton() == (QAbstractButton *) restartButton) {
+
+            } else if (msgBox.clickedButton() == (QAbstractButton *) quitButton) {
+                 exit(0);
+            }
+            // FIN DU BLOC  --!
+
+
+        }
         return;
     }
 
index c38ba03a2d35d2956d2ff64bfdb2c9de16558b3a..fabe4ccf884eadbd0b9058d8e396397bc4f91a8d 100644 (file)
@@ -2,7 +2,6 @@
 #define ENEMYFACTORY_H
 
 #include <QList>
-#include <QTimer>
 #include <QString>
 
 #include "map.h"
index af09f338eacd2c6721daceadecd12d1ea0f4d507..08f99e3e56eaae52f7b945189731e9365b055823 100644 (file)
@@ -12,7 +12,7 @@ MainWindow::MainWindow(QWidget *parent) :
     /**
     * Initialisation des données du joueur
     **/
-    _player = new Player(999,10);
+    _player = new Player(22,10);
 
     /**
     * Création et chargement de la map
@@ -47,8 +47,16 @@ MainWindow::MainWindow(QWidget *parent) :
     /// Boutons de choix de tourelle
     // . Pistolet à eau
     QObject::connect(ui->turretButton_PistoletAEau,SIGNAL(pressed()),_player,SLOT(setTurretChoice1()));
-    QObject::connect(_player,SIGNAL(setTurret1ButtonDisabled(bool)),this->ui->turretButton_PistoletAEau,SLOT(setDisabled(bool)));
-
+    QObject::connect(_player,SIGNAL(setTurret1ButtonDisabled(bool)),ui->turretButton_PistoletAEau,SLOT(setDisabled(bool)));
+    // . Lance-pierres
+    QObject::connect(ui->turretButton_LancePierres,SIGNAL(pressed()),_player,SLOT(setTurretChoice2()));
+    QObject::connect(_player,SIGNAL(setTurret2ButtonDisabled(bool)),ui->turretButton_LancePierres,SLOT(setDisabled(bool)));
+    // . Paintball
+    QObject::connect(ui->turretButton_Paintball,SIGNAL(pressed()),_player,SLOT(setTurretChoice3()));
+    QObject::connect(_player,SIGNAL(setTurret3ButtonDisabled(bool)),ui->turretButton_Paintball,SLOT(setDisabled(bool)));
+    // . Pétanque
+    QObject::connect(ui->turretButton_Petanque,SIGNAL(pressed()),_player,SLOT(setTurretChoice4()));
+    QObject::connect(_player,SIGNAL(setTurret4ButtonDisabled(bool)),ui->turretButton_Petanque,SLOT(setDisabled(bool)));
 
     // Demande d'informations sur une tourelle
     QObject::connect(_sceneMap,SIGNAL(turretInfosRequest(QString)),ui->turretInfoLabel,SLOT(setText(QString)));
@@ -91,9 +99,9 @@ void MainWindow::showMapContextMenu(const QPoint& pos) {
    // Création du menu de choix de la tourelle
    QMenu myMenu(this);
    QAction* createTurret1 = myMenu.addAction("Pistolet a eau");
-   myMenu.addAction("-- turret 2 --");
-   myMenu.addAction("-- turret 3 --");
-   myMenu.addAction("-- turret 4 --");
+   QAction* createTurret2 = myMenu.addAction("Lance-pierres");
+   QAction* createTurret3 = myMenu.addAction("Paintball");
+   QAction* createTurret4 = myMenu.addAction("Petanque");
    myMenu.addAction("-- turret 5 --");
 
    // On regarde si un choix a été effectué et si la case est libre pour la pose d'une tourelle
@@ -103,6 +111,12 @@ void MainWindow::showMapContextMenu(const QPoint& pos) {
        // TODO CHANGER ADD TURRET
        if(selectedItem == createTurret1)
            _sceneMap->addTurretAt(TYPE::PISTOLET_A_EAU,mousePos.x(),mousePos.y());
+       else if(selectedItem == createTurret2)
+           _sceneMap->addTurretAt(TYPE::LANCE_PIERRES,mousePos.x(),mousePos.y());
+       else if(selectedItem == createTurret3)
+           _sceneMap->addTurretAt(TYPE::PAINTBALL,mousePos.x(),mousePos.y());
+       else if(selectedItem == createTurret4)
+           _sceneMap->addTurretAt(TYPE::PETANQUE,mousePos.x(),mousePos.y());
    }
 
 }
index f1730630df7d558b80739d67e4d3cd21e4ff89ce..f6fe65232c01b0a16bf071936cfb2b97d5f9ac00 100644 (file)
          <string>Pistolet à eau</string>
         </property>
        </widget>
+       <widget class="QPushButton" name="turretButton_LancePierres">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>30</y>
+          <width>98</width>
+          <height>27</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string>Lance-pierres</string>
+        </property>
+       </widget>
+       <widget class="QPushButton" name="turretButton_Paintball">
+        <property name="geometry">
+         <rect>
+          <x>20</x>
+          <y>60</y>
+          <width>98</width>
+          <height>27</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string>PaintBall</string>
+        </property>
+       </widget>
+       <widget class="QPushButton" name="turretButton_Petanque">
+        <property name="geometry">
+         <rect>
+          <x>130</x>
+          <y>60</y>
+          <width>98</width>
+          <height>27</height>
+         </rect>
+        </property>
+        <property name="text">
+         <string>Pétanque</string>
+        </property>
+       </widget>
       </widget>
      </item>
      <item>
diff --git a/map.cpp b/map.cpp
index 90a1f9e63a0cdc4b343ac7edaa06a7db67c16cd4..a1cda0083fefa41c4d98fe3627f03631ea639685 100644 (file)
--- a/map.cpp
+++ b/map.cpp
@@ -95,7 +95,7 @@ void Map::removeEnemy(Enemy* ptr) {
     int i;
     for(i = 0; i < _enemies.length() ; ++i) {
 
-        if(_enemies[i] == ptr){
+        if(_enemies[i] == ptr) {
             std::cout << "OMG je suis mort" << std::endl;
             _enemies.removeAt(i);
            // QObject::disconnect(ptr);
@@ -132,6 +132,42 @@ bool Map::addTurretAt(TYPE::TURRET turretType,float mx,float my) {
             }
             break;
 
+            // Lance-pierres
+            case TYPE::LANCE_PIERRES:
+            if(_player->payMoney(Slingshot::getBasicCost()))
+            {
+                enoughMoney = true;
+                newTurret = new Slingshot(((int)(mx/32))*32,
+                                         ((int)(my/32))*32,
+                                         1,
+                                         this);
+            }
+            break;
+
+            // Paintball
+            case TYPE::PAINTBALL:
+            if(_player->payMoney(Paintball::getBasicCost()))
+            {
+                enoughMoney = true;
+                newTurret = new Paintball(((int)(mx/32))*32,
+                                         ((int)(my/32))*32,
+                                         1,
+                                         this);
+            }
+            break;
+
+            // Pétanque
+            case TYPE::PETANQUE:
+            if(_player->payMoney(Bowling::getBasicCost()))
+            {
+                enoughMoney = true;
+                newTurret = new Bowling(((int)(mx/32))*32,
+                                         ((int)(my/32))*32,
+                                         1,
+                                         this);
+            }
+            break;
+
             // Type inconnu ~ erreur
             default:
             break;
@@ -188,6 +224,8 @@ void Map::removeTurret(void) {
              // Désactive les boutons de tourelle
              emit disableTurretUpgradeButton(true);
              emit disableTurretSellButton(true);
+             // Met à jour l'affichage
+             this->update();
 
             break;
         }
@@ -218,6 +256,9 @@ void Map::upgradeTurret(void) {
                 // Si l'upgrade est maximale, on désactive le bouton d'upgrade
                 if(_turrets[i]->isLevelMax())
                     emit disableTurretUpgradeButton(true);
+
+                // Met à jour l'affichage
+                this->update();
             }
             break;
         }
diff --git a/map.h b/map.h
index 3f717c937085078c4e1be1dbc64e27180a964bb1..9d5daf8bb7f88c6e5669c973454fe7fbd83e6185 100644 (file)
--- a/map.h
+++ b/map.h
@@ -3,6 +3,7 @@
 
 #include <QFile>
 #include <QList>
+#include <QTimer>
 #include <QGraphicsScene>
 #include <QGraphicsSceneMouseEvent>
 #include <QMouseEvent>
index ad36ec6439f8dc9dd5ca2d32002f2d75cf9144dd..ec142d27c9d419a837ef965ce03ba7868cb4883f 100644 (file)
@@ -33,9 +33,24 @@ void Player::loseLives(int livesLost) {
     // Fait perdre des vies au joueur
     // ... et le compteur est notifié
     _lives-=livesLost;
-    if(_lives < 0)
+    if(_lives <= 0){
         _lives = 0;
 
+        //!-- BLOC DE FIN DE PARTIE : Victoire
+        QMessageBox msgBox;
+        msgBox.setText("Fin de partie");
+        msgBox.setInformativeText("Vous avez perdu...");
+        QPushButton *restartButton = msgBox.addButton(tr("Rejouer"), QMessageBox::ActionRole);
+        QPushButton *quitButton = msgBox.addButton(tr("Quitter"), QMessageBox::ActionRole);
+        msgBox.exec();
+        if (msgBox.clickedButton() == (QAbstractButton *) restartButton) {
+
+        }
+        else if (msgBox.clickedButton() == (QAbstractButton *) quitButton)
+             exit(0);
+        // FIN DU BLOC  --!
+    }
+
     emit livesValueChanged(_lives);
 }
 
@@ -58,6 +73,15 @@ void Player::setTurretChoice(TYPE::TURRET choice) {
         case TYPE::PISTOLET_A_EAU :
             emit setTurret1ButtonDisabled(false);
             break;
+        case TYPE::LANCE_PIERRES :
+            emit setTurret2ButtonDisabled(false);
+            break;
+        case TYPE::PAINTBALL:
+            emit setTurret3ButtonDisabled(false);
+            break;
+        case TYPE::PETANQUE:
+            emit setTurret4ButtonDisabled(false);
+            break;
         default:
             break;
         }
@@ -72,6 +96,15 @@ void Player::setTurretChoice(TYPE::TURRET choice) {
         case TYPE::PISTOLET_A_EAU:
             emit setTurret1ButtonDisabled(true);
             break;
+        case TYPE::LANCE_PIERRES:
+            emit setTurret2ButtonDisabled(true);
+            break;
+        case TYPE::PAINTBALL:
+            emit setTurret3ButtonDisabled(true);
+            break;
+        case TYPE::PETANQUE:
+            emit setTurret4ButtonDisabled(true);
+            break;
         default:
             break;
         }
@@ -79,6 +112,9 @@ void Player::setTurretChoice(TYPE::TURRET choice) {
 
 }
 void Player::setTurretChoice1(){this->setTurretChoice(TYPE::PISTOLET_A_EAU);}
+void Player::setTurretChoice2(){this->setTurretChoice(TYPE::LANCE_PIERRES);}
+void Player::setTurretChoice3(){this->setTurretChoice(TYPE::PAINTBALL);}
+void Player::setTurretChoice4(){this->setTurretChoice(TYPE::PETANQUE);}
 
 
 
index 4aeb0a7fddbe86334904f1fdefb4ab1c6c880b52..ca79d1eaf9c7e16d8dba0d9f42b38771a42e5824 100644 (file)
--- a/player.h
+++ b/player.h
@@ -1,6 +1,7 @@
 #ifndef PLAYER_H
 #define PLAYER_H
 
+#include <QMessageBox>
 #include <QObject>
 #include "types.h"
 
@@ -31,12 +32,18 @@ public slots:
     void loseLives(int livesLost);
     void turretSold(int money);
     void setTurretChoice1();
+    void setTurretChoice2();
+    void setTurretChoice3();
+    void setTurretChoice4();
 
 
 signals:
     void moneyValueChanged(int);
     void livesValueChanged(int);
     void setTurret1ButtonDisabled(bool);
+    void setTurret2ButtonDisabled(bool);
+    void setTurret3ButtonDisabled(bool);
+    void setTurret4ButtonDisabled(bool);
     void turretSelected();
 };
 
index c4d3b118f492506071ea02ee8a87772fa02c40d8..4e7c17eb7db4f942b92972e4acc8dd44f9b4eed9 100644 (file)
@@ -3,8 +3,12 @@
 #include "map.h"
 #include "projectile.h"
 
-Projectile::Projectile(float posX, float posY, float targetX, float targetY, float speed, int damages, Map* map)
-    : Entity(posX,posY),_speed(speed),_damages(damages),_targetX(targetX),_targetY(targetY)
+/**
+* PROJECTILE
+**/
+
+Projectile::Projectile(float posX, float posY, float targetX, float targetY, int damages, Map* map)
+    : Entity(posX,posY),_damages(damages),_targetX(targetX),_targetY(targetY)
 {
     // Calcul du vecteur de déplacement du point (posX,posY) vers (targetX,targetY)
     // .. Nb : on calcule ici le vecteur normalisé pour appliquer ensuite la vitesse propre à l'objet
@@ -20,16 +24,94 @@ QRectF Projectile::boundingRect() const {
     return QRectF(0,0,5,5);
 }
 
-void Projectile::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+void Projectile::advance(int phase) {
+
+    if(!phase)
+        return;
+
+    // Collision avec ennemi
+    // . Recherche des ennemis de la map
+    QList<Enemy*> entities = _map->getEnemyList();
+    QList<Enemy*>::iterator i;
+    for(i = entities.begin(); i < entities.end() ; ++i) {
+            if(((*i)->getType() | _targetType) == _targetType &&
+               this->collidesWithItem(*i,Qt::IntersectsItemBoundingRect)){
+                // On retire le projectile de la scène
+                this->scene()->removeItem(this);
+                // Inflige des domages au monstre
+                Enemy *e = *i;
+                e->hurt(_damages);
+                return;
+            }
+    }
+
+
+
+    // Déplacement du projectile selon le vecteur de déplacement et la vitesse
+    float newx = this->x() + _speed*_movementVect.x();
+    float newy = this->y() + _speed*_movementVect.y();
+
+    // std::cout << "I'm still alive mothafucka" << std::endl;
+
+    // Si le projectile est en dehors de l'écran, on le supprime
+    if(newx < 0 || newx > 512 || newy < 0 || newy > 512){
+        _map->removeItem(this); // TODO VERIFIER Semble faire un appel à delete() de l'objet
+        return;
+    }
+    this->setPos(newx,newy);
+
+}
+
+/**
+* PROJECTILE WATER
+**/
+
+ProjectileWater::ProjectileWater(float posX,float posY,float targetX,float targetY,int damages, Map *map)
+    :Projectile(posX,posY,targetX,targetY,damages,map){
+    _targetType = DEFAULT_TARGET_TYPE;
+    _speed = DEFAULT_SPEED;
+}
 
+void ProjectileWater::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+    // Dessine le projectile
     painter->setBrush(QBrush(Qt::cyan));
-    // Dessine la tourelle
     painter->drawRect(0,0,5,5);
+}
 
+/**
+* PROJECTILE WATER
+**/
 
+ProjectileStone::ProjectileStone(float posX,float posY,float targetX,float targetY,int damages, Map *map)
+    :Projectile(posX,posY,targetX,targetY,damages,map){
+    _targetType = DEFAULT_TARGET_TYPE;
+    _speed = DEFAULT_SPEED;
 }
 
-void Projectile::advance(int phase) {
+void ProjectileStone::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+    // Dessine le projectile
+    painter->setBrush(QBrush(Qt::gray));
+    painter->drawRect(0,0,5,5);
+}
+
+
+/**
+* PROJECTILE PAINT BALL
+**/
+
+ProjectilePaintball::ProjectilePaintball(float posX,float posY,float targetX,float targetY,int damages, Map *map)
+    :Projectile(posX,posY,targetX,targetY,damages,map){
+    _targetType = DEFAULT_TARGET_TYPE;
+    _speed = DEFAULT_SPEED;
+}
+
+void ProjectilePaintball::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+    // Dessine le projectile
+    painter->setBrush(QBrush(Qt::green));
+    painter->drawRect(0,0,5,5);
+}
+
+void ProjectilePaintball::advance(int phase) {
 
     if(!phase)
         return;
@@ -39,12 +121,98 @@ void Projectile::advance(int phase) {
     QList<Enemy*> entities = _map->getEnemyList();
     QList<Enemy*>::iterator i;
     for(i = entities.begin(); i < entities.end() ; ++i) {
-            if(this->collidesWithItem(*i,Qt::IntersectsItemBoundingRect)){
+            if( ((*i)->getType() | _targetType) == _targetType
+                && this->collidesWithItem(*i,Qt::IntersectsItemBoundingRect)){
                 // On retire le projectile de la scène
                 this->scene()->removeItem(this);
-                // Inflige des dommages au monstre
+                // Inflige des domages au monstre
                 Enemy *e = *i;
                 e->hurt(_damages);
+                // Ralenti également le monstre pendant 4 secondes
+                e->setSpeedMalus(0.5f,4);
+                return;
+            }
+    }
+
+
+
+    // Déplacement du projectile selon le vecteur de déplacement et la vitesse
+    float newx = this->x() + _speed*_movementVect.x();
+    float newy = this->y() + _speed*_movementVect.y();
+
+    // std::cout << "I'm still alive mothafucka" << std::endl;
+
+    // Si le projectile est en dehors de l'écran, on le supprime
+    if(newx < 0 || newx > 512 || newy < 0 || newy > 512){
+        _map->removeItem(this); // TODO VERIFIER Semble faire un appel à delete() de l'objet
+        return;
+    }
+    this->setPos(newx,newy);
+
+}
+
+
+/**
+* PROJECTILE BOWLING
+**/
+
+ProjectileBowling::ProjectileBowling(float posX,float posY,float targetX,float targetY,int damages, Map *map)
+    :Projectile(posX,posY,targetX,targetY,damages,map){
+    _targetType = DEFAULT_TARGET_TYPE;
+    _speed = DEFAULT_SPEED;
+}
+
+void ProjectileBowling::paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) {
+    // Dessine le projectile
+    painter->setBrush(QBrush(Qt::black));
+    painter->drawRect(0,0,5,5);
+}
+
+
+
+/**
+* Dommages de zone :
+* Les dommages de bases sont calculés de la sorte :
+* 15 * niveau ^ 1.5
+* Les dommages de zone sont calculés de la sorte :
+* 10 * niveau ^ 1.5
+* Afin d'économiser en calculs, on se base sur les dommages de base, multipliés par 10/15.
+**/
+void ProjectileBowling::advance(int phase) {
+
+    if(!phase)
+        return;
+
+    // Collision avec ennemi
+    // . Recherche des ennemis de la map
+    QList<Enemy*> entities = _map->getEnemyList();
+    QList<Enemy*>::iterator i;
+    for(i = entities.begin(); i < entities.end() ; ++i) {
+            if( ((*i)->getType() | _targetType) == _targetType &&
+                this->collidesWithItem(*i,Qt::IntersectsItemBoundingRect)) {
+
+
+                // Inflige des dommages à la cible...
+                Enemy *e = *i;
+                e->hurt(_damages);
+
+                // ... puis on recherche des ennemis à une case de distance qui seront également blessés
+                for(int j = 0 ; j < entities.size() ; ++j) {
+
+                    float targetX = entities[j]->x();
+                    float targetY = entities[j]->y();
+
+                    if(entities[j] != e && sqrt(pow(fabs(this->x()-16 - targetX - ((*i)->getSize()-1)*16),2)
+                            +pow(fabs(this->y()-16 - targetY - ((*i)->getSize()-1)*16),2)
+                        )  <= 32)
+                    {
+                        entities[j]->hurt(_damages*10/15);
+                    }
+
+                }
+                // On retire le projectile de la scène
+                this->scene()->removeItem(this);
+
                 return;
             }
     }
index 2ac673059d811713d8c3e7a06fdfc37931ba0cfc..cb3da38a00642a02b3be7f455d0e486ffe17e12e 100644 (file)
 #include "entity.h"
 #include "map.h"
 
+/**
+* PROJECTILE
+**/
 
 class Map;
 class Projectile : public Entity
 {
 
+protected:
+
    float _speed;
    int _damages;
    float _targetX;
    float _targetY;
+   int _targetType; // Combinaison de TYPE::ENTITY
    QPointF _movementVect;
    Map* _map;
 
    virtual void advance(int phase);
 
 public:
+   Projectile(float posX,float posY,float targetX,float targetY,int damages, Map *map);
    QRectF boundingRect() const;
-   virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
+   virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*) = 0;
+
+
+
+};
+
+
+/**
+* PROJECTILE WATER
+**/
+
+class ProjectileWater : public Projectile {
+
+public:
+
+    // Caractéristiques
+    static const float DEFAULT_SPEED = 4;
+    static const int DEFAULT_TARGET_TYPE = TYPE::T_RAMPANT | TYPE::T_VOLANT;
+
+    ProjectileWater(float posX,float posY,float targetX,float targetY,int damages, Map *map);
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
+
+};
+
+
+/**
+* PROJECTILE STONE
+**/
+
+class ProjectileStone : public Projectile {
+
+public:
+
+    // Caractéristiques
+    static const float DEFAULT_SPEED = 2.5;
+    static const int DEFAULT_TARGET_TYPE = TYPE::T_VOLANT;
+
+
+    ProjectileStone(float posX,float posY,float targetX,float targetY,int damages, Map *map);
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
+
+};
+
+/**
+* PROJECTILE PAINT BALL
+**/
+class ProjectilePaintball : public Projectile {
+
+    // Méthode redéfinie pour l'effet spécial
+    void advance(int phase);
+
+public:
+
+    // Caractéristiques
+    static const float DEFAULT_SPEED = 3;
+      static const int DEFAULT_TARGET_TYPE = TYPE::T_RAMPANT | TYPE::T_VOLANT;
+
+
+    ProjectilePaintball(float posX,float posY,float targetX,float targetY,int damages, Map *map);
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
+
+};
+
+/**
+* PROJECTILE BOWLING
+**/
+class ProjectileBowling : public Projectile {
+
+    // Méthode redéfinie pour l'effet spécial
+    void advance(int phase);
+
+public:
+
+    // Caractéristiques
+    static const float DEFAULT_SPEED = 2;
+    static const int DEFAULT_TARGET_TYPE = TYPE::T_RAMPANT | TYPE::T_VOLANT;
 
-   Projectile(float posX,float posY,float targetX,float targetY,float speed,int damages, Map *map);
 
+    ProjectileBowling(float posX,float posY,float targetX,float targetY,int damages, Map *map);
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget*);
 
 };
 
diff --git a/types.h b/types.h
index 2c3c3b396e30f533f80bc6dbe20386332a98a158..74973784f6987119a8b0879381a9aea19ed52cc8 100644 (file)
--- a/types.h
+++ b/types.h
@@ -9,7 +9,7 @@ namespace TYPE {
 typedef enum { NORTH = 1 , SOUTH = 2 , EAST = 4 , WEST = 8, GOAL = 32, UP = 128 } DIRECTION;
 typedef enum { T_RAMPANT = 1, T_VOLANT = 2 } ENTITY;
 typedef enum { CAFARD , FOURMI , GUEPE , MOUSTIQUE } ENEMY;
-typedef enum { NONE, PISTOLET_A_EAU } TURRET;
+typedef enum { NONE, PISTOLET_A_EAU, LANCE_PIERRES, PAINTBALL, PETANQUE } TURRET;
 
 
 };