How to display a variable?

I got kinda bored during class, and decided to try to make a 3d turn based RPG battle, but there’s one problem that i can’t figure out how to solve. I want to have a variable show up in play mode, so that the player can see the enemy’s health and whatnot, like in Scratch. If there’s any way to do this, please tell me.

Hi @Edward_Wilson,

The best way to display variables is to write them into a text item with the set text - block. Below you can find an interactive example that you can remix by pressing the remix - button. :slight_smile:

Thanks, man! probably should’ve thought of that.

Hi, how to group the text item with the camera such that it moves with the camera? I tried group and attach it seems not working. Thanks!

Hi @Maggie_Kwok,

You can use the add child CoBlock to set the text item as a child of the Camera, or drag and drop the text item onto the Camera in the Scene Inspector.

Hope that helps! Let me know if you have any further questions.

Geoff @ TechLeap

Thank you very much! It works well.

1 Like