Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Manic

I'm making a game with a randomly-generated level. I looked at Drop and saw how you can change the level on the fly, but I've been wondering whether you can resize the level on the fly. Otherwise I'm going to pre-generate the whole level, which is fine, but it'd be cool if you could resize the map without having to redeclare it.

That last part--I know you can re-make the collision and background maps by redeclaring them and getting rid of the old ones, but how would that fare performance-wise, especially if you are making fairly large levels at the end?

1 decade ago by Joncom

You can modify levels on the fly if you want to.

// How to change the tile located at x, y.
backgroundMap.data[y][x] = newTile;

// How to change the map width and height.
// (Make sure that you add data if you increase the size!)
backgroundMap.width = newWidth;
backgroundMap.height = newHeight;

Performance-wise, give it a try and see, because I'm not sure.
Page 1 of 1
« first « previous next › last »