added argument to interpolate_move, removed return value from interpolate_move

pull/8/head
Sara 2023-06-18 14:08:55 +02:00
parent 96eeb3233f
commit 81e242532b
2 changed files with 5 additions and 5 deletions

View File

@ -166,7 +166,7 @@ void update_collision() {
}
}
object_t* interpolate_move(object_t* object, float target_x, float target_y, float max_step_size) {
void interpolate_move(object_t* object, float target_x, float target_y, float max_step_size, int slide) {
// calculate step delta
float dx = target_x - object->sprite.x, dy = target_y - object->sprite.y;
// calculate direction x,y
@ -179,7 +179,7 @@ object_t* interpolate_move(object_t* object, float target_x, float target_y, flo
if(!_can_collide(object)) {
object->sprite.x = target_x;
object->sprite.y = target_y;
return NULL;
return;
}
/*
@ -208,11 +208,11 @@ object_t* interpolate_move(object_t* object, float target_x, float target_y, flo
object_broadcast_collision(object, other);
object->sprite.x = old_x;
object->sprite.y = old_y;
return other;
return;
}
}
}
// no collision, return nothing
return NULL;
return;
}

View File

@ -62,6 +62,6 @@ void draw_objects();
void update_collision();
object_t* interpolate_move(object_t* object, float target_x, float target_y, float max_step_size);
void interpolate_move(object_t* object, float target_x, float target_y, float max_step_size, int slide);
#endif /* _world_h */