Hey yo I'm working on a space adventure/2D side scroller and I am now having issues with my jump code. I can get the character to jump with the following code, but instead of jumping upwards, my character jumps downward. I have messed around with it for a while changing the variables to negative and what not. Still to no avail. I followed a tutorial online and got the following code.
if key == " " then
if player.y_velocity == 0 then
player.y_velocity = jump_height
end
end
Now before I took the code straight from the tutorial I had it written out on my own. That didn't work so I went ahead and just tried to copy and paste it and just adjust a few numbers. That didn't work either. Anyone have any ideas whats going on or have a better way to implement jumping into a game.
However, this causes another issue. I have my player.y set to 535, so when it goes negative, it goes off the screen. This is the only fix I could find for the upwards jumping. Any ideas on how to fix this next issue?