From 87b80d30d8abb42771adf510770fae0767743d2a Mon Sep 17 00:00:00 2001 From: Mathieu Date: Tue, 31 Mar 2020 16:30:07 +0200 Subject: [PATCH] Description of textures added --- assets/style.css | 1 + index.html | 1 + script.js | 27 ++++++++++++++++----------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/assets/style.css b/assets/style.css index 2dc5457..0888660 100644 --- a/assets/style.css +++ b/assets/style.css @@ -72,4 +72,5 @@ canvas { img { height: 50px; width: 50px; + margin: 2px; } \ No newline at end of file diff --git a/index.html b/index.html index 4a14861..c6c4f76 100644 --- a/index.html +++ b/index.html @@ -38,6 +38,7 @@

Know everything about the different blocks :

+

(Put your mouse over a texture)

Food :
diff --git a/script.js b/script.js index b71b9c7..311b096 100644 --- a/script.js +++ b/script.js @@ -83,31 +83,36 @@ const scoreTarget = byId("scoreTarget") // Get map texture const imgGrass = new Image(); -imgGrass.src = './assets/map/grass.png'; +imgGrass.src = './assets/map/grass.png' +imgGrass.title = "It is just grass.." const imgIce = new Image(); -imgIce.src = './assets/map/ice.jpg'; +imgIce.src = './assets/map/ice.jpg' +imgIce.title = "Ice is a slippery slope.. You can not turn on it !" // Get wall texture const imgWall = new Image(); -imgWall.src = './assets/wall/wall.jpg'; +imgWall.src = './assets/wall/wall.jpg' +imgWall.title = "It is a brick wall.. Do not try to destroy it with your snake !" // Get food texture const imgApple = new Image(); -imgApple.src = './assets/food/apple.png'; +imgApple.src = './assets/food/apple.png' +imgApple.title = "Food is food, go get the apple !" const imgCherry = new Image(); -imgCherry.src = './assets/food/cherry.png'; +imgCherry.src = './assets/food/cherry.png' +imgCherry.title = "Do you want to eat some cherries ? Too bad, it is not in the game for now..." // Get snake texture let imgSnakeHeadUp = new Image(); -imgSnakeHeadUp.src = './assets/snake/snake_head_up.png'; +imgSnakeHeadUp.src = './assets/snake/snake_head_up.png' let imgSnakeHeadLeft = new Image(); -imgSnakeHeadLeft.src = './assets/snake/snake_head_left.png'; +imgSnakeHeadLeft.src = './assets/snake/snake_head_left.png' let imgSnakeHeadRight = new Image(); -imgSnakeHeadRight.src = './assets/snake/snake_head_right.png'; +imgSnakeHeadRight.src = './assets/snake/snake_head_right.png' let imgSnakeHeadDown = new Image(); -imgSnakeHeadDown.src = './assets/snake/snake_head_down.png'; +imgSnakeHeadDown.src = './assets/snake/snake_head_down.png' const imgSnakeBody = new Image(); -imgSnakeBody.src = './assets/snake/snake_body.png'; +imgSnakeBody.src = './assets/snake/snake_body.png' /** @@ -135,7 +140,7 @@ function showRulesScreen() { wallList.appendChild(imgWall); // Display map texture - mapList.appendChild(imgGrass); + mapList.appendChild(imgGrass) mapList.appendChild(imgIce); }