Пример #1
0
bool Player::init(char* name, int tag, int money, int strength)
{

	this->setTag(tag);
	addPlayerAnimation();  //角色动画
	SpriteFrame* spf;
	switch (tag){
	case PLAYER_1_TAG:
	{	
		spf = playerSpriteFrameCache->getSpriteFrameByName("player1_anim_01.png");
		break;
	}
	case PLAYER_2_TAG:
	{
		spf = playerSpriteFrameCache->getSpriteFrameByName("player2_anim_02.png");
		break;
	}
	}

	setPlayerAnimate();
	Sprite::initWithSpriteFrame(spf);  //设置当前精灵
	_name = name;
	_money = money;
	_strength = strength;
	//添加股票
	stockMap.insert(0, Stock::create(800100, String::create("rich_technology"), 0, 100, 0, 100));
	stockMap.insert(1, Stock::create(800200, String::create("rich_technology"), 0, 200, 0, 100));
	stockMap.insert(2, Stock::create(800300, String::create("rich_technology"), 0, 70, 0, 0));
	stockMap.insert(3, Stock::create(800400, String::create("rich_technology"), 0, 100, 0, 100));
	stockMap.insert(4, Stock::create(800500, String::create("rich_technology"), 0, 150, 0, 0));


	return true;
}
Пример #2
0
bool RicherPlayer::init(char* name, int tag,bool enemy,int money,int strength)
{
	this->setTag(tag);
	addPlayerAnimation();
	SpriteFrame* spf;
	switch(tag)
	{
	case PLAYER_1_TAG:
		{
			spf = player_spriteFrameCache->getSpriteFrameByName("player1_anim_01.png");
			break;
		}
	case PLAYER_2_TAG:
		{
			spf = player_spriteFrameCache->getSpriteFrameByName("player2_anim_02.png");
			break;
		}
	}

	setPlayerAnimate();
	Sprite::initWithSpriteFrame(spf);
	_name = name;
	_enemy = enemy;
	_money = money;
	_strength = strength;
	_isMyTurn = true;
	restTimes = 0;

	memset(left_animation, 0, 20);
	memset(right_animation, 0, 20);
	memset(down_animation, 0, 20);
	memset(up_animation, 0, 20);


	stockMap.insert(0,Stock::create(800100,LanguageString::getInstance()->getLanguageString(RICH_TECHNOLOGY),0,10,0,100));
	stockMap.insert(1,Stock::create(800200,LanguageString::getInstance()->getLanguageString(RICH_TECHNOLOGY),0,20,0,200));
	stockMap.insert(2,Stock::create(800300,LanguageString::getInstance()->getLanguageString(RICH_TECHNOLOGY),0,70,0,800));
	stockMap.insert(3,Stock::create(800400,LanguageString::getInstance()->getLanguageString(RICH_TECHNOLOGY),0,10,0,400));
	stockMap.insert(4,Stock::create(800500,LanguageString::getInstance()->getLanguageString(RICH_TECHNOLOGY),0,0,0,0));

	skill_vector.push_back(1);
	skill_vector.push_back(1);
	skill_vector.push_back(1);
	addSkillAnimation();
	return true;
}