[gcompris] intro_gravity, added a crash icon



commit 5b71a74c17c1359cd5c27dd40fc9e4739bf15ccd
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sun Nov 4 16:27:40 2012 +0100

    intro_gravity, added a crash icon
    
    Now when Tux hit a planet a crash icon is displayed.

 src/intro_gravity-activity/intro_gravity.py |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/src/intro_gravity-activity/intro_gravity.py b/src/intro_gravity-activity/intro_gravity.py
index e3e58e3..a568d25 100644
--- a/src/intro_gravity-activity/intro_gravity.py
+++ b/src/intro_gravity-activity/intro_gravity.py
@@ -275,6 +275,9 @@ class Spaceship(Gcompris_intro_gravity):
 
   def crash(self):
     self.done = True
+    bounds = self.tux_spaceship.get_bounds()
+    self.force_line.props.visibility = goocanvas.ITEM_INVISIBLE
+    self.tux_spaceship.props.pixbuf = gcompris.utils.load_pixmap("intro_gravity/crash.png")
     self.game.crash()
 
 class Asteroids:
@@ -335,23 +338,17 @@ class Asteroids:
       self.ship_instance.game.win()
       return False
     elif abs(bound_ast_x - bound_ship_x) < 40 and abs(bound_ast_y - bound_ship_y) < 40:
-      self.crash_image(bound_ship_x, bound_ship_y)
+      self.lost(bound_ship_x, bound_ship_y)
       return False
     else:
       if bound_ss_y < 100:
         # The space shuttle was missed
-        self.crash_image(bound_ship_x, bound_ship_y)
+        self.lost(bound_ship_x, bound_ship_y)
         return False
 
     return True
 
-  def crash_image(self, x, y):
-    image = goocanvas.Image(
-      parent = self.rootitem,
-      pixbuf = gcompris.utils.load_pixmap('/intro_gravity/crash.png'),
-      x = x - 50,
-      y = y - 50)
-
+  def lost(self, x, y):
     self.ship_instance.crash()
 
 class Fixed_planet:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]