Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A: joystick state/target speed, player directly controls this variable and no others
- // B: trail 1
- // C: trail 2, what the player character actually uses to turn
- // This if/else sets the pre-final speed to cap to a if b is higher, without compromising b itself.
- if(b > a)
- {
- b - 1;
- // This if/else moves c closer to b if it's not the same value, caps c if b is higher.
- if(c > b)
- {
- // This prevents overshooting the movement past 0.
- if(c - b >= 4)
- {
- c - 4;
- }
- else
- {
- c = 0;
- }
- }
- else
- {
- c = b;
- }
- }
- else
- {
- b + 1;
- // This if/else moves c closer to a if it's not the same value, caps c if a is higher.
- if(c > a)
- {
- // This prevents overshooting the movement past 0.
- if(c - a >= 4)
- {
- c - 4;
- }
- else
- {
- c = 0;
- }
- }
- else
- {
- c = a;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement