Im not using anchor point cuz I have no idea where should I add it.
heres my code
display.setStatusBar( display.HiddenStatusBar ) -- Example of shape drawing function local function newStar() -- need initial segment to start local star = display.newLine( 0,0,0,-110, 27, -35) --local star = display.newLine( 0,-110, 27, -35) -- further segments can be added later star:append( 105,-35, 43,16, 65,90, 0,45, -65,90, -43,15, -105,-35, -27,-35, 0,-110) -- default color and width (can also be modified later) star:setStrokeColor( 255/255, 255/255, 25/2555, 255/255 ) star.strokeWidth = 3 return star end -- Create stars with random color and position local stars = {} \_W=display.contentWidth \_H=display.contentHeight for i = 1, 1 do local myStar = newStar() myStar.anchorX, myStar.anchorY= -1,-1 -- Graphics 2.0 needs colors from 0 to 1 myStar:setStrokeColor( math.random(255)/255, math.random(255)/255, math.random(255)/255, math.random(200)/255 + 55/255 ) myStar.strokeWidth = math.random(10) myStar.x = math.random( display.contentWidth) myStar.y = math.random( display.contentHeight) myStar.rotation = math.random(360) --myStar.rotation=myStar.rotation myStar.xScale = math.random(150)/105 myStar.yScale = myStar.xScale local point = display.newCircle(myStar.x, myStar.y, 5) --local point = display.newCircle(myStar.anchorX, myStar.anchorY, 5) local dr = math.random( 1, 4 ) myStar.dr = dr if ( math.random() \< 0.5 ) then myStar.dr = -dr end table.insert( stars, myStar ) end function stars:enterFrame( event ) for i,v in ipairs( self ) do v.rotation = v.rotation+ v.dr end end Runtime:addEventListener( "enterFrame", stars )
u can try this
i can make the star rotate in its middle point but their still a line connect its angle and middle point
what should i do ?
anyway thx RobMiracle