levelGeneration


to make the multiple levels i drew up textures for each level which i assigned to an  array of pictures.

levels in the game in texture form a green pixel being the "playerSpawnPoint",  a red pixel being an "enemySpawn",   black being a wall tile, as shown below

level1       

then using the texture referanced by levelnumber in the levelMapsTexture array i check pixel by pixel and spawn in the charactors in adding in ememys on the red pixels and setting the player position to the green pixel.  the world being scaled so that every 16 pixels is one unit which is the width and height of the tiles and charactors i am using 


i pass the texture to the worldGeneration script, which at first i wanted to randomly generate textures for me which i, not wanted to clutter up the main script made a seperate cs file to do that in. I  had a certain ruleset for how lines should be placed  as i want it to feel like a maze with no 2 block wide paths, that combined that the walls need to be 2 tiles thick in order for the rule tile to generate them properly. lead me to droping that "feature".  

 Anyway passing the texture through i checked each pixel of the texture again if it was black i assigned the ruletile to the tilemap at the assosiated coordanates. leaving the rest clear. this allows the bricks to wrap around the walls of the maze. 


if you are interested in ruletiles this it how i first found out about it, its pretty good at making tilebased games actually look good without the effort of manual placing tiles or just doing a big image and i use it in most of my games. 

anyway that about all for the world generation 

if you have any questions to do with this method of levelGeneration feel free to ask. 

Files

build1.0.zip Play in browser
Oct 29, 2019

Get PatMan

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.