Author Topic: Automatic doors  (Read 5475 times)

0 Members and 1 Guest are viewing this topic.

Offline AndyPanda

Automatic doors
« on: June 27, 2004, 02:51:29 PM »
Hi again...
Is there anyone who have a smart way to make automatic sliding doors? I have this:

 (method (doit)
 (super:doit())
    (if(== (send gEgo:onControl()) ctlNAVY)
        (aDoor:(open))
    )(else
    (aDoor:(close))
    )
)

...which obviously doesn't work, since the doors will open constantly while ego is on the Navy control color, and because of that goes into a loop  :P




Offline Nychold

Re:Automatic doors
« Reply #1 on: June 27, 2004, 04:10:11 PM »
Keep an active record of what state the door is in:  closed, opening, open, and closing.  Then, when you hit the navy control line, you just need to examine the state, and change it if necessary.  Exact source code would depend on your implementation and idea. ^^

Offline Doan Sephim

Re:Automatic doors
« Reply #2 on: June 27, 2004, 04:33:19 PM »
for this one i wouldnt use the door class at all. i would just set up a variable (local open = 0) and a view of a door with (for example) ctlGREY as the control color in front and ctlMAROON as the color behind and then do this:
(if(== (send gEgo:onControl()) ctlGREY)
(if(not(open))
(aDoor:setCycle(End)cel(0)loop(0))//draw it to slide or open
= open 1
)(else
)
)
and then to close it, you could draw another control (for example) ctlSILVER around the ctlGREY and put in:
(if(== (send gEgo:onControl()) ctlSILVER)
(if(open)
(aDoor:setCycle(End)cel(0)loop(1))//this loop would need to be the opposite of the other.
= open 0
)(else
)
)
i think that would work...
doan
« Last Edit: June 27, 2004, 04:43:35 PM by doan sephim »
Artificial Intelligence Competition

Offline AndyPanda

Re:Automatic doors
« Reply #3 on: June 27, 2004, 06:13:22 PM »
Just a little misunderstanding from my part. It worked at last. Thanks guys!


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.043 seconds with 17 queries.