Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Gfunkera on Thu 01/04/2004 10:23:23

Title: Pan a camera over BG?
Post by: Gfunkera on Thu 01/04/2004 10:23:23
Ok, so I wasnt sure were to put this so this seemed like a good place.... Ok so what I want to do is I got a bg I've made of a volcanoe island and I want to gradually zoom in on the bg, untill the volcanoe is close up.... Now is there a easy way of doing this, software, script, etc. ??? Or what would you guys say would be the easiest way of doing this? Your replies will be greatley appreciated.
Title: Re:Pan a camera over BG?
Post by: Gilbert on Thu 01/04/2004 10:29:22
If you meaned doing this in AGS, it's actually better put  in the beginners' tech forum.

That depends on how you want the effects to be, there're lots of ways, eg.
1. Play a FLIC
2. Play an AVI
3. Use animated bg frames
4. Put the graphics of teh volcano as a character, and use walkable areas to scale it up
5. Try those Raw Draw scaled functions in the new beta.
Title: Re:Pan a camera over BG?
Post by: on Thu 01/04/2004 10:32:02
I don't believe there is any existing function for zooming  in on a background.  I've experimented with making the background as a character on a scaled walkable area and have it walk toward the front of the room to simulate a zoom.  As I recall it was complicated by how the base of the background was defined so that it got larger on screen without appearing to shift position.
Title: Re:Pan a camera over BG?
Post by: on Thu 01/04/2004 14:17:43
Rich, you'll have to create a video file.

Either that, or ask the Escape From Delirium team how to do it.

;)
Title: Re:Pan a camera over BG?
Post by: SSH on Thu 01/04/2004 15:32:44
If you use 2.61 beta 3 or later then you can do something like  this


function room_a() {
 // script for room: Player enters screen (after fadein)
int i=0;
WaitMouseKey(40);
while (i<800) {
 RawDrawImageResized(-i, -((i*5)/8), 1, 320+(i*2), 200+((i*5)/4));
 i=((i*100)/99)+1;
 Wait(1);
}
WaitMouseKey(500);
QuitGame(0);
 
}

function room_b() {
 // script for room: Player enters screen (before fadein)
RawDrawImageResized(0, 0, 1, 320, 200);
 
}


(http://www.freeweb.telco4u.net/superscottishhero/zoom.rar)

The complicated arithmetic is just there to stop the zoom slowing down as you get closer (which is what happens if you have i=i+1).

If you want to zoom as if the camera was moving over water to your island, then  of course, the horizon will change relative to the island which will take a lot more effort...
Title: Re:Pan a camera over BG?
Post by: Gfunkera on Thu 01/04/2004 17:19:02
Yea, thanks I think that is just what I needed :-)

- EDIT -

Where can I find 2.61 beta 3?

- EDIT -
Nevermind I found beta 4 here. (http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=12051)

Ok I get a error when trying to save room??
(http://www.2dadventure.com/ags/error.PNG)
I've copied everything exactley... I think  :-\
Title: Re:Pan a camera over BG?
Post by: Gfunkera on Thu 01/04/2004 18:28:08
Ok so do I copy this code directley into the room I want too zoom?? So i imported my image of the ocean and volcanoe, now I click "i" button for room interactions and click script and add the script above?? I notice the room tags like room_a & room_b whats this for??? Please help me aaaaaaaaahhhhhhhhhhhhhhhhhh lol :p
Title: Re:Pan a camera over BG?
Post by: SSH on Thu 01/04/2004 18:36:42
*cough* RTFm *cough*

anyway..

You'll need to change the "1" sprite number:

 RawDrawImageResized(-i, -((i*5)/8), YOUR_SPRITE_NUMBER_HERE, 320+(i*2), 200+((i*5)/4));

same goes for the other call of that function, change the 1 to your sprite number.

You need to open the interaction editor, chnage Before Faedin interaction to run script, edit script and paste the
 // script for room: Player enters screen (before fadein)
RawDrawImageResized(0, 0, YOUR_SPITE_NO_HERE, 320, 200);

code into the editor. Save and close that, then add a run script interaction for "After faedin" and copy the other code in there.

Title: Re:Pan a camera over BG?
Post by: Gfunkera on Thu 01/04/2004 18:42:52
Ok so I would use my volcanoe background as a sprite?? Well anyways I guess I better read the manual although I don't think I'm realy understanding this correctley....
Title: Re:Pan a camera over BG?
Post by: Gfunkera on Thu 01/04/2004 18:58:02
Well anyways still getting error compiling script after defining sprites....  


Error (line 11): Undefined token 'WaitMouseKey'  could I just get the crm files from you that used to do this???
Title: Re:Pan a camera over BG?
Post by: SSH on Thu 01/04/2004 20:53:11
I only put the waitmousekey in there for the demo: you'll probably want to do different things yourself before and after the zoom. If you're getting that error, I guess you may have missed some punctuation out somewhere, such as a ";" at the end of a line.

Seriously, though, if you're going to try and do something at all complicated like this, try following the help file's scripting tutorial first.
Title: Re:Pan a camera over BG?
Post by: Gfunkera on Thu 01/04/2004 21:20:22
Well after screwing with it for an hour I got it working real nice  8)