瀏覽代碼

sandbox: dead cell images

Bastien Sevajol 10 年之前
父節點
當前提交
594473db9f

二進制
intelligine/display/pygame/image/dead_ant.png 查看文件


二進制
intelligine/display/pygame/image/dead_blue_ant.png 查看文件


二進制
intelligine/display/pygame/image/dead_red_ant.png 查看文件


+ 11 - 0
intelligine/display/pygame/visualisation.py 查看文件

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