[gnome-games/gnibbles-clutter-rebased: 110/129] Fixed the reset/colision bug.
- From: Jason Clinton <jclinton src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-games/gnibbles-clutter-rebased: 110/129] Fixed the reset/colision bug.
- Date: Mon, 12 Oct 2009 21:35:28 +0000 (UTC)
commit f0d3c500eb2c19d2be1be12437345946e72db8f8
Author: Guillaume Beland <guillaume beland gmail com>
Date: Wed Aug 19 20:39:32 2009 -0400
Fixed the reset/colision bug.
gnibbles/gnibbles.c | 4 ++--
gnibbles/worm.c | 50 ++++++++++++++++++++++++++++++++------------------
2 files changed, 34 insertions(+), 20 deletions(-)
---
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index 5eca6ff..f9e6c71 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -259,9 +259,9 @@ gnibbles_move_worms (void)
}
}
/*
- printf ("head: (%d,%d) tail: (%d,%d) ? STOP:%d\n",
+ printf ("head: (%d,%d) tail: (%d,%d) \n",
worms[0]->xhead, worms[0]->yhead,
- worms[0]->xtail, worms[0]->ytail, worms[0]->stop);
+ worms[0]->xtail, worms[0]->ytail);
*/
for (i = 0; i < properties->numworms; i++) {
if (!worms[i]->stop) {
diff --git a/gnibbles/worm.c b/gnibbles/worm.c
index 3f816e2..70e3179 100644
--- a/gnibbles/worm.c
+++ b/gnibbles/worm.c
@@ -548,7 +548,20 @@ gnibbles_worm_reset (GnibblesWorm *worm)
gnibbles_worm_animate_death (worm);
gint i,j;
-
+/*
+ FILE *fo;
+ fo = fopen ("output.txt", "w");
+ for (i = 0; i < BOARDHEIGHT; i++) {
+ for (j = 0; j < BOARDWIDTH; j++) {
+ if (board->walls[j][i] == EMPTYCHAR)
+ fprintf (fo, "%c", ' ');
+ else
+ fprintf (fo, "%c", board->walls[j][i]);
+ }
+ fprintf (fo, "\n");
+ }
+ fclose (fo);
+*/
for (i = 0; i < BOARDHEIGHT; i++)
for (j = 0; j < BOARDWIDTH; j++)
if (board->walls[j][i] == WORMCHAR + worm->number)
@@ -562,26 +575,27 @@ gnibbles_worm_reset (GnibblesWorm *worm)
worm->length = 1;
worm->change = SLENGTH - 1;
+ switch (worm->direction) {
+ case WORMRIGHT:
+ worm->xtail++;
+ break;
+ case WORMLEFT:
+ worm->xtail--;
+ break;
+ case WORMDOWN:
+ worm->ytail++;
+ break;
+ case WORMUP:
+ worm->ytail--;
+ break;
+ default:
+ break;
+ }
+
gnibbles_worm_queue_empty (worm);
clutter_actor_set_opacity (CLUTTER_ACTOR (worm->actors), 0xFF);
board->walls[worm->xtail][worm->ytail] = EMPTYCHAR;
-/*
- FILE *fo;
- fo = fopen ("output.txt", "w");
- for (i = 0; i < BOARDHEIGHT; i++) {
- for (j = 0; j < BOARDWIDTH; j++) {
- if (board->walls[j][i] == EMPTYCHAR)
- fprintf (fo, "%c", ' ');
- else
- fprintf (fo, "%c", board->walls[j][i]);
- }
- fprintf (fo, "\n");
- }
- fclose (fo);
-*/
- //if (worm->lives > 0)
- //gnibbles_worm_show (worm);
- //gnibbles_worm_move_head_pointer (worm);
+
worm->stop = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]