@richard, could you please add switch statements to block coding? it simplifies things like having many tilemaps, so that somebody isnt doing
if (a==1) {
} else if (a==2) {
} else if (a==3) {
} else…
but instead:
switch (a) {
1:
2:
3:
4:
…
@richard, could you please add switch statements to block coding? it simplifies things like having many tilemaps, so that somebody isnt doing
if (a==1) {
} else if (a==2) {
} else if (a==3) {
} else…
but instead:
switch (a) {
1:
2:
3:
4:
…
You could just put the tilemaps in an array and then they would all be in order with less code like you’re wishing for.
Wait, that’s a thing?
Yup! Most C-style language have a switch() statement, JavaScript and TypeScript included. Useful … but not as widely used as it probably should be, perhaps because the syntax is a bit quirky.
I’m my game that I’m making, each “case” has a tilemap and something to set the platform speed, player start, etc. that would make it harder to make an array