Platforms jumping

From my post yesterday i figured out how to jump well using velocity and acceleration. my question now is how can i make it so that my object jumps and then stays on something like a platform, i’ve thought of using a code like this
" if oval1.top > rectangle1.top +oval1.height and oval1.left >rectangle1.left then
oval1.top = oval1.top -1
end if"
but it doesn’t work, i was wondering if anyone had a suggestion (the rectangle is at the bottom right of the screen)
I’m still very new to programming and any help would be nice :slight_smile:

Y values increase as they go down on the screen, so try looking to see if oval1.top is less than the rectangle.top.

i just tried that out bill and instead of stopping it just keeps bouncing inside of the rectangle. would i have to do something with the velocity/accleration code that im using?

" VelY = VelY + AccelY
Oval1.top = Oval1.top + VelY

if VelY > 10 then
VelY = 10
end if

if Oval1.top + Oval1.height > window1.height then
Oval1.top = window1.height - Oval1.height
VelY = -VelY* 0.95
end if

if oval1.top < rectangle1.top +oval1.height and oval1.left >rectangle1.left then
oval1.top = oval1.top -1
end if
"
this is the code that i have atm