HTML and CSS Reference
In-Depth Information
The World Object
The world object contains just the necessary information to create the world the camera will
scroll around on and display to the user. The actual world is never shown to the user as a vis-
ible object:
world . cols = 15 ;
world . rows = 15 ;
world . tileWidth = 32 ;
world . tileHeight = 32 ;
world . height = world . rows * world . tileHeight ;
world . width = world . cols * world . tileWidth ;
world . map = [];
The cols and rows depict the entire size of the world, and the tileHeight and tileWidth
values are used in calculations when determining the camera position and painting the world
tiles to the Camera. The height and width are calculated from the first four values, and the
map array is filled in with the map data we examined previously.
Search WWH ::

Custom Search