So I am making a game with 2D terrain generation...
My method for generating the map is pretty simple. I have a line of 16x16 dirt tiles that line the "top" of the map. Each one will spawn a new block 16 pixels below that until it reaches Y=0. An invisible actor randomly spawns objects that change parts of the ground into things like ore and caves.The problem is, I want it to be a fairly tall map, if fairly narrow. With a scene size of 320x1280 and squares filling most of the map, framerate already drops considerably. I want it to be a sort of "infinite runner" where you dig downward.
I was thinking I could make the dirt tiles destroy themselves if they got above a certain height above the player. So I constrained the player's self.position.Y to a game attribute called miner Y. The dirt should destroy itself when self.position.y is greater than miner Y + 320. It doesn't seem to work. I tried putting it under a timer (to be changed later) to see if it was only activating one time. No luck.
The other issue is I only want dirt to spawn 320 pixels below the miner, so that the scene will not be filled with dirt all the time. So, similarly, I changed the dirt's behavior to say: if self.position.y > miner Y-320 then spawn dirt below it. It also does not work and either does not spawn any dirt below the initial layer or fills the whole scene like usual, depending on how I word the statement.
If someone could help me to make it so that dirt a certain distance above the miner destroys itself while new dirt only spawns a certain distance below the miner, that would be greatly appreciated. Thanks in advance!