Scoreboard locked to the corner of the screen? (overlay?)

This forum is currently in read-only mode.
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • Hi. I'd like to have a scoreboard for my game Move ( ) in the upper-right, tracking time taken and deaths... died. Is there a way to have something overlaid on the action?

  • Create a new layer above the main one and set the ScrollX and ScrollY rates on said layer to zero. Then you can put all of your interface/scoreboard elements on that layer and they will be displayed above the action and they will move with the screen when scrolling. Hope that helps.

  • Thanks! Since I've already got a topic here, I'll use it to ask another question instead of creating a new one.

    How can I create a timer? I want to increment a variable every 10 ms, and then display that on screen.

  • No problem.

    For a timer, just a global variable for the timer. Then, for the on screen part, place a text object into your layout and always set it's text to the value of your timer variable.

  • The expression timer returns the time in milliseconds since the start of the layout. So timer / 10 will give you a value that increments 1 every 10 milliseconds. If you don't want all the decimal points, try int(timer / 10).

  • So I can use timer in calculations, and it'll give me the time since the layout started? That's cool!

    I have two questions about text, if that's cool.

    1) How can I display variables in a text object? Everything I try just displays the variable name.

    2) Is it possible to concatenate variables and nonvariables? I basically want to have a text object read Variable1.Variable2 , so I'd need to have a variable, a text thing, and another variable.

    And one question that isn't about text

    I want to use that timer that Ashley mentioned, and at the end of every level I'd like to write the value of Timer to a variable so that at the end of the game you can see all your times. Is there a way to dynamically determine what variable is written to (I guess this deals with concatenation as well). Like, if I have a variable called CurrentLevel that is currently set to 3, can I make it so that Construct will write to levelTime3? (or levelTime'CurrentLevel')?

  • 1. To get it to display in the text box, try something like objectname('variablename') for private variables, just replacing object name and variable names with... well, the object name and the variable name. Then for global variables, use global('variablename').

    2. Do this: object('variable') & "," & object('variable). The "&" will allow you to tack on extra parts to a string.

    Hope that helps.

  • 1) How can I display variables in a text object? Everything I try just displays the variable name.

    I bet you're trying stuff like:

    "timer"

    Stuff between quotes is constant text. Don't use quotes for variables:

    timer

  • Don't I feel silly

    Thanks

  • It still just has what i typed - currentLevel or timer or etc. Is there a different syntax for the Text object?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Expressions don't work in the property grid. If you want the text to show the timer, you need to do it in the event sheet editor, ie.

    + Always

    -> Text: set text to timer

  • would it not be str(timer)?

  • There's no need, if you set a text object's text to a number, it is automatically converted to text.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)