// Constructor for the enemy. The layer is initialized in Model's constructor.
Enemy::Enemy(int x, int y) : Model(x,y)
{
    // Create a default NodeLoaderLibrary.
    NodeLoaderLibrary* nodeLoaderLibrary;
    nodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
    
    // Create a new CCBReader with a default NodeLoaderLibrary
    // This can take a lot of parameters to use code connections and more
    CCBReader* ccbReader = new CCBReader(nodeLoaderLibrary);
    
    // Load the main node from the CocosBuilder file
    modelNodes = ccbReader->readNodeGraphFromFile("Orc.ccbi");
    
    // Get the animationmanager so we can animate the thing afterwards
    animationManager = ccbReader->getAnimationManager();
    modelNodes->setPosition( Point(x, y));
    //modelNodes->setScale(0.5f);
    
    Node* rShoulder = modelNodes->getChildByTag(1)->getChildByTag(4)->getChildByTag(1);
    rShoulder->setZOrder(0);
    Node* lHip = modelNodes->getChildByTag(1)->getChildByTag(1);
    lHip->setZOrder(0);
    Node* rHip = modelNodes->getChildByTag(1)->getChildByTag(2);
    rHip->setZOrder(0);
    Node* rUpperArm = rShoulder->getChildByTag(2);
    rUpperArm->setZOrder(-1);
    Node* chest = modelNodes->getChildByTag(1)->getChildByTag(4)->getChildByTag(2);
    chest->setZOrder(0);
    Node* hips = modelNodes->getChildByTag(1)->getChildByTag(3);
    hips->setZOrder(0);
    modelNodes->getChildByTag(1)->getChildByTag(4)->setZOrder(0);
    
    Node* lShoulder = modelNodes->getChildByTag(1)->getChildByTag(4)->getChildByTag(4);
    lShoulder->setZOrder(3);
    Node* rElbow = rShoulder->getChildByTag(1);
    rElbow->setZOrder(1);
    Node* rLowerArm = rShoulder->getChildByTag(1)->getChildByTag(1);
    rLowerArm->setZOrder(2);
    Node* rHand = rShoulder->getChildByTag(1)->getChildByTag(2);
    rHand->getChildByTag(1)->setVisible(true);
    rHand->setZOrder(2);
    
    Node* neck = modelNodes->getChildByTag(1)->getChildByTag(4)->getChildByTag(3);
    neck->setZOrder(2);
    
    
    this->addChild(modelNodes); // Add the loaded node to the scene (this)
    
    healthStatus->setPosition(Point(x-500, y+100));
    this->addChild(healthStatus);
    
    initAttacks();
    
    // As nobody called ccbReader->autoRelease(), returning now would cause
    // a memory leak. We can call autoRelease or delete it ourselves.
    delete ccbReader;
    
}
Exemple #2
0
void initTable() {
	initAttacks(false);
	initAttacks(true);
	initKingAttacks();
	initGoldAttacks();
	initSilverAttacks();
	initPawnAttacks();
	initKnightAttacks();
	initLanceAttacks();
	initSquareRelation();
	initAttackToEdge();
	initBetweenBB();
	initCheckTable();
	initSquareDistance();

	Book::init();
	initSearchTable();
}
Exemple #3
0
void initTable() {
	initAttacks(false);
	initAttacks(true);
	initKingAttacks();
	initGoldAttacks();
	initSilverAttacks();
	initPawnAttacks();
	initKnightAttacks();
	initLanceAttacks();
	initSquareRelation();
	initAttackToEdge();
	initBetweenBB();
	initCheckTable();

	auto eval = std::unique_ptr<Evaluater>(new Evaluater);
	eval->init();

	Book::init();
	initSearchTable();
}
Exemple #4
0
void Board::initStartPosition()
{
    initMasks();
    initAttacks();

    wKing = 1 << 3;
    wQueens = 1 << 4;
    wRooks = 1 | (1 << 7);
    wBishops = (1 << 2) | (1 << 5);
    wKnights = (1 << 1) | (1 << 6);
    wPawns = 0x000000000000FF00;
    wPieces = wKing | wQueens | wRooks | wBishops | wKnights | wPawns;

    bKing = 1ULL << 59;
    bQueens = 1ULL << 60;
    bRooks = (1ULL << 63) | (1ULL << 56);
    bBishops = (1ULL << 61) | (1ULL << 58);
    bKnights = (1ULL << 62) | (1ULL << 57);
    bPawns = 0x00FF000000000000;
    bPieces = bKing | bQueens | bRooks | bBishops | bKnights | bPawns;

    allPieces = wPieces | bPieces;
}
Exemple #5
0
Board0x88::Board0x88(void)
{
  initBoard();
  initAttacks();
  //initMoves();
}