Jump to content

Checking how well drawn something is


Recommended Posts

Hi there I'm looking to make a drawing/tracing type of "game" but I'm having trouble with one aspect of it.

For some context a sprite appears on the screen and the user has to do their best to trace the outline. 

I'm having troubles coming up with a way to judge the player how well they outlined the sprite. Here is what I've tried so far: 

First set how many white pixels (the sprite's outline) there are to begin with. Then after the user is done with their tracing, I check how many white pixels are still visible. using canvas context and getImageData. While this works, looping through that many pixels takes a very long (read: unacceptable) time to process.

My second thought was to store the outline of the image in a huge array of { x, y } coordinates then when the user draws, add all their drawn { x, y } coordinates and check for collisions between the two. This works, but making each sprites x, y outline coordinates array sounds like a daunting task (it could be probably automated with some tool or script). 

Any thoughts on this? Is there an easier way to go about what I'm doing? Any help would be appreciated. 

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...