Automatic doors

AndyPanda 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

Nychold 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. ^^
doan sephim 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
AndyPanda Just a little misunderstanding from my part. It worked at last. Thanks guys!