# This a weird thing but ✨yuh✨

**URL:** https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977
**Category:** Show & Tell
**Tags:** game
**Created:** [March 24, 2021, 9:56pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977 "2021-03-24T21:56:46Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Local\_momo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/local_momo/32/3598_2.png) [@Local\_momo](https://forum.makecode.com/u/Local_momo)
#### Post date: [March 24, 2021, 9:56pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/1 "2021-03-24T21:56:47Z")

</div>

> **[game](https://arcade.makecode.com/89015-28416-23357-86047)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

tell me whatcha thing

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [March 24, 2021, 10:24pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/2 "2021-03-24T22:24:51Z")

</div>

😕 There is an error:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/402d9a9a9799cafa7618e890238dac03e61e7670.png)

---

<div class="post-metadata">

### Author: ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)
#### Post date: [March 24, 2021, 10:56pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/3 "2021-03-24T22:56:18Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/e/ebb1923c390d557bedd4efc83f4dbf88104d96c9.png)

---

<div class="post-metadata">

### Author: ![Local\_momo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/local_momo/32/3598_2.png) [@Local\_momo](https://forum.makecode.com/u/Local_momo)
#### Post date: [March 25, 2021, 3:36pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/4 "2021-03-25T15:36:56Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)
#### Post date: [March 25, 2021, 4:33pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/5 "2021-03-25T16:33:32Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Local\_momo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/local_momo/32/3598_2.png) [@Local\_momo](https://forum.makecode.com/u/Local_momo)
#### Post date: [March 26, 2021, 4:20pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/6 "2021-03-26T16:20:23Z")

</div>

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”

---

<div class="post-metadata">

### Author: ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)
#### Post date: [March 26, 2021, 5:00pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/7 "2021-03-26T17:00:50Z")

</div>

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

> **[game](https://arcade.makecode.com/30895-24271-76095-29416)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

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](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/c/cbcf1d331af4520021b06e5855ae19e108346ac8.png)

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/87ab0d2149d9b541594dbc9465148d08bc0e0d48.png)

@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 ☹

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [March 26, 2021, 5:09pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/8 "2021-03-26T17:09:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Local\_momo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/local_momo/32/3598_2.png) [@Local\_momo](https://forum.makecode.com/u/Local_momo)
#### Post date: [March 27, 2021, 3:13pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/9 "2021-03-27T15:13:24Z")

</div>

> **[game](https://arcade.makecode.com/26628-68562-50599-65529)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I found a way to get the tilemaps to switch regularly

---

<div class="post-metadata">

### Author: ![Primal\_Nexus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/primal_nexus/32/3540_2.png) [@Primal\_Nexus](https://forum.makecode.com/u/Primal_Nexus)
#### Post date: [March 29, 2021, 12:55am UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/10 "2021-03-29T00:55:46Z")

</div>

@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

---

<div class="post-metadata">

### Author: ![Local\_momo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/local_momo/32/3598_2.png) [@Local\_momo](https://forum.makecode.com/u/Local_momo)
#### Post date: [March 31, 2021, 3:52pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/11 "2021-03-31T15:52:53Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Primal\_Nexus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/primal_nexus/32/3540_2.png) [@Primal\_Nexus](https://forum.makecode.com/u/Primal_Nexus)
#### Post date: [March 31, 2021, 7:23pm UTC](https://forum.makecode.com/t/this-a-weird-thing-but-yuh/6977/12 "2021-03-31T19:23:59Z")

</div>

No problem, I just thought it was a glitch
