Code works more or less good
This commit is contained in:
1 parent
3495d28edf
commit
348aa632dd
17 files changed
+4180
-56
No files matched your search
+12
-35
@@ -103,43 +103,19 @@ namespace ZL
|
||||
player->setupHitSparks(sparkTexture);
|
||||
std::cout << "Load resurces step 9" << std::endl;
|
||||
|
||||
// Load NPCs from JSON
|
||||
// Load NPCs from JSON. Aggressive (canAttack) NPCs need a player target
|
||||
// and hit sparks; peaceful NPCs don't take damage from the player so
|
||||
// they don't need either.
|
||||
npcs = GameObjectLoader::loadAndCreate_Npcs(params.npcsJsonPath, CONST_ZIP_FILE);
|
||||
for (auto& npc : npcs) {
|
||||
if (npc) npc->setupHitSparks(sparkTexture);
|
||||
if (!npc) continue;
|
||||
if (npc->canAttack) {
|
||||
npc->setupHitSparks(sparkTexture);
|
||||
npc->attackTarget = player.get();
|
||||
}
|
||||
}
|
||||
|
||||
auto ghostTexture = std::make_shared<Texture>(CreateTextureDataFromPng("resources/w/ghost_skin001.png", CONST_ZIP_FILE));
|
||||
|
||||
std::cout << "Load resurces step 11" << std::endl;
|
||||
auto npc02 = std::make_unique<Character>();
|
||||
|
||||
npc02->loadBinaryAnimation(AnimationState::STAND, "resources/w/default_float001.anim", CONST_ZIP_FILE);
|
||||
npc02->loadBinaryAnimation(AnimationState::WALK, "resources/w/default_float001.anim", CONST_ZIP_FILE);
|
||||
npc02->loadBinaryAnimation(AnimationState::ACTION_IDLE, "resources/w/float_attack003_cut.anim", CONST_ZIP_FILE);
|
||||
npc02->loadBinaryAnimation(AnimationState::ACTION_ATTACK, "resources/w/float_attack003.anim", CONST_ZIP_FILE);
|
||||
npc02->loadBinaryAnimation(AnimationState::STAND_TO_ACTION, "resources/w/default_float001_cut.anim", CONST_ZIP_FILE);
|
||||
npc02->loadBinaryAnimation(AnimationState::ACTION_TO_STAND, "resources/w/default_float001_cut.anim", CONST_ZIP_FILE);
|
||||
npc02->loadBinaryAnimation(AnimationState::ACTION_TO_DEATH, "resources/w/default_float001_cut.anim", CONST_ZIP_FILE);
|
||||
npc02->loadBinaryAnimation(AnimationState::DEATH_IDLE, "resources/w/default_float001_cut.anim", CONST_ZIP_FILE);
|
||||
|
||||
npc02->npcId = "ghost_01x";
|
||||
npc02->npcName = "Evil Ghost";
|
||||
npc02->setTexture(ghostTexture);
|
||||
npc02->walkSpeed = 1.5f;
|
||||
npc02->rotationSpeed = 8.0f;
|
||||
npc02->modelScale = 0.01f;
|
||||
npc02->hp = 30;
|
||||
//npc02->modelScale = 0.1f;
|
||||
npc02->modelCorrectionRotation = Eigen::Quaternionf(Eigen::AngleAxisf(M_PI, Eigen::Vector3f::UnitY()));
|
||||
|
||||
npc02->position = params.ghostPosition;
|
||||
npc02->setTarget(npc02->position);
|
||||
npc02->canAttack = true;
|
||||
npc02->attackTarget = player.get();
|
||||
npc02->setupHitSparks(sparkTexture);
|
||||
|
||||
npcs.push_back(std::move(npc02));
|
||||
auto sparkTexture2 = std::make_shared<Texture>(CreateTextureDataFromPng("resources/w/star.png", CONST_ZIP_FILE));
|
||||
|
||||
// Teleport zone visuals: an upward fountain of sparks parked at the
|
||||
// teleport position, so the player can spot the zone from a distance.
|
||||
@@ -150,12 +126,13 @@ namespace ZL
|
||||
std::vector<Vector3f> teleportEmitPoints;
|
||||
teleportEmitPoints.push_back(Vector3f{ teleportPosition.x(), teleportPosition.y(), teleportPosition.z() });
|
||||
teleportSparks->setEmissionPoints(teleportEmitPoints);
|
||||
teleportSparks->setTexture(sparkTexture);
|
||||
teleportSparks->setTexture(sparkTexture2);
|
||||
teleportSparks->setEmissionRate(50.0f);
|
||||
teleportSparks->setMaxParticles(80);
|
||||
teleportSparks->setParticleSize(0.15f);
|
||||
teleportSparks->setParticleSize(0.05f);
|
||||
teleportSparks->setBiasX(0.0f);
|
||||
teleportSparks->setEmissionDirection(Vector3f{ 0.0f, 1.0f, 0.0f });
|
||||
teleportSparks->setEmissionRadius(teleportRadius);
|
||||
teleportSparks->setSpeedRange(0.5f, 1.0f);
|
||||
teleportSparks->setZSpeedRange(0.5f, 1.5f);
|
||||
teleportSparks->setScaleRange(0.5f, 1.0f);
|
||||
|
||||
Reference in new issue
Block a user