Page 1 of 1

A Snake Fork

PostPosted: Sun Jul 20, 2014 5:15 pm
by Tiash
Last week, i have fork Snake by Ripper121 for do a version that uses a list instead an array, for find a more efficient version of the same game.

But i have a bug: when the snake hits a food, it stops running.
I think that problem is in the function "next_step()" after it's test "hitFood()"
Code: Select all
void next_step() {
  //Controllo se mangia
  if (hitFood()) {
    insertBody();
    score = score + point;
    nextFood();
  } else {
    insertBody();
    removeBody();
  }
}

I do not understand what causes the problem.

Can anyone help me?
How can i debug it?

Here the code

Re: A Snake Fork

PostPosted: Sun Jul 20, 2014 7:35 pm
by Tiash
I have find the problem!
I was wrong to implement the function "removeBody" :lol:
I have find a inefficiency too, that in the next days i will fix :D
The code is now update! (and working too)

Re: A Snake Fork

PostPosted: Sun Jul 20, 2014 8:23 pm
by ripper121
Nice to see first mods ;)

Re: A Snake Fork

PostPosted: Mon Jul 21, 2014 11:18 am
by Tiash
I have update the code with some little fix.

Image

ripper121 wrote:Nice to see first mods ;)

:D

Re: A Snake Fork

PostPosted: Mon Jul 21, 2014 12:37 pm
by ripper121
What are this crosses?
If you like you can Post the game in the Snake thread or i can include it in the Main post as a Mod.

Re: A Snake Fork

PostPosted: Mon Jul 21, 2014 12:42 pm
by Tiash
ripper121 wrote:What are this crosses?

The crosses indicate where the snake has eaten something. :D

ripper121 wrote:If you like you can Post the game in the Snake thread or i can include it in the Main post as a Mod.

First i want to implement some ideas. When I am satisfied, I will add :D

Re: A Snake Fork

PostPosted: Mon Jul 21, 2014 1:51 pm
by ripper121
snake[1].jpg
snake[1].jpg (64.3 KiB) Viewed 5354 times

This is a screenshot from the Nokia Snake 2, you can see the bigger part which is your cross.
It would be nice to see such graphics :D

Re: A Snake Fork

PostPosted: Mon Jul 21, 2014 3:22 pm
by rodot
This topic reminds me of a snake game I made on a very, very early prototype of the Gamebuino :lol: