Build a SNAKE Game from Scratch with HTML, CSS and JS!

  Рет қаралды 616

CST Tips

CST Tips

Күн бұрын

Пікірлер: 2
@SimonMcclurg
@SimonMcclurg Ай бұрын
Very cool. You might want to update placeFood with a validation loop to check if the food coincides with any part of the snake function placeFood() { let isOnSnake = true; while (isOnSnake) { food.x = Math.floor(Math.random() * (boardSize / 20)) * 20; food.y = Math.floor(Math.random() * (boardSize / 20)) * 20; // Check if the food position overlaps with any part of the snake isOnSnake = snake.some(segment => segment.x === food.x && segment.y === food.y); } }
@CST-Tips
@CST-Tips Ай бұрын
Thanks for the suggestion! I'll definitely consider adding that feature in a future update.
BUILD Your Own Unique Button with HTML and CSS!
8:37
CST Tips
Рет қаралды 53
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
Make a Amazing Loading Spinner with JUST HTML and CSS!
5:12
Build a Classic Brick Breaker (Breakout) Game with Phaser JS - Full Tutorial
10:58
CREATE a Magic Mood Switch Button with HTML, CSS & JS!
13:29
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН