void Enemy::handleCollisionWith(GameObject* gameObject) { // if (this->hp<=0) { // this->isScheduledForRemove = true; // } // // bloodBar->setScaleX(0.3f*hp/maxHp); // if (gameObject != NULL) { if (gameObject->getTag() < 200) { if (stopAction()) { return; } if (checkIsCollision(gameObject)) { isCollision = true; stop(); CCBAnimationManager* animationManager = dynamic_cast<CCBAnimationManager*>(this->getUserObject()); if (animationManager->getRunningSequenceName() == NULL or strcmp(animationManager->getRunningSequenceName(), "attack") != false) { animationManager->runAnimationsForSequenceNamed("attack"); CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(effectSoundFileName); gameObject->atkHandler(atk, this); } curActionCount++; } } } }
void Enemy::resetSpeed() { xSpeed = kCJStartSpeed; CCBAnimationManager* animationManager = dynamic_cast<CCBAnimationManager*>(this->getUserObject()); if (animationManager->getRunningSequenceName() == NULL or strcmp(animationManager->getRunningSequenceName(), "walk") != false) { animationManager->runAnimationsForSequenceNamed("walk"); } }
void Soldier::normalAtkHandler(GameObject* gameObject) { CCBAnimationManager* animationManager = dynamic_cast<CCBAnimationManager*>(this->getUserObject()); if (animationManager->getRunningSequenceName() == NULL or strcmp(animationManager->getRunningSequenceName(), "attack1") != false) { animationManager->runAnimationsForSequenceNamed("attack1"); CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(effectSoundFileName); gameObject->atkHandler(atk, this); } }