Microsoft MakeCode

HUD and Inventory for large tile maps

Hi there,

I am new to Arcade, and loving it.

Is there a way to have an HUD “glued” to one of the edges of the screen while Player sprites “walks” around in a large tile map?

I want to keep inventory, and other status info, always visible, and I decided to ask before hacking this (if you can get the location of the camera, for example, you could place this info at an offset, but there seem to be no blocks to get this info).

Thanks!

1 Like

It’s easiest in JavaScript – here’s an example drawing a box just offset from the bottom right corner of the screen with some sample content.

There’s not currently a great way to do this in just blocks, unfortunately. You can create a sprite and place it an offset as you mentioned, but the offsets of the camera (available as game.currentScene().camera.offsetX / Y) aren’t directly accessible in blocks, and the tile map constrains the camera in a way that you won’t likely be able to easily deal with in blocks at the moment.

I’ll see if there’s anything we can do to make this easier (I suppose at the very least I can make a quick extension exposing a few more blocks for things like scene.createRenderable for doing simple UIs).

1 Like

It would be nice to start making our hud more pluggable/customizable.

Thanks for the response!

I think having blocks for this would be terrific for beginners.
I was thinking about something along the lines of a block for “gluing” a sprite to one of the edges of the physical screen.

Something like “glue mysprite to (edge) of screen” where
edge := top | bottom | left | right | top-left | top-right | bottom-left | bottom-right

For top|bottom|left|right the sprite can be placed in the middle of the indicated edge.
Also, the sprite should have the highest Z value, so it is on top of everything else.

Hope other people find this useful too.
Thanks

2 Likes

Oh, an absolute position for sprites on the screen is definitely an interesting idea. Worth noting the z index is already exposed in blocks (its in the same dropdown as set x / change x by).

The sprites category is already a bit packed, so we generally have to be careful about adding new blocks - each one we add makes it slightly less likely someone will find the block they need when they start looking. I’ll try and get a quick start on a simple extension for this sort of thing that we can iterate on :).

3 Likes

Thanks so much for even considering this.:smiley:

@jwunderl @peli this sounds like a great candidate for an extension. It would also let us finally make a “put this text on the screen” block instead of using splash for everything :slight_smile:

1 Like

We should rewrite our HUD as an extension (internally) so that we know that someone else can inject a different HUD implementation.