Skill ideas. Not sure I like them.

This commit is contained in:
Linus_Probert 2018-02-28 15:28:45 +01:00
parent 727e1f5dd3
commit 20cb94b529
3 changed files with 27 additions and 1 deletions

View File

@ -27,11 +27,22 @@ create_default(const char *s_label, Sprite *s)
{
Skill *skill = ec_malloc(sizeof(Skill));
m_strcpy(skill->label, 20, s_label);
skill->resetTime = 5;
skill->resetCountdown = 0;
skill->icon = s;
skill->use = NULL;
return skill;
}
static bool
skill_use_flurry(Skill *skill, SkillData *data)
{
Position pos = position_to_matrix_coords(&data->player->sprite->pos);
UNUSED(pos);
UNUSED(skill);
return true;
}
static Skill *
create_flurry(void)
{
@ -42,6 +53,7 @@ create_flurry(void)
s->clip = CLIP16(0, 0);
s->fixed = true;
Skill *skill = create_default("Flurry", s);
skill->use = skill_use_flurry;
return skill;
}

View File

@ -23,16 +23,25 @@
#include "player.h"
#include "roommatrix.h"
#include "sprite.h"
#include "vector2d.h"
enum SkillType {
FLURRY
};
typedef struct SkillData_t {
Player *player;
RoomMatrix *matrix;
Vector2d direction;
} SkillData;
typedef struct Skill_t {
char label[20];
Sprite *icon;
unsigned int resetTime;
unsigned int resetCountdown;
bool active;
void (*use)(struct Skill_t*, Player*, RoomMatrix*);
bool (*use)(struct Skill_t*, SkillData*);
} Skill;
Skill*

View File

@ -19,6 +19,11 @@
#ifndef VECTOR2D_H_
#define VECTOR2D_H_
#define VECTOR2D_RIGHT (Vector2d) { 1, 0 }
#define VECTOR2D_LEFT (Vector2d) { -1, 0 }
#define VECTOR2D_UP (Vector2d) { 0, -1 }
#define VECTOR2D_DOWN (Vector2d) { 0, 1 }
typedef struct Vector2d_t {
float x;
float y;