more minigun bullet + recule
This commit is contained in:
parent
b0feeb2099
commit
629ac1a90d
2
bullet.c
2
bullet.c
|
@ -11,7 +11,7 @@ typedef struct Bullet {
|
|||
float angle;
|
||||
} Bullet;
|
||||
|
||||
#define BULLET_MAX 500
|
||||
#define BULLET_MAX 5000
|
||||
|
||||
Bullet bullets[BULLET_MAX] = {0};
|
||||
|
||||
|
|
|
@ -27,11 +27,13 @@ void draw_minigun(Vector2 pos, Camera2D *cam)
|
|||
angle *= 180/PI;
|
||||
|
||||
if (key_down(KC_SHOOT)) {
|
||||
bullet_spawn(BULLET_MINIGUN, GetScreenToWorld2D(pos, *cam), angle);
|
||||
|
||||
int speed = 5;
|
||||
Vector2 world = GetScreenToWorld2D(pos, *cam);
|
||||
Vector2 toward = Vector2Normalize((Vector2) {cos(angle * PI/180), sin(angle * PI/180)});
|
||||
cam->target = Vector2Subtract(GetScreenToWorld2D(pos, *cam), Vector2Scale(toward, speed));
|
||||
cam->target = Vector2Subtract(world, Vector2Scale(toward, speed));
|
||||
|
||||
bullet_spawn(BULLET_MINIGUN, Vector2Subtract(world, Vector2Scale(toward, speed*1.0)), angle);
|
||||
bullet_spawn(BULLET_MINIGUN, Vector2Subtract(world, Vector2Scale(toward, speed*6.0)), angle);
|
||||
}
|
||||
|
||||
DrawTexturePro(m, source, dest, origin, angle + 90, WHITE);
|
||||
|
|
Loading…
Reference in New Issue