Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: Iwan on Sat 20/03/2004 18:46:37

Title: Automatic doors
Post by: Iwan on Sat 20/03/2004 18:46:37
How can I make a door slide open as i walk towards it (like on star treck)?
Title: Re:Star Teck
Post by: Pumaman on Sat 20/03/2004 19:37:49
Draw a Region on the ground near the door, and then in the region interactions, for the "Player walks onto region" event you can start an animation of the door opening.
Title: Re:Star Teck
Post by: Darth Mandarb on Sat 20/03/2004 20:47:36
I use two regions to do this.  1 to open the door, and 1 to close it (in case you open it, but then don't leave the screen by going through it)

(http://www.twin-design.com/random/egor_help.gif)

The green region is off initially. (before fadein you disable that region)

When you step on the blue region it;
runs the animation to open the door
reactivates a walkable area behind it
disables the blue region (itself)
enables the green region.

If you head back into the room you;
step on the now active green region;
turns off the green region;
reactivates the blue region;
turns off the walkable area;
runs the closing animation.

It's a little more complicated.  But it works great.

~ d
Title: Re:Star Teck
Post by: a-v-o on Sat 20/03/2004 20:51:02
Instead of the green region, you can use the interaction "player walks off region" to close the door.
Title: Re:Star Teck
Post by: foz on Sun 21/03/2004 00:43:10
Avo....darths method is a more stable way...the walk on and off method can give some strange results.....doors open and closing wrongly..
Title: Re:Star Teck
Post by: Ben on Sun 21/03/2004 01:45:11
How so? It seems to work fine, as long as the region covers both sides of the door.
Title: Re:Star Teck
Post by: TerranRich on Mon 22/03/2004 03:30:46
Darth, that is the same exact method I use for By the Sword, except that the blue region has to extend up beyond the door, and have the top edge of the room come inside the blue region. This way, once the player exits upward past the edge, you run the animation to close the door.
Title: Re:Star Teck
Post by: Darth Mandarb on Mon 22/03/2004 05:20:04
terranRICH - Yeah, I used that method in JP & Cosmo.  It works flawlessly.

I haven't played with the 'Player Walks Off Region' yet.

Of course my next project has no doors like that ...

~ d
Title: Re:Star Teck
Post by: James Kay on Mon 22/03/2004 09:49:39
My long delayed Devco Quest has a front door which is a "Ster Trek" sliding door (this is NOT SciFi anymore! These doors exist!!!).
Anyway, it just used one region, with a walk-onto and walk-off-of script. This works fine, no problems. A lot less hassle than switching on and off extra regions.
Title: Re:Star Teck
Post by: Darth Mandarb on Mon 22/03/2004 17:02:41
James Kay - It's funny because it does make sense to do it with the 'walks off region' command.

When I first developed the method to open/close doors this way, there were no regions in AGS.  So I got used to doing it that way!

But you're right ... that's a better way to do it.

~ d
Title: Re:Automatic doors
Post by: TerranRich on Tue 23/03/2004 04:40:22
D'oh! That's right. I'm still thinking in the realm of hotspots. Yes, region-wise it only takes one area to do this correctly. You could even leave the room edges alone and simply have a, "if" statement check the player's X/Y-position to see if it's above/below a certain point, to decide whether the player switches rooms.
Title: Re: Automatic doors
Post by: R4L on Mon 23/08/2004 15:50:22
Considering the door animation file playing, would the doors stay open or will it play the animation again? How would you make the door stay open?
Title: Re: Automatic doors
Post by: TerranRich on Thu 26/08/2004 22:25:40
The doors would stay open if you use the AnimateObjectEx function and set it so that it ends on the last frame and does not repeat.
Title: Re: Automatic doors
Post by: Khris on Thu 02/09/2004 22:50:27
I'm quite new here, but considering the door's animation, I have an idea:

Wouldn't it be possible to use two objects, one for the door and another for the wall the door slides into and then just move the door-object beneath the other one?
This way, the animation would require only two sprites and would be much smoother, right?
Title: Re: Automatic doors
Post by: Scorpiorus on Fri 03/09/2004 05:17:04
Yeah, if a sliding door is to be moved over a plane of the screen it is indeed more efficient to use the method you are talking about. Otherwise, the ordinary animation can always be applied.