views:

16

answers:

2

Really basic question here: I'm trying to do a 2D top-down Zelda type game. I have two symbols defined for vertical and horizontal walls, with four instances of each. I also have four symbols defined for north, south, east and west doors, with accompanying classes for all of these symbols.

My question is, am I doing this wrong? Can I get by with just one "wall" symbol, and rotate it into vertical and horizontal positions? Do I only just need one "door"?

Now that I'm getting into coding, I'm not sure how I'm supposed to handle 2-3 different classes for wall objects and 4 different classes for doors, which leads me to think I'm doing it wrong.

A: 

However many symbols you use for your tiles is pretty much up to you.

A top-down perspective will let you get away with using the same tile for a door and just rotating it 90 degrees depending on it's orientation. If you're doing the sort of angled top down you will need different tiles altogether.

What you should do is have one Door class and have that deal with which symbol to use internally. That way you simply add a door, potentially with an argument that defines direction and have your class work that out.

You should not have four Door classes, one for each orientation. That will just complicate things.

grapefrukt
A: 

Why not define one symbol in Flash and put your different views of your wall in different frames. Name the Frames and after that you simply change the perspective with gotoAndStop("north") or gotoAndStop("south"). Don't forget to call the stop()-function at first frame.

Tobias Kun