コード例 #1
0
ファイル: BeamSword.cpp プロジェクト: Technologx2013/iSSB
	void BeamSword::Update(long gameTime)
	{
		Item::Update(gameTime);
		if(active)
		{
			if(isHeld())
			{
				setHitState(true);
				setHoldOffset(0, 0);
			}
		}
		else
		{
			setHitState(false);
			if(isHeld())
			{
				Player*playr = getPlayer();
				switch(playr->getPlayerDir())
				{
					case Player::LEFT:
					changeAnimation("carry_left",FORWARD);
					break;
					
					case Player::RIGHT:
					changeAnimation("carry_right",FORWARD);
					break;
				}
				setHoldOffset(4,-4);
			}
			else
			{
				active = false;
				changeAnimation("normal",FORWARD);
			}
		}
	}
コード例 #2
0
ファイル: RayGun.cpp プロジェクト: 3Xpedite/iSSB
	RayGun::RayGun(float x1, float y1) : Item(x1, y1, 20000, TYPE_HOLD)
	{
		itemNo = Global::ITEM_RAYGUN;
		
		weight = 0.2f;
		
		ammo = 16;
		active = false;
		activeTime = 0;
		attackType = 0;
		
		Animation*anim;
		
		anim = new Animation("left",1,"Images/Game/Items/RayGun/raygun.png");
		addAnimation(anim);
		
		anim = new Animation("right",1,"Images/Game/Items/RayGun/raygun.png");
		anim->mirror(true);
		addAnimation(anim);
		
		anim = new Animation("down_left",1,"Images/Game/Items/RayGun/raygun_down.png");
		addAnimation(anim);
		
		anim = new Animation("down_right",1,"Images/Game/Items/RayGun/raygun_down.png");
		anim->mirror(true);
		addAnimation(anim);
		
		dir = (byte)((GameEngine::random()*2)+1);
		
		switch(dir)
		{
			case Player::LEFT:
			changeAnimation("left",FORWARD);
			break;
			
			case Player::RIGHT:
			changeAnimation("right",FORWARD);
			break;
		}
		
		setHoldOffset(5, 1);
	}