[gnome-games/gnibbles-clutter] Finally solved the colision detection bug
- From: Guillaume Béland <guillaubel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-games/gnibbles-clutter] Finally solved the colision detection bug
- Date: Thu, 6 Aug 2009 20:51:41 +0000 (UTC)
commit 748cb9a661ac54ada8156a14e6182936f7f9c406
Author: Guillaume Beland <guillaume beland gmail com>
Date: Thu Aug 6 16:24:22 2009 -0400
Finally solved the colision detection bug
gnibbles/worm-clutter.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/gnibbles/worm-clutter.c b/gnibbles/worm-clutter.c
index 6262890..7ee2406 100644
--- a/gnibbles/worm-clutter.c
+++ b/gnibbles/worm-clutter.c
@@ -423,6 +423,8 @@ gnibbles_worm_move_head_pointer (GnibblesWorm *worm)
if (worm->yhead <= 0)
worm->yhead = BOARDHEIGHT - 1;
+ gnibbles_worm_add_actor (worm);
+ board->walls[worm->xhead][worm->yhead] = WORMCHAR + worm->number;
}
static void
@@ -446,6 +448,9 @@ gnibbles_worm_move_tail_pointer (GnibblesWorm *worm)
default:
break;
}
+
+ gnibbles_worm_remove_actor (worm);
+ board->walls[worm->xhead][worm->yhead] = EMPTYCHAR;
}
static void
@@ -610,10 +615,8 @@ gnibbles_worm_move_head (GnibblesWorm *worm)
worm->keypress = 0;
gnibbles_worm_move_head_pointer (worm);
- gnibbles_worm_add_actor (worm);
gnibbles_worm_handle_bonus (worm);
- board->walls[worm->xhead][worm->yhead] = WORMCHAR + worm->number;
worm->length++;
if (key_queue[worm->number] && !g_queue_is_empty (key_queue[worm->number])) {
@@ -629,17 +632,11 @@ gnibbles_worm_move_tail (GnibblesWorm *worm)
if (worm->change <= 0) {
gnibbles_worm_move_tail_pointer (worm);
- gnibbles_worm_remove_actor (worm);
-
if (worm->change) {
-
gnibbles_worm_move_tail_pointer (worm);
- gnibbles_worm_remove_actor (worm);
- board->walls[worm->xtail][worm->ytail] = EMPTYCHAR;
worm->change++;
worm->length--;
}
- board->walls[worm->xtail][worm->ytail] = EMPTYCHAR;
} else {
worm->change--;
worm->length++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]