# Function Imposters: A coding challenge

**URL:** https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525
**Category:** Collaboration
**Tags:** extension, make, game
**Created:** [November 18, 2025, 12:42am UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525 "2025-11-18T00:42:13Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)
#### Post date: [November 18, 2025, 12:42am UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/1 "2025-11-18T00:42:13Z")

</div>

Welcome… to

# FUNCTION IMPOSTERS!

What is all this about?

Well it centers around the function category

What I want YOU to do is to create functions that mimic the blocks that you’re trying to replicate

There’s only 2 rules:

- You cannot use the block your trying to replicate in your function.
- No outside code: Everything related to the function is inside the function definition, NOTHING OUTSIDE OF IT.

For example, here’s my flawed attempt at replicating the

```auto
controller.moveSprite(sprite, vx, vy)

```

block:

> **[Function-Imposters-Attempt](https://arcade.makecode.com/80097-19479-58815-69550)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

(The red one uses the function, the blue one uses the actual block.)

So yeah

Also you can use extensions

GET TO CODING!!!

---

<div class="post-metadata">

### Author: ![Archer\_Bright](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/archer_bright/32/32896_2.png) [@Archer\_Bright](https://forum.makecode.com/u/Archer_Bright)
#### Post date: [November 18, 2025, 3:34am UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/2 "2025-11-18T03:34:16Z")

</div>

I hate myself for doing this but…

AMONG US

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [November 18, 2025, 3:42am UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/3 "2025-11-18T03:42:29Z")

</div>

This is neat! I’ll release all my solutions but everyone should try their hand at this before looking at other peoples’ solutions!  
(I’ll use blocks too, just to keep things fair… ish…)

---

<div class="post-metadata">

### Author: ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)
#### Post date: [November 18, 2025, 5:42pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/4 "2025-11-18T17:42:58Z")

</div>

Absolutely intended

_Vine boom x69_

---

<div class="post-metadata">

### Author: ![Iro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iro/32/34749_2.png) [@Iro](https://forum.makecode.com/u/Iro)
#### Post date: [November 18, 2025, 5:44pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/5 "2025-11-18T17:44:54Z")

</div>

Okay so I know you probably didn’t mean it like this, but it really sounds like (because of the nothing outside of the function rule), that I wouln’t be allowed to call it, because you said ANYTHING related to the function. Lol

---

<div class="post-metadata">

### Author: ![king\_bob](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/king_bob/32/35049_2.png) [@king\_bob](https://forum.makecode.com/u/king_bob)
#### Post date: [November 18, 2025, 5:45pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/6 "2025-11-18T17:45:12Z")

</div>

this sounds like a lot of fun

---

<div class="post-metadata">

### Author: ![Bilangus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bilangus/32/33219_2.png) [@Bilangus](https://forum.makecode.com/u/Bilangus)
#### Post date: [November 18, 2025, 5:46pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/7 "2025-11-18T17:46:23Z")

</div>

Here is background image and background color! Color is a little scuffed because it takes in a number but it should be fine.

> **[FunctionImposters - Background image, Background color](https://arcade.makecode.com/86971-54501-55371-26128)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)
#### Post date: [November 18, 2025, 9:00pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/8 "2025-11-18T21:00:45Z")

</div>

Oof

Should of specified that the call block is the exclusion to all that

---

<div class="post-metadata">

### Author: ![AgentBoom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agentboom/32/16635_2.png) [@AgentBoom](https://forum.makecode.com/u/AgentBoom)
#### Post date: [November 18, 2025, 9:35pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/9 "2025-11-18T21:35:57Z")

</div>

This is a very original idea! Love it!  
I’m gonna get to work on it. I’ll have to think of what block to do tho.

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [November 20, 2025, 5:23am UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/10 "2025-11-20T05:23:25Z")

</div>

So, I wanted to make it so that you could add more than one sprite, and I’ve encountered many issues while doing that! Using blocks once you’ve used javaScript is frustrating sometimes, because sometimes it does things behind the scenes that I would do very, very differently.  
This is more of a giant explanation for how I did this, so it’s a very, very long post. I like doing this more than just sending a solution because I think it’s more interesting, and more fun! For me at least. I don’t know if anyone else is gonna have fun reading all this!

> **Spoilers!**
>
> My first “solution” used On Game Update but otherwise works about as well as it could possibly work (I’ll get to that later)
> 
> ![Screenshot 2025-11-19 at 1.15.54 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/0/9045818554c9d9937cd78db09028c189f89345c0.png)  
> This was a bit more complicated before I cheated and looked at the actual source code for the follow block. I was doing the button checks and then moving the sprites inside the button IF blocks, instead of holding the button state inside variables and then using it later, which is much cleaner.  
> Then only after I had looked at the actual implementation did I realize that technically I shouldn’t be using the On Game Update block (even though that’s basically how the actual code works) so I just changed it to make it look better.  
> Then I tried to turn it into a single function like this, to stop using the On Game Update block:  
> (The “Run In Parallel” block is from my JavaScript Extras extension but it’s the exact same code as the “Separately Do” block from the timers extension)  
> ![Screenshot 2025-11-19 at 1.25.21 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/b/3ba7a893b3be7495bdb7ed68c1bcfff52c5b71d0.png)  
> But it turns out that since I’m not using them anywhere else, those arrays have become local variables instead of global variables, which means every time you run the function they are created new, so I changed the code to this:  
> ![Screenshot 2025-11-19 at 6.17.56 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/0/402a4cc57780dcbfbba9f8c07d8b4e1e73cb346a.png)  
> Which still doesn’t work because the “isMoving” variable is still global.  
> My main struggles here were due to the way Makecode does global and local variables. _Most_ variables are global but for some reason arrays are not global, which is truly annoying to me. I mean, I know that it wouldn’t be an issue if I could just add this code:  
> ![Screenshot 2025-11-19 at 6.41.16 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/8/38bc8d871ebb380970b25d78f3cb40cf5d1ec4fc.png)  
> But I cannot, so I made the isMoving state variable into an array in the hopes that it would become a local variable like the other ones, but it… didn’t? Yeah. It became a global variable instead. Looking at the javaScript, I could see that for some reason this one is defined outside of the function, making it global, instead of inside the function, like the sprite arrays. This led me to realize that, for some reason, if I define a sprite array normally inside the function it becomes global!  
> ![Screenshot 2025-11-19 at 6.54.59 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/c/c/cc355e91ec6e283d4df26ba655c0129ee137325e.png)  
> But for whatever reason simply _adding_ to an array inside the function without ever defining it, like I was doing before, leads to it being a local variable. So now, finally, I can actually do this whole thing inside a single function by tricking Makecode into making my sprite arrays global! I also got tired of the Run In Parallel + While loop thing, so I added an inline On Game Update block to my [JavaScript extras extension](https://forum.makecode.com/t/making-an-extension-for-every-javascript-exclusive-feature-i-can-think-of/36766) just because I can. This turned out to be a really cool small adventure! Here’s my final solution:  
> [https://arcade.makecode.com/S72282-30700-01822-40073](https://arcade.makecode.com/S72282-30700-01822-40073)  
> The smiley faces are controlled by the original block, and the boxes around them are controlled by my function!

The reason none of our functions could ever be perfect is because Makecode is a big meanie and the move sprite code is handled right before the sprite physics is done, then all our code is run after that. This means that the move sprite block will always literally be one step ahead of our code:

 ![Screenshot 2025-11-19 at 11.58.52 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/9/f92f6abb392cfa0bbc88f7b00926bfa5723045f0.png)  
How unfair!

---

<div class="post-metadata">

### Author: ![Green\_Lizard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/green_lizard/32/33280_2.png) [@Green\_Lizard](https://forum.makecode.com/u/Green_Lizard)
#### Post date: [November 20, 2025, 4:21pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/11 "2025-11-20T16:21:14Z")

</div>

I created pong using mostly just one function

> **[pong useing just a function](https://arcade.makecode.com/S78162-28764-68147-46903)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

and I spelled “using wrong”

---

<div class="post-metadata">

### Author: ![AgentBoom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agentboom/32/16635_2.png) [@AgentBoom](https://forum.makecode.com/u/AgentBoom)
#### Post date: [November 20, 2025, 10:31pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/12 "2025-11-20T22:31:16Z")

</div>

How did my enemy lose he’s literally always level with the ball. Good game tho. AI is simple but works.

---

<div class="post-metadata">

### Author: ![Green\_Lizard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/green_lizard/32/33280_2.png) [@Green\_Lizard](https://forum.makecode.com/u/Green_Lizard)
#### Post date: [November 21, 2025, 3:40am UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/13 "2025-11-21T03:40:37Z")

</div>

If you press A there are different difficulties

---

<div class="post-metadata">

### Author: ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)
#### Post date: [November 23, 2025, 12:03am UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/14 "2025-11-23T00:03:28Z")

</div>

Ok, decided to do something easier.

I impersonated the “camera follow sprite” block.

> **[Function-Imposters-Attempt-2](https://arcade.makecode.com/27931-18631-01487-93502)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Press A to use the actual block, B to use its imposter.

---

<div class="post-metadata">

### Author: ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)
#### Post date: [November 23, 2025, 10:39pm UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/15 "2025-11-23T22:39:03Z")

</div>

what if we somebody figures out how a block works, by the code that the block calls?

---

<div class="post-metadata">

### Author: ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)
#### Post date: [November 24, 2025, 1:41am UTC](https://forum.makecode.com/t/function-imposters-a-coding-challenge/40525/16 "2025-11-24T01:41:36Z")

</div>

That might not be possible, the blocks could call very different functions that may be able to be translated into makecode scripts, but very hard to do so.
