All pastes #626748 Raw Edit

Stuff

public text v1 · immutable
·published 2007-07-19 21:19 UTC
rendered paste body
#include "zcommon.acs"

bool bGameOver = true;

int iHighScore = 0;
int iPlayer = 0;
int iPoints = 0;

int iPointsPreviousLevel = 0;
int iPointsNextLevel = 50;
int iScrollSpeed = 50;
int iProjectiles = 1;

script 1 (void)
{
	ClearInventory(); // this doesn't work in an enter script in netplay! yay bugs!
}

script 2 (void)  // Treadmill minigame start
{	
	if (!(PlayerHealth() <= 0))
	{
		iPlayer = PlayerNumber();
		bGameOver = false;
		iPoints = 0;
		
		Teleport(1);
		Ceiling_LowerAndCrush(5, 255, 255);
		Sector_SetDamage(5, 255, 0);
		HudMessage(s:"Ready?"; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 2.0);
		Delay(35*1);
		HudMessage(s:"3"; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 1.0);
		Delay(35*1);
		HudMessage(s:"2"; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 1.0);
		Delay(35*1);
		HudMessage(s:"1"; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 1.0);
		Delay(35*1);
		HudMessage(s:"Go!"; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 4.0);
		Scroll_Floor(4, iScrollSpeed, 0, 2);
		Delay(35*2);
		HudMessage(s:"Points: ",d:iPoints; HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.8, 1.0);
		
		while (bGameOver == false) {
			iPoints++;
			HudMessage(s:"Points: ",d:iPoints; HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.8, 1.0);
			CheckLevel(iPoints);
			delay(35);
		}
	}
}

script 3 DEATH
{
	if (PlayerNumber() == iPlayer && bGameOver == false)
	{
		bGameOver = true;
		Ceiling_RaiseByValue(5, 255, 104);
		Sector_SetDamage(5, 0, 0);
		Scroll_Floor(4, 0, 0, 0);
		LevelOne();
		HudMessage(s:"Major beef, squid! Game over..."; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 4.0);
		Delay(35*4);
		if (iPoints > iHighScore) {
			iHighScore = iPoints;
			HudMessage(s:"New High Score: ",d:iHighScore; HUDMSG_PLAIN, 3, CR_BRICK, 0.1, 0.6, 4.0);
		}else{
			HudMessage(s:"High Score: ",d:iHighScore; HUDMSG_PLAIN, 3, CR_BRICK, 0.1, 0.6, 4.0);
		}
	}
}

script 4 (int gone) DISCONNECT
{
	if (PlayerNumber() == iPlayer && bGameOver == false)
	{
		bGameOver = true;
		Ceiling_RaiseByValue(5, 255, 104);
		Sector_SetDamage(5, 0, 0);
		Scroll_Floor(4, 0, 0, 0);
		LevelOne();
	}
}

script 5 (void)
{
	if (iHighScore <= 0)
		HudMessage(s:"No high score has been set yet..."; HUDMSG_PLAIN, 3, CR_BRICK, 0.1, 0.6, 4.0);
	else
		HudMessage(s:"High Score: ",d:iHighScore; HUDMSG_PLAIN, 3, CR_BRICK, 0.1, 0.6, 4.0);
}

script 6 (void)
{
	HudMessage(s:"This teleport takes you to the\nJetsons Space DM treadmill\nminigame!"; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 4.0);
	Delay(35*4);
	HudMessage(s:"Jane is mad, and will throw\ncrazy obstacles at random, and you\nhave to dodge them!"; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 4.0);
	Delay(35*4);
	HudMessage(s:"Every second you stay\non the treadmill, you get a\npoint, and every 50 points,\nthe level increases!"; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 4.0);
	Delay(35*4);
	HudMessage(s:"When the level increases,\n1 more object is thrown\nat a time, and the\nspeed of the treadmill\nis upped."; HUDMSG_PLAIN, 1, CR_GRAY, 0.1, 0.8, 4.0);
}

script 999 open
{
	Sector_SetDamage(6, 255, 0);
}

function void CheckLevel (int points)   // Check which level you are on, and shoot accordingly.
{
	if (points > iPointsPreviousLevel && points < iPointsNextLevel && points != iPointsNextLevel) {
		for (int i=0; i<iProjectiles; i++)
			Thing_Projectile(Random(2,11), Random(153, 155), 0, 128, 0);
	}
	
	if (points == iPointsNextLevel) {
		if (!(iProjectiles >= 8))
			iProjectiles++;
		if (!(iScrollSpeed >= 500))
			iScrollSpeed += 50;
		
		iPointsPreviousLevel += 50;
		iPointsNextLevel += 50;

		Scroll_Floor(4, iScrollSpeed, 0, 2);
		HudMessage(s:"Level up!"; HUDMSG_PLAIN, 2, CR_TAN, 0.1, 0.6, 4.0);
//		AmbientSound(etc/jane, 127);
	}		
}

function void LevelOne (void)
{
	iPlayer = 0;
	iPointsPreviousLevel = 0;
	iPointsNextLevel = 50;
	iScrollSpeed = 50;
	iProjectiles = 1;
}