Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Snake game ( separate snake body ) Reply To: Snake game ( separate snake body )

#146000
Kuzyo
Participant

Want to ask you about structure of your JS code, how do you structure your code? Do you have special pattern?. After writing something more complex my code become more messy. I tried to find more info about organazing JS code. I read this article of Chris https://css-tricks.com/how-do-you-structure-javascript-the-module-pattern-edition/ . Very interesting idea about settings object where you “cached” all important DOM elements. But I don’t really understood ( maybe you could explain )- I need only one such settings object for whole game (in context of Snake game) or it better to have such “setting” object for every big object in a game?