fixed a divison thingy

This commit is contained in:
alex
2025-09-23 12:40:26 -07:00
parent 7bafc260dd
commit f57c37b900
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -32,7 +32,7 @@
static uint rng_seed = 0; static uint rng_seed = 0;
static uint timer = 0; // This might already exist in libtonc but idk so i'm just making my own static uint timer = 0; // This might already exist in libtonc but idk so i'm just making my own
static int game_speed = 1; // BY DEFAULT IS SET TO 1, but if changed to 2 - 8, should speed up all (or most) of the game aspects that should be sped up by speed, as in the original game. static int game_speed = 1; // BY DEFAULT IS SET TO 1, but if changed to 2 or more, should speed up all (or most) of the game aspects that should be sped up by speed, as in the original game.
static int background = 0; static int background = 0;
static enum GameState game_state = GAME_SPLASH_SCREEN; // The current game state, this is used to determine what the game is doing at any given time static enum GameState game_state = GAME_SPLASH_SCREEN; // The current game state, this is used to determine what the game is doing at any given time
+2 -2
View File
@@ -158,8 +158,8 @@ void sprite_object_reset_transform(SpriteObject* sprite_object)
void sprite_object_update(SpriteObject* sprite_object) void sprite_object_update(SpriteObject* sprite_object)
{ {
sprite_object->vx += (sprite_object->tx - sprite_object->x) / (8 / get_game_speed()); // SPEED sprite_object->vx += ((sprite_object->tx - sprite_object->x) * get_game_speed()) / 8; // SPEED
sprite_object->vy += (sprite_object->ty - sprite_object->y) / (8 / get_game_speed()); // this makes the game_speed not be sprite_object->vy += ((sprite_object->ty - sprite_object->y) * get_game_speed()) / 8; // this makes the game_speed not be
// able to be more than 8, because of // able to be more than 8, because of
//integer division making it a divide by 0. //integer division making it a divide by 0.
// shouldn't be a problem since speed 9 or more // shouldn't be a problem since speed 9 or more