Jump to content

Replace background tileSprite.


oobarbazanoo
 Share

Recommended Posts

the this.bk variable gets overwritten  by the second line ,so why defining it twice anyway? He only needs to make sure it's loaded and then store the tileSprite to a variable (background) and just call background.loadTexture( "back2" ) whenever he needs the base texture to be replaced.  

Also note that the old texture is removed , so in order to apply the previous texture you may need to repeat the same process again.

For more information refer to the API docu

Link to comment
Share on other sites

52 minutes ago, FakeWizard said:

the this.bk variable gets overwritten  by the second line ,so why defining it twice anyway? He only needs to make sure it's loaded and then store the tileSprite to a variable (background) and just call background.loadTexture( "back2" ) whenever he needs the base texture to be replaced.  

Also note that the old texture is removed , so in order to apply the previous texture you may need to repeat the same process again.

For more information refer to the API docu

Yep, my bad. I've edited to avoid confusion but declaring it 2 times was really nonsense... :P Thanks for pointing!

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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