I am trying to draw a variable width line by using an array of circles that I add circles with different radi to.
Every frame (inside the extend block) the sketch processes 50 new circles and adds them to a MutableList which is then drawn using drawer.circles().
Once the sketch has been running for a long enough time it completely fills up the computers memory and causes it to crash.
I understand that this is probably not the best way to do what I’m trying to do, but can’t think of any other way of drawing dynamic-width lines.
It would probably help if I didn’t have to store all of the circles in a list, but could draw them on the screen and not have them cleared when the next frame is rendered.
And welcome to the forum There are several ways to do that. Maybe the easiest is to use orx-no-clear which allows you to draw and keep the previous content visible. That way you only draw one circle.
Or create your own RenderTarget instead (that’s what orx-no-clear does for you behind the scenes).
If you want to draw an animated morphing variable thickness line you could take this different approach, but it’s a bit more convoluted:
I’ll create an easy to use function and post it as a reply later.
ps. Feel free to share an image of what you are trying to create (here in the forum or somewhere else like https://imgur.com/ if you can’t yet share images here): maybe a different approach comes to mind when I see it.
All of the images are the blurrier seeming ones, I couldn’t get it working without this NoClear “hack”. It’s small enough to not really annoy me and I’m constantly working on stuff so I dunno how interested I am in trying to “fix” it.