Scoring System Question
Fal01
Member Posts: 460
Hi All.
I'm making a game where the height the player gets to determines the the score, and I also want to constrain the time(in milliseconds) in which the player gets to this height to the score, so each player can have a different score by getting to the same height but at different speeds.
Does anyone know an equation for this so that the lower the number ie-(time), the higher the score?.
Hope this makes sense! My tiny brain is fried trying to work this out!
Cheers
I'm making a game where the height the player gets to determines the the score, and I also want to constrain the time(in milliseconds) in which the player gets to this height to the score, so each player can have a different score by getting to the same height but at different speeds.
Does anyone know an equation for this so that the lower the number ie-(time), the higher the score?.
Hope this makes sense! My tiny brain is fried trying to work this out!
Cheers
It’s not a bug – it’s an undocumented feature
Best Answers
-
Photics Posts: 4,172Well, the height part should be easy... that's just the Y value.
Time could work like a multiplier. Begin by grabbing the "start time" from the game.time attribute. This is in milliseconds. Then, when the player hits a new height, grab the game.time attribute again.
So... if the game time was 10.25 when the player started
...and the time the new height was reached was 25.50
The time to reach that height was 15.25 seconds. Height.time-start.time
(Those are two attributes to create... they can have unique names.)
Here, is where you can decide how much time you want to give to a player. 100 seconds is an arbitrary number...
So... 100-15.25 is 84.75.
With that number, it could be added or multiplied to the score. You could even get fancy with exponential function or log10, to create a different way of adding a bonus. It depends on your game. -
MotherHoose Posts: 2,456@Fal01 … are you doing a verticalScrolling game?
remember that the actors in any scene:
-can store/change values based on their position
-that all actors have a self.Time of 0 when scene loads
-scores for scenes should be within the scene and only change the gameScore when scene is completed (so no problems occur on resetScene)
===
on the last background in the scroll:
create two attributes … index type … name: howHigh and timeIt
when that BG moves to top …
Rule: when
Attribute: condition you use
--changeAttribute: self.howHigh To: self.howHigh+100 or any number you like
--changeAttribute: whatever your move changes are
then when scene is done:
the value of the howHigh gives you the Height
and the value of that BG's self.Time gives you the time (in seconds)
Use those values and that actor to calculate score
EX:
Rule: when
Attribute: self.Time ≥240 (60 seconds/min times 4mins = 240 seconds)
--changeAttribute self.timeIt To: 1
Otherwise:
here you add rules for lesser time frames with higher timeIt values
before you changeScene:
--changeAttribute: game.Score To: game.Score+(self.howHigh*self.timeIt)
I suggest you drag a Note behavior on to the actor and list all the values you want to use for time and height.
if this is not as clear, I will do a demo for you …
MH
Answers
game.maxTime would be the amount of time it would take the worst player to complete the level.
For example, if the height is 150 and the heightFactor (a constant) is 100, game.maxTime is 60 (seconds) and game.Time is 21 (seconds), the formula would be:
game.score=150*100*(60/21)=42857
Some other examples:
game.score=150*100*(60/16)=56250
game.score=250*100*(60/20)=75000
game.score=225*100*(60/20)=67500
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
i do
timer every 0 sec run to completion
constran attribute score to 999999(my max score i try)*(1-game time/(1200))
1200 is the time why i become 0 points left
Constrain Attribute game.score to 999999-game.Time*[a factor such as 1000]
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User