setting a maximum scroll speed

Hi,

I am building a runner game with parallax scrolling of the background and a stationary sprite object creating an illusion of a running sprite. The game’s speed increases as the score increases. I’d like to set a maximum value (5) for which the speed can get to beyond which the speed remains constant.How can this be achieved. I have tried to read from the math library but I can’t seem to find an appropriate method

[lua]
–speed of the wall
wall.speed = 2 + (0.01 * mydata.score)
[/lua]

thanks
Sedrack

Not sure if this is what you mean, but I’d do this:

wall.speed = 2 + (0.01 \* mydata.score) wall.speed = (wall.speed \< 5) and (wall.speed) or (5)

Not sure if this is what you mean, but I’d do this:

wall.speed = 2 + (0.01 \* mydata.score) wall.speed = (wall.speed \< 5) and (wall.speed) or (5)