This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

chiefnoah
chiefnoah presents ...

2012/5/3

Snake

Remake of the classic arcade game Snake.

*Use the arrow keys to controll your snake


*Eat the red dots (food)

*Don't eat yourself or eat the wall

26555 views / 62 in the last 7 days

3 votes | 0 in the last 7 days

Tags: game with-source

open in greenfoot
Your browser does not support the canvas tag.
A new version of this scenario was uploaded on Fri May 04 01:32:05 UTC 2012 *Progressive difficulty: every time you eat a piece of food, the snake moves faster. *Bug fixes
SwedishsamSwedishsam

2012/5/4

I'm doing a similar game as a school project, but i am in need of code to make the food spawn randomly on the map over and over again as i eat it. As of now i can only get the food to spawn over and over again in the same place.
chiefnoahchiefnoah

2012/5/4

Here's an example from my code: public void placeFood(int amountOfFood) { for (int i = 0; i < amountOfFood; i++) { addObject(new Food(), Greenfoot.getRandomNumber(59)+1, Greenfoot.getRandomNumber(39)+1); } }
chiefnoahchiefnoah

2012/5/4

Here's an example from my code: public void placeFood(int amountOfFood) { for (int i = 0; i < amountOfFood; i++) { addObject(new Food(), Greenfoot.getRandomNumber(59)+1, Greenfoot.getRandomNumber(39)+1); } }
A new version of this scenario was uploaded on Fri May 04 14:01:07 UTC 2012 *Published source code
jabirfatah91jabirfatah91

2012/11/18

Hi does your snake consist of two body segments from the game starting?
chiefnoahchiefnoah

2012/11/19

Each body segment (the size of the head) is an individual object. I created an array of those objects, and when the snake moves, an object gets the location of the body part that was 1 place before it in the array.
Denver005Denver005

2016/8/12

can i please have all of your codes :( i need help for my game project :(
hmphrydmphyhmphrydmphy

2016/8/12

HAHAHA :D BOSS DENVER
newbie installation problem: I am running the latest Greenfoot 3.5.1 but it fails to open the snake game: the world could not be constructed. The world subclass may not have a public constructor without parameters, or may not be public.

See all comments

Want to leave a comment? You must first log in.

Who likes this?

chiconese Flo6723 Firewall