Example #1
0
void Kirby::bup() {
	if(action != BUP) {
		PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 190, 199, 20, ANIM_ONESHOT);
		AS_SoundQuickPlay(kirbybup1);
		aerial = true;
		delay = 60/20 * 10;
		dy = -6;
		dx = 0;
		fastfall = 0;
		DI = 0;
		setDirection();
		action = BUP;
	}
	else {
		if(delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 199) {
			PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 200, 200, 20, ANIM_LOOP, -1);
			AS_SoundQuickPlay(kirbybup2);
			delay = 60/20 * 1;
			dy = 4;
		}
		else if(delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 200) {
			if(!checkFloorCollision()) {
				PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 200, 200, 20, ANIM_LOOP, -1);
				delay = 60/20 * 1;
				dy = 4;
			}
			else {
				PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 201, 201, 20, ANIM_LOOP, -1);
				delay = 60/20 * 1;
				int directionmodifier = 1;
				if(direction ==RIGHT) directionmodifier = -1;
				Hitbox tempbox;
				tempbox.addCircle(createAtkbox(36, 805%64, 22, Knockback((-1*directionmodifier), -.5, 8), 24));
				tempbox.addCircle(createAtkbox(30, 794%63, 22, Knockback((-1*directionmodifier), -.5, 8), 24));
				tempbox.addCircle(createAtkbox(47, 812%64, 10, Knockback((-1*directionmodifier), -.5, 8), 24));
				((vector<Projectile>*)getProj())->push_back(Projectile(x, y, -5*directionmodifier, 0, 20, FINALCUTTER, charnum, tempbox, stage, display));
			}
		}
	}
}
Example #2
0
void Ike::bup() {
    if (action != BUP) {
        PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 118, 122, 15, ANIM_LOOP, -1);
        delay = 60 / 15 * 5;
        setDirection();
        dx = 0;
        if (aerial) dy = -gravity;
        else dy = 0;
        action = BUP;
        int directionmodifier = 1;
        if (direction == RIGHT) directionmodifier = -1;
        Hitbox tempbox;
        tempbox.addCircle(createAtkbox(32, 32, 15, Knockback(0, 0, 2), 3, -2));
        Projectile p = Projectile(x, y, -.1 * directionmodifier, -4, 30, IKESWORD, charnum, tempbox, stage, display);
        ((vector<Projectile>*)getProj())->push_back(p);
    }
    else if (delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 122) {
        PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 127, 127, 15, ANIM_LOOP, -1);
        PA_FatPlaySfx("ikebup");
        delay = 60 / 15 * 1;
    }
    else if (delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 127) {
        PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 128, 128, 15, ANIM_LOOP, -1);
        delay = 60 / 15 * 3;
        dy = -gravity - 6;
        aerial = true;
    }
    else if (delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 128) {
        PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 129, 134, 15, ANIM_LOOP, -1);
        delay = 60 / 15 * 6;
        dy = -gravity;
    }
    else if (PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 135 && checkFloorCollision()) {
        PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 136, 138, 15, ANIM_LOOP, -1);
        delay = 60 / 15 * 3;
        dy = 0;
        aerial = false;
    }
    else if (delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 138) {
        idle();
    }
    else if ((delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 134) || (delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 135)) {
        PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 135, 135, 15, ANIM_LOOP, -1);
        delay = 60 / 15 * 1;
        dy = -gravity + 6;
    }
}
Example #3
0
void Mario::bdown() {
	if (action != BDOWN) {
		PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 149, 149, 20, ANIM_LOOP, -1);
		delay = 60 / 20 * 1;
		fluddcharge = 0;
		dx = 0;
		if (aerial) dy = -gravity / 2;
		else dy = 0;
		action = BDOWN;
	}
	else if (custom_action(ACTION_SPECIAL, PAD_RELEASED) && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 149) {
		PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 150, 150, 12, ANIM_LOOP, -1);
		delay = 60 / 12 * 1;
		int directionmodifier = 1;
		if (direction == RIGHT) directionmodifier = -1;
		Hitbox tempbox;
		tempbox.addCircle(createAtkbox(58, 32, 5, Knockback((-1*directionmodifier), -.5, 6), 60, 5));
		((vector<Projectile>*)getProj())->push_back(Projectile(x, y - 16, -5*directionmodifier, 0, 2*fluddcharge, FLUDDWATER, charnum, tempbox, stage, display));
		fluddcharge = 0;
	}
	else if (PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 150) {
		if (delay == 1) {
			fall();
		}
	}
	else if (delay == 1 && PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 149) {
		delay = 60 / 20 * 1;
		fluddcharge++;
	}
	else if (aerial && checkFloorCollision()) {
		dy = 0;
	}
	else {
		fluddcharge++;
		if (fluddcharge > 30) fluddcharge = 30;
	}
}
Example #4
0
Fighter* Projectile::checkHits(Fighter* other) {
	Hitbox temp = hit;
	Hitbox atkbox;
	vector<Circle> circles = temp.getCircles();
	for (uint8 n = 0; n < circles.size(); n++) {
		Circle current = circles[n];
		Circle newcircright(current.getX() + x, current.getY() + y, current.getRadius(), current.getKnockback(), current.damage);
		Circle newcircleft(64 - current.getX() + x, current.getY() + y, current.getRadius(), current.getKnockback(), current.damage);
		if (dx < 0) atkbox.addCircle(newcircright);
		else atkbox.addCircle(newcircleft);
	}
	if(TYPE == THUNDER1 || TYPE == THUNDER2 || TYPE == THUNDER3 || TYPE == THUNDER4) {
		vector<Projectile> projs = *((vector<Projectile>*)getProj());
		for(int n = 0; n < (int)projs.size(); n++) {
			if(projs[n].owner == owner && (projs[n].TYPE == THUNDER1 || projs[n].TYPE == THUNDER2 || projs[n].TYPE == THUNDER3 || projs[n].TYPE == THUNDER4)) {
				if(!projs[n].enabled) enabled = false;
			}
		}
	}
	if (!enabled) {
		if(TYPE == THUNDER1 || TYPE == THUNDER2 || TYPE == THUNDER3 || TYPE == THUNDER4) {
			vector<Projectile> projs = *((vector<Projectile>*)getProj());
			for(int n = 0; n < (int)projs.size(); n++) {
				if(projs[n].owner == owner && (projs[n].TYPE == THUNDER1 || projs[n].TYPE == THUNDER2 || projs[n].TYPE == THUNDER3 || projs[n].TYPE == THUNDER4)) {
					projs[n].enabled = false;
				}
			}
		}
		return other;
	}
	if (other -> respawntimer > 0) return other;
	if (other -> invincibility > 0) return other;
	if(atkbox.hits(other -> getAtkbox())) {
		if(atkbox.getHitCircle(other -> getAtkbox()).priority < other -> getAtkbox().getHitCircle(atkbox).priority) {
			if (dx < 0) other -> takeDamage(atkbox.getHitCircle(other -> getDefbox(PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM))), 1, owner, 0);
			else other -> takeDamage(atkbox.getHitCircle(other -> getDefbox(PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM))), -1, owner, 0);
		}
		else if(atkbox.getHitCircle(other -> getAtkbox()).priority == other -> getAtkbox().getHitCircle(atkbox).priority) {
			removeProj(num); 
		}
		else {
			removeProj(num);
			return other; // they win priority
		}
	}
	else if(atkbox.hits(other -> getDefbox(PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM)))) {
		if(other -> MYCHAR == KIRBY && PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM) == 189) {
			if(TYPE != THUNDER1 && TYPE != THUNDER2 && TYPE != THUNDER3 && TYPE != THUNDER4 && TYPE != IKESWORD) removeProj(num);
			else atkbox.enabled = false;
		}
		else if (other -> action == AIRDODGE || other -> action == ROLL || other -> action == DODGE) { /*doesn't hit*/
		}
		else if (other -> action == SHIELD) {
			other -> shieldstr -= (int)((atkbox.getHitCircle(other -> getDefbox(PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM))).damage));
			if(TYPE != THUNDER1 && TYPE != THUNDER2 && TYPE != THUNDER3 && TYPE != THUNDER4 && TYPE != IKESWORD) removeProj(num);
			else atkbox.enabled = false;
			if(TYPE == THUNDER1 || TYPE == THUNDER2 || TYPE == THUNDER3 || TYPE == THUNDER4) {
				vector<Projectile> projs = *((vector<Projectile>*)getProj());
				for(int n = 0; n < (int)projs.size(); n++) {
					if(projs[n].owner == owner && (projs[n].TYPE == THUNDER1 || projs[n].TYPE == THUNDER2 || projs[n].TYPE == THUNDER3 || projs[n].TYPE == THUNDER4)) projs[n].enabled = false;
				}
			}
		}
		else if(other -> COUNTER) {
			if(TYPE != THUNDER1 && TYPE != THUNDER2 && TYPE != THUNDER3 && TYPE != THUNDER4 && TYPE != IKESWORD) removeProj(num);
			else atkbox.enabled = false;
			other -> COUNTER = false;
			if(other -> MYCHAR == IKE && (PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM) == 139 || PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM) == 140)) {
				PA_StartSpriteAnimEx(MAIN_SCREEN, other -> SPRITENUM, 143, 144, 10, ANIM_LOOP, -1);
				other -> action = ATTACK;
				other -> delay = 60/10 * 2;
				other -> freeze(30);
				other -> dx = 0;
				PA_StartSpriteAnimEx(MAIN_SCREEN, other -> SPRITENUM, 139, 139, 1, ANIM_LOOP, -1);
			}
			if(TYPE == THUNDER1 || TYPE == THUNDER2 || TYPE == THUNDER3 || TYPE == THUNDER4) {
				vector<Projectile> projs = *((vector<Projectile>*)getProj());
				for(int n = 0; n < (int)projs.size(); n++) {
					if(projs[n].owner == owner && (projs[n].TYPE == THUNDER1 || projs[n].TYPE == THUNDER2 || projs[n].TYPE == THUNDER3 || projs[n].TYPE == THUNDER4)) projs[n].enabled = false;
				}
			}
		}
		else if(other -> CAPE) {
			dx *= -1;
			owner = other -> charnum;
			vector<Circle> temp = hit.getCircles();
			hit.reset();
			for(int n = 0; n < (int)temp.size();n++) {
				hit.addCircle(Circle(temp[n].getX(), temp[n].getY(), temp[n].getRadius(), Knockback(temp[n].getKnockback().dx * -1, temp[n].getKnockback().dy, temp[n].getKnockback().length), temp[n].damage));
			}
			if(dx > 0) PA_SetSpriteHflip(MAIN_SCREEN, num, 0);
			if(dx < 0) PA_SetSpriteHflip(MAIN_SCREEN, num, 1);
		}
		else if (other -> ABSORB && (TYPE != IKESWORD)) {
			other -> percentage -= atkbox.getHitCircle(other -> getDefbox(PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM))).damage;
			if(other -> percentage < 0) other -> percentage = 0;
			if(TYPE != THUNDER1 && TYPE != THUNDER2 && TYPE != THUNDER3 && TYPE != THUNDER4) removeProj(num);
			else atkbox.enabled = false;
			if(TYPE == THUNDER1 || TYPE == THUNDER2 || TYPE == THUNDER3 || TYPE == THUNDER4) {
				vector<Projectile> projs = *((vector<Projectile>*)getProj());
				for(int n = 0; n < (int)projs.size(); n++) {
					if(projs[n].owner == owner && (projs[n].TYPE == THUNDER1 || projs[n].TYPE == THUNDER2 || projs[n].TYPE == THUNDER3 || projs[n].TYPE == THUNDER4)) projs[n].enabled = false;
				}
			}
		}
		else {
			other -> takeDamage(atkbox.getHitCircle(other -> getDefbox(PA_GetSpriteAnimFrame(MAIN_SCREEN, other -> SPRITENUM))), 1, owner, 0);
			if (TYPE != FINALCUTTER && TYPE != IKESWORD && TYPE != THUNDER1 && TYPE != THUNDER2 && TYPE != THUNDER3 && TYPE != THUNDER4) removeProj(num);
			else enabled = false;
			if(TYPE == THUNDER1 || TYPE == THUNDER2 || TYPE == THUNDER3 || TYPE == THUNDER4) {
				vector<Projectile> projs = *((vector<Projectile>*)getProj());
				for(int n = 0; n < (int)projs.size(); n++) {
					if(projs[n].owner == owner && (projs[n].TYPE == THUNDER1 || projs[n].TYPE == THUNDER2 || projs[n].TYPE == THUNDER3 || projs[n].TYPE == THUNDER4)) projs[n].enabled = false;
				}
			}
		}
	}
	return other;
}
Example #5
-1
void Mario::bneut() {
	if (action != BNEUT) {
		PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 132, 133, 12, ANIM_LOOP, -1);
		delay = 60 / 12 * 2;
		dx = 0;
		action = BNEUT;
	}
	else if (PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 133 && delay == 1) {
		PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 134, 134, 10, ANIM_LOOP, -1);
		delay = 60 / 10 * 1;
		PA_FatPlaySfx("mariobneut");
		int directionmodifier = 1;
		if (direction == RIGHT) directionmodifier = -1;
		Hitbox tempbox;
		tempbox.addCircle(createAtkbox(32, 32, 6, Knockback(-.25*directionmodifier, 0, 6), 10, 5));
		Projectile p = Projectile(x, y, -2 * directionmodifier, 0, 120, FIREBALL, charnum, tempbox, stage, display);
		((vector<Projectile>*)getProj())->push_back(p);
	}
	else if (PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 134 && delay == 1) {
		PA_StartSpriteAnimEx(MAIN_SCREEN, SPRITENUM, 135, 136, 12, ANIM_LOOP, -1);
		delay = 60 / 12 * 2;
	}
	else if (PA_GetSpriteAnimFrame(MAIN_SCREEN, SPRITENUM) == 136 && delay == 1) {
		fall();
	}
	else if (aerial && checkFloorCollision()) dy = 0;
}