Study Guides (390,000)
CA (150,000)
SFU (5,000)
IAT (80)
IAT 167 (20)
Final

IAT167-Map Example.docx


Department
Interactive Arts & Tech
Course Code
IAT 167
Professor
Jack Stockholm
Study Guide
Final

This preview shows page 1. to view the full 4 pages of the document.
Main.as
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
// properties go here
private var O:int = MapBlock.MAPBLOCK_ROAD;
private var W:int = MapBlock.MAPBLOCK_GRASS;
private var blockType:int;
private var mWidth:int = MapBlock.MAPBLOCK_WIDTH;
private var mHeight:int = MapBlock.MAPBLOCK_HEIGHT;
// the overall size should be 16 columns and 10 rows
public static const MAP_ROWS :int = 10;
public static const MAP_COLUMNS:int = 16;
// make an array to hold the pattern
private var mapArray:Array = [W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
O, W, W, W, W, W, W, W, W, W, W, O, W, W, W, W,
O, W, W, W, W, W, W, W, W, W, W, O, W, W, W, W,
O, W, W, W, W, W, W, W, W, W, W, O, W, W, W, W,
O, O, O, W, W, W, W, W, W, O, O, O, W, W, W, W,
W, W, O, W, W, W, W, W, W, O, W, W, W, W, W, W,
W, W, O, O, O, O, O, O, O, O, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W];
// constructor function
public function Main():void
{
drawMap();
}
public function drawMap():void
{
var mapblock:MapBlock;
var row:int = 10;
for (var i:int = 0; i < mapArray.length; i++)
{
blockType = mapArray[i];
You're Reading a Preview

Unlock to view full version