Add flowchart#20
Conversation
… characters. & layout page. Maybe work on fonts too
| @@ -0,0 +1,97 @@ | |||
| $(function () { | |||
|
|
||
| // Create audio event | ||
| var $soundButton = $('.sound') | ||
| $soundButton.on('click' , playAudio) |
There was a problem hiding this comment.
You may gather eventListeners together with comments.
| $soundButton.on('click' , playAudio) | ||
|
|
||
| function playAudio () { | ||
| document.getElementsByClassName('audio')[0].play() |
| } | ||
|
|
||
| function gameOver () { | ||
| if (totalStepsTakenByP1 >= 100 || totalStepsTakenByP2 >= 100) { whoWon() } |
There was a problem hiding this comment.
no need brackets if you want to do in 1 line.
|
|
||
| // reverse the numbering for even or odd rows. | ||
| $row.each(function () { | ||
| if (Number(($(this).attr('class'))) % 2 === 0) { |
There was a problem hiding this comment.
I expect if we remove Number(), it will still work, why?
| painOrPleasureP2() | ||
| $circle.css("left", "25px") // indicate player2 turn | ||
|
|
||
| if (randomDiceResult === 6) { |
There was a problem hiding this comment.
You may try this later : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator
| startPosition() | ||
|
|
||
| // Using Array to input Snakes & Ladders | ||
| var painAndPleasureArray = [0,'ladder0',0,'ladder1',0,0,'snake0',0,'ladder2',0, //row 1 |
There was a problem hiding this comment.
If we try this with Object, how we can do this?
| ,'ladder9',0,'snake6',0,'snake7',0,0,0,'snake8',0] //row 10 | ||
|
|
||
|
|
||
| // Player 1 Snakes & Ladders |
There was a problem hiding this comment.
The two functions are looks very similar. How can we merge the functions into one painOrPlearsure? Refactor this will be helpful to you.
Hint : you can use parameters for functions.
|
Project Workflow: 4 / 5 GlowThe auto-generation logic of game board, sexy music. GrowYou may use parameters for functions, it will help you to reduce some repetition. Things to look forKeep practicing :) - Handling functions, CSS. |
| var $dieButton = $('.dieButton') | ||
| var $dieValue = $('.dieValue') | ||
| $dieButton.on('click', rollDice) | ||
|
|
There was a problem hiding this comment.
Is "dieButton" a spelling error? Might want to change it to $diceButton
| } | ||
|
|
||
| function whoWon () { | ||
| if ((totalStepsTakenByP1 >= 100)) { |
There was a problem hiding this comment.
Why is there a double (( )) here and in line 82?
|
|
||
| .bg { | ||
| background-image: url("../images/bg4.jpg"); | ||
| height: 100%; |
There was a problem hiding this comment.
might want to specific that width shall be 100%
|
|
||
| .container { | ||
| border: 1px solid red; | ||
| max-width: 1500px; |
| <div class="wrapper2"> | ||
| <div class='top-row right-section'> | ||
| <img class='gold' src="./assets/images/gold.png" alt="gold image"> | ||
| <button class="sound" type="button"><img src="./assets/images/sound.png" alt ="auto play"></button> |
There was a problem hiding this comment.
Might want to explain how your button works to the user
| <div class='top-row right-section'> | ||
| <img class='gold' src="./assets/images/gold.png" alt="gold image"> | ||
| <button class="sound" type="button"><img src="./assets/images/sound.png" alt ="auto play"></button> | ||
| <button class="resetButton" type="button"><img src="./assets/images/reset.png" alt ="reset Button"></button> |
There was a problem hiding this comment.
Might want to explain how your button works to the user
No description provided.