I'm trying to get the canvas to draw a line in a loop between four objects, from one object to the next, in order to draw a polygon.
Here's the .cap:
I have four copies of a sprite, and each copy has it's own private variable called nodenum. They are numbered 1, 2, 3, and 4, and this number is stored in nodenum.
The I have a counter object that contains drawfrom and drawto variables. It starts at drawfrom = 1 and drawto = 2. It's supposed to find the node who's nodenum equals drawfrom and store that node's x and y coordinates in yet another object's private variables (ax and ay). Then it finds the node that matches drawto and stores it's coordinates in bx, by.
Hope you're with me so far. Anyway, the counter then counts up drawfrom and drawto, so now drawfrom = 2 and drawto = 3 in preparation for the next line.
Then it's supposed to draw a line on the canvas from ax,ay to bx,by, and start the loop over again.
Here's the event sheet:
I'm having two problems:
1. The canvas seems to be resizing upon running the layout.
2. It's still drawing a line... but it only draws one line, and the line is offset from the nodes 1 and 2. Like this:
The tan part is the canvas. It's supposed to cover the entire image.
I'm pretty sure the canvas resizing is a bug, but it seems like it wants to draw anyway. But there's only one line... is there something wrong with my loop? Should I be doing this differently?