added argument to interpolate_move, removed return value from interpolate_move
parent
96eeb3233f
commit
81e242532b
|
@ -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
|
// calculate step delta
|
||||||
float dx = target_x - object->sprite.x, dy = target_y - object->sprite.y;
|
float dx = target_x - object->sprite.x, dy = target_y - object->sprite.y;
|
||||||
// calculate direction x,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)) {
|
if(!_can_collide(object)) {
|
||||||
object->sprite.x = target_x;
|
object->sprite.x = target_x;
|
||||||
object->sprite.y = target_y;
|
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_broadcast_collision(object, other);
|
||||||
object->sprite.x = old_x;
|
object->sprite.x = old_x;
|
||||||
object->sprite.y = old_y;
|
object->sprite.y = old_y;
|
||||||
return other;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no collision, return nothing
|
// no collision, return nothing
|
||||||
return NULL;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,6 @@ void draw_objects();
|
||||||
|
|
||||||
void update_collision();
|
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 */
|
#endif /* _world_h */
|
||||||
|
|
Loading…
Reference in New Issue