Improve skidding
parent
a60713a723
commit
f3a31cef50
|
@ -45,7 +45,7 @@ void move(struct kinematic_obj *obj, Vector2 acceleration){
|
||||||
current = kinematic_HEAD;
|
current = kinematic_HEAD;
|
||||||
while(current != NULL){
|
while(current != NULL){
|
||||||
if(current->obj != obj){
|
if(current->obj != obj){
|
||||||
// SAT: If any projected axis is non overlapping, exit
|
// SAT method - If any projected axis is non overlapping, exit
|
||||||
if (obj->rect.x + obj->rect.width < current->obj->rect.x) goto iter;
|
if (obj->rect.x + obj->rect.width < current->obj->rect.x) goto iter;
|
||||||
if (current->obj->rect.x + current->obj->rect.width < obj->rect.x) goto iter;
|
if (current->obj->rect.x + current->obj->rect.width < obj->rect.x) goto iter;
|
||||||
if (obj->rect.y + obj->rect.height < current->obj->rect.y) goto iter;
|
if (obj->rect.y + obj->rect.height < current->obj->rect.y) goto iter;
|
||||||
|
|
19
obj/player.c
19
obj/player.c
|
@ -127,8 +127,8 @@ void player_input_check(struct player_obj *player){
|
||||||
set_squish_target_offset(player->image, 1, 0);
|
set_squish_target_offset(player->image, 1, 0);
|
||||||
if(frame_counter<land_lag_frames){
|
if(frame_counter<land_lag_frames){
|
||||||
++frame_counter;
|
++frame_counter;
|
||||||
//if (IsKeyDown(JUMP))
|
if (IsKeyDown(JUMP))
|
||||||
// state_buffer = JUMP_SQUAT;
|
state_buffer = JUMP_SQUAT;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
jumps = 1;
|
jumps = 1;
|
||||||
|
@ -185,23 +185,28 @@ void player_input_check(struct player_obj *player){
|
||||||
|
|
||||||
//Skidding
|
//Skidding
|
||||||
if (on_ground == true){
|
if (on_ground == true){
|
||||||
if (IsKeyDown(LEFT)){
|
if (player->kinematic.velocity.x > 3){
|
||||||
if (player->kinematic.velocity.x > 0){
|
if (!IsKeyDown(RIGHT)){
|
||||||
set_squish_target_offset(player->image, 0, 15);
|
set_squish_target_offset(player->image, 0, 15);
|
||||||
player->kinematic.dim_reduction[0] = 10;
|
player->kinematic.dim_reduction[0] = 10;
|
||||||
}else{
|
}else{
|
||||||
set_squish_target_offset(player->image, 0, 0);
|
set_squish_target_offset(player->image, 0, 0);
|
||||||
player->kinematic.dim_reduction[0] = 0;
|
player->kinematic.dim_reduction[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}else if (player->kinematic.velocity.x < -3){
|
||||||
else if(IsKeyDown(RIGHT)){
|
if (!IsKeyDown(LEFT)){
|
||||||
if (player->kinematic.velocity.x < 0){
|
|
||||||
set_squish_target_offset(player->image, 2, 15);
|
set_squish_target_offset(player->image, 2, 15);
|
||||||
player->kinematic.dim_reduction[2] = 10;
|
player->kinematic.dim_reduction[2] = 10;
|
||||||
}else{
|
}else{
|
||||||
set_squish_target_offset(player->image, 2, 0);
|
set_squish_target_offset(player->image, 2, 0);
|
||||||
player->kinematic.dim_reduction[2] = 0;
|
player->kinematic.dim_reduction[2] = 0;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
player->kinematic.velocity.x = 0;
|
||||||
|
set_squish_target_offset(player->image, 2, 0);
|
||||||
|
player->kinematic.dim_reduction[2] = 0;
|
||||||
|
set_squish_target_offset(player->image, 0, 0);
|
||||||
|
player->kinematic.dim_reduction[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue