Custom property for a Sprite

Hi,

I’d like to be able to set a custom property on a Sprite, e.g. to store the number of lives that the Sprite has left.

Is there a way to declare a custom property on a Sprite?

If not as a work around I’ll use a property that I don’t otherwise need - e.g. ‘friction x’.
Any other / better work arounds?

We have many such Sprite instances, and are storing them in an array, so it’s not really feasible to have a separate variable for each instance’s lives. We could in theory store them in an Array of numbers, but then we’d have to keep the two arrays in sync.

Thanks in advance - this is actually for my 9 year old child who is loving Makecode Arcade!

tom

the info blocks is where you can store lives now if your trying to make a costume life where it is show by numbers instead then make a new variable name it “lives” then let that number of lives, then add a forever loop add a if statement to it that will check if the variable # is equal to 0 if true then set game to end. :+1:

You could use the arcade-sprite-data extension. Sorry for no images or further tutorials as I’m replying on my watch lol.

2 Likes

We used the arcade-sprite-data extension - worked perfectly - thanks @Kiwiphoenix364