We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I would like to link the letters of a string to some shapes, for example:
link letter "a" to an ellipse link letter "b" to a rectangle link letter "c" to a triangle
so if the string is "abc" I will have "ellipse, rect and triangle" on the screen; so if the string is "bca" I will have "rectangle, triangle and ellipse" on the screen; so if the string is "cab" I will have "triangle, ellipse and rectangle" on the screen; ... and so on.
Could you help me?
Thank you very much.
Answers
Post the code you have so far. If you have none, attempt to write this yourself.
You will need to define a String to store the letters. You will need a loop to iterate over the letters in that String. You will need to use conditional
if( ) { } else { }
statements that cause things to only happen if it is the right letter. You will need to know how to use functions to draw shapes, liketriangle()
,ellipse()
, andrect()
. Where are the shapes drawn? How is their position related to the index of the character you are looking at?If you only need a few basic shapes, you could also just use geometric shapes unicode and write things directly with a font and
text()
commands... ◢ ◯ ⬛
However the approach that @TfGuy44 suggests is much more versatile.