image Tutorial on Describing Setting 3 - Map

image image In addition to placing characters through text, you can also place them using a map. The canvas is a 600 pixel by 600 pixel area. The map divides the canvas into 20 by 20 blocks, each of which is 30-pixel by 30-pixel squares. Each of our characters is roughly that size.

For example, consider the map shown on the right and its corresponding canvas next to it. The initial positions of carrots, rabbit, foxes, and spinstars are explicitly specified in the map and they are drawn on the canvas according to the grid positions. (Both foxes have moved a bit from their initial position when the image is taken) Each character is represented by a letter. For example, 'r' for rabbit, 's' for spinstar, etc. '-' is used to represent blank spaces. Note that you can also place walls (w) in your map. For the full chart of GameChangineer characters and their corresponding letters, click 'Show/Hide Map Keys' on the game page.


Try it yourself: Try placing different characters in the map textbox on the main website, then click "Execute" near the bottom of that page to generate the code for your game plan. If there are no typos and everything is understood, click the button at the bottom to see your code in action!

Quiz: What is the difference between 'w--w' and 'w w' in the map? (That is, what is the difference between '-' and space ' ' in the map?)


Programming Concepts (optional material):
Computer graphics, images created using a computer, play an essential role in video games. There is a canvas on which the characters are displayed. In computer graphics, the canvas is made up of many pixels, each of which is a small dot on the screen. We can theoretically color each pixel on the canvas using the Red, Green, Blue (RGB) color model. Likewise, we can position each character at a specific position on the canvas.

Each pixel has an x,y-coordinate. The grid is organized such that the origin, or (0,0), is at the upper left corner of the canvas. The x-coordinate values increase as we move right, and the y-coordinate values increase as we move down.

Data structures are what we use to organize data. In general, data structures are used to hold the attributes of an object. Simple data structures are sufficient to represent attributes such as if the object is dead or not. More sophisticated data structures are especially useful to represent more complex attributes, such as the x and y coordinate-pairs of each object, etc. Complex data structures can even hold a heterogeneous set of attributes for the object.



Next page

Tutorials Home