Faster update on create object MouseX;MouseY? Problem when the mouse moves faster

I have created a square (Block) 10px * 10px in Piskel and added the code in the image below.

When I drag the mouse normally fast, I get the upper line with lots of “holes”, not a complete line.

When I drag the mouse slowly, I get the lower one, a tight line.

Why is not “create object” created faster? Can I do it in any other way so that I get a complete line even when I drag the mouse a little faster?

It’s not a case of creating objects creating them faster. That’s not the bottleneck.

The holdup is down to how fast you device renders the scene. Say it’s the standard 60 fps, then 60 objects are created.

Now, for example, if you move the mouse 300 pixels in a second, only 60 of them will be drawn on. 240 of them will be empty, leaving gaps.

One way around this is to draw from the last known mouse position to the current one. Another way, if you want to get fancy, is to interpolate the gaps.

2 Likes

Trying to draw using objects is not a good idea, as they are not meant for this. Try the shape painter instead, it will also draw a line from the previous point to the current one making sure there is no hole.

I have tested it but it leads to two other problems. It works fine to draw a straight line but:

Can not figure out how to delete part of a line (eraser). This is easy if the line consists of several different objects.

I have a player who has the behavior Physics 2. Although I add behavior Physics 2 to shape painter, it is not working using the drawn line as a platform. If I draw a line with sprite and add physics 2, my player can go on the drawn line. See this post: Add behavior platform to newly drawn object?