speed bullet var
This commit is contained in:
parent
d4e02f01b5
commit
bbb631f633
3
bullet.c
3
bullet.c
|
@ -42,9 +42,10 @@ void draw_bullets(Camera2D *cam)
|
||||||
if (bullets[i].time <= EPSILON)
|
if (bullets[i].time <= EPSILON)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
float speed = 50;
|
||||||
float angle = bullets[i].angle * PI/180;
|
float angle = bullets[i].angle * PI/180;
|
||||||
Vector2 toward = Vector2Normalize((Vector2) {cos(angle), sin(angle)});
|
Vector2 toward = Vector2Normalize((Vector2) {cos(angle), sin(angle)});
|
||||||
bullets[i].pos = Vector2Add(bullets[i].pos, Vector2Scale(toward, 50));
|
bullets[i].pos = Vector2Add(bullets[i].pos, Vector2Scale(toward, speed));
|
||||||
bullets[i].time -= GetFrameTime();
|
bullets[i].time -= GetFrameTime();
|
||||||
DrawTexture(textures[bullets[i].type], bullets[i].pos.x, bullets[i].pos.y, WHITE);
|
DrawTexture(textures[bullets[i].type], bullets[i].pos.x, bullets[i].pos.y, WHITE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue