Computer Science Canada Snake Game Help |
Author: | Phenomena [ Tue Oct 10, 2006 7:55 pm ] | ||
Post subject: | Snake Game Help | ||
Okay I've been learning turing in my grade 11 Computer Engineering class, and as the final project for this unit we have to make a video game. I decided to make a simple snake game. The only problem is, we never learnt how to identify if a character has been pressed, so my question how do i tell if the one of the arrow keys has been pressed. so far for my snake i have this ![]()
its my first application with turing so it may be bit rough >_> |
Author: | neufelni [ Tue Oct 10, 2006 8:42 pm ] | ||
Post subject: | |||
To use the arrow keys you need to use Input.KeyDown. Here is a little program that I wrote to show how to use it.
This tutorial might also help. http://www.compsci.ca/v2/viewtopic.php?t=114 You might also want to go through the Turing Walkthroug. http://compsci.ca/v2/viewtopic.php?t=8808 |
Author: | ericfourfour [ Tue Oct 10, 2006 10:27 pm ] | ||
Post subject: | |||
Here is exactly the same thing that Nick did, except it uses arrays. I thought it would be useful since you will need arrays in your snake game if you want to track where the snake has turned etc.
|
Author: | Phenomena [ Wed Oct 11, 2006 2:16 pm ] |
Post subject: | |
heh thanks guys it helped out alot ![]() now i have to set up the collision... sounds fun >_> |
Author: | ericfourfour [ Wed Oct 11, 2006 8:39 pm ] | ||
Post subject: | |||
In my previous post I wrote in the wrong directions in the comments. It should be:
|
Author: | Phenomena [ Thu Oct 12, 2006 7:46 pm ] |
Post subject: | |
heh thanks to you guys this is almost done. Im just having troubles with the last few things ![]() im actually proud of myself, although ive probably done in this in the most ineffecient way its actually kinda fun and its my first app ![]() |
Author: | Phenomena [ Thu Oct 12, 2006 7:49 pm ] |
Post subject: | |
sorry for double post but i cant edit my last post. anyways maybe you guys could help me with one last thing. I need to create the red (poisnous) apples. But my problem is since the red apples dont disappear, but just add new ones to the board the way I see it id need to have an infinite amount of variables to do that. Which obvisouly wont work ![]() anyways maybe you guys could just point me in the right direction, i wont learn if you guys just give me the code XD |
Author: | ericfourfour [ Thu Oct 12, 2006 8:09 pm ] |
Post subject: | |
You should probably look up flexible arrays (resizable arrays) and types/records. This would be a simple solution. You could have the types hold the data for the apples and the flexible array could hold the data type. If you want to go overboard try using classes (OOP). It will take more than a week or maybe a month to learn how to use classes. Then you have to learn how to use them effectively which will take even longer. |
Author: | Phenomena [ Thu Oct 12, 2006 8:13 pm ] |
Post subject: | |
well since i only have about a week left ill go with the first ![]() thanks |