# Upside down ground correction?

How would you go about making ground correction for a platformer but upside down(reversed gravity)? I used this formula: P.Y+=(P.Y-2)%8-1 but the character just keeps bumping up and down like a pogo stick.

By ground correction I mean checking if the player is inside a solid tile while falling and moving him up (or down in my case) until he isn't.

if pd.dy<0 then
pd.f=true
pd.g=false
pd.j=false
if col_map(pd,"up",1) then pd.f=false pd.dy=0 pd.g=true pd.y+=(pd.y-1)%8
end elseif pd.dy>0 then
pd.j=true
if col_map(pd,"down",1) then pd.dy=0
end end

• I'd recommend showing us this code in the context of where it appears in your program. Sep 10 '20 at 23:09
• if pd.dy<0 then pd.f=true pd.g=false pd.j=false if col_map(pd,"up",1) then pd.f=false pd.dy=0 pd.g=true pd.y+=(pd.y-1)%8 end elseif pd.dy>0 then pd.j=true if col_map(pd,"down",1) then pd.dy=0 end end Sep 11 '20 at 12:59
• You've probably noticed that code doesn't read well in comments. Always use the edit link at the bottom of your question to ensure important information like this is part of your question and formatted correctly, not hidden in a comment. See the help center if you need formatting guidance. Sep 11 '20 at 13:02