khleug35 Posted February 3, 2018 Share Posted February 3, 2018 Is it possible to create steep path without NINJA PHYSICS? make the player stand on oblique platform or steep path and the player will slip down, Thank you very much https://jsfiddle.net/0z76tofy/ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update}); var player; var platforms; var cursors; var jumpButton; function preload() { game.stage.backgroundColor = '#85b5e1'; game.load.baseURL = 'http://examples.phaser.io/assets/'; game.load.crossOrigin = 'anonymous'; game.load.image('player', 'sprites/phaser-dude.png'); game.load.image('platform', 'sprites/platform.png'); game.load.image('platform2', 'sprites/platform.png'); } function create() { player = game.add.sprite(100, 100, 'player'); game.physics.arcade.enable(player); player.body.collideWorldBounds = true; player.body.gravity.y = 500; platforms = game.add.physicsGroup(); platforms.create(-100, 200, 'platform'); platforms.setAll('body.immovable', true); cursors = game.input.keyboard.createCursorKeys(); jumpButton = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); } function update () { game.physics.arcade.collide(player, platforms); platforms.angle = 20; player.body.velocity.x = 0; if (cursors.left.isDown) { player.body.velocity.x = -250; } else if (cursors.right.isDown) { player.body.velocity.x = 250; } if (jumpButton.isDown && (player.body.onFloor() || player.body.touching.down)) { player.body.velocity.y = -400; } } Link to comment Share on other sites More sharing options...
samme Posted February 3, 2018 Share Posted February 3, 2018 https://github.com/hexus/phaser-arcade-slopes Link to comment Share on other sites More sharing options...
khleug35 Posted February 10, 2018 Author Share Posted February 10, 2018 On 2018/2/4 at 12:22 AM, samme said: https://github.com/hexus/phaser-arcade-slopes Thanks!! samme It work!! but Is it just work for tilemap?? ? Is it working for sprite ?? Thanks Link to comment Share on other sites More sharing options...
Recommended Posts