# Drawbridge.COG
# by DogSRoOL
#
# spuds_61520@yahoo.com
# strings_of_gold@hotmail.com
symbols
Message Activated
Message Timer
Thing Drawbridge
Surface Switch0
Surface Switch1
flex MoveTime
flex WaitTime
int Active=0
end
# ========================================================================================
code
Activated:
if(Active) return;
RotatePivot(Drawbridge, 1, MoveTime);
SetWallCel(Switch0, 1);
SetWallCel(Switch1, 1);
Active=1;
Return;
Arrived:
if(Active) SetTimer(WaitTime);
else
{
SetWallCel(Switch0, 0);
SetWallCel(Switch1, 0);
Active=0;
}
Return;
Timer:
RotatePivot(Drawbridge, 0, MoveTime);
Return;
# ........................................................................................
end
Since I had to use rotatepivot, you're frame setup will be much different. Use a ghost object to isolate the point you want the drawbridge to pivot arount (near the bottom). The first frame (frame0) should dictate the direction to close (-90 degrees, probably) and the next frame should dictate the opening direction (+90 degrees). It's a little complicated to understand at first. When you're done, delete the ghost object. You don't actually need it. If you need an example, let me know.
BTW, I hope this was for a SP game, because I don't know much about MP cogging.
------------------
May the forks be with you.
[This message has been edited by DogSRoOL (edited March 29, 2003).]