spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column46


A DOM-Based Snakes Game, Part I (2)

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

The Game Architecture

The architecture of the game board is based on the DIV container (see sketch below). This container includes 299 HTML tags, numbered 0 to 298. The tag types are also shown in the sketch below. The board is divided into several areas. The right most column is the <BR> column. This column's tags simulate a "new line" at the end of every row. The other 286 tags are <IMG> tags and constitute the game's visible board. The visible board is surrounded by a border that includes its outer images. (See the hashed images in the sketch below.) The images inside the border constitute the core of the board and is where the action takes place. The core includes 220 images, arranged in 11 rows of 20 images each. Every image on the board can be found by its row and column numbers. There are 23 columns, numbered 0 to 22. Likewise, there are 13 rows, numbered 0 to 12. The border includes columns 0 and 21, and rows 0 and 12. Column 22 is the <BR> column. As you can see from the sketch below, each image is also accessible as an element of a single array that includes all the images, numbered 0 to 298. We'll show you later in this column how to convert a row-column coordinates to a single array indexing.

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Created: August 16, 1999
Revised: August 16, 1999

URL: http://www.webreference.com/js/column46/architect.html