Im working on a clicker game and on click the kart speed should increase and decrease when not clicking.
ca anyone tell the math?? so the amount of speed it gets for each click depends on player score?
Im working on a clicker game and on click the kart speed should increase and decrease when not clicking.
ca anyone tell the math?? so the amount of speed it gets for each click depends on player score?
You should add the current speed + score
speed = speed + score
Each game uses their own math most likely, but it isn’t hard to come up with your own.
You can do what @whimbur suggested above, but i feel like that’s not how most games do it (what you were asking)
This is just very rough fake code, you’re going to have to set yours up for your game.
Put a function inside a while true do loop so when they click that does something like:
while true do
function (click mouse button 1 down)
clicked = true -- a variable to determine if they clicked
speed = speed + (a percentage of their score)
end
if clicked = false then
speed = speed - (the percentage, or a fixed value. Your choice)
end
clicked = false
end
speed = 16 + 10000000??(30charcharr)
I believe if the road is really really long it could work, but yeah, not the best idea.