Jump to content

Using Phaser Kinetic Scroller Plugin


shvalb
 Share

Recommended Posts

Hi guys,

I'm new to Phaser and I'm trying to setup the Kinetic scroller using the example on the Website

(https://github.com/jdnichollsc/Phaser-Kinetic-Scrolling-Plugin)

instead of horizontal scrolling I configured it to vertical and I put the code in my main state.

The problem is when I scroll vertically it also scrolls the main background picture as well.

How can I define a scrolling area that is not the entire screen?

Here is my scrolling code:

create: function() {
    //Starts the plugin
    this.game.kineticScrolling.start();

    this.rectangles = [];

    var initY = 100;

    for (var i = 0; i < 26; i++) {
        this.rectangles.push(this.createRectangle(this.game.world.centerX-450/2 , initY, 450, 80));

        initY += 90;
    }

    //Changing the world width
    this.game.world.setBounds(0, 0, this.rectangles.length, 320 * this.game.height);

  },

 

Any help would be appreciated!

Thanks!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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