As an artist, once you get a handle on trig it will be easy because you can visualize everything. I believe the reason your vertices failed is that they are simple sine and cosine values which means they are all no larger than 1.
They need to be multiplied by the distance to the center of the polygon
[lua]
local cx = display.contentWidth * 0.5
local cy = display.contentHeight * 0.5
local numSides = 6
local size = 30 – distance from the center of the polygon
local unitCircle = 2 * math.pi – full circle in radians
local rad = unitCircle/ numSides
local startRad = 0 – in radians
– try startRad = rad/2 for a first rotation
local verts = {}
for i=1,numSides do
local xVert = math.cos(startRad + rad * i ) * size
local yVert = math.sin(startRad + rad * i ) * size
verts[#verts+1] = xVert
verts[#verts+1] = yVert
local circ = display.newCircle( cx + xVert,cy + yVert, 2 )
circ:setFillColor( 0.9, 0.95, 0.12 )
end
local polygon = display.newPolygon( cx, cy, verts )
polygon:setFillColor( 0, 0.68, 0.99 )
polygon.strokeWidth = 1
polygon:setStrokeColor( 0.85, 0.22, 0.09 )
polygon:toBack( )
[/lua]
To get an handle on the visuals, you should check out the math is fun unit circle
Once you get a grasp on how this works, you can use the module @roaminggamer posted above