Making a panner

Hi there!

So I’m working on this simple bit of code that is supposed to pan the screen of an object reaches an edge to produce a nice “follow camera” effect.

…Only I don’t have any idea how to pan the screen.

I’ve tried adding all of my objects to groups and moving those, but dynamic bodies disregard that entirely. I even tried moving the display.getCurrentStage() object!

There must be an easier way! I get the feeling that I’m missing something really obvious here. :slight_smile:

Your replies are appreciated! [import]uid: 38072 topic_id: 9215 reply_id: 309215[/import]

Try this out,
create an image that is twice the width of the screen and as high as the screen. Add this to a group and set a transition on it to pan.

local group = display.newGroup()
local image = display.newImage(group,“image.png”,0,0)

transition.to(group,{time=2000, x=-display.contentWidth})

you shall see it panning, play with the time=2000 to speed it up or slow it down.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 9215 reply_id: 33682[/import]

Thanks! :slight_smile: [import]uid: 38072 topic_id: 9215 reply_id: 33865[/import]