gamnit: intro custom textures, built programmatically pixel per pixel
[nit.git] / contrib / asteronits / src / game_logic.nit
index 8d45e54..785fe9d 100644 (file)
@@ -83,6 +83,7 @@ class World
                                        if object == ship then
                                                # The ship is invincible
                                                # TODO health and losing
+                                               ship.hit
                                        else
                                                object.destroy
                                        end
@@ -162,7 +163,7 @@ abstract class SpacialObject
                # Realistic rotation, kept for reference and reality minded individuals
                #var r = applied_rotation * 0.2
                #rotation_inertia += r
-               #rotation_inertia = rotation_inertia.min(2.0).max(-2.0)
+               #rotation_inertia = rotation_inertia.clamp(-2.0, 2.0)
 
                # Inertia to position
                rotation += rotation_inertia * dt
@@ -197,6 +198,9 @@ class Ship
                world.objects.add bullet
                world.bullets.add bullet
        end
+
+       # Something hits the ship
+       fun hit do end
 end
 
 # Asteroid, the main obstacle in this game