Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: LL Notorious B.I.G. Will C-H on Thu 13/11/2003 16:40:55

Title: Scrolling rooms
Post by: LL Notorious B.I.G. Will C-H on Thu 13/11/2003 16:40:55
Hi, im having trouble with the scripting for getting my room to scroll down away from where the character is, i imagine its nice and simple to do but cant figure it out. Any help?

Thankyou - Will
Title: Re:Scrolling rooms
Post by: on Thu 13/11/2003 16:58:46
Does it need to be a playable sequence?  For cut scenes I've made the playable character as an invisible character and moved it around to simulate "camera" moves.
Title: Re:Scrolling rooms
Post by: Pumaman on Thu 13/11/2003 16:59:37
You can scroll the screen manually with SetViewport. Scroll down would be something like:


int y = GetViewportY();
int i = 0;
while (i < 50) {
 SetViewport(0, y + i);
 i++;
 Wait(1);
}


Obviously the 50 would have to be adjusted depending on how far you want it to scroll.
Title: Re:Scrolling rooms
Post by: Ben on Thu 13/11/2003 16:59:37
EDIT: Yeah.. What he said  :P
Title: Re:Scrolling rooms
Post by: Scummbuddy on Thu 13/11/2003 17:00:02
Sounds to me like you want, from the manual
------------------------------
SetViewport
SetViewport (int x, int y)

Locks the screen viewport to having the top-left hand corner at (X,Y) in a scrolling room. This allows you to manually pan across a scrolling room or to have the screen follow a non-player character.
The lock is released when you either call ReleaseViewport or the player changes rooms.

NOTE: The co-ordinates supplied are 320x200-scale co-ordinates, and will be automatically multiplied up by the engine.

NOTE: This function has no effect if the current room isn't a scrolling room.

Example:

SetViewport (character[MAN].x - 160, character[MAN].y - 110);

will scroll around and follow character MAN in a specific room, ( you must put this in the room's repeatedly execute event)
See Also: GetViewportX, GetViewportY, ReleaseViewport
-------------------------------

At first, I thought you were having trouble just making a scrolling room in AGS
Title: Re:Scrolling rooms
Post by: Nixxon on Thu 13/11/2003 17:03:43
Make a second character start him off in the same room, set his view to a blank sprite, set his script name to BILLY or whatever then use.
SetPlayerCharacter(BILLY);
MoveCharacter (BILLY, int x, int y);
then change set player character back to your main char when your finished.

Might be a simpler way... this works though
Title: Re:Scrolling rooms
Post by: Scorpiorus on Thu 13/11/2003 17:11:50
Wow, five posts at a time ;D
Title: Re:Scrolling rooms
Post by: Ben on Thu 13/11/2003 17:13:05
I hate it when CJ makes me look stupid  :P
Title: Re:Scrolling rooms
Post by: LL Notorious B.I.G. Will C-H on Mon 17/11/2003 13:37:30
Thanks people, im sure one of those will work.

Many thanks - Will