Greetings.
I'll first state that I'm a CS student so please don't provide a solution to my question.
I just want to know if I'm on the right path. Think I've been maybe 8 hours trying to do this...
My homework consists of a few images, a canvas and some buttons.
Everything is working, right now I'm on the last part of the homework. I have to use the canvas to touch in a spot, drag a diagonal line up or down and after ending the drag a rectangle must be drawn.
What I've done so far:
Create a global empty list.
When trying to draw the rectangle I add items to the list, 8 items to be converted to pairs of x,y coordinates.
When I try to set the x1,y1, x2,y2 etc it's not working. I think there must be something off with the values because if I remove items from the list I get an error. So I know the list is good. Testing with static values I can draw the rectangle.
What I'm not sure, didn't find information about it either...are the pointList values used clockwise?
I tried using math thinking it goes clockwise since my previous x,y and the current would be x1,y1 and x3,y3?
I'm using the drag handler of the canvas, tried to use touchup but didn't make sense.
The professor gave us a hint saying that one of the corners is x1,y1 and the other is x2,y2.
As an alternative I thought about of recording the drag x, y values and then creating the lines using math blocks...not sure if it can be done.
This are the blocks I'm trying to use, the x, y values may be misplaced... it's late.
Thanks for reading this and for your time.