Posted by matt on October 26, 1998 at 20:31:02:
What I've tried to do here is make a cog for an object that goes through some frames, makes some noises, and at one point, makes some sparks appear for a pulse or two. I had the movement and the sounds fine (except the sounds played twice instead of once) but I tried to add sparks and now nothing works. I'm a real inexperienced cogger so forgive me if this is laughable. What I'm trying to do is make the sparks appear at a designated ghost point when the moving object is sleeping after it reaches frame two and at that same point I'd like it to play the sounds. Can anyone help me with this? Where all have I gone wrong in this cog:
symbols
int numframes desc=number_of_frames
int count local
int curframe=0 local
thing moveobj desc=zapper
thing console0 linkid=1
thing sparkGhost desc=where_the_sparks_are
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=forcefieldhit01.wav local
sound wav1=r2fall01.wav local
sound wav2=00electrexplo3.wav local
template sparkTemplate=+sparks
end
#----------------------------------------------------------------------------------
code
activate: // If player presses button
if (GetSenderId() != 1) return;
curframe=getcurframe(moveobj);
movetoframe(moveobj, 2, speed);
PlaySoundLocal(wav0, 1, 0, 66);
PlaySoundLocal(wav1, 1, 0, 66);
PlaySoundThing(sparksound, sparkGhost, 1, -1, -1, 0);
CreateThing(sparkTemplate, sparkGhost);
sleep(waittime);
movetoframe(moveobj, 3, speed);
stop;
#--------------------------------------------------------------------------------------
arrived:
end