Browse Source

sandbox: dead cell images

Bastien Sevajol 9 years ago
parent
commit
594473db9f

BIN
intelligine/display/pygame/image/dead_ant.png View File


BIN
intelligine/display/pygame/image/dead_blue_ant.png View File


BIN
intelligine/display/pygame/image/dead_red_ant.png View File


+ 11 - 0
intelligine/display/pygame/visualisation.py View File

@@ -9,9 +9,14 @@ from os import getcwd
9 9
 from synergine.metas import metas
10 10
 from intelligine.cst import PREVIOUS_DIRECTION
11 11
 
12
+# TODO: Analyser les procedes ici pour proposer des outils dans le framework
13
+
12 14
 ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/ant.png')
15
+dead_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/dead_ant.png')
13 16
 red_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/red_ant.png')
14 17
 blue_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/blue_ant.png')
18
+dead_red_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/dead_red_ant.png')
19
+dead_blue_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/dead_blue_ant.png')
15 20
 bug = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/ant.png')
16 21
 rock = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/rock.png')
17 22
 
@@ -20,6 +25,8 @@ directions_red_ant = DirectionnedImage(red_ant)
20 25
 directions_blue_ant = DirectionnedImage(blue_ant)
21 26
 
22 27
 def bug_direction(bug):
28
+    if bug.get_life_points() <= 0:
29
+        return dead_ant
23 30
     try:
24 31
         previous_direction = metas.value.get(PREVIOUS_DIRECTION, bug.get_id())
25 32
     except KeyError:
@@ -27,6 +34,8 @@ def bug_direction(bug):
27 34
     return directions_ant.get_for_direction(previous_direction)
28 35
 
29 36
 def red_ant_direction(bug):
37
+    if bug.get_life_points() <= 0:
38
+        return dead_red_ant
30 39
     try:
31 40
         previous_direction = metas.value.get(PREVIOUS_DIRECTION, bug.get_id())
32 41
     except KeyError:
@@ -34,6 +43,8 @@ def red_ant_direction(bug):
34 43
     return directions_red_ant.get_for_direction(previous_direction)
35 44
 
36 45
 def blue_ant_direction(bug):
46
+    if bug.get_life_points() <= 0:
47
+        return dead_blue_ant
37 48
     try:
38 49
         previous_direction = metas.value.get(PREVIOUS_DIRECTION, bug.get_id())
39 50
     except KeyError: