1 decade ago by Imran
I'm currently building a side scroller game where the level is generated dynamically as the player progresses.
The way I have it set right now is if the player reaches a certain distance away from the middle of the previous level "chunk" a new chunk is generated on the next screen as he progresses forward (the player can only move from left to right, not from right to left).
I've basically tried doing this by doing something like this:
The problem is, I don't think the data object can take the variable thischunkstart - does anyone have any suggestions of a better way to do this?
And let me also apologize for how terrible my programming is, I'm still learning here!
The way I have it set right now is if the player reaches a certain distance away from the middle of the previous level "chunk" a new chunk is generated on the next screen as he progresses forward (the player can only move from left to right, not from right to left).
I've basically tried doing this by doing something like this:
LevelTest.layer[2].data[this.nextchunkstart][2]=3;
The problem is, I don't think the data object can take the variable thischunkstart - does anyone have any suggestions of a better way to do this?
And let me also apologize for how terrible my programming is, I'm still learning here!