Downloads containing building.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Building level szmol96 Custom / Concept N/A Download file

File preview

const int startX = 0;
const int startY = 0;
const int endX = 200;
const int endY = 97;

const int startX2 = 1;
const int startY2 = 98;
const int endX2 = 200;
const int endY2 = 100;

int cTile = 0;

bool canChangeUp = true;
bool canChangeDown = true;

void createFloor() {
	for(int i=startX2;i<(endX2+1);i++) {
		for(int j=startY2;j<(endY2+1);j++) {
			jjTileSet(4, i, j, 20);
		}
	}
}

void clearTiles() {
	for(int i=startX;i<(endX+1);i++) {
		for(int j=startY;j<(endY+1);j++) {
			jjTileSet(4, i, j, 0);
		}
	}
}

void onLevelLoad() {
	clearTiles();
	createFloor();
}

void onMain() {	
	p.ammo[2] = 3;
	p.ammo[3] = 3;
	if (canChangeUp == true) {
		p.ammo[4] = 3;
	} else {
		p.ammo[4] = 0;
	}
	if (canChangeDown == true) {
		p.ammo[5] = 3;
	} else {
		p.ammo[5] = 0;
	}
	p.ammo[6] = 3;
	p.ammo[7] = 3;
	p.ammo[9] = 3;
	
	
	if (p.currWeapon == 2) {
		cTile--;
		p.currWeapon = 1;
	}
		
	if (p.currWeapon == 3) {
		cTile++;
		p.currWeapon = 1;
	}
	
	if (cTile < 11) {
		canChangeUp = false;
	} else {
		canChangeUp = true;
	}
	
	if (p.currWeapon == 4) {
			cTile = cTile-10;
			p.currWeapon = 1;
		}
	
	if (cTile > 769) {
		canChangeDown = false;
	} else {
		canChangeDown = true;
	}
	
	if (p.currWeapon == 5) {
			cTile = cTile+10;
			p.currWeapon = 1;
		}
	
	if (p.currWeapon == 6) {
		jjTileSet(4, (p.xPos/32)+(p.direction*1), p.yPos/32, cTile);
		p.currWeapon = 1;
	}
	
	if (p.currWeapon == 7) {
		jjTileSet(4, (p.xPos/32)+(p.direction*1), p.yPos/32, 0);
		p.currWeapon = 1;
	}
	
	if (p.currWeapon == 9) {
		clearTiles();
		createFloor();
		p.currWeapon = 1;
	}
	
	if (cTile < 1) cTile = 1;
	
	jjTileSet(1, 1, 26, cTile);
}