]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
added capsule attack/animation handling
[l2e.git] / src / main.cpp
index 59348338391daea0d5c6ea5fdb1578fdd4f32fe3..53301ce5f5c785fa7c97d6d49f047936fa35e91c 100644 (file)
@@ -279,17 +279,34 @@ int main(int argc, char **argv) {
                gameState.heroes[3].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING);
                gameState.heroes[2].MapEntity().AddFollower(&gameState.heroes[3].MapEntity());
 
+               graphics::Sprite flashSprite(IMG_Load("test-data/flash.png"), 96, 96);
+               graphics::ComplexAnimation flashAttackAnimation(&flashSprite, 132);
+               graphics::ComplexAnimation::FrameProp flashAttackFrames[4];
+               flashAttackFrames[0] = graphics::ComplexAnimation::FrameProp(0, 1, Vector<int>(0, -16));
+               flashAttackFrames[1] = graphics::ComplexAnimation::FrameProp(0, 0, Vector<int>(0, -16));
+               flashAttackFrames[2] = graphics::ComplexAnimation::FrameProp(0, 1, Vector<int>(0, -16));
+               flashAttackFrames[3] = graphics::ComplexAnimation::FrameProp(0, 0, Vector<int>(0, -16));
+               flashAttackAnimation.SetFrames(flashAttackFrames, 4);
+               Capsule capsule;
+               capsule.SetName("Flash");
+               capsule.SetHealth(5, 5);
+               capsule.SetLevel(1);
+               capsule.GetStats().SetAttack(12);
+               capsule.GetStats().SetDefense(18);
+               capsule.GetStats().SetStrength(2);
+               capsule.GetStats().SetAgility(11);
+               capsule.GetStats().SetIntelligence(16);
+               capsule.GetStats().SetGut(23);
+               capsule.GetStats().SetMagicResistance(11);
+               capsule.SetBattleSprite(&flashSprite);
+               capsule.SetAttackAnimation(&flashAttackAnimation);
+               capsule.SetMeleeAnimation(gameState.heroes[0].MeleeAnimation());
+
                InitScreen screen(width, height);
 
                app::State *state(0);
 
                if (battle) {
-                       graphics::Sprite flashSprite(IMG_Load("test-data/flash.png"), 96, 96);
-                       Capsule capsule;
-                       capsule.SetName("Flash");
-                       capsule.SetHealth(13, 13);
-                       capsule.SetBattleSprite(&flashSprite);
-
                        BattleState *battleState(new BattleState(&gameConfig, bg, &monstersLayout));
                        battleState->AddMonster(monster);
                        battleState->AddMonster(monster);