How can I display the player's level on screen?

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Gigglyardo
Slime
Posts: 9
Joined: Sun Aug 16, 2015 1:20 am

How can I display the player's level on screen?

Post by Gigglyardo »

Basically, I just need to display the player's level on a corner of the screen, without accessing any menus. Kind of like a HUD, that's visible while walking around.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

A simple way would be to call `show string at(ID, x, y)` each tick while the game is running. There wouldn't be any graphics with it, but it'd have the level onscreen.

In a while loop that runs while the game is being played, you'll have to set a string (say, ID 0) to the hero's level, and then call show string at() with that string ID.

append number(0, get hero level(0))
show string at(0, 0, 0)

If you want some HUD graphics, you might try checking out slice collections, and load one of those. If you use a text slice to display the value, you'll have to use `set slice text(handle, string ID)` instead of `show string at`
My pronouns are they/them
Ps. I love my wife
Post Reply