Open BlastWind opened 3 years ago
1) Gonna self assign myself to this one. Harder than I think. Here's an example problem we need to consider:
2) On map data specification
If the background is completely tile based, here's one way to represent map data:
demoLevel1Data.txt
:
// 2D int array where each int maps to a specific asset
0 0 0 0
0 1 2 0
0 1 2 0
0 1 1 0
In the draw(window)
function specified in the issue description, we specify which asset does each int map to:
switch(integerValue){
case 0:
// dealing with dungeon wall
// so draw the damn dungeon wall
case 1:
// dealing with torches
case 2:
// dealing with statues
...
}
However, what if one asset spans longer than two tiles? What if we want to specify which way the asset is facing in the data? Then, a 2d int array might not suffice. However, we can probably still model the data with a 2d array, just not with a single integer.
Aside: We want to use the flyweight design pattern so that, for example, when we are rendering 100 dungeon basic floor tiles, they are pointing to (and not storing) the same asset in the spritesheet.
Very good article you have there, I like the flyweight idea.
Splitting task into smaller tasks:
Produce:
Links to #16