Switch to full style
Advice on general approaches or feasibility and discussions about game design
Post a reply

A Snake Fork

Sun Jul 20, 2014 5:15 pm

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:
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

Sun Jul 20, 2014 7:35 pm

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

Sun Jul 20, 2014 8:23 pm

Nice to see first mods ;)

Re: A Snake Fork

Mon Jul 21, 2014 11:18 am

I have update the code with some little fix.

Image

ripper121 wrote:Nice to see first mods ;)

:D

Re: A Snake Fork

Mon Jul 21, 2014 12:37 pm

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

Mon Jul 21, 2014 12:42 pm

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

Mon Jul 21, 2014 1:51 pm

snake[1].jpg
snake[1].jpg (64.3 KiB) Viewed 5356 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

Mon Jul 21, 2014 3:22 pm

This topic reminds me of a snake game I made on a very, very early prototype of the Gamebuino :lol:

Post a reply