Hi, I’m creating a game where the player must draw a line along a visible path, a dotted line, by drawing with the “shape painter” tool. The goal is to trace a line along the path without going outside the set boundaries. If the player completes the path correctly win; if leaves parts incomplete, fail.
I’ve thought about creating invisible sensitive areas along the path and destroying them when they collide with the touch. However, this becomes complicated and time-consuming for more complex drawings. Is there a better way to achieve what I want?
Thank you
Welcome. Can you add more details? What’s being traced? Does it need to be done from a start position to the end or just traced in any sequence?
These are just guesses and talking outloud.
The extension read pixels might help. You could check the color at the CursorX and CursorY. Maybe use it to scan the image and create objects if the color is a certain color.
I’m wondering if it would be easier to create a sort of hitbox with the new tilemap object. You could sort of draw over the image. You could check the tile at the CursorX and CursorY, change it to another tile when touched and then count the number of tiles that were changed. You could the same for invalid tiles.
Thank you for the message!
I’m attaching some example images for clarity.
The game is designed to test motor skills and coordination in children, so there isn’t a specific direction required, just that the drawing is completed. The player traces a simple line that needs to follow a dashed one already present in the scene.
Your idea of using the tilemap could be an interesting solution, especially for making it easier to check the tracing. I’ll also consider using the pixel reading extension, as it might help manage movements more precisely.
There’s also an extension that will slice an object. It uses the collision mask which can be a pain to setup so it’s not convex. For the image that repeats, you could make copies of the object.
The extension could probably be modified to only create objects of certain colors. IDK if you’re comfortable with extensions. The same concept could be done with nested repeats and the read pixels.
This works. I used a tiled sprite and a 1 pixel white sprite for the pieces. X and Y are scene variables. I used just 1 color since it’s either black or white. I used less than since my image wasn’t pure black and white. Also, I added a wait because on my phone anyways, read pixels doesn’t work on the first frame.
This breaks everything into 30x30 pieces. If you delete them then you could count how many objects are in the scene. I colored the pieces purple.
Hi @Keith_1357, thank you so much!
Your solution using Repeat and Read pixels works like a charm.
It saved me from a lot of unnecessary manual work. I really appreciate it!