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? [import]uid: 63884 topic_id: 12994 reply_id: 312994[/import]

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. [import]uid: 5833 topic_id: 12994 reply_id: 47660[/import]

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:

  
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  
  

Just a simple change in the order of the if statements but it makes all the difference. [import]uid: 5833 topic_id: 12994 reply_id: 47686[/import]