attaque animation
This commit is contained in:
parent
cb3bff4ac5
commit
2f1fc1e4ae
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 958 B |
19
ninja.c
19
ninja.c
|
@ -5,12 +5,14 @@
|
|||
#include "keys.h"
|
||||
|
||||
Texture ninja_texture;
|
||||
Texture ninja_attack_texture;
|
||||
|
||||
float dash_time = 0;
|
||||
|
||||
void load_ninja()
|
||||
{
|
||||
ninja_texture = LoadTexture("data/ninja.png");
|
||||
ninja_attack_texture = LoadTexture("data/ninja_attaque.png");
|
||||
}
|
||||
|
||||
float ninja_radius()
|
||||
|
@ -64,11 +66,11 @@ void hit_hitbox(Vector2 pos, float angle)
|
|||
coll[i] = Vector2Rotate(coll[i], angle * PI/180);
|
||||
}
|
||||
DrawTriangle((Vector2){ pos.x + coll[0].x, pos.y + coll[0].y },
|
||||
(Vector2){ pos.x + coll[1].x, pos.y + coll[1].y },
|
||||
(Vector2){ pos.x + coll[2].x, pos.y + coll[2].y }, VIOLET);
|
||||
(Vector2){ pos.x + coll[1].x, pos.y + coll[1].y },
|
||||
(Vector2){ pos.x + coll[2].x, pos.y + coll[2].y }, VIOLET);
|
||||
DrawTriangle((Vector2){ pos.x + coll[3].x, pos.y + coll[3].y },
|
||||
(Vector2){ pos.x + coll[4].x, pos.y + coll[4].y },
|
||||
(Vector2){ pos.x + coll[5].x, pos.y + coll[5].y }, VIOLET);
|
||||
(Vector2){ pos.x + coll[4].x, pos.y + coll[4].y },
|
||||
(Vector2){ pos.x + coll[5].x, pos.y + coll[5].y }, VIOLET);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +79,12 @@ void draw_ninja(Vector2 pos, Camera2D *cam)
|
|||
Vector2 dash = ninja_dash(GetScreenToWorld2D(pos, *cam), GetScreenToWorld2D(GetMousePosition(), *cam), 0.12);
|
||||
cam->target = Vector2Add(cam->target, dash);
|
||||
|
||||
Texture n = ninja_texture;
|
||||
Texture n;
|
||||
if (dash_time >= EPSILON)
|
||||
n= ninja_attack_texture;
|
||||
else
|
||||
n = ninja_texture;
|
||||
|
||||
Rectangle source = {0, 0, n.width, n.height};
|
||||
Rectangle dest = {pos.x, pos.y, n.width, n.height};
|
||||
Vector2 origin = {n.width/2, n.height/2};
|
||||
|
@ -86,5 +93,5 @@ void draw_ninja(Vector2 pos, Camera2D *cam)
|
|||
angle += 90;
|
||||
DrawTexturePro(n, source, dest, origin, angle, WHITE);
|
||||
|
||||
hit_hitbox(pos, angle);
|
||||
// hit_hitbox(pos, angle);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue