Microsoft MakeCode

While Overlapping - Chopping Trees - Status Bars and HUD


I am now trying to:

  1. Make it so when mysprite overlaps with a tree, it shows its status bar, and when the character walks away it disappears.

I’m actually making some progress! However, now I’ve got this blinking issue of the status bars…

What I did was: on game update every 500ms, the game checks whether mysprite is overlapping with any of the trees. If it ISN’T; it makes ALL the status bars for the trees invisible…

When my sprite overlaps a tree, it makes THAT status bar visible…

I’ve tried putting in a variable with an IF statement on the game update 500ms but I haven’t got it quite right.


1 Like

Instead of looping over all of them, you just want to turn invisible on for the status bar attached to the sprite you’re checking. Like this:


Omg it seems so obvious now! Thanks.


I am working on a dual-type inventory system…

The first part is with text sprites and the other is with regular sprites… I am using Text Sprites for an inventory system for collectible resources (such as wood, stone, ores etc)

They seem to behave as lists? How can I create an array of an array so that when I want to add more ‘resource’ types, I can just append them to this list?

Best wishes

Here’s the updated source so far… please ignore the random floating sprites (they’re a start of my inventory components…)

1 Like

@WoodysWorkshop you can just place another array block inside of the first one! We actually did something like this on stream yesterday. We wanted to create a schedule where each day of the week had an array of numbers. Here’s what that code looked like:

The inner loop in this case is filling each day of the week with “-1” which we decided meant “nothing is scheduled”