Jump to content

rotating sprite around circle


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:




I want to rotate this dots sprite:




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;}


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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