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