Jump to content

Scaling a group of sprites with an anchor


sombrelain
 Share

Recommended Posts

Hey there,

 

I'm new to Phaser development and am currently trying to build a zoomable, draggable world map. Dragging works fine, but I can't get the zooming to work correctly.

 

The background of my world map is Sprite containing the background image. This sprite is in a Group with some other sprites (something like cities on the map). When I now scale the whole group using something like 

game.add.tween(mapGroup.scale).to({x: scaleX, y:scaleY}, 50, null, true);

everything works fine, but the anchor for scaling is always the upper left corner. With Sprites, I can set the anchor property to define where the anchor of the scaling is located, how would I do that for a whole group?

 

My goal is: If I point the mousecursor at let's say New York on the world map, then zoom in, the mousecursor should still be located at NY after the scaling. 

 

This is probably pretty obvious for someone experienced with 2D graphics development, any help would be greatly appreciated.

 

Thanks a lot :)

Link to comment
Share on other sites

  • 11 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...