Question for Orbz: How can I create an exponential expression?
SaveDave
Member Posts: 140
How can i create an exponential expression..??
what im looking to do is for a score to increase as you get closer to the end of a level:
i.e. starts off on zero and in effect, accelerates up to 100,000. i need this on an increasing level if this all makes sense!
help would be really appreciated!!
EDIT by BeyondtheTech: I know our forum doesn't really have private messaging, except for writing on developer's "walls," but please refrain from creating vague topic titles such as "question for xxx," especially if others can be helpful to chime in, and if others have similar issues and need to search through the titles to see if it has been discussed before. I have therefore renamed the title according to your actual message.
what im looking to do is for a score to increase as you get closer to the end of a level:
i.e. starts off on zero and in effect, accelerates up to 100,000. i need this on an increasing level if this all makes sense!
help would be really appreciated!!
EDIT by BeyondtheTech: I know our forum doesn't really have private messaging, except for writing on developer's "walls," but please refrain from creating vague topic titles such as "question for xxx," especially if others can be helpful to chime in, and if others have similar issues and need to search through the titles to see if it has been discussed before. I have therefore renamed the title according to your actual message.
Comments
It's hard to tell you what figures to use as I don't know what your score is based on (is it distance/enemies kiled?) or what the limit is.
So... it will increase rapidly the closer you get to the goal.
standard width.
`constrain attribute game.score to exp(self.position.X/477.72393009357)`
that will give you exactly 100,000 when the characters position is 5500. You could just use 477.7 which would give you 100,057 when the characters position is 5500 which is not only easier but I assume you want the end to be slightly before the top of your scene? Or even just 477, which ever suits you game best.
By the way, exp(x) is the same as e^x.
If you didn't want to use e as the constant you could just use something like
`constrain attribute game.score to 1.0021^self.position.X`
great help...
if all goes well i should have a wicked game finished with the next week or so!!
Position/totalDistance*maxScore
also, how would i then go about stopping the score from continuing to increase once the screen is touched for example?
??
You need to set a global boolean variable called "touched" and when the screen is touched set it to true. then put the score computation inside a rule that says when game.touched = false