[gnome-games/gnibbles-clutter] New animation for on walls and finally reintroduced mariobros-like animation on



commit 89bf8756730fb5876fe1979021c786918c741b40
Author: Guillaume Beland <guillaume beland gmail com>
Date:   Wed Aug 19 17:15:22 2009 -0400

    New animation for on walls and finally reintroduced mariobros-like animation on
    bonushalf

 gnibbles/board.c |    6 +++---
 gnibbles/worm.c  |   23 ++++++++++++++++++++---
 2 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/gnibbles/board.c b/gnibbles/board.c
index 9483658..e898cdf 100644
--- a/gnibbles/board.c
+++ b/gnibbles/board.c
@@ -66,7 +66,7 @@ gnibbles_board_new (void)
 
   board->surface = clutter_texture_new_from_file (filename, NULL);
  
-  clutter_actor_set_opacity (CLUTTER_ACTOR (board->surface), 80);
+  clutter_actor_set_opacity (CLUTTER_ACTOR (board->surface), 100);
   g_value_init (&val, G_TYPE_BOOLEAN);
   g_value_set_boolean ( &val, TRUE);
 
@@ -165,8 +165,8 @@ gnibbles_board_load_level (GnibblesBoard *board)
   clutter_actor_raise (board->level, board->surface);
 
   clutter_actor_set_opacity (board->level, 0);
-  clutter_actor_set_scale (CLUTTER_ACTOR (board->level), 2.0, 2.0);
-  clutter_actor_animate (board->level, CLUTTER_EASE_OUT_CIRC, 510,
+  clutter_actor_set_scale (CLUTTER_ACTOR (board->level), 0.2, 0.2);
+  clutter_actor_animate (board->level, CLUTTER_EASE_OUT_BOUNCE, 1210,
                          "opacity", 0xff,
                          "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER,
                          "scale-x", 1.0,
diff --git a/gnibbles/worm.c b/gnibbles/worm.c
index 3e90034..757c9ad 100644
--- a/gnibbles/worm.c
+++ b/gnibbles/worm.c
@@ -581,7 +581,7 @@ gnibbles_worm_reset (GnibblesWorm *worm)
 */
   //if (worm->lives > 0) 
     //gnibbles_worm_show (worm);
-  gnibbles_worm_move_head_pointer (worm);
+  //gnibbles_worm_move_head_pointer (worm);
   worm->stop = FALSE;
 }
 
@@ -631,7 +631,7 @@ gnibbles_worm_resize (GnibblesWorm *worm, gint newtile)
 void
 gnibbles_worm_move_head (GnibblesWorm *worm)
 {
-  if (g_list_length (worm->list) <= 1)
+  if (g_list_length (worm->list) < 0)
     return;
 
   if (worm->human)
@@ -662,6 +662,9 @@ void
 gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize)
 {
   gint i;
+  gfloat x,y;
+  ClutterActor *tmp = NULL;
+  ClutterActor *group = clutter_group_new ();
 
   if (erasesize) {
     if (g_list_length (worm->list) <= erasesize) {
@@ -670,9 +673,23 @@ gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize)
     }
 
     for (i = 0; i < erasesize; i++) {
+      tmp = gtk_clutter_texture_new_from_pixbuf (worm_pixmaps[worm->number]);
+      clutter_actor_get_position 
+        (CLUTTER_ACTOR (g_list_last (worm->list)->data), &x, &y);
+      clutter_actor_set_position (CLUTTER_ACTOR (tmp), x, y);
+      clutter_actor_set_size (CLUTTER_ACTOR (tmp),
+                              properties->tilesize,
+                              properties->tilesize);
+      clutter_container_add_actor (CLUTTER_CONTAINER (group), tmp);
+
       gnibbles_worm_move_tail_pointer (worm);
-      worm->length--;
     }
+    worm->length -= erasesize;
+    clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
+
+    clutter_actor_animate (group, CLUTTER_EASE_OUT_ELASTIC, 450,
+                           "opacity", 0,
+                           NULL);
   }
 }
 



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