map:setFocus question

Question! I've been encountering this problem with map:setFocus (same thing happened when I tried with 11-AnimatedCharacters tutorial)

Basically I have a map:setFocus (player) in a player spawn listener, and then in enterFrame there is map:update (event). Before the player can reach the extreme left of the map, the map seems to scroll off a little to the right, thus the player ends up off screen. This doesn't happen when the player goes to the extreme right of the map.

Any ideas?

Very strange, are you able to email your project to support@justaddli.me and I will take a look at it as soon I can.

After having the code sent to me I can happily say this is now solved, and it was a very silly mistake. And what makes it worse I had already solved it for another user but somehow forgot to put the fix in the main trunk.

If anyone else experiences the error between now and when 3.5 is released, it is a simple fix. Just go into the clampPosition function in lime-utils.lua file ( around line 951 ) just replace the main block of code with this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if _bounds then
        
        if _x > _bounds.x then
                _x = _bounds.x
        elseif abs(_x) > ( _bounds.width - _bounds.offset.x ) - display.contentWidth then
                _x = - ( ( _bounds.width - _bounds.offset.x ) - display.contentWidth) 
        end
 
        if y > _bounds.y then
                _y = _bounds.y
        elseif abs(_y) > ( _bounds.height - _bounds.offset.y ) - display.contentHeight then
                _y = - ( ( _bounds.height - _bounds.offset.y ) - display.contentHeight )
        end
                
end
views:1382 update:2011/10/13 16:30:09
corona forums © 2003-2011