[gnome-games/gnibbles-clutter] Added fade-in animation on level & worm on game start



commit 5c90a4c8be8fff156ed50dc398df2c43b26424da
Author: Guillaume Beland <guillaume beland gmail com>
Date:   Wed Jul 15 16:53:02 2009 -0400

    Added fade-in animation on level & worm on game start

 gnibbles/board.c        |    6 ++++++
 gnibbles/gnibbles.c     |    4 ++--
 gnibbles/worm-clutter.c |    5 +++++
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gnibbles/board.c b/gnibbles/board.c
index 158c294..10148fe 100644
--- a/gnibbles/board.c
+++ b/gnibbles/board.c
@@ -170,6 +170,12 @@ gnibbles_board_load_level (GnibblesBoard *board, GnibblesLevel *level)
   ClutterActor *stage = gnibbles_board_get_stage (board);
   clutter_container_add_actor (CLUTTER_CONTAINER (stage), board->level);
   clutter_actor_raise (board->level,board->surface);
+
+  clutter_actor_set_opacity (board->level, 0);
+  clutter_actor_animate (board->level, CLUTTER_EASE_IN_QUAD, 410,
+                         "opacity", 255,
+                         NULL);
+
 }
 
 void
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index cb16c33..509ba28 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -266,13 +266,13 @@ gnibbles_move_worms (void)
     if (worms[i]->xhead >= BOARDWIDTH) {
       worms[i]->xhead = 0;
       gnibbles_worm_add_actor(worms[i]);
-    } else if (worms[i]->xhead < 0) {
+    } else if (worms[i]->xhead <= 0) {
       worms[i]->xhead = BOARDWIDTH;
       gnibbles_worm_add_actor (worms[i]);
     } else if (worms[i]->yhead >= BOARDHEIGHT) {
       worms[i]->yhead = 0;
       gnibbles_worm_add_actor (worms[i]);
-    } else if (worms[i]->xhead < 0) {
+    } else if (worms[i]->xhead <= 0) {
       worms[i]->yhead = BOARDHEIGHT;
       gnibbles_worm_add_actor (worms[i]);
     }
diff --git a/gnibbles/worm-clutter.c b/gnibbles/worm-clutter.c
index 3cd26b8..51f4510 100644
--- a/gnibbles/worm-clutter.c
+++ b/gnibbles/worm-clutter.c
@@ -343,6 +343,11 @@ gnibbles_worm_new (guint number, guint t_xhead,
   gnibbles_worm_add_actor (worm);
   gnibbles_worm_queue_empty (worm);
 
+  clutter_actor_set_opacity (worm->actors, 0);
+  clutter_actor_animate (worm->actors, CLUTTER_EASE_IN_QUAD, 410,
+                         "opacity", 0xff,
+                         NULL);
+
   return worm;
 }
 



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