This a weird thing but ✨yuh✨

tell me whatcha thing

:confused: There is an error:

Hm, yeah, it looks like something is missing in this comparison so it’s failing to compile:

image

2 Likes

hmm, I’m trying to figure out how I can have tilemaps change, and I want there to be multiple levels too, so I thought maybe using variables would work?

Right, that sounds like a good idea - the issue here is that it’s comparing the current tilemap to 0, and the code is getting mad as it doesn’t think those two things can be compared. What exactly are you trying to do there? It looks like you might want it to say “if the current tilemap is the first one and you touch a green orb, teleport to the red orb” or something similar to that?

1 Like

the compare to equal to zero was actually an accident on my part that I thought I fixed before posting! my original idea was “if current tilemap is equal to tilemap1 then”

2 Likes

Nice nice, I did a small update to make it work like that:

If that looks good to you I can update the original post with it so it doesn’t look broken at first~

There’s one confusing bit about blocks / javascript / most languages when comparing things that I had to work around, which is that the equality comparison there doesn’t quite work for tilemaps like you would hope – the tilemap block you had in there creates a new tilemap each time it is called (similar to the sprite create block) and the equality equality check checks if it is the exact same thing – like if it were a house, it checks if the address is the same, not if the house looks the same. That means dropping the tilemap level 1 block in the equality check there doesn’t work. To make it work I used an array to store the different levels, so you can point at the exact level you want and say ‘is the current tilemap this tilemap’:

image

image

@richard just to double check, in the current tilemaps extension there is no loose equality check for tilemaps right? I guess it probably wouldn’t work consistently anyways as you’ll often at least change one wall / tile at runtime :frowning:

1 Like

It doesn’t do deep equals, but it should always work with reference equality. You can use == in most cases.

I found a way to get the tilemaps to switch regularly

2 Likes

@Local_momo on level 3 the checkpoint at the end won’t take you to the next level- instead the lava under the checkpoint kills you

yeah, I haven’t gotten to that point yet, sorry!

No problem, I just thought it was a glitch