John Nameless wrote: ↑Mon Aug 11, 2025 11:32 am
So im trying to make a graf, move it's x coords at the same speed to where the player is moving, making it not able to go offscreen.
if i'm understanding you correctly, you want the graf to follow the player's position, right? you might want something like this:
Code: Select all
x = max(npc.sectionObj.boundary.left, min(npc.sectionObj.boundary.right - npc.width, (player.x + player.width * 0.5 - npc.width * 0.5))) - npc.spawnX;
y = 0;
just make sure to have the following inside the graf's npc config file:
Code: Select all
setpos=0
blocks=0
relativecoords=0
if you want something more involved (such as, the graf has a smooth transition to the player's x coordinate instead, or it continues moving), that's going to be more complex and might require additional lua