示例#1
0
	void BeamSword::onPlayerHit(Player*collide, byte dir)
	{
		if(isHeld())
		{
		    if(attackDir==ATTACK_NORMAL)
		    {
		    	causeDamage(collide,2);
		    	switch(getPlayer()->getPlayerDir())
		    	{
					case Player::LEFT:
		    		causeHurtLaunch(collide, -1,2,3, -1,1,2);
		    		causeHurt(collide, Player::RIGHT, 3);
		    		break;
		    		
					case Player::RIGHT:
		    		causeHurtLaunch(collide, 1,2,3, -1,1,2);
		    		causeHurt(collide, Player::LEFT, 3);
		    		break;
		    	}
		    }
		    else if(attackDir==ATTACK_SIDE)
		    {
		    	causeDamage(collide,3);
		    	switch(getPlayer()->getPlayerDir())
		    	{
					case Player::LEFT:
		    		causeHurtLaunch(collide, -1,3,3.5f, -1,2,2.3f);
		    		causeHurt(collide, Player::RIGHT, 3);
		    		break;
		    		
					case Player::RIGHT:
		    		causeHurtLaunch(collide, 1,3,3.5f, -1,2,2.3f);
		    		causeHurt(collide, Player::LEFT, 3);
		    		break;
		    	}
		    }
		    else if(attackDir==ATTACK_SMASH)
		    {
		    	causeDamage(collide,smashPower);
		    	switch(getPlayer()->getPlayerDir())
		    	{
					case Player::LEFT:
		    		causeHurtLaunch(collide, -1,2+((float)smashPower/4),2.1f, -1,2+((float)smashPower/4),2.6f);
		    		causeHurt(collide, Player::RIGHT, 4);
		    		break;
		    		
					case Player::RIGHT:
		    		causeHurtLaunch(collide, 1,2+((float)smashPower/4),2.1f, -1,2+((float)smashPower/4),2.6f);
		    		causeHurt(collide, Player::LEFT, 4);
		    		break;
		    	}
		    }
	    }
	}
示例#2
0
文件: RayGun.cpp 项目: 3Xpedite/iSSB
	void RayGun::Ray::onPlayerHit(Player*collide, byte dir)
	{
		if(isHittable(collide,dir))
		{
			if(collide->getAttacksPriority()==5)
			{
			    if(itemdir==collide->getPlayerDir())
			    {
			        causeDamage(collide,2);
			        collide->y-=3;
			        causeHurtLaunch(collide,0,0,0, -1,1,1);
			        switch(itemdir)
			        {
			            case Player::LEFT:
			            causeHurtLaunch(collide,-1,3,1, 0,0,0);
			            causeHurt(collide, Player::RIGHT, 300);
			            break;
						
			            case Player::RIGHT:
			            causeHurtLaunch(collide,1,3,1, 0,0,0);
			            causeHurt(collide, Player::LEFT, 300);
			            break;
			        }
			        destroy();
			    }
			    else
			    {
			        xvelocity=-xvelocity;
			        switch(itemdir)
			        {
			            case Player::LEFT:
						itemdir=Player::RIGHT;
			            changeAnimation("right", NO_CHANGE);
			            break;
			 
			            case Player::RIGHT:
						itemdir=Player::LEFT;
			            changeAnimation("left", NO_CHANGE);
			            break;
			        }
			    }
			}
			 
			else if(collide->getAttacksPriority()==6)
			{
			    xvelocity=-xvelocity;
			    switch(itemdir)
			    {
			        case Player::LEFT:
					itemdir=Player::RIGHT;
			        changeAnimation("right", NO_CHANGE);
			        break;
						
			        case Player::RIGHT:
					itemdir=Player::LEFT;
			        changeAnimation("left", NO_CHANGE);
			        break;
			    }
			}
			 
			else if(collide->getAttacksPriority()==7)
			{
			    destroy();
			}
			 
			else
			{
			    causeDamage(collide,2);
			    collide->y-=3;
			    causeHurtLaunch(collide,0,0,0, -1,1,1);
			    switch(itemdir)
			    {
			        case Player::LEFT:
			        causeHurtLaunch(collide, -1,3,1, 0,0,0);
			        causeHurt(collide, Player::RIGHT, 300);
			        break;
					
			        case Player::RIGHT:
			        causeHurtLaunch(collide,1,3,1, 0,0,0);
			        causeHurt(collide, Player::LEFT, 300);
			        break;
			    }
			    destroy();
			}
		}
	}