tamitchell / simple-game

0 stars 0 forks source link

Feedback #1

Open dmc2015 opened 6 years ago

dmc2015 commented 6 years ago

You could make this more readable by adding the content of the element on its own line



<button id="attackbtn" class="herobtn" onclick="attack(this.id);">Attack</button>


<button id="attackbtn" class="herobtn" onclick="attack(this.id);">
   
 Attack

</button>




good work implementing scss, I am curious about what this line was doing in your main.css. Really I am curious about the whole file in general.
 content: "Errno::ENOENT: No such file or directory @ rb_sysopen - main.scss"; }


main.js


you have good comments, they look like they are mostly for your development process and not necessarily to explain the code because they are all at the top. This is good when you are trying to break down the problem but now you should add comments directly related to your code and clean this up.




you have a lot of selectors at the top, you could abstract these to a module.

module.exports = {

 selectElements() {

 // create an object with the same names as your variables but for properties
 // return that object in this method
 // include and call this module and function in your main.js file and set it equal to a variable
 }
}



then your variable has all the properties that you have set



‘pausePlay’ & ‘gameReset’ is dead code, it doesn't do anything







thanks for citing the toggleSprite function

you could improve on it with



sprite.scrsrc2 = (spriteSrc === src1)? src2 : src1



you should remove the console.logs



for each player attack the opponent also attacks, it might be better if you mix the opponent actions up with defensive options and attacks selected randomly on an interval. Otherwise I think it is challenging to win.

Also, right now Goku can't win

.


Most of the code is good and the functions are a good length, there isn't a lot of nested logic which is also very good.



About Code Design: So think about actions that recur on a regular basis, think about relating the game to the real world.



If your game were real what features/characteristics would have properties?



Goku has health, attacks, he can be defeated. Those are some of Goku’s attributes.



The same could be said for Ryu.



What is an action that recurs through out the game, attacks, checking the health of characters, defensive moves, sprites that change.



You can structure anything that has properties to it or that will be recurring/used frequently in to an object/class.

Anything that is used frequently could also just be used in a function.



Here is a structure that I like and may seem familiar


Classes or Modules and Features of them/properties


Arena
 Goku 
Ryu 
Attacks
 Utilities
-health check
-sprite management
-logging/user communication





 
 



dmc2015 commented 6 years ago

please let me know if you have any questions.

Also this project is not passing. Do you check/see the note in garnet? You need a readme to pass. Please add one to the master branch and gh-pages

dmc2015 commented 6 years ago

@tamitchell gave you feedback