logo

 

     
 
BW2 Home
BW2 Site Map
BW2 Popular Articles
BW2 Search
Using This Site...
 
 
Bitwise Home
 
 
 

rss

 
 

ruby in steel

hostgator

 

ActionScript

Latest addition : Wednesday 11 March 2009.

This section's articles

Adventures in ActionScript - part two

Wednesday 11 March 2009 by Huw Collingbourne

This series explains how to use ActionScript - the language behind Adobe’s Flash graphics and Flex framework - to program an adventure game. In part one, I created a simple ‘map’ which was an ‘associative array’ (a ‘hash’ or ‘dictionary’ of key-value pairs) containing user-defined Room objects. Each room had ‘exits’ which took the form of strings (each string being the name of an ‘adjoining’ room). This string was used as a key into the ‘map’ to locate a room with the matching name.

In principle, I might just as easily have used a simple array or rooms indexed from 0 to 9 (say) to represent a map of ten rooms). Each ‘exit' could then have been an integer - so if the North exit were 1 that would mean it leads into the room at index 1 in the array. Using string keys instead of integers made the map a bit more easily readable but, essentially, moving from one location to another still required me to obtain a value (e.g. the string at exit N) and then use that value (...)
- more...



More...

Adventures in ActionScript - part one

Saturday 28 February 2009 by Huw Collingbourne

ActionScript 1 - Associative Arrays

Monday 13 October 2008 by Huw Collingbourne


Home