android - Corona SDK: altering the display content view -
apologies if common question. have done searches, maybe missing key words.
i wondering if possible manipulate x , y coordinates of screen view? way know of off screen items enter view add them single display group , move them in view. seems resource intensive in large map. possible? if not there better practice sort of thing?
you can store display object in table , use function change .x & .y coordinates.
local mygroup = { } function drawgroup() local img = display.newimagerect( "baseimage.png", 100, 100 ) img.x = 76 img.y = 200 mymap[#mymap+1] = img --create other items end function translateto( group, x, y ) local numitems = #mygroup i=1, < numitems, 1 mygroup[i].x = mygroup[i].x + x mygroup[i].y = mygroup[i].y + y end end function translateto( group, x, y, t ) local numitems = #mygroup local t = t or 0 i=1, < numitems, 1 transition.to( mygroup[i], { time=t, x=x, y=y, delta=true} ) end end
Comments
Post a Comment