Computer Science Canada How do you use turing to make a snake eat things game |
Author: | tangaora [ Thu Oct 28, 2010 7:55 pm ] |
Post subject: | How do you use turing to make a snake eat things game |
i just need someone show me the first part how to start.... i do not have any idea how to start this thing... |
Author: | zero-impact [ Fri Oct 29, 2010 1:40 am ] |
Post subject: | RE:How do you use turing to make a snake eat things game |
You could start by making a very simple game, where all you do is move a circle around on a screen and catch other circles.That is how I started when I made this type of game. From this you can implement a system where you create additional circles that follow the "head". For the "things" that you want the snake to eat, you could simply pick a random location on the screen and store that position. When the snake head comes within a certain distance of this point, make the snake bigger, and pick a new point to place the "thing". This is just a very general conceptual outline. I'm not sure what your programming ability is, so it is hard to know what exactly it is you need help with. If you have absolutely no idea how to start, you might want to take a look at some of the graphics tutorials in the next forum over. |
Author: | copthesaint [ Fri Oct 29, 2010 9:07 am ] | ||
Post subject: | Re: How do you use turing to make a snake eat things game | ||
Want a start?
There thats a start. lol. Sadly I think you wont understand it all... No offence, its just your lack of a logical description |
Author: | DanShadow [ Fri Oct 29, 2010 9:44 am ] |
Post subject: | RE:How do you use turing to make a snake eat things game |
Hahahaha, copthesaint thats classic. [UPDATE]: Also, assuming this is a school assignment you should have been given notes on how to do all of this already. If you dont understand some of the programming concepts needed to do this project, I would recommend asking your teacher for help, or asking specific questions here ![]() On a serious note, start by brainstorming. - What kind of information do I need for this project? .. - I need to hold how long the snake is (how many links) .. - I need to hold the coordinates for each link of the snake .. - I need to hold an xy coordinate for the current 'thing' to be eaten There's a simple start. Create an integer to store how many links are currently in the snake. Create a multi-dimensional array (or a couple arrays) to hold the xy values of each link of the snake (Note: using a tile-based drawing system will probably make this easier if you know how to do it) Create a loop Inside said loop, create procedures to (a) draw your snake, (b) draw the "thing" to be eaten, (c) check if your snake has gone outside the bounds of your window, (d) do a bound check to determine if the head of your snake has collided with the "thing" to be eaten, then add a link to the snake and create a random xy coordinate for the new "thing" to be eaten. Hint for doing snake links: Every time your snake "head" moves, set the next link in your xy coordinate array equal to the link above it. (example, if head is [0] in the array...) //snakeLink[link][x,y] = coordinate; snakeLink[0][0,0] = new moved coordinate snakeLink[1] = snakeLink[0] snakeLink[2] = snakeLink[1] ... snakeLink[n] = snakeLink[n-1] (pseudo-code btw, I dont use Turing anymore) Anyway... there is more than enough to get you a good headstart. If you have any specific questions with issues your having developing this application, please feel free to ask. Good luck! |