Hi,
I have a sprite off of the screen which I am trying to center on the screen.
Please take a look at my source code and let me know what I am doing wrong:
NOTE: The position of the sprite is (-500, -500) & the screen size is (360x640)
function init(self)
-- Add initialization code here
-- Remove this function if not needed
go.set("#FAS-Statue", "scale.x", 0.65)
go.set("#FAS-Statue", "scale.y", 0.65)
local sprPosOld = go.get_world_position("#FAS-Statue") -- Position set to (-500, -500)
sprPosOld.x = sprPosOld.x * -1
sprPosOld.y = sprPosOld.y * -1
local sprPos = vmath.vector3( sprPosOld.x+(360/2), sprPosOld.y+(640/2), 1 ) -- Trying to center on screen, screen is (360x640)
go.set_position( sprPos,"#FAS-Statue" )
-- More to come soon!
end
Thanks!