T
T
th0m4sXD2017-06-27 20:55:16
Unity
th0m4sXD, 2017-06-27 20:55:16

How to implement acceleration in the game?

you need to implement such physics, the character runs, when the user starts tapping on the screen, the character accelerates, but
the speed does not depend on the number of clicks, you need to keep the balance of the number of clicks (scale), when there are too many clicks, the speed starts to fall. what do you advise?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devalone, 2017-06-27
@th0m4sXD

I haven’t written on unreal yet, so pseudocode:

void update(unsigned dt) {
    if(tapSpeed >= minTapSpeed && tapSpeed <= maxTapSpeed)
        playerSpeed += dt * k1;
    else
        playerSpeed -= dt * k2;
    tapSpeed -= dt * k3;
}

void onTap() {
    tapSpeed += k4;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question