fitness23

Tween world bounds

Recommended Posts

If you don't care about the camera or physics, you can just tween game.world.bounds {width, height}

But maybe physics is the most important part, so:

var world = this.world;
var bounds = world.bounds.clone();

this.add.tween(bounds)
  .to({
    width: 2000
  })
  .onUpdateCallback(function () {
    world.resize(bounds.width, bounds.height);
  })
  .start();

 

Share this post


Link to post
Share on other sites
13 hours ago, samme said:

If you don't care about the camera or physics, you can just tween game.world.bounds {width, height}

But maybe physics is the most important part, so:


var world = this.world;
var bounds = world.bounds.clone();

this.add.tween(bounds)
  .to({
    width: 2000
  })
  .onUpdateCallback(function () {
    world.resize(bounds.width, bounds.height);
  })
  .start();

 

This worked perfectly! Thanks so much I would never have got that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.