lib & examples: update modules using the java_package annotation
[nit.git] / examples / mnit_dino / src / dino_android.nit
index f2a7260..be92d49 100644 (file)
@@ -1,6 +1,6 @@
 # This file is part of NIT ( http://www.nitlanguage.org ).
 #
-# Copyright 2012-2013 Alexis Laferrière <alexis.laf@xymus.net>
+# Copyright 2012-2014 Alexis Laferrière <alexis.laf@xymus.net>
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-module dino_android
+module dino_android is
+       app_namespace "org.nitlanguage.dino"
+end
 
 import dino
 
 import mnit_android
+import android::portrait
+import android::vibration
 
 redef class ImageSet
        redef fun start_over_path do return "images/play_again_mobile.png"
@@ -32,4 +36,20 @@ redef class Display
        redef fun top_offset do return 92
 end
 
-super
+redef class Dino
+       # When hit, vibrate
+       redef fun hit(hitter, dmg)
+       do
+               app.vibrator.vibrate 25
+               super
+       end
+end
+
+redef class Caveman
+       # When crushed, vibrate a little
+       redef fun die(turn)
+       do
+               app.vibrator.vibrate 10
+               super
+       end
+end