Downloads containing SEcav.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 16 Levels Jazz2Online Multiple N/A Download file
JJ2+ Only: Shimmering CavernFeatured Download Seren Battle 9.4 Download file

File preview

class vector{
  float x,y;
  vector() {}
  vector(float setX,float setY) {x=setX; y=setY;}
}
class level{
  array<vector> torches;
  vector rf,toaster,bat,waterfall;
  level()
  {
    for(int y=0;y<jjLayerHeight[4];y++)
    {
      for(int x=0;x<jjLayerWidth[4];x++)
      {
        if(jjEventGet(x,y)!=AREA::AREAID) {continue;}
        vector pos((x+0.5)*32,(y+0.5)*32);
        switch(jjParameterGet(x,y,0,3))
        {
          case 0:
            torches.insertLast(pos);
            break;
          case 1:
            rf=pos;
            break;
          case 2:
            toaster=pos;
            break;
          case 3:
            bat=pos;
            break;
          case 4:
            waterfall=pos;
            break;
        }
      }
    }
  }
}
level thisLevel;
void onLevelLoad(){
  jjObjectPresets[OBJECT::GREENSPRING].lightType=LIGHT::LASER;
  jjObjectPresets[OBJECT::GREENSPRING].light=1;
  jjObjectPresets[OBJECT::SHARD].lightType=LIGHT::POINT;
  jjObjectPresets[OBJECT::SHARD].light=1;
  jjObjectPresets[OBJECT::BOUNCEONCE].lightType=LIGHT::POINT;
  jjObjectPresets[OBJECT::BOUNCEONCE].light=1;
  jjObjectPresets[OBJECT::BOLLPLATFORM].noHit^=2|8;
  jjObjectPresets[OBJECT::BOLLPLATFORM].determineCurAnim(ANIM::BAT,0);
  jjObjectPresets[OBJECT::FRUITPLATFORM].noHit^=2|8;
  jjObjectPresets[OBJECT::FRUITPLATFORM].determineCurAnim(ANIM::BAT,1);
}
void onMain(){
  jjOBJ@ obj;
  for(int i=0;i<jjObjectCount;i++)
  {
    @obj=jjObjects[i];
    if(!obj.isActive) {continue;}
    switch(obj.eventID)
    {
      case OBJECT::GREENSPRING:
        if(obj.xPos<50*32) {obj.ySpeed=-16;}
        else if(obj.xPos<75*32) {obj.ySpeed=-25;}
        else if(obj.xPos<100*32) {obj.ySpeed=-26.5;}
        else {obj.ySpeed=-18;}
        if(obj.freeze>0&&jjGameTicks%2==0) {obj.freeze++;}
        break;
      case OBJECT::RFAMMO3:
        obj.xPos=thisLevel.rf.x-48*jjSin(jjGameTicks*6+obj.xOrg*32/3);
        obj.yPos=thisLevel.rf.y+48*jjCos(jjGameTicks*6+obj.xOrg*32/3);
        obj.xSpeed=obj.ySpeed=0;
        obj.determineCurAnim(ANIM::AMMO,48);
        if(jjGameTicks%7==0) {createExplosion(obj.xPos,obj.yPos,ANIM::AMMO,7);}
        break;
      case OBJECT::TOASTERAMMO3:
        obj.xPos=thisLevel.toaster.x+64*jjSin(jjGameTicks*5+obj.xOrg*32/4);
        obj.yPos=thisLevel.toaster.y+64*jjCos(jjGameTicks*5+obj.xOrg*32/4);
        obj.xSpeed=obj.ySpeed=0;
        obj.determineCurAnim(ANIM::AMMO,56);
        if(jjGameTicks%7==0) {createExplosion(obj.xPos,obj.yPos,ANIM::AMMO,55);}
        break;
      case OBJECT::BOLLPLATFORM:
        obj.xOrg=thisLevel.bat.x-10*32*jjSin(1.5*jjGameTicks);
        obj.yOrg=thisLevel.bat.y+6*32*jjSin(3*jjGameTicks);
        obj.direction=jjCos(1.5*jjGameTicks)>0?-1:1;
        obj.frameID=jjGameTicks/7%8;
        obj.determineCurFrame();
        break;
      case OBJECT::FRUITPLATFORM:
        obj.direction=int(obj.xOrg)/32%2==0?-1:1;
        break;
      case OBJECT::STEADYLIGHT:
        if(obj.special==0)
        {
          obj.special=1;
          obj.light=(obj.xOrg/32-77)/3.5;
          obj.light*=-obj.light;
          obj.light+=127;
        }
        break;
      case OBJECT::SHARD:
        if(obj.special==0) {obj.special=jjRandom()%1024; obj.var[0]=70;}
        obj.xSpeed=2*jjSin(16*jjGameTicks+obj.special);
        obj.ySpeed=-4;
        if(jjRandom()%obj.var[0]==0) obj.state=STATE::KILL;
        break;
    }
  }
  for(uint i=0;i<thisLevel.torches.length();i++)
  {
    if(jjRandom()%10==0)
    {
      jjAddObject(OBJECT::SHARD,thisLevel.torches[i].x,thisLevel.torches[i].y);
    }
  }
  if(jjGameTicks%10==0)
  {
    int ID=jjAddObject(OBJECT::BOUNCEONCE,thisLevel.waterfall.x+16*jjSin(jjRandom()),thisLevel.waterfall.y);
    jjObjects[ID].determineCurAnim(ANIM::AMMO,12);
  }
}
void onPlayer(){
  p.powerup[WEAPON::RF]=p.powerup[WEAPON::TOASTER]=true;
}
void createExplosion(float x,float y,ANIM::Set set,uint8 anim){
  int ID=jjAddObject(OBJECT::EXPLOSION,x,y);
  jjObjects[ID].determineCurAnim(set,anim);
}