How can i make this?

Hi!
So i have to create a program but i can’t even start.
So my program shoud do this: One click, save the point from that point a dynamic line is created from the point to the cursor coordinate, as I move the cursor the line end point move with it.
I can do it to this point, but if I click another the line is fixed, and a regular hexagon is drawn with the line length.
After this the screen have to be filled with hexagon side by side not leaving gasp.

SHOW US WHAT YOU GOT.

Do you have a setup()? A draw()?
Are you using a state variable to track which state the program is in?
Can you save the mouse positions?
Can you draw the line?

To even START helping you with the hexagons you will need that much. Post the code for this so we don’t have to start from scratch!


Your problem breaks down into parts. This is common with most programs. Learning to break one large problem down into smaller problems is an important skill.

The first part of the problem (which I would love to say you have done but can’t because you have shown us no code) is to get the start and end points saved into variables for one edge of one hexagon.

The next logical step would be to draw one hexagon using that edge as a side of the hexagon.

Whoa, what? Even that is a big problem. Break THAT problem down. How do you even draw a hexagon at all? Can you even draw a single hexagon on the screen?

Now that you have one hexagon, can you make it bigger? How much bigger would it need to be to have the same edge length as that line you have?

Where would it need to be for one of its corners to be at the start point?

How much would it need to rotate to align with the line?

Can you now determine where some other hexagons should be?

You are absolutly right, and I’m sorry. I had to go to work, so I didn’t have time for coding. Now i have some time, i will code it, and ask again when I’m stucked.