It's actually a bit simpler than you'd expect. although this probably isn't the best method.
In AGS, you would set the player characters view to something invisible (a blank sprite), and then add the following to room_RepExec()
cEgo.x = mouse.x;
cEgo.y = mouse.y;
AGS will automatically scroll the background so the player character (which is under the mouse pointer) stays centred.
The character image in the center of the screen isn't the one the player is controlling. It's a background object that looks like him (or her). For the sake of the example we'll assume it's object[0].
If you want to keep it centered, you'd add;
object[0].X = mouse.x;
You'd probably want a couple of hard caps on this too, to prevent the object running too far to the left or right. so add;
you might need to adjust a few things to fit your game, this example is for a game running in 640*480, with a background 1280 (2 screens) wide.
if (object[0].X < 960) { object[0].X = 960; } // right - stops the character moving above 960
if (object[0].X > 320) { object[0].X = 320; } // left - stops the object moving below 240
If any of the above turns out to be my usual nonsense, I apologize in advance.
Edit; - I forgot something. You need to factor in the width of your background object. So if he's 50 pixels wide, you need to subtract 25 to keep it centered.
In AGS, you would set the player characters view to something invisible (a blank sprite), and then add the following to room_RepExec()
cEgo.x = mouse.x;
cEgo.y = mouse.y;
AGS will automatically scroll the background so the player character (which is under the mouse pointer) stays centred.
The character image in the center of the screen isn't the one the player is controlling. It's a background object that looks like him (or her). For the sake of the example we'll assume it's object[0].
If you want to keep it centered, you'd add;
object[0].X = mouse.x;
You'd probably want a couple of hard caps on this too, to prevent the object running too far to the left or right. so add;
you might need to adjust a few things to fit your game, this example is for a game running in 640*480, with a background 1280 (2 screens) wide.
if (object[0].X < 960) { object[0].X = 960; } // right - stops the character moving above 960
if (object[0].X > 320) { object[0].X = 320; } // left - stops the object moving below 240
If any of the above turns out to be my usual nonsense, I apologize in advance.
Edit; - I forgot something. You need to factor in the width of your background object. So if he's 50 pixels wide, you need to subtract 25 to keep it centered.