From f59ca154d1ff579bef1286d3a04dc00a7e44453f Mon Sep 17 00:00:00 2001 From: Arthur 'Grizzly' Grisel-Davy Date: Thu, 30 Apr 2020 21:28:51 -0400 Subject: [PATCH] Add enemies that can die --- asset/asset.svg | 107 +++++++++++++++++++++++++++++++++--------------- main.py | 6 ++- models.py | 56 ++++++++++++++++++++----- 3 files changed, 122 insertions(+), 47 deletions(-) diff --git a/asset/asset.svg b/asset/asset.svg index 555d914..72963ad 100644 --- a/asset/asset.svg +++ b/asset/asset.svg @@ -25,9 +25,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.11079427" - inkscape:cx="-1017.0394" - inkscape:cy="-2198.0564" + inkscape:zoom="0.31337352" + inkscape:cx="-3450.9727" + inkscape:cy="-20.573896" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -60,52 +60,101 @@ inkscape:groupmode="layer" id="layer2" inkscape:label="back" - style="display:inline"> + style="display:inline;opacity:1"> + y="19.51149" + inkscape:export-filename="/home/grizzly/Documents/Python/tangledmind/maps/map1_back.png" + inkscape:export-xdpi="96.518349" + inkscape:export-ydpi="96.518349" /> + inkscape:connector-curvature="0" + inkscape:export-filename="/home/grizzly/Documents/Python/tangledmind/maps/map1_back.png" + inkscape:export-xdpi="96.518349" + inkscape:export-ydpi="96.518349" /> + inkscape:connector-curvature="0" + inkscape:export-filename="/home/grizzly/Documents/Python/tangledmind/maps/map1_back.png" + inkscape:export-xdpi="96.518349" + inkscape:export-ydpi="96.518349" /> + inkscape:connector-curvature="0" + inkscape:export-filename="/home/grizzly/Documents/Python/tangledmind/maps/map1_back.png" + inkscape:export-xdpi="96.518349" + inkscape:export-ydpi="96.518349" /> + inkscape:connector-curvature="0" + inkscape:export-filename="/home/grizzly/Documents/Python/tangledmind/maps/map1_back.png" + inkscape:export-xdpi="96.518349" + inkscape:export-ydpi="96.518349" /> + sodipodi:nodetypes="cccccccccccccc" + inkscape:export-filename="/home/grizzly/Documents/Python/tangledmind/maps/map1_back.png" + inkscape:export-xdpi="96.518349" + inkscape:export-ydpi="96.518349" /> + id="path964" + inkscape:export-filename="/home/grizzly/Documents/Python/tangledmind/maps/map1_back.png" + inkscape:export-xdpi="96.518349" + inkscape:export-ydpi="96.518349" /> + α. + β. + style="display:none;opacity:0.4207921"> + id="g5223"> + inkscape:export-ydpi="96"> + inkscape:export-ydpi="96"> + inkscape:export-ydpi="96"> + inkscape:export-ydpi="96"> + transform="rotate(45,-267.71741,255.73419)"> + inkscape:export-ydpi="96"> + transform="rotate(-135,-231.7835,215.81778)"> + inkscape:export-ydpi="96"> + inkscape:export-ydpi="96"> surface.get_width()+self.img.get_width() or - # self.deplacement[1]+surface.get_height()/2>surface.get_height()+self.img.get_height()): - return True - else: - return False \ No newline at end of file + impact = True + + # Touchs an enemy + for k,enemy in enumerate(game.enemies): + if enemy.mask.overlap(self.mask, (enemy.posx+enemy.rect.center[0]-self.posx-self.rect.center[0],enemy.posy+enemy.rect.center[1]-self.posy-self.rect.center[1])): + print("Impact on enemy {} at position {}".format(enemy.name,(enemy.posx,enemy.posy))) + enemy.die(game,k) + impact = True + + return impact \ No newline at end of file