# Help with pixel art end math issue's

**URL:** <https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809>\
**Category:** Arcade\
**Tags:** make, art, graphics-and-math, extension, game\
**Created:** [March 27, 2023, 11:15pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809 "2023-03-27T23:15:28Z")\
**Posts on this page:** 20\
**Page:** 7

<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:** [February 26, 2024, 5:24pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/128 "2024-02-26T17:24:55Z")

</div>

@foxrii you can change the palette by going to the assets tab of the editor (next to blocks and javascript).

there’s a button for it on the left-hand side

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 23, 2024, 4:51pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/129 "2024-05-23T16:51:52Z")

</div>

@richard… Xd i wanted to make a extension for fun yesterday but i wanted to add a single namespace but with like… ill just show you  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/f9399dbe22b62ba2f96c8d316e18ae8b2b420362.png)  
stuff like that

---

<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:** [May 23, 2024, 4:55pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/130 "2024-05-23T16:55:30Z")

</div>

@YuHayate use the `//% subcategory=whatever` annotation on your functions. It works just like the `group` annotation but puts the blocks into a subcategory instead.

You can also rearrange the order of subcategories with an annotation on the namespace like this:

```auto
//% subcategories='["number", "boolean", "string"]'

```

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 23, 2024, 5:48pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/131 "2024-05-23T17:48:51Z")

</div>

alright thx

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 23, 2024, 6:03pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/132 "2024-05-23T18:03:31Z")

</div>

what about default values on blocks like this?  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/c/c1e8e3f938f0df7a09147c7ac768cee889b2418f.png)  
like i want there to be a option to if you want to give that test a id or not  
the block only work when i have it like this  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/6/610b3429e0a7e027ce28ad251b7be7bba929a4ca.png)  
i tryed to make it like in js but that does not work ether

```auto
//% block="foo || $a"
export function foo(a: string = "default") {
// insert code here
}

```

---

<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:** [May 23, 2024, 6:25pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/133 "2024-05-23T18:25:10Z")

</div>

@YuHayate

```auto
//% a.defl="whatever"

```

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 23, 2024, 7:15pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/134 "2024-05-23T19:15:36Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/16ee7b3f7fc3c23ade36d45a939bad54b1191951.png)  
hmm  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/5/5f764d0c6fd197a3f1c7f9d63f67fa4e1efaf304.png)

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 23, 2024, 7:15pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/135 "2024-05-23T19:15:38Z")

</div>

i may have found why, still confused tho  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/4040d45eccba0905bb54d8f74f28c86881c137dc.png)

---

<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:** [May 23, 2024, 7:22pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/136 "2024-05-23T19:22:13Z")

</div>

ah, right. i forgot we don’t support default values for string parameters. also, any parameter after the `||` in a block definition needs to be optional.

```auto
/**
 * This is a good example. We can't specify the default value of
 * the string in the function definition but we can use an if
 * statement to set it ourselves
 */
//% block="good example || $id"
//% id.defl="default"
function goodExample(id?: string) {
    if (!id) id = "default";
}

/**
 * The examples below are both invalid. The first one won't
 * compile correctly from blocks to typescript and the second
 * one won't compile at all
 */

//% block="bad example || $id"
//% id.defl="default"
function badExample(id: string) {
}

//% block="bad example || $id"
//% id.defl="default"
function anotherBadExample(id = "default") {
}

```

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 23, 2024, 11:50pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/137 "2024-05-23T23:50:41Z")

</div>

@richard . a bug?  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/823e1fec705556a00c3060020412a079c3c0e674.png)

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 23, 2024, 11:52pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/138 "2024-05-23T23:52:31Z")

</div>

any ideas what causes it?

> **[Advance](https://arcade.makecode.com/96095-85999-67774-89704)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<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:** [May 23, 2024, 11:53pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/139 "2024-05-23T23:53:42Z")

</div>

@YuHayate when that happens, it almost always means you messed up one of your block definitions. In this case, looks like you misspelled the shadow block id for one of your functions:

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

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 24, 2024, 3:33pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/140 "2024-05-24T15:33:10Z")

</div>

Xd, thx, i didnt even know that is sent errors to the console

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [June 26, 2024, 2:43am UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/142 "2024-06-26T02:43:52Z")

</div>

hey @richard, I’m always asking you for help it seems, ig I’m not good at finding information myself loI

anyways, how would i make a block that is like an if statement? or a for loop  
like shown bellow  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/1/e/1e112b020895fc6451fb0985356a09bb0d14774d.png)

is this possible to do in an extension?

---

<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:** [June 26, 2024, 4:50pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/143 "2024-06-26T16:50:25Z")

</div>

making a block like an if-statement is not possible. blocks made by extensions can have at most one statement input (one “mouth”)

making a block like a for-loop is totally possible though! here’s one for example:

```typescript

//% weight=100 color=#0fbc11 icon=""
namespace custom {
    //% blockId=my_custom_for_loop
    //% block="for $index from 0 to $upperBound"
    //% draggableParameters=reporter
    //% upperBound.defl=4
    //% handlerStatement=true
    export function forLoop(upperBound: number, handler: (index: number) => void) {
        for (let i = 0; i <= upperBound; i++) {
            handler(i);
        }
    }
}

```

and here’s the block that produces:

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/6/2/62eb317ced279fe32205d2725c6c95beb630f237.png)

---

<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:** [June 26, 2024, 4:51pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/144 "2024-06-26T16:51:02Z")

</div>

also, no worries! i’m always happy to answer questions when i can

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [July 17, 2024, 10:26pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/145 "2024-07-17T22:26:41Z")

</div>

what about two handlers?  
is that posible?

---

<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:** [July 18, 2024, 5:09pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/146 "2024-07-18T17:09:04Z")

</div>

@YuHayate nope! one handler max

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [July 18, 2024, 9:12pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/147 "2024-07-18T21:12:09Z")

</div>

ok : (

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [August 3, 2024, 1:03am UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/148 "2024-08-03T01:03:08Z")

</div>

hey @richard just wanted to know what im doing wrong here.

```auto
function play8BitSound() {
    let effects: number[][] = [[440, 0, 4550], [330, 0, 100]...];
    for (let i = 0; i < effects.length; i++) {
        let effect = effects[i];
        music.play(music.createSoundEffect(
            WaveShape.Square,
            effect[0], // startHz
            effect[0], // endHz (same as startHz)
            effect[1], // startVolume
            effect[1], // endVolume (same as startVolume)
            effect[2], // duration
            SoundExpressionEffect.None,
            InterpolationCurve.Linear
        ), music.PlaybackMode.UntilDone);
    }
}

```

[Previous page](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809.md?page=6)

[Next page](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809.md?page=8)
