0 Favourites

# How to make a Score Screen Layout?

• 11 posts
• Hi,

How can i make a Score Screen Layout in the end of each stage like in Super Mario Bros and Sonic games?

I want to use math expressions to show the player his total score and his rank which depends of his total score. But i dont know how to do this...

The Expression is:

TotalScore = (Score * number of items collected) / HealthLost

Obs: Score and number of items collected are global variables.

Example:

If the TotalScore is 4000~5000+ an S letter is shown right below the Rank text.

If the TotalScore is 3000~3999 an A letter is shown right below the Rank text.

If the TotalScore is 2000~2999 an B letter is shown right below the Rank text.

If the TotalScore is 1000~1999 an C letter is shown right below the Rank text.

• Soo.. where is the problem? You've got everything you need already in your text. Just use the numbers as conditions to determine which symbol you wanna display.

a condition could look like

totalscore greater or equal 4000: create rank s

totalscore greater or equal 3000 AND totalscore less than 4000: create rank a

or a shorter solution:

When you display the score layout:

create rank (sprite with c, b, etc in frames 1, 2, ..., 0 is empty)

set totalscore = score*numberitems/healthlost

set localvar = floor(totalscore/1000)

• localvar > 4 : set rank frame number = 4
• else: set rank frame number = localvar

or if you wanna use animations:

• localvar > 4 : set rank animation = "a4"
• else: set rank animation = "a"&str(localvar)

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

Construct 3 users don't see these ads
• Thanks for help. I got the idea for rank now :)

But i still dont know how to use or implement those math expressions on the layout...

How can i use math expressions with global variables and variables?

• just type them...

• I tried but dont work. The math expressions dissappear and leave the box text blank

• Where do you try to type them (which dialog) and what do you exactly type.

• I typed on layout event sheet

Function On "TotalScore" >> Function Set return value to (Score*ItemQuantity)/HealthLost

and Function On "HealthLost" >> Function Set return value to Totalhealth-health

• <img src="http://666kb.com/i/ciu1e8doyp4dm3hcf.png" border="0" />

it should work... (ofc should never divide by 0)

although you don't necessarily need to put stuff like this in a function (if the calculation is the only action you wanna execute)

• I'll try this. Thanks! :D

• I tried what you told but i dont know why isnt working.

The values on screen dont change...

<img src="http://img189.imageshack.us/img189/9335/9oo7.png" border="0" />

• You are using function.returnvalue wrong. The function gives that value back to the event that called the function, so there you could set score to function.returnvalue. BUT you don't even need it in this case.

Just set score = score*diamonds/healthlost (careful: if healthlost is 0, the value is not defined (can't divide by zero)! Add a subevent with the condition: if healthlost = 0: score = score*diamonds. And another subevent with the condition else: score = score*diamonds/healthlost.)

So your events could look like this:

on "totalscore":

• healthlost = 0 : set score = score*diamonds
• else: set score = score*diamonds/healthlost

on "healthlost": set healthlost = 3-health

done

• 11 posts