I need some serious help with zooming in and out of my game world. I haven’t been able to find out how to properly do this and any help would be appreciated.
I am able to scale my group with group:scale(sx, sy), however when I do this, this also seems to shift the y values of the image up and I end up with more ground then sky in the level and my character starts shifting to the top of the screen. I need to do some focal point type scaling as well, any tips would be appreciated. [import]uid: 44767 topic_id: 14728 reply_id: 314728[/import]
Have you tried setting the “reference point” of the group to the center. They might be set to top left by default, which would mess up the scaling. [import]uid: 12540 topic_id: 14728 reply_id: 54483[/import]
The reference point is set to the center as the scaling doesn’t impact the physics. I think I need to move the y of the group down as I’m scaling. [import]uid: 44767 topic_id: 14728 reply_id: 54488[/import]
ps change this line:
[lua]game.y = 650[/lua]
to
[lua]game.y = display.contentHeight[/lua]
and it should fit right.
also i changed this line in the main game loop
[lua]local targetx = (- exorcist.x + 700) * game.xScale[/lua]
to
[lua]local targetx = (- exorcist.x + display.contentWidth/2) * game.xScale[/lua]
to make the main character stay more central [import]uid: 6645 topic_id: 14728 reply_id: 56680[/import]