Sure! I must admit that I forgot about that circumstance!
All you have to do is change the bit that I labelled "The more complicated bit" to this:
Oh, and by the way, I'm sure that this is not the only way to do what you want to do - it's just how I would do it! I'm sure someone else could offer a different approach.
But if it works...
Oh, and if you want more realistic physics, instead of setting gravity to zero with each collision, you could have it "bounce" by doing this:
All you have to do is change the bit that I labelled "The more complicated bit" to this:
; The more complicated bit If gravity < 0 Repeat If ImagesCollide(backimage,0,0,0,charimage,px,py,0) py=py-1 jumping = False gravity = 0 Else Exit EndIf Forever ElseIf gravity > 0 Repeat If ImagesCollide(backimage,0,0,0,charimage,px,py,0) py=py+1 gravity = 0 Else Exit EndIf Forever EndIf
Oh, and by the way, I'm sure that this is not the only way to do what you want to do - it's just how I would do it! I'm sure someone else could offer a different approach.
But if it works...
Oh, and if you want more realistic physics, instead of setting gravity to zero with each collision, you could have it "bounce" by doing this:
If gravity < 0 Repeat If ImagesCollide(backimage,0,0,0,charimage,px,py,0) py=py-1 jumping = False gravity = -gravity / 3 Else Exit EndIf Forever ElseIf gravity > 0 Repeat If ImagesCollide(backimage,0,0,0,charimage,px,py,0) py=py+1 gravity = -gravity / 3 Else Exit EndIf Forever EndIf