Here is some old code that may help you though it needs a bit of work to be perfect I'm sure. I don't mess with 2D much anymore.
`ignor this part I just made images instead of loading them
create bitmap 1, 640, 480
ink rgb(0,0,255), 0
box 0,0,20,20
box 0,400,480,410
box 200,200,250,210
get image 1,0,0,20,20
get image 2,0,400,480,410
get image 3,200,200,250,210
delete bitmap 1
sync on : sync rate 30 : hide mouse
backdrop on : color backdrop 0
playerx = 0
playery = 300
sprite 1,playerx,playery,1
sprite 2,0,400,2
sprite 3,200,300,3
jump = 0
do
`basic left to right movement
if leftkey() = 1 then playerx = playerx - 5
if rightkey() = 1 then playerx = playerx + 5
`if jump = 1 then check for collision to stop jump
`and push player away from roof
if jump = 1
if sprite collision(1,0) <> 0
jump = 0
playery = playery + 10
endif
endif
`If player has jumped too high then make fall
if groundy - playery >= 150
jump = 0
endif
`if player is not jumping and not hitting the ground
`then fall
if jump = 0
if sprite collision(1,0) = 0
playery = playery + 5
else
`if player is on the ground then jump
if upkey() = 1
jump = 1
`save where player jumped from
groundy = playery
endif
endif
endif
`make player jump
if jump = 1
playery = playery - 5
endif
`update player position
sprite 1,playerx,playery,1
sync
loop
end