So my program draws beautiful geometrical structures that depend on many variables.
At the moment you can choose the value of those variables in the menu and enjoy the sight of one of those structures each time.

But I would like to add a new feature. A button that makes the use able to see how that structure changes over time by increasing the value of a variable each time it gets drawn For this I need to re-draw everything with the new variables.
What I mean is, I need to start with some values and draw the beautiful thing, then I need it to be undrawn and then to be able to draw another one again but with the value increased a little bit, so you can see how you can go from one figure to another.

I'll show you pictures to illustrate you:

For example, from the top one, to the bottom one. The first one has a value of 2/100 and the second one has a value of 17.6/100

Or from:

(25/100)

To:

(45/150)

So if you increase the first number bit by bit, you will be able to see the image transform from one to another.

I would need a way to undraw-redraw with changed values, to choose the rate of change and the speed that it changes, and a way to change the colors bit by bit like a rainbow.

Is there a way of doing any of these things?

I just use drawpolyline and drawline
If that's not what you're asking, then idk what you mean by method

+1 vote

You know you could store the commands and parameter in an array.
For example: `['poly_line', [Vect...], Color.., 'draw_line', Vec.., Vec.., Color..]`
That's drawpolyline with a Vector2 array and color, and then a regular line with three parameter after.

In the draw function you can then read this array using a match statement within a while loop.

``````var i = 0
while i < commands.size():
match commands[i]:
'poly_line':
draw_poly_line(commands[i+1], commands[i+2])
i += 3
'draw_line':
draw_line(commands[i+1], commands[i+2], commands[i+3])
i += 4
_: printer('Sry.. Unknown command at ' + str(i) + ' :(')
``````

And you can add more to it.
So how does this help? Well now you can easily call a specified number of these commands. Simply by replacing `commands.size()` in the while loop with `min('your_var', commands.size()`.
Any questions?

answered May 19 by (1,694 points)
selected Jun 28

I'll look into that.
Just tell me this. Is there any modifications to project that I need to know about?

Yes, I took the old version of the project (aka, deleted all your changes) and then added a few things in the _process function to change the variable NbOfEpicycles and the colors, and also I made the screen bigger and added a different background but I don't think that affects the program.
I mean, I will push the code to GitHub again, so you can see what I mean.
This is the changed project.
So I just analized what you did and realised this thing could be made.
To see what I mean just run the project, press space or enter and then watch what it does.
Please do not move the cursor or it will restart, and also I am still working in the colors to make them cycle.

Actually, the problem was very easy to find.
Inside your level scene's circle drawer script. Line 10.

See, what's happening is that you attempted to put all of the lines of code in one line with the if statement. That's not how it works. The script compiler will only take the first command as part of the if statement.

``````#Inline if statements only work for one command.
if condition: a command; this other command is not part of the if statement
``````

The rest gets called normally. So every time you move your mouse, click with it, press any key(besides enter), any input event at all. It will reset.
What you need to do is to put each command on a separate line with one tab more than the preceding if statement.

``````if condition:
a command
another command
etc...
This command isn't part of the if statement
``````

True! Thank you very much! Hahah I don't remember why I did that xD thank you for all your help, have a nice weekend!

Same to you.