I thought I had a ok grip on corona polygons, but after a major rewrite of my game I cannot make them work…
I define an array of polygons one place in the code:
local vertices = {-1000, -1000, 1000, -1000, 1000, 1000, -1000, 1000} panelArr[idx].poly = display.newPolygon(gameGroup, \_W/2, \_H/2, vertices )
And then I (per frame) play with some of the poly parameters ala this:
panelArr[idx].poly.width = 6000/z panelArr[idx].poly.height = 6000/z panelArr[idx].poly.alpha = alpha panelArr[idx].poly.isVisible = true panelArr[idx].poly:toFront()
The problem is that they won’t show at all. If I, however, create the polygon for each frame, directly above the other code it works:
panelArr[panelIdx].poly:removeSelf() local vertices = {-1000, -1000, 1000, -1000, 1000, 1000, -1000, 1000} panelArr[idx].poly = display.newPolygon(gameGroup, \_W/2, \_H/2, vertices ) panelArr[idx].poly.width = 6000/z panelArr[idx].poly.height = 6000/z panelArr[idx].poly.alpha = alpha panelArr[idx].poly.isVisible = true panelArr[idx].poly:toFront()
The above works.
So I need to know what has happened to the polygon along the way that breaks it. Is there some way of testing is a polygon is valid?