Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Tamanegi on Tue 02/10/2012 01:12:48

Title: "Fixed" portion of background
Post by: Tamanegi on Tue 02/10/2012 01:12:48
I want to do this, but am unsure how to take on the problem:

In one room, the player is on a bridge and in the background, you can see the city's skyline. When you reach the border of the screen, the camera moves so you can see the rest of the room, but the skyline doesn't move, only the bridge part of the background.

I was thinking of having the skyline as the room's background, and the bridge as an object that I move. But this appears to me as cumbersome because of walkable areas and hotspots that I would have to turn on and off, causing problems when the two "room parts" have overlapping ones. Also, the player character needs to be moved. Is there an easier way of doing what I have in mind?
Title: Re: "Fixed" portion of background
Post by: Eric on Tue 02/10/2012 01:34:28
What you're attempting is called "parallax scrolling," and there's a module for it (http://www.adventuregamestudio.co.uk/forums/index.php?topic=33142.0)!
Title: Re: "Fixed" portion of background
Post by: Ali on Tue 02/10/2012 01:35:40
Eric beat me to it.

Using that module, if you make the skyline a large object with a PxPos of -3 it should have the desired effect. These days I think most computers can handle big objects, but it might be a bit slow using DX5.
Title: Re: "Fixed" portion of background
Post by: Eric on Tue 02/10/2012 01:43:00
Well, I beat you to linking, but surely you deserve some extra credit as the module's creator.
Title: Re: "Fixed" portion of background
Post by: Tamanegi on Tue 02/10/2012 03:13:51
Actually I searched for "paralax" with one "l", that's probably why I didn't find the module by myself.

Hey, that's great. I think I understand how it works, except for PxView and PxLoop: Everything I checked in the demo game for the module has a value of 0 there, what do I need it for?

So I understand that I don't really need any meaningful background at all, instead I use objects only?

Thank you very much for the module!
Title: Re: "Fixed" portion of background
Post by: Ali on Tue 02/10/2012 14:39:50
PxView and PxLoop are a hangover from an older version of AGS. I'm going to change how they work to allow smoother movement, but haven't got round to it yet.

For now, you don't need to use them at all, but you do need to create them.

You would still use a background for whatever portion of the scene the character is standing on. In most rooms the parallax objects are relatively small, as in the demo. In your case you'll need a very big object set up like the sun in the demo.
Title: Re: "Fixed" portion of background
Post by: Tamanegi on Tue 02/10/2012 17:31:27
If that is so, there is something I don't understand. How does the module know which parts of my background are transparent so the backdrop (the skyline) is visible?
Title: Re: "Fixed" portion of background
Post by: Ali on Tue 02/10/2012 20:15:36
Just use walkbehinds, as you would to put any object or character behind a part of the backdrop. Then set the baseline for the sky object to -100 (or something like that) so it will definitely be behind everything else.
Title: Re: "Fixed" portion of background
Post by: Tamanegi on Tue 02/10/2012 20:28:26
So simple... I didn't know that walkbehinds also are for objects, but now that I think about it, it's obvious :D Thank you!