Skip to content

Commit 09f821c

Browse files
committed
Adds 3 new animations and replaces sword swing.
The Explosion and tripple swing animations still need to be implemented.
1 parent 609f9df commit 09f821c

6 files changed

Lines changed: 11 additions & 6 deletions

File tree

assets/Extras/Explosion.png

5.33 KB
Loading

assets/Extras/SwordSwing.png

388 Bytes
Loading

assets/Extras/TrippleSwing.png

1.14 KB
Loading

src/player.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,16 +525,16 @@ build_sword_animation(Player *p, SDL_Renderer *renderer)
525525
{
526526
animation_load_texture(p->swordAnimation, "Extras/SwordSwing.png", renderer);
527527
animation_set_frames(p->swordAnimation, (AnimationClip[]) {
528-
{ 0, 0, 16, 16, 20 },
529-
{ 16, 0, 16, 16, 20 },
530-
{ 32, 0, 16, 16, 20 },
531-
{ 48, 0, 16, 16, 20 },
532-
{ 64, 0, 16, 16, 20 }
528+
{ 0, 0, 32, 32, 20 },
529+
{ 32, 0, 32, 32, 20 },
530+
{ 64, 0, 32, 32, 20 },
531+
{ 96, 0, 32, 32, 20 },
532+
{ 128, 0, 32, 32, 20 }
533533
});
534534

535535
p->swordAnimation->loop = false;
536536
p->swordAnimation->sprite->dim = GAME_DIMENSION;
537-
p->swordAnimation->sprite->clip = (SDL_Rect) { 0, 0, 16, 16 };
537+
p->swordAnimation->sprite->clip = (SDL_Rect) { 0, 0, 32, 32 };
538538
p->swordAnimation->sprite->rotationPoint = (SDL_Point) { 16, 16 };
539539
}
540540

src/skill.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ create_default(const char *s_label, Sprite *s)
306306
skill->use = NULL;
307307
skill->levelcap = 1;
308308
skill->tooltip = NULL;
309+
skill->animation = NULL;
309310
return skill;
310311
}
311312

@@ -1076,5 +1077,7 @@ skill_destroy(Skill *skill)
10761077
sprite_destroy(skill->icon);
10771078
if (skill->tooltip)
10781079
tooltip_destroy(skill->tooltip);
1080+
if (skill->animation)
1081+
animation_destroy(skill->animation);
10791082
free(skill);
10801083
}

src/skill.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define SKILL_H_
2121

2222
#include <stdbool.h>
23+
#include "animation.h"
2324
#include "roommatrix.h"
2425
#include "sprite.h"
2526
#include "vector2d.h"
@@ -60,6 +61,7 @@ typedef struct Skill_t {
6061
bool (*available)(Player*);
6162
bool (*use)(struct Skill_t*, SkillData*);
6263
Tooltip *tooltip;
64+
Animation *animation;
6365
} Skill;
6466

6567
Skill*

0 commit comments

Comments
 (0)