From 486a72a549d928b3ac2ba806ca6ce8bb17b14a09 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 30 Mar 2021 04:14:06 -0400 Subject: ball, map: Fix ball speed --- diff --git a/src/ball.c b/src/ball.c index 2666a6e..4dc0ab0 100644 --- a/src/ball.c +++ b/src/ball.c @@ -84,8 +84,8 @@ void db_balls_move(struct db_ball *ball) { if (ball->sr == 0) { - ball->x += cos(ball->a * (M_PI / 180)); - ball->y += sin(ball->a * (M_PI / 180)); + ball->x += cos(ball->a * (M_PI / 180)) * ball->s; + ball->y += sin(ball->a * (M_PI / 180)) * ball->s; } else { ball->a = fmod(ball->a + ball->d * ball->s, 360); ball->x = ball->cx + cos(ball->a * (M_PI / 180)) * ball->sr; diff --git a/src/map.c b/src/map.c index b41507b..99e404e 100644 --- a/src/map.c +++ b/src/map.c @@ -450,6 +450,9 @@ _db_tmx_object_property_start(void *pv, const char *name, const char **attr) free(p_type); db_dbg(" Object speed: %f px/s", map->obj_s); + map->obj_s /= map->fr; + db_dbg(" Object speed: %f px/f", + map->obj_s); } else if (strcmp(p_name, "direction") == 0) { db_xml_get_string_attr(p, attr, "value", &dir, 1); if (strcmp(dir, "lr") == 0) { -- cgit v0.9.1