claire Posted October 14, 2013 Share Posted October 14, 2013 Did Phaser provide scrollbar?For example, I do have a list of character/anything for player to choose, which cannot fit the whole screen and need a scrollbar to browse. Any method I can use? Link to comment Share on other sites More sharing options...
rich Posted October 14, 2013 Share Posted October 14, 2013 There isn't one built-in by default, no, but you could easily create one using a Sprite with enableDrag turned on, but lock the drag so it only works vertically (or horizontally if your scroll bar needs to go that way). Then limit the area it can move to a 1px wide Rectangle (the bounds parameter) as tall as you need. Link to comment Share on other sites More sharing options...
claire Posted October 16, 2013 Author Share Posted October 16, 2013 Is it something like this?var bg = game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'game-bg').anchor.setTo(0.5, 0.5);bg.draggable = true;This code is not working. Am I getting this wrong? Is there any way to have a scrollbar exactly like DOM element which have scrollbar at the side and can scroll using mouse? Link to comment Share on other sites More sharing options...
andcore Posted July 9, 2014 Share Posted July 9, 2014 is there any way to crop text element? I can not see crop method in text. But maybe there is another way... Link to comment Share on other sites More sharing options...
georgejfrick Posted June 25, 2015 Share Posted June 25, 2015 I know this is old, but I want to reply to a few of these because I know people are searching. I'm hoping to get an example into the examples area... You want to create a container sprite, not a group.var containerSprite = game.add.sprite( 0, 0 );var scrollMask = game.add.graphics(0, 0);scrollMask.beginFill(0xffffff);scrollMask.drawRect( yourX, yourY, maskWidth, maskHeight );scrollMask.endFill();containerSprite.mask = scrollMask;// Add your sprites and text to the containerSprite using addChild// You can move the mask, move the container sprite, and move the sprites within the container.From there, you just need a scrolling control. WitheringTreant and gaelbeltran 2 Link to comment Share on other sites More sharing options...
Recommended Posts