My current project involves using Vue and HTML canvas to create a responsive "link game". You can view a sample of my work in the image below:
However, I've encountered a strange issue. I'm trying to determine if a line drawn between two dots is considered "legitimate". Here's an illustration of what constitutes a "legitimate" connection:
In order to achieve this goal, I've been utilizing a variable to store information about each dot's location:
this.Dotlocation[[RowID,ColID,GroupID],[x_location,y_location]]
Unfortunately, no matter what I do, the information doesn't seem to be accurate. Here's the output I'm getting:
[
// id,col,group
[ [ 3, 2, 4 ], [ 631.4, 417.43 ] ],
[ [ 3, 1, 3 ], [ 495, 417.43 ] ],
...
]
There are a couple of questions that arise from this data:
- I don't understand why the IDs are out of order.
- The grouping and columns appear to be incorrect; it appears to be related to the final column.
You can find the lengthy code that I've been working with below for reference:
DrawImgOnCanvas(question,context1){
// Code block here
},
Here is the input data being used:
question:[
['assets/GamePic/Cat.png','assets/GamePic/Cat.png','assets/GamePic/Cat.png'],
['assets/GamePic/Cat.png','assets/GamePic/Cat.png','assets/GamePic/Cat.png','assets/GamePic/Cat.png','assets/GamePic/Cat.png'],
['assets/GamePic/Cat.png','assets/GamePic/Cat.png']
],
Thank you for taking the time to read through this. I look forward to your response.
[1]: https://i.sstatic.net/MmxjB.png
[2]: https://i.sstatic.net/MoZX6.png