garrettgsb / sooper-maria-sisters

They can do it if they try~
MIT License
0 stars 0 forks source link

Levels from map files #18

Closed garrettgsb closed 6 years ago

garrettgsb commented 6 years ago

I'm not going to spec this out too much because this is really Jeremy's brainchild... But the idea is for levels to be generated from a text grid. One would use mostly just normal qwerty keyboard characters, arranged in a grid, to draw a level layout. The characters would map to whatever the level designer wanted, declared somewhere else in the file. Then, that map file would be passed to the Level constructor, much like we do with level config files now, and the constructor would loop through each character and instantiate the corresponding obj, if there is one. The obj's x,y coords in the level would be based on the character's position in the map.

So something like this:

................
.....ggg........
...........ggg..
..t.............

...With an accompanying legend, which may look something like this:

{
  g: {
    obj: GroundTile
    props: { item: Coin }
  },
  t: {
    obj: Trampoline
    props: { bounciness: 'really really bouncy' }
  }
}

That would create a level with 2 platforms, each 3 blocks long, and a trampoline to get up there.

Notes

(Well, actually just one note)