I am trying to make my invisible player walk across a room to to make it look like a cutscene. The room is 400 in length, so I want it topan to the other half of the room.
function room_Load()
{
aFog.Stop();
sAirplane.Play();
player.Transparency = 100;
gMain.Visible = false;
}
function room_AfterFadeIn()
{
Wait(200);
aOrcus.Play();
player.Move(35, 188, eBlock);
}
He starts on the right side of the room, but he doesn't move an inch from the spot he enters on.
room_RepExec() is called every non-blocked frame, so in there you would move the viewport along in small increments with SetViewport.
Something like:
int horizontalPosition = GetViewportX();
if (horizontalPosition > 0)
{
SetViewport(horizontalPosition - 1, 0);
}
This will decrease the vertical position by one pixel each frame. You can add more stuff to delay the starting of the scroll, like a bool to signal when it should scroll and not.
To move right, you would increase the horizontal position, and the if would look like:
if (horizontalPosition < Room.Width - System.ScreenWidth)
You should make the player move a non-blocking action so the rest of the script functions can run while it is moving, or handle the scrolling in the room's repeatedly_execute_always.
Have you drawn a walkable area? You can also use eAnywhere in the .Move command instead.
Also, this might be related to the fact that AGS does not move invisible objects/characters. You can try and set his transparency to 99 instead of 100 and see if it makes a difference.
But to pan the room, you don't really need a character to move, just use Jack's code. ;) Though, if you are using the newer version of AGS (3.5) the command has been updated, and you should use the Camera command instead.
Quote from: Cassiebsg on Wed 09/09/2020 17:05:19
Also, this might be related to the fact that AGS does not move invisible objects/characters. You can try and set his transparency to 99 instead of 100 and see if it makes a difference.
Not that's wrong, it moves transparent object, it does not move objects which have ".Visible = false" or ".on = false".
Okay, I wasn't sure if 100 was equal to false on either one of those, that's why I suggested to try it, since I am sure that 99 isn't. ;)