Hi
I’m trying to create a kind of maze game with Dusk, but have been stuck for days trying to get the map to pivot from the centre of the camera.
I have a map that is larger than the screen (50x50 tiles). The player starts in the middle and when you turn, i’m trying to get the map to rotate as well, so the player is always upright. But this is where I have issues, it seems to always pivot from the top left corner of the camera. I have set the anchorX, anchorY to 0.5,0.5 and set the anchorGroup to true.
I’m hoping its me doing something silly, i’m new to Corona. Here are the bits of my code that I hope can help. Any suggestions would be really appreciated.
-------------------------------------------------------------------------------- -- Load Map -------------------------------------------------------------------------------- map = dusk.buildMap("maps/world" .. levelNum .. ".json") map.anchorX, map.anchorY = 0.5, 0.5 map.anchorGroup=true sceneGroup:insert( map ) -------------------------------------------------------------------------------- -- Create Player -------------------------------------------------------------------------------- hero = newHero( { x=map.data.width/2, y=map.data.height/2 } ) -- centred to map map.layer["tiles\_static"]:insert(hero) map.positionCamera(hero.x , hero.y) -- position camera on hero --map.setCameraFocus(hero) --map.setTrackingLevel(1) -------------------------------------------------------------------------------- -- Rotate map 360 degrees to test -------------------------------------------------------------------------------- transition.to(map, { time = 6000, rotation = 360 } )
Thanks for looking.