Grrrrrrr... I was almost finished with this cog then the switch stops working, and I cant figure out why, everything seems to be put together correctly.
Please help me with this.. ^_^..
I cant see what the problem is.. It worked fine before I added the second flag value, but I need that to make the loop stop when its suppose to, and to work when its suppose to.. ^_^//.. Please help!
Please help me with this.. ^_^..
Code:
symbols
message startup
message arrived
message activated
thing hovercraft
surface switch
flex MoveSpeed=1.0
sound HoverSound
flex Volume=.5
flex mindist=10
flex maxdist=10
flex 1_2=1
int dummy local
int flag=0 local
int flag2=0 local
end
# ...................................................................................................
code
startup:
SetWallCel(switch,0);
return;
arrived:
If(flag == 0) MoveToFrame(hovercraft, 0, MoveSpeed);
flag = 1;
flag2 = 0;
else If(flag2 == 0) MoveToFrame(hovercraft, 9, MoveSpeed);
flag = 0;
flag2 = 1;
Stop;
activated:
If(GetWallCel(switch) == 0)
{
call move_hc;
}
else if(GetWallCel(switch) == 1)
{
call stop_move;
}
return;
# ...................................................................................................
move_hc:
dummy = PlaySoundThing(hoversound, hovercraft,volume,mindist,maxdist,0x81);
MoveToFrame(hovercraft, 9, movespeed);
SetWallCel(switch,1);
flag = 0;
flag2 = 0;
return;
#..............................
stop_move:
dummy = MoveToFrame(hovercraft, 0, movespeed);
SetWallCel(switch,0);
flag = 1;
flag2 = 1;
return;
#..............................
endI cant see what the problem is.. It worked fine before I added the second flag value, but I need that to make the loop stop when its suppose to, and to work when its suppose to.. ^_^//.. Please help!
"Greetings young Padawan."
![http://forums.massassi.net/html/smile.gif [http://forums.massassi.net/html/smile.gif]](http://forums.massassi.net/html/smile.gif)
![http://forums.massassi.net/html/biggrin.gif [http://forums.massassi.net/html/biggrin.gif]](http://forums.massassi.net/html/biggrin.gif)
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)