Activity: Random Height
I'M FINISHED WITH HOUR OF CODE!

Parameters are the words and numbers between the parentheses of our rectangle. Each parameter controls one part of what the rectangle looks like.

  • The rectangle's fourth parameter is its height parameter. Change the height parameter to top_height.

You can use the grey comment above the rectangle code as a guide for what each parameter controls.

Make sure you don't delete the commas that separate each parameter.

stage.set_background("city") sprite = codesters.Sprite("bike") sprite.set_size(0.5) sprite.go_to(-200, 0) stage.set_gravity(10) stage.disable_all_walls() def space_bar(): sprite.jump(5) # add other actions... stage.event_key("space", space_bar) def interval(): # add any other actions... top_height = random.randint(1, 10) # sprite = codesters.Rectangle(x, y, width, height, "color") top_block = codesters.Rectangle(0, 0, 100, 50, "blue") stage.event_interval(interval, 2)
Support