Right. So for a particular scene I need the camera to follow a 'character' (a moving vehicle) in the centre of a vertically scrolling screen. Easy enough.
Problem is, the vehicle sprite includes an effect coming out of the back of the vehicle - with the vehicle itself in the top half of the sprite and the trail effect a the bottom. Because the vehicle itself is at the top of the sprite, the screen isn't scrolling until the top of the vehicle nears the top of the screen, so it's continually off-centre vertically as it scrolls.
I figured I could resolve this by manually offsetting the viewport in repeatedly_execute_always, but there's a problem - the sprite now 'flickers' up and down by a few pixels with each game loop. I assume this is because the rep_ex is checking precisely one frame offset against the movement of the sprite.
The most annoying thing is that I know I've solved this problem before, many moons ago. But I've searched and searched and experimented and experimented and can't figure it out.
Here's the rep_ex_always code that results in the flicker effect:
SetViewport(cBuggy.x, cBuggy.y-400);
Any help very much appreciated!
Afaik, this is why late_rep_ex_always (https://www.adventuregamestudio.co.uk/manual/ags40.htm) was added to AGS.
Well I'll be damned, I had no idea that was added. Thanks!