Chopping a tree, getting wood (HUD)

Hi again makers and coders :slight_smile:

Today I am working on a tree chopping function… Two things I need help with…

  1. Hiding the Status Bars
    I’m using the extension of Status Bars to show the ‘health’ of a tree. To attach these, these always appear as shown. Does anyone know how I can make these hidden and only show when the ‘hero’ interacts with them?

  2. Updating a Sprite
    I’m using the extension Text Sprites as a HUD for collecting wood… The way I’ve done it at the moment is just to demonstrate that it always creates a new sprite and stacks them on top rather than updating the current one. What do I need to do to update the animation of this sprite, on chopping the tree?

(Note: I haven’t done the character’s animation yet… That’ll come later.)

Source:

Have you tried turning on smooth transition and adding a border?

For 1, you’ll just want to use the ‘Invisible’ sprite flag (its under the same drop down as auto destroy). Status bars are implemented as sprites with some extra features, so most of the sprite blocks should work! Lots of options on how to implement this - could be as simple as having an on game update that checks if the sprite is overlapping a tree and then sets invisible to true or false depending on whether its ocerlapping or not.

For 2, you’ll probably want to initialize the element in the on start:

And then just update the hud sprites text in the a button event:

One other option would be to just keep it as you have it, and give the hudwood a lifespan (same dropdown as sprite x, vx) of 2500ms or so, so that the notification is temporary - just depends on how you want your game to look!

2 Likes