Downloads containing ezhydro.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Hydroponic ThunDerDraGon Capture the flag N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.5.asc" ///@MLLE-Generated
#pragma require "ezhydro-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ezhydro.j2as" ///@MLLE-Generated

array<uint8> ids = {
	
          11, 12, 13, 14, 15, 40, 41, 42, 43, 44, 45, 46, 57,163, 176, 177, 178, 179,
          180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
		  197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 213, 214, 218, 219, 220, 221, 222, 224, 225, 226, 227, 228, 229, 233, 234, 235, 236, 237, 238, 240, 242
};


void PaletteSetting(uint hue, uint sat, uint lum) {
	for (uint i = 0; i < ids.length; i++) 
		       jjPalette.color[ids[i]].setHSL(
		   jjPalette.color[ids[i]].getHue() - hue,
		   jjPalette.color[ids[i]].getSat() - sat, 
		   jjPalette.color[ids[i]].getLight() - lum
		   );
    jjPalette.apply();
	
}

void coloredSpring(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::SPRING, false);
	jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 216);
}

class ColoredCrate : jjBEHAVIORINTERFACE {
    
    void onBehave(jjOBJ@ obj) {
        obj.behave(obj.eventID == OBJECT::GUNCRATE? BEHAVIOR::CRATE : BEHAVIOR::SHARD);
        
        if (obj.state == STATE::KILL) {
            obj.delete();
        }
    }
    void onDraw(jjOBJ@ obj) {
       
        jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, 40);
    }
}

void onLevelLoad() {
	
	jjObjectPresets[OBJECT::ELECTROBULLETPU].eventID = OBJECT::ELECTROBULLET;
	
	jjObjectPresets[OBJECT::GUNCRATE].behavior = ColoredCrate();
	jjObjectPresets[OBJECT::SHARD].behavior = ColoredCrate();
	
	jjUseLayer8Speeds = true;
	
	jjOBJ@ preset = jjObjectPresets[OBJECT::FROZENSPRING];
	preset.behavior = coloredSpring;
	preset.bulletHandling = HANDLING::IGNOREBULLET;
	preset.freeze = 0;
	preset.ySpeed = -18.f;
	preset.xPos = preset.xOrg + 8;
	
	/* jjTexturedBGFadePositionY = 0.3; */
	PaletteSetting(9, 9, 14);
	
	jjWaterLayer = 7;
	jjSetWaterGradient(0,2,4, 0,4,2);
	jjWaterLighting = (WATERLIGHT::GLOBAL);
}

void onMain() {
	for (int i = 1; i < jjObjectCount; i++) { 
	   jjOBJ@ o = jjObjects[i];
	   if (o.isActive) {
	       if (o.behavior == BEHAVIOR::PICKUP && o.state == STATE::FLOATFALL && o.eventID != OBJECT::FULLENERGY) {
		     o.state = STATE::FLOAT;
	        }
	
		   if (o.eventID == OBJECT::GUN9POWERUP) o.direction = -1;
		   if (o.eventID == OBJECT::RFPOWERUP) o.direction = 0;
	   }
	}
}

void onDrawLayer7(jjPLAYER@ play, jjCANVAS@ screen) {
	jjSetWaterLevel((play.cameraY - jjLayers[7].getYPosition(play)) + 416, true);
}
void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ screen) {
  jjSetWaterLevel(16000, true);
}

/*bool onLocalChat(string &in stringReceived, CHAT::Type chatType) {
	
    array<string> results;
	if (jjRegexMatch(stringReceived,"!palette\\s(\\d+)\\s(\\d+)\\s(\\d+)",results,true)) {
		int hue = int(abs(parseInt(results[1])));
		int sat = int(abs(parseInt(results[2])));
		int lum = int(abs(parseInt(results[3])));
		if (hue <= 255 && sat <= 255 && lum <= 255) {
		    PaletteSetting(hue, sat, lum);
		} else jjAlert("|>> Both parameters must not exceed 255");
		return true;
	}
	
	return false;
}