Fix examples
This commit is contained in:
parent
80b9ac1873
commit
a4e36efb64
|
|
@ -226,13 +226,13 @@ void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *e
|
|||
static float fractionSpeed = 0.8f;
|
||||
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
Vector2 diff = Vector2Subtract(player->position, camera->target);
|
||||
Vector2 diff = Vector2SubtractV(player->position, camera->target);
|
||||
float length = Vector2Length(diff);
|
||||
|
||||
if (length > minEffectLength)
|
||||
{
|
||||
float speed = fmaxf(fractionSpeed*length, minSpeed);
|
||||
camera->target = Vector2Add(camera->target, Vector2Scale(diff, speed*delta/length));
|
||||
camera->target = Vector2AddV(camera->target, Vector2Scale(diff, speed*delta/length));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,12 +245,12 @@ void ResetStar(Star *s)
|
|||
|
||||
} while (!(fabs(s->vel.x) + fabs(s->vel.y) > 1));
|
||||
|
||||
s->pos = Vector2Add(s->pos, Vector2MultiplyV(s->vel, (Vector2){ 8, 8 }));
|
||||
s->pos = Vector2AddV(s->pos, Vector2MultiplyV(s->vel, (Vector2){ 8, 8 }));
|
||||
}
|
||||
|
||||
void UpdateStar(Star *s)
|
||||
{
|
||||
s->pos = Vector2Add(s->pos, s->vel);
|
||||
s->pos = Vector2AddV(s->pos, s->vel);
|
||||
|
||||
if (s->pos.x < 0 || s->pos.x > GetScreenWidth() ||
|
||||
s->pos.y < 0 || s->pos.y > GetScreenHeight())
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user