Snake problem

Could someone please explain me the [B]snake movement[/B] stuff that is shown everywhere. I tried to understand it and then to write something similiar but i failed in it. My snake is just standing and doesn't move.

Comments

  • : Could someone please explain me the [B]snake movement[/B] stuff that is shown everywhere. I tried to understand it and then to write something similiar but i failed in it. My snake is just standing and doesn't move.
    :
    [blue]The snake is an array of cells - or list of cells. Every cell contains the coordinates from screen. Now, to move a snake you have to do the following:

    1. Detach the last node (a tail) of a snake
    2. Paint that node with a screen empty color (erase tail)
    3. Change the coordinates of a detached node to be a head node. Use the direction of a snake and current head coordinates.
    4. Attach the new head of a snake
    5. Paint that head with a snake color or pattern[/blue]
  • download my snake program Snake version 1.0. my id is shax. i guess you can understand that program and solve your problem. it is only around 100 lines. do tell me how the game is and rate my game.
    Sharath
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories