Help with flower stem

So I’m not sure if its a bug or me lol, with the little time I’ve had I’ve tried to solve the flower but I’m stuck at the stem. Tried several times with various technics and i cant solve it and because of it i cant start on level 3 exercises.

Here is my code:

set ground_y to 90

set flower_radius to 0
set flower_grow_speed to 0.4
set flower_ascend to 1

set flower_x to 50
set flower_y to 90

set pistil_radius to 0
set pistil_grow_speed to 0.1

set stem_x to 50
set stem_y to 90
set stem_width to 0
set stem_height to 0

repeat 60 times do
  change flower_radius to flower_radius + flower_grow_speed
  change flower_y to flower_y - flower_ascend

  change pistil_radius to pistil_radius + pistil_grow_speed

  change stem_x to flower_x - (stem_width / 2 )
  change stem_y to flower_y
  change stem_width to stem_height / 10
  change stem_height to ground_y - stem_y

  

  // Sky
  fill_color_hex("#ADD8E6") 
  rectangle(0, 0, 100, 90)
  
  // Ground
  fill_color_hex("green")
  rectangle(0, ground_y, 100, 10)

  //Flower
  fill_color_hex("red")
  circle(50, flower_y, flower_radius)

  //Pistil
  fill_color_hex("yellow")
  circle(flower_x, flower_y, pistil_radius)

  //Stem
  fill_color_hex("green")
  rectangle(stem_x, stem_y, stem_width, stem_height)

  // TODO: Draw the flower here
end

I added codeblocks for you :slight_smile:

Do you get an error when you run it? What does the error say?

Did you try to use the scrubber to examine the values?

Thank you and yes i do get an error it says " Uh Oh. The first Stem isn’t correct."

So I checked the scrubber and it gives. This called the rectangle function with the values (47.1, 30, 5.9, 60).

It drew a rectangle at coordinates (47.1, 30) with a width of 5.9 and a height of 60.

seems like its either going over 0.1 (x value) or is missing an 0.1 (width value).

That sounds like the completed, final stem. You may want to scroll to the start and look at the first stem. What numbers do you get for that?

This is what i have for the first flower.
set stem_x to 50
set stem_y to 90
set stem_width to 0
set stem_height to 0

When i change the numbers of the variable to * Stem: rectangle(49.95, 89, 0.1, 1) I get an error saying Uh Oh. The final Stem isn’t correct. Either way its over 0.1 or missing an 0.1.

sorry my math is not my strong suit! :]

If you check the instructions, you’ll see a bit that says " Got it working but have an error still?" with a thing to expand, and then a video from me. That should help you solve this.

If you don’t see it, please refresh the page, as I added it earlier today.

Let us know if that helps! :slight_smile:

Amazing! I had to fix the order of the variable and that solved it! Thank you!. Excited to finish it and get into the next exercises.

1 Like

Great! Congrats!