Hi all,
I have a problem as the title. Please help me.
Thanks!!!
Hi all,
I have a problem as the title. Please help me.
Thanks!!!
screenW = display.contentWidth; screenH = display.contentHeight; local function createResource( img, width, height, x, y) local resource = display.newImage( img, true ); resource.width = width; resource.height = height; resource.x = x; resource.y = y; return resource; end cirle1 = createResource( "circle.png", screenW, screenW, screenW/2, screenH/2); local line = display.newLine( cirle1.x, cirle1.y, cirle1.x + cirle1.width/2.2, cirle1.y ); line.isVisible = false; local circle = display.newCircle( line.x, line.y, 20 ); local speed = 5; local function rotaLine() line.rotation = line.rotation - speed; local lineX, lineY = line:localToContent( screenW/2.3, 0 ); circle.x = lineX; circle.y = lineY; end line.enterFrame = rotaLine; Runtime:addEventListener("enterFrame", line);
Any way better than this code?
screenW = display.contentWidth; screenH = display.contentHeight; local function createResource( img, width, height, x, y) local resource = display.newImage( img, true ); resource.width = width; resource.height = height; resource.x = x; resource.y = y; return resource; end cirle1 = createResource( "circle.png", screenW, screenW, screenW/2, screenH/2); local line = display.newLine( cirle1.x, cirle1.y, cirle1.x + cirle1.width/2.2, cirle1.y ); line.isVisible = false; local circle = display.newCircle( line.x, line.y, 20 ); local speed = 5; local function rotaLine() line.rotation = line.rotation - speed; local lineX, lineY = line:localToContent( screenW/2.3, 0 ); circle.x = lineX; circle.y = lineY; end line.enterFrame = rotaLine; Runtime:addEventListener("enterFrame", line);
Any way better than this code?