i'm new here and im currently practicing creating a game using AGS... i have a question...
Is camera control possible in AGS? if so, can anyone please teach me how to do it? tnx...
The AGS camera follows a character marked as the player character.
However, you can slightly get around it, check this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36051.0) for one way to do it.
~Trent
You can choose the camera position (i.e. the room pixel appearing at the top-left of the screen) at will by using SetViewport() (http://www.adventuregamestudio.co.uk/manual/SetViewport.htm).
The arguably best way is to come up with your own conditions/formula and run them inside the global script's repeatedly_execute function.
Just keep in mind that calling it every game loop i.e. 40 times a second might cause the scrolling to be a bit jerky.
This is how I did it for a game I mad a few months back.
if (IsKeyPressed(372) == 1) { // Up
SetViewport(GetViewportX(), GetViewportY()-1);
}
if (IsKeyPressed(377) == 1) { // Right
SetViewport(GetViewportX()+1, GetViewportY());
}
if (IsKeyPressed(375) == 1) { // Left
SetViewport(GetViewportX()-1, GetViewportY());
}
if (IsKeyPressed(380) == 1) { // Down
SetViewport(GetViewportX(), GetViewportY()+1);
}
if (player.Moving == true) {
ReleaseViewport(); // When the player starts moving again the camera snaps back to his position
}
And I put that in the script of the rooms that were larger than the screen resolution (though you can have it in the Global Script if it's for all your rooms).
Thanks! very useful
You can also create simple camera moves using this module:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=33142.0
For camera moves set the targetCharacter to an invisible cDummy character, then use that character to control where the camera should be aiming.
Quote from: Creator on Thu 20/11/2008 03:13:11
This is how I did it for a game I mad a few months back.
<...>
And I put that in the script of the rooms that were larger than the screen resolution (though you can have it in the Global Script if it's for all your rooms).
You can put the key-handling function in GlobalScript, but call it from rooms - this will reduce code duplication greatly.
Ramjuz dug this up from 2008... :)
Quote from: Khris on Fri 15/08/2014 01:18:20
Ramjuz dug this up from 2008... :)
Ouch... did not notice I am giving comment to 2008th post. :)