Q
Quelandoris
Guest
Hello,
Currently working on a rhythm platformer game (long story), And I want to add a feature that allows the player to flip their own gravity. At the moment, gravity does flip, but just before the player would collide with the ground/ceiling, they hover slightly above the ground for a few moments, then disappear (Presumably to the other side of the ground/ceiling, outside of the room). I'm not sure how to fix this so any help would be appreciated
Heres my relevant code:
Prior to pressing X, jumping works fine.
Not entirely sure whats causing the issue, so any help would be appreciated. Thank you in advance
Currently working on a rhythm platformer game (long story), And I want to add a feature that allows the player to flip their own gravity. At the moment, gravity does flip, but just before the player would collide with the ground/ceiling, they hover slightly above the ground for a few moments, then disappear (Presumably to the other side of the ground/ceiling, outside of the room). I'm not sure how to fix this so any help would be appreciated
Heres my relevant code:
Code:
//Jumping "Space"
if(gravity_direction==270){
if (place_free(x,y+1)){
gravity=.25;
}
else{
gravity=0;
}
if(up){
if(!place_free(x,y+1)){
vspeed=-6;
}
}
}
else{
if (place_free(x,y-1)){
gravity=.25;
}
else{
gravity=0;
}
if(up){
if(!place_free(x,y-1)){
vspeed=6;
}
}
}
//Switch Gravity "X"
if(keyboard_check_pressed(ord("X"))){
if(gravity_direction==270){
gravity_direction=90;
}
else if(gravity_direction==90){
gravity_direction=270;
}
}
Not entirely sure whats causing the issue, so any help would be appreciated. Thank you in advance