# 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:** 5

<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:** [September 11, 2023, 4:47pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/87 "2023-09-11T16:47:59Z")

</div>

@YuHayate you can shove whatever extra properties you want into a Sprite using the `sprite.data` property.

For example:

```auto
console.log(sprite.data.name) // prints "undefined"

sprite.data.name = "josephine"

console.log(sprite.data.name) // prints "josephine"
console.log(sprite.data["name"]) // prints "josephine"

```

Just be aware that the `sprite.data` property has the `any` type so you need to be careful when accessing properties off of it. The compiler won’t catch any spelling or type errors

---

<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:** [September 11, 2023, 5:58pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/88 "2023-09-11T17:58:04Z")

</div>

ya what i mean is to get the name of a sprite like

```auto
let list: any[] = []
console.log(list.name)
// returns list

```

---

<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:** [September 11, 2023, 6:06pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/89 "2023-09-11T18:06:28Z")

</div>

Ah, you mean getting the name of a variable as a string? We don’t support that.

If you’re just trying to check the type of something at runtime, then `instanceof` is good for that. For example:

```auto
function printType(arg: any) {
    if (arg instanceof Sprite) {
        console.log("Sprite")
    }
    else if (arg instanceof Array) {
        console.log("Array")
    }
    else {
        console.log("Unknown")
    }
}

```

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [September 11, 2023, 6:06pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/90 "2023-09-11T18:06:57Z")

</div>

That code will break. I’m note sure what you’re trying to do here exactly either…  
Like @richard said, to assign a name to a sprite, do `sprite.data.name = "name"`

To retrieve it just grab `sprite.data.name` or `sprite.data["name"]`

---

<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:** [September 11, 2023, 9:19pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/91 "2023-09-11T21:19:33Z")

</div>

it was an example, what i want is to get the name of the variable like the text we use to declare set modify the variable  
like if we declare a variable like `let NameOfSprite = "anything"`  
i want a way to get the name of the sprite (in this case NameOfSprite) and return it as a string

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [September 11, 2023, 9:56pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/92 "2023-09-11T21:56:10Z")

</div>

That’s unfortunately not possible. Could you provide a use-case scenario where you would need this?

---

<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:** [September 11, 2023, 10:11pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/93 "2023-09-11T22:11:14Z")

</div>

well if i want to use `throw ""` with a function a make to replace all \<‘number’\> to a string in a array at index ‘number’, i wanted to get a sprite name to make the error look more clear

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [September 12, 2023, 4:39pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/94 "2023-09-12T16:39:36Z")

</div>

You can just write “list”, it will be apparent which variable it’s referring to because it will highlight the line/block in question

---

<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:** [September 21, 2023, 6:39pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/95 "2023-09-21T18:39:19Z")

</div>

hey guys do you thing this color is too bright?  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/f6a2ba76b40d0350fc2d8a69a7b06ee0bb39e6cc.png)

---

<div class="post-metadata">

**Author:** ![Sonicblaston](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sonicblaston/32/19164_2.png) [@Sonicblaston](https://forum.makecode.com/u/Sonicblaston)\
**Post date:** [September 21, 2023, 8:01pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/96 "2023-09-21T20:01:21Z")

</div>

“Becomes blind”. Yes indeed it is too bright

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [September 21, 2023, 8:01pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/97 "2023-09-21T20:01:22Z")

</div>

Yeah definitely

---

<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:** [September 22, 2023, 4:51pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/98 "2023-09-22T16:51:28Z")

</div>

XD, ok its to bright, got it

---

<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:** [September 22, 2023, 4:51pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/99 "2023-09-22T16:51:36Z")

</div>

hey @richard. is there a way to add library’s to 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:** [September 22, 2023, 5:28pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/100 "2023-09-22T17:28:47Z")

</div>

@YuHayate do you mean a specific javascript library?

extensions are themselves libraries. however, if you’re trying to use some 3rd party non-makecode library it will really depend on the implementation as to whether it will work or not. most likely it will not work unless the library is very very simple.

---

<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:** [September 25, 2023, 5:11pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/101 "2023-09-25T17:11:03Z")

</div>

alright thanks

---

<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:** [November 8, 2023, 7:26pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/102 "2023-11-08T19:26:24Z")

</div>

hey @richard! i was making a extension and i tried to make a total run time function using `settings.`  
but instead of keeping track of the total time like in [This](https://makecode.com/_XrHbrMep97Tm), so in that example i use the better settings extension [here](https://github.com/S0m3randomguy/BetterSettings).  
but if i use `setting.` from the javascript editor it just makes makecode not work? it just makes the editors not work or take 5 minutes to load

the code im using in my extension

```auto
settings.writeNumber("StartRunTime", settings.readNumber("TotalRunTime"))
let TotalRunTime = 0

game.onUpdate(function() {
        TotalRunTime = game.runtime() + settings.readNumber("StartRunTime");
        settings.writeNumber("TotalRunTime", TotalRunTime);
})

```

---

<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:** [November 9, 2023, 5:32pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/103 "2023-11-09T17:32:31Z")

</div>

@YuHayate that code works fine for me… Can you share the whole project?

---

<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:** [November 9, 2023, 7:23pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/104 "2023-11-09T19:23:19Z")

</div>

ok… i wanted to finish it first but sure

i took the code out to work on this project and now it doesnt bug out it just doesnt work

> **[extension builder helper](https://arcade.makecode.com/49529-13232-12812-89786)**
>
> Fait avec ❤️ dans 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:** [November 9, 2023, 8:45pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/105 "2023-11-09T20:45:45Z")

</div>

hmmmm, yeah i’m not really sure what’s going on here! that share link works fine for me.

---

<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:** [November 10, 2023, 8:29pm UTC](https://forum.makecode.com/t/help-with-pixel-art-end-math-issues/18809/106 "2023-11-10T20:29:46Z")

</div>

the console is just NaN or 0 for me

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

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