2008.06.06, 11:59 PM
I have been trying to make a hangar, with a "Control Room" Which opens the hangar door, so you can fly the ships out. In the control room I have a switch, based from the demo switch, which opens the door with a movment. I have two problems with this.
1. The switch is only clickable from the back and sides, not the front.
2. The door does not open. I am getting no errors. Here is the script and screenshots of my settings:
![[Image: picture4fr4.png]](http://img292.imageshack.us/img292/3875/picture4fr4.png)
http://img292.imageshack.us/img292/3875/picture4fr4.png
![[Image: picture3pp3.png]](http://img384.imageshack.us/img384/2791/picture3pp3.png)
http://img384.imageshack.us/img384/2791/picture3pp3.png
![[Image: picture2hn3.png]](http://img501.imageshack.us/img501/7982/picture2hn3.png)
http://img501.imageshack.us/img501/7982/picture2hn3.png
![[Image: picture1zu6.png]](http://img511.imageshack.us/img511/2258/picture1zu6.png)
http://img511.imageshack.us/img511/2258/picture1zu6.png
It would be awesome if you could help.
1. The switch is only clickable from the back and sides, not the front.
2. The door does not open. I am getting no errors. Here is the script and screenshots of my settings:
Code:
// ***********************************************************
//
// OBJECT: Switch Move
//
// A simple switch that can be used to move segments from one
// point to another. It takes one parameter:
//
// parameter 0: map movement to activate
//
// ***********************************************************
var switchUp;
//
// switch construction
//
function switchConstruct(obj)
{
obj.model.on=true;
obj.model.name="Switch";
obj.setting.suspend=true;
obj.model.light.on=false;
obj.model.halo.on=false;
obj.model.shadow.on=false;
obj.setting.damage=false;
obj.setting.invincible=true;
obj.setting.clickable=true;
obj.size.clickDistance=4500;
obj.size.x=500;
obj.size.z=600;
obj.size.y=1000;
switchUp=true; // switch starts in the up position
}
//
// switch clicking
//
function switchClick(obj)
{
// can't click switch again until move is over
obj.setting.clickable=false;
// change switch position
if (switchUp) {
obj.model.animation.start('SwitchDown');
map.movement.start(obj.setting.getParameter(0));
switchUp=false;
}
else {
obj.model.animation.start('SwitchUp');
map.movement.startReverse(obj.setting.getParameter(0));
switchUp=true;
}
}
//
// swich move events
//
function switchMove(obj,subEvent,id)
{
// the LOOP event is sent when a movement
// is ready to loop (or stop if not looping)
// we use this to determine if it's OK to activate
// the switch again
if (subEvent==DIM3_EVENT_MOVE_LOOP) {
obj.setting.clickable=true;
}
}
//
// switch events
//
function event(obj,mainEvent,subEvent,id,tick)
{
switch (mainEvent) {
case DIM3_EVENT_CONSTRUCT:
switchConstruct(obj);
return;
case DIM3_EVENT_CLICK:
switchClick(obj);
return;
case DIM3_EVENT_MOVE:
switchMove(obj,subEvent,id);
return;
}
}![[Image: picture4fr4.png]](http://img292.imageshack.us/img292/3875/picture4fr4.png)
http://img292.imageshack.us/img292/3875/picture4fr4.png
![[Image: picture3pp3.png]](http://img384.imageshack.us/img384/2791/picture3pp3.png)
http://img384.imageshack.us/img384/2791/picture3pp3.png
![[Image: picture2hn3.png]](http://img501.imageshack.us/img501/7982/picture2hn3.png)
http://img501.imageshack.us/img501/7982/picture2hn3.png
![[Image: picture1zu6.png]](http://img511.imageshack.us/img511/2258/picture1zu6.png)
http://img511.imageshack.us/img511/2258/picture1zu6.png
It would be awesome if you could help.
, is because it allows me to separate the map into sections that never move and can be cached versus sections that could be different from tick to tick.)