# Rainbow Snake (one more Snake Game 🌈 )

**URL:** https://discourse.processing.org/t/rainbow-snake-one-more-snake-game/15624
**Category:** Gallery
**Created:** [November 18, 2019, 10:13pm UTC](https://discourse.processing.org/t/rainbow-snake-one-more-snake-game/15624 "2019-11-18T22:13:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![LittleBoxes](https://avatars.discourse-cdn.com/v4/letter/l/ee59a6/32.png) [@LittleBoxes](https://discourse.processing.org/u/LittleBoxes)
#### Post date: [November 18, 2019, 10:13pm UTC](https://discourse.processing.org/t/rainbow-snake-one-more-snake-game/15624/1 "2019-11-18T22:13:27Z")

</div>

Hello,

Here is another version of the classic Snake made with p5js.

[Rainbow Snake](http://www.coffeegame.fr/rainbowsnake/)

Spacebar to skip the title screen and the movements are done with the arrows  
It works on the phone by touching the top, bottom, right and left of the screen to move.

I intend to add small improvements to the gameplay with some options and bonus

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [November 19, 2019, 9:12am UTC](https://discourse.processing.org/t/rainbow-snake-one-more-snake-game/15624/2 "2019-11-19T09:12:34Z")

</div>

Nice. Maybe you want to make an adaption for different screen sizes on my phone (1080x1920 pixels density 441ppi) it doesn’t fit.

---

<div class="post-metadata">

### Author: ![LittleBoxes](https://avatars.discourse-cdn.com/v4/letter/l/ee59a6/32.png) [@LittleBoxes](https://discourse.processing.org/u/LittleBoxes)
#### Post date: [November 19, 2019, 12:35pm UTC](https://discourse.processing.org/t/rainbow-snake-one-more-snake-game/15624/3 "2019-11-19T12:35:17Z")

</div>

Yes good idea ! I will try it !

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [November 19, 2019, 5:05pm UTC](https://discourse.processing.org/t/rainbow-snake-one-more-snake-game/15624/4 "2019-11-19T17:05:55Z")

</div>

```
eat(food) {
	if (food.x == this.snake[0].x && food.y == this.snake[0].y) {
		return true;
	} else {
		return false;
	}

```

I can’t eat the food. Sometimes my snake’s center is at the corner of the food. Sometimes it is midway on an edge of the food.

---

<div class="post-metadata">

### Author: ![LittleBoxes](https://avatars.discourse-cdn.com/v4/letter/l/ee59a6/32.png) [@LittleBoxes](https://discourse.processing.org/u/LittleBoxes)
#### Post date: [November 19, 2019, 8:13pm UTC](https://discourse.processing.org/t/rainbow-snake-one-more-snake-game/15624/5 "2019-11-19T20:13:11Z")

</div>

@TfGuy44 I saw this problem playing in landscape mode. Is this the case for you ?

@noel It’s strange. With such a resolution, the game should fit. The canvas adjusts itself to the size of the browser. The title take 704px.  
For canvas auto-adjustment I use `window.innerWidth` and `window.innerHeight`. It may be a compatibility problem that causes this… Is there another way to use the full page ?

---

<div class="post-metadata">

### Author: ![LittleBoxes](https://avatars.discourse-cdn.com/v4/letter/l/ee59a6/32.png) [@LittleBoxes](https://discourse.processing.org/u/LittleBoxes)
#### Post date: [November 19, 2019, 8:50pm UTC](https://discourse.processing.org/t/rainbow-snake-one-more-snake-game/15624/6 "2019-11-19T20:50:12Z")

</div>

> [@TfGuy44](#):
>
> I can’t eat the food. Sometimes my snake’s center is at the corner of the food. Sometimes it is midway on an edge of the food.

It’s now fixed 😉
