Jump to content

Scrollable Text Box Tutorial not working on mobile


blokus
 Share

Recommended Posts

Hello all,

I recreated the scrolling text box tutorial in my game. However, it is running a bit glitchy on mobile. For example, if I swipe up, the text first goes down for a second and then follows my finger up. You’ll see the problem if you open the tutorial on mobile. Any thoughts? I copied my code below.

var graphics = scene.make.graphics();

graphics.fillRect(x, y + 10, width, height - 20);

var mask = new Phaser.Display.Masks.GeometryMask(scene, graphics);

var text = scene.add.text(x + 20, y + 20, content, { 

  fontFamily: 'Assistant', 

  fontSize: '28px', 

  color: '#000000', 

  wordWrap: { width: width - 20 } 

}).setOrigin(0);

text.setMask(mask);

var minY = height - text.height - 20;

if (text.height <= height - 20) {

  minY = y + 20;

}

//  The rectangle they can 'drag' within

var zone = scene.add.zone(x, y - 3, width, height + 6).setOrigin(0).setInteractive({useHandCursor: true});

zone.on('pointermove', function (pointer) {

  if (pointer.isDown) {

    text.y += (pointer.velocity.y / 10);

    text.y = Phaser.Math.Clamp(text.y, minY, y + 20);

  }

});
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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