Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sammy_snakes on Sun 06/05/2012 01:49:16

Title: Cover one area in shadow when walking into another? transition with hotspots
Post by: sammy_snakes on Sun 06/05/2012 01:49:16
Hello all!

I need the player to transition from a house to a garden smoothly, aka no fade to black transition screens from room 1 to 2.

is it possible for the outside to appear black whilst the player is in the house, and when the players walks across a hotspot in the doorway, the interior of the house fades to black and the exterior garden appears?

(http://www.writtleart.org/SamS/ags.gif)

best example i can find from a previous game would be MI1 in the voodoo shop

around 35 seconds in..
http://www.youtube.com/watch?v=4EpgivF8Hq8&feature=relmfu



Cheers

Sam
Title: Re: Cover one area in shadow when walking into another? transition with hotspots
Post by: Grim on Sun 06/05/2012 03:10:08
Easily done! The way I'd suggest, is that you make two black objects, one for each part of the screen you want to hide. Make sure their walkbehind base is something really high, like a 1000. Starting inside, make sure only one of the objects is visible. In the doorway, I'd place 2 regions that trigger the object that's visible to dissapear, and the other one to become visible instead, covering up the inside of the house. You can alternatively use transparency instead visible=false/true and try playing with Tween module to fade those objects in and out smoothly.

I hope that's helpful:)

EDIT: Just noticed about transition with  hotspots! That's even easier- you won't need regions. Just switch those objects on and off in that hotspot interaction!;) If it's the same hotspot you might want to determine which object to disable by either a room variable, like this (sorry, guys, don't know how to post code... ;)) :

if (int outside == false){
object1.Visible=false;
object2.Visible=true;
outside=true;
player.walk(x,y);   /////walk outside the house
}

if (int outside == true){
object1.Visible=true;
object2.Visible=false;
outside=false;
player.walk(x,y);   /////walk inside the house
}

Or you can just use the player's coordinates to determine which side of the door they're on and switch between the objects accordingly, thus avoiding creating too many variables (can get confusing sometimes).
Title: Re: Cover one area in shadow when walking into another? transition with hotspots
Post by: sammy_snakes on Sun 06/05/2012 07:40:01
This is perfect thanks very much!
Title: Re: Cover one area in shadow when walking into another? transition with hotspots
Post by: sammy_snakes on Sun 06/05/2012 08:42:57

Quick query , i seem to be getting parse errors.. do i have to declare the int value  at the start of the rooms script?


function hHotspot3_WalkOn()
{
 
if (int outside == false){
object0.Visible=false;
object1.Visible=false;
object2.Visible=true;

outside=true;
player.walk(x,y);   /////walk outside the house
}

if (int outside == true){
object0.Visible=true;
object1.Visible=true;
object2.Visible=false;

outside=false;
player.walk(x,y);   /////walk inside the house
}


}
Title: Re: transition with hotspots
Post by: Deu2000 on Sun 06/05/2012 09:46:10
The error is here:
if(int outside == . . .

Replace them with:
if(outside == . . .

And in top of the script:
int object;
Title: Re: Cover one area in shadow when walking into another? transition with hotspots
Post by: NickyNyce on Sun 06/05/2012 12:32:10
accidental post

Edit: You can post code the same way you hide things...just use code instead
Title: Re: Cover one area in shadow when walking into another? transition with hotspots
Post by: sammy_snakes on Sun 06/05/2012 15:58:38
Thanks again! i really need to brush up on my coding!