Issue with scaling

I’m currently experiencing an weird issue with map:scale()

Basically what I’m doing:

function onLoop(event)
local xScale, yScale = map:getScale()
map:setPosition(player.x * xScale, player.y * yScale)
end
to set the map on the player at every Loop of the engine.

This working fine when the map boot with the scale at 1.

Then I have 2 button: 1 that remove 0.2 to the scale
and one that set the scale add 0.2 to the scale.

for some reason when I set the scale back to 1 more often that not the map:setPosition(player.x * xScale, player.y * yScale) get wrong data and the map is displayed offset that the player.

I’ve tried fixing this issue but I don’t seems to get an hand on how to fix this …

Anyone can help ? [import]uid: 64835 topic_id: 17558 reply_id: 317558[/import]

There really something weird with the scale between 0 and 1 during a scale for example and can scale to 2 and back to 1 without much issue.

Also if I add 0.2 to the scale the resulting mapScale will be 1.24999… instead of 0.2

Thanks [import]uid: 64835 topic_id: 17558 reply_id: 66742[/import]

The Map:setFocus() function should ( hopefully ) be able to help you - http://justaddli.me/api.php?c=map&m=setFocus - [import]uid: 5833 topic_id: 17558 reply_id: 66806[/import]

Nope still an issue with scale but it still do not focus on the player. [import]uid: 64835 topic_id: 17558 reply_id: 66813[/import]