View Single Post
chandie

JCF Member

Joined: Jan 1970

Posts: 19

chandie has disabled reputation

Mar 6, 2020, 07:33 AM
chandie is offline
Reply With Quote
Turtle Boss

And another delayed response from me
It's been a while and I didn't keep the code. However I've tried using Normal Turtle animations and a new behavior in order to make it work and it helped. Here's the thing:

Code:
bool boss=false;


			void onLevelLoad()  {
	
	jjObjectPresets[OBJECT::PURPLEGEM].points = 2000;		
	jjObjectPresets[OBJECT::NORMTURTLE].behavior = TURTBOSS;
	jjObjectPresets[OBJECT::NORMTURTLE].points = 5000;
	jjObjectPresets[OBJECT::NORMTURTLE].energy = 50;
	jjObjectPresets[OBJECT::NORMTURTLE].bulletHandling = HANDLING::HURTBYBULLET;
	jjObjectPresets[OBJECT::NORMTURTLE].state = STATE::WALK;

	}
	
	

	void onFunction0(jjPLAYER@ play) {
	play.activateBoss();
	boss=true;
	{play.boss=jjAddObject(OBJECT::NORMTURTLE, 38*32, 55*32);}
		jjMusicLoad("boss.s3m");
		play.activateBoss(true);

	}	

	
		void TURTBOSS(jjOBJ@ boss) {

		jjPLAYER@ play = jjLocalPlayers[0];
	
			
	if ( boss.energy==0) 
	{	
		boss.counter==0;
		boss.counter += 0; 
		boss.determineCurAnim(ANIM::TURTLE, 7);
		boss.determineCurFrame();
		boss.frameID = boss.counter/56;
		jjDrawSpriteFromCurFrame(boss.xPos, boss.yPos, boss.curFrame, boss.direction, SPRITE::NORMAL);
		++boss.counter;
	
	if ( boss.energy==0&&++boss.counter>20)  
			jjEventSet(play.xPos / 32, play.yPos / 32, AREA::EOL);
	}
	
	if ((boss.xPos > play.xPos+3 || boss.xPos < play.xPos-3)&& boss.state != STATE::KILL)
	{boss.direction = (play.xPos < boss.xPos) ? +1 : +1;}
	else 
				{
				boss.direction==1;}
	if (boss.yPos < 54*32)
	{boss.yPos = boss.yPos;}
	if (boss.xPos > 24*32)
	{boss.xPos = boss.xPos;}
		switch (boss.state) {
		
	 case STATE::WALK:
        boss.behave(BEHAVIOR::WALKINGENEMY);
        {
		if (boss.counter >= 180)
		{boss.counter = 0; }
  
                boss.counter++;
                if (u==0||u==1)
                {if (++boss.counter < 180){
                        boss.xSpeed= (1+1)*boss.direction;
                        boss.determineCurAnim(ANIM::TURTLE, 7);
                        if (boss.counter == 10){
                        jjSample(boss.xPos, boss.yPos, SOUND::INTRO_GREN3);}
                        if (boss.justHit == 0)
                        {jjDrawSpriteFromCurFrame(boss.xPos, boss.yPos, boss.curFrame, boss.direction, SPRITE::NORMAL);}
                        boss.determineCurFrame();
                        //boss.frameID = boss.counter/10;
						}
                        
				break;		
						
						
  	
                        } }
						case STATE::FREEZE:
			if (boss.freeze > 0) {
				boss.draw();
				boss.freeze -= 4;
			}
			if (boss.freeze < 4) {
				boss.unfreeze(0);
				boss.state = boss.oldState;
			}
			
			break;
	case STATE::KILL:
	case STATE::DEACTIVATE:
		boss.deactivate();
		break;

		
										
						}
					//if (boss.justHit == 0)
		//jjDrawSpriteFromCurFrame(boss.xPos, boss.yPos, boss.curFrame, boss.direction, SPRITE::NORMAL);
		//else jjDrawSpriteFromCurFrame(boss.xPos, boss.yPos, boss.curFrame, boss.direction, SPRITE::SINGLECOLOR,15);			
						}