Nahsgnoy Posted November 23, 2015 Share Posted November 23, 2015 Hi guys! i am a beginner user 1st time building a game using Phaser. I am trying to build a climbing game where a guy tries climbs up a trunk with obstacles as high as he can. So far, this is what i have got: Currently, the obstacles(rocks) appear across the whole game.world.width. How do i set the game bounds so that the obstacles will only appear within the trunk? I tried using sprite.input.boundsSprite = trunk; and sprite.input.boundsRect = trunk; but it seems its only applicable to bound sprite dragging.Then i tried game.world.setBounds but from the Phaser docs, do not quite understand how do i set the trunk as the game border. especially when I hope for it to scale so as it will appear right for all devices. Additional info, some of my code: var game = new Phaser.Game(window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio, Phaser.AUTO); Using tileSprite to create the trunk for player to climb:this.trunk = this.add.tileSprite(Math.ceil(this.game.world.width * 0.15), 0, Math.ceil(this.game.world.width * 0.7), this.game.world.height, 'trunk'); *The background is not a sprite but just a normal sky blue background color. Can you please kindly advice? Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts