Views - Interface doesn't keep up

B

buhalda

Guest
I have a view in a platform game. The players step event calls for a script that does this:
view_xview[0] = lerp(view_xview[0],obj_roofrunner.x-(view_wview[0]/2),0.1)
view_yview[0] = lerp(view_yview[0],obj_roofrunner.y-(view_hview[0]/2),0.1)
view_xview[0] = clamp(view_xview[0],0,room_width-view_wview[0])
basically to follow the player more smoothly. But I also have an inventory object that for the draw event, displays an image over everything you see. My question is, why is it that when I move, the inventory lags behind by a pixel or two ( If I start moving right, it follows you but with a gap of two pixels on the right side of the screen or view).
 

Tthecreator

Your Creator!
Its probably because you position your inventory before positioning/sizing your view.
So your inventory might set at x=50 while your view will get set to view_xview=52. Which makes the inventory lagg behind a bit.
To solve this you could change the order of your code or use the draw GUI event. (Just google game maker draw gui)
 

Jabbers

Member
Are you putting it in the End Step event? Sometimes you can get a dragging effect if you try to re-position objects in the Step event.
 
Top