Skip to content
drewmccluskey edited this page Jan 9, 2019 · 5 revisions

round

This function will return a percentage of the sum of two inputs

Syntax:

Lerp(float a, float b, float amt)
Argument Description
float a The first number to add
float b The second number to add
float amt The percentage to return

Returns: int

Description:

This function will return a value which is the stated percentage of the sum of two input float values. It can be used to predict movement in a within a program.

Example:

float xFuture = lerp(x, x+hspeed, room_speed/2)

This code will set float xFuture to the predicted x position of an object after half a second of gameplay. This can be useful for online games to reduce visual lag as well as for smarter enemy AI.

Back to number_functions

Clone this wiki locally