Posted by matt on October 24, 1998 at 13:41:15:
In Reply to: Freezing Problems posted by Matt on October 24, 1998 at 13:19:12:
Here's the cog I mentioned before. I changed it so I could use less frames for my moving platform. Now there are only 4 and it still freezes up when I fire like before.
symbols
int numframes desc=number_of_frames
int count local
int curframe=0 local
thing moveobj desc=platform
surface switch0 linkid=1
message activate local
message arrived local
flex speed 2.0 desc=move_speed
flex waittime 1.0 desc=wait_time_at_each_stop
sound wav0=lvrclik1.wav local
end
#----------------------------------------------------------------------------------
code
activate: // If player presses button
if (GetWallCel(switch0) == 1) return;
if (GetSenderId() != 1) return;
setwallcel(switch0,1);
PlaySoundPos(wav0, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
curframe=getcurframe(moveobj);
for (count=1; count<=numframes; count=count+1)
{movetoframe(moveobj, count, speed);
waitforstop(moveobj);
sleep(waittime);}
for (count=numframes - 1; count>=0; count=count-1)
{movetoframe(moveobj, count, speed);
waitforstop(moveobj);
sleep(waittime);}
stop;
#--------------------------------------------------------------------------------------
arrived:
setwallcel(switch0,0);end
PlaySoundPos(wav0, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
stop;
end