From 1ad6b01c2cac5f771fcef0911c6d81230e50d0ed Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 30 Aug 2012 00:19:31 +0200 Subject: [PATCH] moved Selan to test.l2s --- src/main.cpp | 36 +----------------------- test-data/test.l2s | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 35 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6f637a7..935d451 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,41 +106,7 @@ int main(int argc, char **argv) { Monster monster(*intp.GetMonster("lizard")); Hero maxim(*intp.GetHero("maxim")); - - SDL_Surface *selanImg(IMG_Load("test-data/selan.png")); - Sprite selanSprite(selanImg, 64, 64); - Hero selan; - selan.SetName("Selan"); - selan.SetLevel(1); - selan.SetSprite(&selanSprite); - selan.SetMaxHealth(28); - selan.SetHealth(28); - selan.SetMaxMana(23); - selan.SetMana(23); - selan.SetIP(0); - selan.SetStats(Stats(23, 21, 23, 19, 22, 80, 13)); - ComplexAnimation selanAttackAnimation(&selanSprite, framerate); - selanAttackAnimation.AddFrames(1, 0, Vector(4, 0), 2); - selanAttackAnimation.AddFrame(1, 0, Vector(8, 2)); - selanAttackAnimation.AddFrame(2, 0, Vector(10, 4)); - selanAttackAnimation.AddFrame(2, 0, Vector(14, 4)); - selanAttackAnimation.AddFrames(2, 0, Vector(12, 2), 3); - selanAttackAnimation.AddFrames(2, 1, Vector(14, 2), 2); - selanAttackAnimation.AddFrame(2, 1, Vector(2, 0)); - selanAttackAnimation.AddFrame(2, 2, Vector(-2, -4)); - selanAttackAnimation.AddFrame(2, 2, Vector(-8, -8)); - selanAttackAnimation.AddFrame(2, 2); - selan.SetAttackAnimation(&selanAttackAnimation); - ComplexAnimation selanSpellAnimation(&selanSprite, framerate); - selanSpellAnimation.AddFrames(2, 0, Vector(), 3); - selanSpellAnimation.AddFrames(2, 1, Vector(), 2); - selanSpellAnimation.AddFrames(2, 2, Vector(), 3); - selanSpellAnimation.AddFrames(2, 3, Vector(), 2); - selan.SetSpellAnimation(&selanSpellAnimation); - SDL_Surface *selanMeleeImg(IMG_Load("test-data/melee-selan.png")); - Sprite selanMeleeSprite(selanMeleeImg, 96, 96); - SimpleAnimation selanMeleeAnimation(&selanMeleeSprite, 2 * framerate, 4); - selan.SetMeleeAnimation(&selanMeleeAnimation); + Hero selan(*intp.GetHero("selan")); SDL_Surface *guyImg(IMG_Load("test-data/guy.png")); Sprite guySprite(guyImg, 64, 64); diff --git a/test-data/test.l2s b/test-data/test.l2s index 74e71cd..8474e1f 100644 --- a/test-data/test.l2s +++ b/test-data/test.l2s @@ -120,3 +120,73 @@ export Hero maxim { framecount: 4 } } + +Sprite selanSprite { + image: "test-data/selan.png", + size: <64,64> +} +export Hero selan { + name: "Selan", + level: 1, + sprite: selanSprite, + maxHealth: 28, + health: 28, + maxMana: 23, + mana: 23, + ip: 0, + stats: Stats { + atp: 23, + dfp: 21, + str: 23, + agl: 19, + int: 22, + gut: 80, + mgr: 13 + }, + attackAnimation: ComplexAnimation { + sprite: selanSprite, + frametime: frameTime, + repeat: false, + frames: [ + { column: 1, row: 0, disposition: < 4, 0> }, + { column: 1, row: 0, disposition: < 4, 0> }, + { column: 1, row: 0, disposition: < 8, 2> }, + { column: 2, row: 0, disposition: <10, 4> }, + { column: 2, row: 0, disposition: <14, 4> }, + { column: 2, row: 0, disposition: <12, 2> }, + { column: 2, row: 0, disposition: <12, 2> }, + { column: 2, row: 0, disposition: <12, 2> }, + { column: 2, row: 1, disposition: <14, 2> }, + { column: 2, row: 1, disposition: <14, 2> }, + { column: 2, row: 1, disposition: < 2, 0> }, + { column: 2, row: 2, disposition: <-2,-4> }, + { column: 2, row: 2, disposition: <-8,-8> }, + { column: 2, row: 2, disposition: < 0, 0> } + ] + }, + spellAnimation: ComplexAnimation { + sprite: selanSprite, + frametime: frameTime, + repeat: false, + frames: [ + { column: 3, row: 0, disposition: < 0, 0> }, + { column: 3, row: 0, disposition: < 0, 0> }, + { column: 3, row: 0, disposition: < 0, 0> }, + { column: 3, row: 1, disposition: < 0, 0> }, + { column: 3, row: 1, disposition: < 0, 0> }, + { column: 3, row: 2, disposition: < 0, 0> }, + { column: 3, row: 2, disposition: < 0, 0> }, + { column: 3, row: 2, disposition: < 0, 0> }, + { column: 3, row: 3, disposition: < 0, 0> }, + { column: 3, row: 3, disposition: < 0, 0> } + ] + }, + meleeAnimation: SimpleAnimation { + sprite: Sprite { + image: "test-data/melee-selan.png", + size: <96,96> + }, + frametime: twoFramesTime, + framecount: 4 + } +} -- 2.39.2