Code written by ChatGPT
when green flag clicked set x velocity to 5 set y velocity to 0 set gravity to -0.1 set bounce factor to 0.8 repeat until touching color [#FF0000] // apply gravity to y velocity change y velocity by gravity // move the ball based on velocity change x by x velocity change y by y velocity // check for collision with edges of the screen if x position > 180 or x position < -180 then // reverse x velocity and apply bounce factor set x velocity to (x velocity * -bounce factor) end if y position > 120 then // reverse y velocity and apply bounce factor set y velocity to (y velocity * -bounce factor) // dampen the bounce over time set bounce factor to (bounce factor - 0.02) end // keep the ball within the screen bounds if touching color [#000000] then // reverse y velocity and apply bounce factor set y velocity to (y velocity * -bounce factor) // dampen the bounce over time set bounce factor to (bounce factor - 0.02) end // update the display go to x: (x position) y: (y position) wait 0.01 seconds end