Automatic doors

Started by Iwan, Sat 20/03/2004 18:46:37

Previous topic - Next topic

Iwan

How can I make a door slide open as i walk towards it (like on star treck)?

Pumaman

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.

Darth Mandarb

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)



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

a-v-o

Instead of the green region, you can use the interaction "player walks off region" to close the door.

foz

Avo....darths method is a more stable way...the walk on and off method can give some strange results.....doors open and closing wrongly..

Ben

How so? It seems to work fine, as long as the region covers both sides of the door.

TerranRich

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.
Status: Trying to come up with some ideas...

Darth Mandarb

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

James Kay

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.

Darth Mandarb

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

TerranRich

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.
Status: Trying to come up with some ideas...

R4L

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?

TerranRich

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.
Status: Trying to come up with some ideas...

Khris

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?

Scorpiorus

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.

SMF spam blocked by CleanTalk