HTML and CSS Reference
The setting.js file
The setting.js file is useful to store constants of the game. For example, it can be
We will use class to represent which type of ile an HTML is. Someimes, we can use the
HTML5 data- atribute to embed element-speciic data. For example, the following HTML
represents a gold coin object having an amount value of 50 :
<div class='gold coin' data-amount='50'></div>
Keep in mind that we put a lot of effort to separate logic, data, and view. The following figure
shows how different parts are separated; data, view, and the logic controlling these parts.
Separaing the data and view helps make our code easier to maintain:
deine how they look there. All visual properies are deined in CSS.
As a DOM element-oriented game, HTML is where we define the game objects—scenes,
player, iles, and the user interface.
CSS is the visual part of these elements. It deines the visual look, dimension, and posiion
of the elements.
and updates the game objects.