SNAKE Borland c++ 6.0! Plz help

Discussion in 'C++' started by inyect185, Nov 7, 2008.

  1. inyect185

    inyect185 New Member

    Joined:
    Nov 7, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi , hey i need to do the snake game! and i dont now how to make the function for move the snake. Plz i need help. im still programing in console mode ! . Someone give me the function plz-
     
  2. imported_xpi0t0s

    imported_xpi0t0s New Member

    Joined:
    Jul 18, 2008
    Messages:
    101
    Likes Received:
    0
    Trophy Points:
    0
    It's not too difficult if you're able to place characters anywhere on the screen.
    What you could do is to store the x,y coords of each body part in an array, then each time the snake moves just calculate the new head position, move all entries in the array down a slot, then put the head position in at the top of the array. For example if you have 20,15, 20,16, 20,17, 21,17, 22,17, and the next position is 19,15, then the array becomes 19,15, 20,15, 20,16, 20,17, 21,17.
    Usually the snake moves on a timer, so you'd look to see if any keys are pressed and direct the snake appropriately, remembering the last direction, so that if no keys are pressed you just continue in the same direction until a new keypress signifies a new direction.
     
  3. hkp819

    hkp819 New Member

    Joined:
    Dec 4, 2008
    Messages:
    59
    Likes Received:
    1
    Trophy Points:
    0
    hello friend
    I am harish kumar
    I have a snake game. I am going to post it here. I think it is helpful to you.
     
  4. imported_xpi0t0s

    imported_xpi0t0s New Member

    Joined:
    Jul 18, 2008
    Messages:
    101
    Likes Received:
    0
    Trophy Points:
    0
    That's snakes and ladders. It's not the same as snake. In snake you control a snake up/down/left/right as it works its way round the screen picking up bits of food that make it grow longer, and you lose when you run into (and therefore eat) yourself. There is no winner and only one player, and the only question is how much you can score before you die.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice