Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → What's wrong with this cog?
What's wrong with this cog?
2010-06-07, 6:20 PM #1
I wrote this awhile ago when I knew more about cog. I set it down, and forget everything. So now trying to fix it, I have no idea what's wrong with it.

It works fine the first time through the level. But if you die and the level restarts, it won't revert back to the loudest sound. It resets the sector speeds but the sound stays the same volume it was before you died until the switch is activated.

Again, I have absolutely no clue what I'm doing here and there are some portions that I commented out. Be nice :omg:

Code:
symbols


sector thrustsector1
sector thrustsector2
sector thrustsector3
sector thrustsector4

vector thrust_vec
flex thrust_speed_high
flex thrust_speed_low
flex thrust_speed_off

message activated
message startup

sound click
sound powerdown
sound powerup
sound rumble

int one local

surface button

end

# ========================================================================================

code

startup:
	SetSectorThrust(thrustsector1, thrust_vec, thrust_speed_high);
	SetSectorThrust(thrustsector2, thrust_vec, thrust_speed_high);
	SetSectorThrust(thrustsector3, thrust_vec, thrust_speed_high);
	SetSectorThrust(thrustsector4, thrust_vec, thrust_speed_high);
	SetWallCel(button, 2);
	one=SectorSound(thrustsector1, rumble, 1);
	#one=SectorSound(thrustsector2, rumble, 1);
	#one=SectorSound(thrustsector3, rumble, 1);
	#one=SectorSound(thrustsector4, rumble, 1);
return;

activated:
		if (GetSenderRef()==button)
			{
			if (GetWallCel(button)==2)
				{
					SetWallCel(button, 1);
					PlaySoundPos(click, SurfaceCenter(button), 1, -1, -1, 0);
					PlaySoundPos(powerdown, SurfaceCenter(button), 1, -1, -1, 0);
					SetSectorThrust(thrustsector1, thrust_vec, thrust_speed_low);
					SetSectorThrust(thrustsector2, thrust_vec, thrust_speed_low);
					SetSectorThrust(thrustsector3, thrust_vec, thrust_speed_low);
					SetSectorThrust(thrustsector4, thrust_vec, thrust_speed_low);	
					#ChangeSoundVol(one, .5, .1);				
					StopSound(one, 0);
					one=SectorSound(thrustsector1, rumble, .5);
				}
			else if (GetWallCel(button)==1)
				{
					SetWallCel(button, 0);
					PlaySoundPos(click, SurfaceCenter(button), 1, -1, -1, 0);
					PlaySoundPos(powerdown, SurfaceCenter(button), 1, -1, -1, 0);
					SetSectorThrust(thrustsector1, thrust_vec, thrust_speed_off);
					SetSectorThrust(thrustsector2, thrust_vec, thrust_speed_off);
					SetSectorThrust(thrustsector3, thrust_vec, thrust_speed_off);
					SetSectorThrust(thrustsector4, thrust_vec, thrust_speed_off);	
					#ChangeSoundVol(one, .1, .1);				
					StopSound(one, 0);
					one=SectorSound(thrustsector1, rumble, 0);
				}
			else
				{
					SetWallCel(button, 2);
					PlaySoundPos(click, SurfaceCenter(button), 1, -1, -1, 0);
					PlaySoundPos(powerup, SurfaceCenter(button), 1, -1, -1, 0);
					SetSectorThrust(thrustsector1, thrust_vec, thrust_speed_high);
					SetSectorThrust(thrustsector2, thrust_vec, thrust_speed_high);
					SetSectorThrust(thrustsector3, thrust_vec, thrust_speed_high);
					SetSectorThrust(thrustsector4, thrust_vec, thrust_speed_high);	
					#ChangeSoundVol(one, 1, .1);	
					StopSound(one, 0);								
					one=SectorSound(thrustsector1, rumble, 1);
				}
			}

return;
2010-06-07, 6:41 PM #2
You might try adding a NewPlayer event that falls into Startup.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!