Jump to content

rotating sprite around circle


PiraTa
 Share

Recommended Posts

Hi, I'm started to learn phaser today and I've trouble.
I'm trying to make preloader state.

I've to sprites:

xAQJha2.png

 

 

I want to rotate this dots sprite:


fYIHOsH.png

 

 

I tried set anchor and different things, but ineffectually. I am confused and I hope for your help


This is part of my code:

public create(): void{    this._loadingContainer = this.game.add.sprite(this.game.world.centerX - 286.65, this.game.world.centerY - 103.25, "loaderContainer"    this._loaderDots = this.game.add.sprite(this.game.world.centerX - 306.8, this.game.world.centerY - 84.5, "loaderDots");    this._loadingContainer.scale.set(0.7);    this._loaderDots.scale.set(0.7);}public update(): void{    this._loaderDots.rotation += 0.05;}

post-16752-0-21805300-1452197193.png

Link to comment
Share on other sites

Nothing happens, no rotation at all? This is kind of a dumb question... but are you sure your "update" method is getting called?

 

You're going to need to anchor the image at (0.5, 0.5) to get it to rotate around its center. Then the position you add it to the game world will be game.world.centerX, game.world.centerY... assuming your game world isn't bigger than the screen.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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