# lerp

1. ### Move an object 16 pixels at a time

Hello all, I am brand new the the GameMaker community, as well as programming in general. I am trying to create a SNES era action RPG. I have been able to setup 4 directional only movement with the code below in my STEP event. I am trying to figure out how to make my character move a minimum of...
2. ### GMS 2.3+ Is it possible for lerp() to be faster?

Is it possible for lerp() to be faster? Like, I can use lerp() directly, or just use its internal way: var value = a + (b - a) * t; Is there any difference? What do you think? Looking at the real FPS, I couldn't exactly distinguish if there is any difference...
3. ### GML Question about Gravity vs Scale & Lerps

Hi All, I have been trying to make a ghost on my platform game which basically records the users game play and plays it back again. The issue I'm facing is that on different scales the ghost does not perform correctly. About the game mechanics. player x position is generally fixed, with the...
4. ### GMS 2.3+ Function Lerp

how does the lerp function work? I want HP to fall smoothly with damage, and not abruptly in one frame! right now I wrote it like this health = health_max health = lerp (health, health_max, 0.15) at the enemy's Step. HP fall smoothly, but immediately recover to the previous level, in which I am...
5. ### GMS 2 How can I determine distances in fake 3d?

[CLOSED] Got help from the Math discord, and they came up with this solution: if (relative != noone) { var start_point = argument1; var end_point = argument2; var input = argument3 if (input > 100) input = 100; else if (input < -100) input = -100; var distance =...
6. ### GML view follow issues

I'm currently working on a top down adventure game where the view follows the player (original system created by Heartbeast): //this Code is in the step Event of the view object //update view position view_xview[0]=(x-view_wview[0]/2); view_yview[0]=(y-view_hview[0]/2); //move view towards...
7. ### How do I get these two co-ordinates?

Heyall I'm using the draw_sprite_pos function to draw a sprite on an angle according to a top-central horizon point. With the help of image scaling I have determined the top left and right two circles and their respective x and y positions. (green) as well as the bottom blue circles y...
8. ### GMS 2 How to calculate steps needed for lerp() to hit target value in step event?

Greetings, I'll come in hard and true: I suck at mathematics. I know that: xx = lerp(xx, 10, 0.25); Can also be written as: xx = xx + ((10 - xx) * 0.25); Let's say I give xx a starting value of 100 in a create event and I put the lerp() function above in the step event. How can I calculate...
9. ### GMS 2 Problem Rotating Sprite + Lerp

Hi all, I'm trying to rotate an enemy that is following a path. using image_angle = direction works but it gives me the "lag" (it dosent change smoothly the angle) effect beacouse the enemy is moving slowly and i have big difference beetween the "past" direction and the "actual" one from step...
10. ### GML Linear interpolation (lerp) analogues?

I want to slowly "move" my value from, for example: 2 to 0 without "this": Sometimes, values that need to slowly decrease or increase are starting to "twitch", trying to get into a certain interval or position. How to fix it?
11. K

### Lerping the camera

Hey guys, So when rotating the camera in my game 90 degrees im coming across a problem with going from 270 - 360. because it treats the camera angle as 0, not 360, it causes the camera angle to whip around in the opposite direction. here's my step code for setting it. if global.grav = 1 {...
12. ### GMS 2 lerp text position left to right?

can someone help me figure out how to lerp my text and value positions? basicly I have 3 major variables that I use - left // the left position of the text when its enabled but not selected - right // the right position of the text when its enabled and selected - width // the...
13. ### parallax background on the y axis

Hey all! First time posting! Fairly new to GM2 but learning. In order to create depth on an island level, I'd like the horizon level of the ocean background layer to somewhat follow the player/ be fixed to the camera as the player/camera descend the y axis. I've been toying with lerp to do...
14. ### GML Camera Lerp isn't actually smooth.

Hey, it's been a while since I've been on here. I'm back with another issue that most people will likely find to be too small to worry about, but I'm worryin about it. My Problem I'm using lerp to smoothly move my camera to my players position. Super basic camera that everyone does. x +=...
15. ### GML Lerping shortest distance in a circle?

Here's my scenario. It's a twinstick shooter and right now I'm working on the keyboard controls. On a keyboard the player uses the arrow keys to aim. To emulate the smoothness of analog aiming, I am currently using lerp. For the most part this works fine, however, when lerping between a low...
16. ### [SOLVED] Lerping a menu cursor?

I'm pretty new to the lerp function in gamemaker, and I was wondering if there was any way to use it to make a smooth movement effect for a menu cursor when moving up and down? My old code was "if ukey { y -= 16; } but I'd like it to have a smoother effect when moving up. So I looked into...
17. ### Smooth Text

Hello GMC community! I have been trying to do a smooth text transition that will appear for each new wave. So far I've made the script to work, but the line of code makes the text jump halfway across the screen without starting from the left side. I understand why it does this but i don't know...
18. C

### Legacy GM Problem with Lerp and Angle

Hello guys! So basically i cannot figure out how to get a smooth transition from 360 to 0 and 360 to 0. Here is a demo https://dl.dropboxusercontent.com/u/10402000/LerpAngle/index.html and this is the code i use. image_angle = lerp(image_angle, point_direction(x,y,mouse_x,mouse_y), 0.05);