diff --git a/SDL3_Core b/SDL3_Core index 6bfa68d..6ce1927 160000 --- a/SDL3_Core +++ b/SDL3_Core @@ -1 +1 @@ -Subproject commit 6bfa68db05dafd773860bcea000f0c3fcba0176a +Subproject commit 6ce19277e54e0c56be105d8edac118aa3f41ba67 diff --git a/assets/asset_builder/src/headers/errors.h b/assets/asset_builder/src/headers/errors.h index cf3be7e..9b5805b 100644 --- a/assets/asset_builder/src/headers/errors.h +++ b/assets/asset_builder/src/headers/errors.h @@ -33,7 +33,7 @@ goto failure; \ } while (0); - #else +#else #define debug_printf(...) #define return_failure_int return EXIT_FAILURE; diff --git a/src/components/physics_system.c b/src/components/physics_system.c index 45dd2c5..1727e25 100644 --- a/src/components/physics_system.c +++ b/src/components/physics_system.c @@ -52,14 +52,13 @@ int physics_system_update(component_t *component) transform_component_data_t *transform_component_data = system_data->transform_component->data; hitbox_component_data_t *hitbox_component_data = system_data->hitbox_component->data; - system_data->velocity.x = lerp(system_data->velocity.x, system_data->target_velocity.x, system_data->smoothing_factor); - system_data->velocity.y = lerp(system_data->velocity.y, system_data->target_velocity.y, system_data->smoothing_factor); - + system_data->velocity.x = lerp_time(system_data->velocity.x, system_data->target_velocity.x * system_data->speed, system_data->smoothing_factor, game.delta_time_ms); + system_data->velocity.y = lerp_time(system_data->velocity.y, system_data->target_velocity.y * system_data->speed, system_data->smoothing_factor, game.delta_time_ms); if(hitbox_component_data->activated) if(linked_list_for_each(&game.entity_manager.entities, action_detect_solve_entities_collision, component)) return EXIT_FAILURE; - transform_component_data->bounds.x += system_data->velocity.x * system_data->speed * (float)game.delta_time_ms / 1000.0f; - transform_component_data->bounds.y += system_data->velocity.y * system_data->speed * (float)game.delta_time_ms / 1000.0f; + transform_component_data->bounds.x += system_data->velocity.x * (float)game.delta_time_ms / 1000.0f; + transform_component_data->bounds.y += system_data->velocity.y * (float)game.delta_time_ms / 1000.0f; return EXIT_SUCCESS; } diff --git a/src/game.c b/src/game.c index ce4cd6f..a755275 100644 --- a/src/game.c +++ b/src/game.c @@ -107,7 +107,14 @@ int game_init(void) }; } - if(!entity_new_component(player_entity, PHYSICS_SYSTEM)) return_failure_int; + { + component_t *physics_component = entity_new_component(player_entity, PHYSICS_SYSTEM); + if(!physics_component) return_failure_int; + + physics_system_data_t *physics_system_data = physics_component->data; + + physics_system_data->smoothing_factor = 0.0005; + } if(!entity_new_component(player_entity, PLAYER_SYSTEM)) return_failure_int; }