Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: jamesreg on Wed 20/11/2013 14:36:26

Title: Help with Controlling Scrolling Screens
Post by: jamesreg on Wed 20/11/2013 14:36:26
My game is set at 800x600 resolution
I am using a background image which is 7200x600
bsically I have 9 different backgrounds on my 7200x600 background and want each to act as a seperate backgroun only when I need them.

I do not want this background image to be a scrolling screen nor do I want to use the multiple background option.
I want each 800x600 part of the 7200x600 image to act as a seperate screen.

Example I want the screen to be set at the first 800x600 location then if the player walks to the edge or off screen i want the screen
not to scroll but to fade out and fade back in with the new location the player located at to be another area of the 7200x600 screen.

If I can give any more info on this I please ask me getting this to work is crucial to the entire rest of my game as I will have to do this quite
often to make things work the way I want.
Title: Re: Help with Controlling Scrolling Screens
Post by: Calin Leafshade on Wed 20/11/2013 14:37:45
Thats kinda what "rooms" are for..

Just make each section a new room and change the room when the player leaves one of the edges.
Title: Re: Help with Controlling Scrolling Screens
Post by: jamesreg on Wed 20/11/2013 14:39:42
Thats not going to work for me.

I will go way beyond the 300 savable rooms that way and do not want to do that.

Plus all this is going on in one room so that will make alot of uneeded coding to make 9 seperate rooms for what is really going on in only one room
Title: Re: Help with Controlling Scrolling Screens
Post by: David Ostman on Wed 20/11/2013 14:40:14
I'm assuming you have a good reason to do this (EDIT: you posted while I wrote my post, now I understand), but I think if you look up SetViewport in the manual you'll find it might be what you need. "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."
Title: Re: Help with Controlling Scrolling Screens (Solved)
Post by: jamesreg on Wed 20/11/2013 14:43:31
I will play with that I seen that but was not sure if that was exactly what I needed or if it was a combination of that and something else ill try it out and post my results

***Add on****

This was easier then I thought just in case someone else at some later time sees this then this is what I did per the advice above.

On room load I simply set my SetViewport(0, 600); and on walk off edge script I changed it too SetViewport(800,600); and so on and so on as needed for each section of my background.

I thought it was more complicated or took more steps then this thank your your help.

Title: Re: Help with Controlling Scrolling Screens
Post by: David Ostman on Wed 20/11/2013 15:08:29
Edit: *delete explanation that you already figured out* Nevermind, glad it worked! :D
Title: Re: Help with Controlling Scrolling Screens
Post by: monkey0506 on Wed 20/11/2013 19:15:17
Quote from: jamesreg on Wed 20/11/2013 14:39:42I will go way beyond the 300 savable rooms that way and do not want to do that.

Not strictly related here, but I wanted to point out a couple of things:

- Saving the state of a room by yourself is actually relatively simple, if you really did reach the limit. It's just a matter of creating some global variables. Doing this could also be used as a mechanic for changing the state of other rooms, as the OtherRoom module has shown.

- Newer versions of AGS are going to get rid of a lot of these limits, and a room's state-saving state will become more easily toggled instead of relying on room number to control this.

Slightly more on-topic, if each of these sub-rooms actually do operate independently of each other, then why wouldn't you be able to split them apart from each other (the issue of state-saving rooms aside)? Changing the viewport works well enough, but it also means that hotspots, objects, regions, walkable areas, and walk-behinds all have to be shared...which across 9 apparently independent rooms could prove to be a non-simple task (perfectly capable of being accomplished, but you'd probably have to avoid using things like Hotspot.Name as that can't currently be changed at run-time).