samathir Posted March 16, 2020 Share Posted March 16, 2020 Hi, I'm new to Phaser 3 and right now I'm trying to make enemy move animatedly in a path. Now It can move in path but I'm struggling on making sprie move animatedly. var config = { type: Phaser.AUTO, width: 800, height: 600, physics: { default: 'arcade', arcade: { gravity: { y: 0 }, debug: false } }, scene: { preload: preload, create: create, update: update } }; var platforms; var game = new Phaser.Game(config); function preload () { this.load.image('sky', 'assets/sky.png'); this.load.spritesheet('npc3', 'assets/npc.png', { frameWidth: 32, frameHeight: 48 }); } function create () { this.add.image(400, 300, 'sky'); platforms = this.physics.add.staticGroup(); var graphics = this.add.graphics(); // the path for our enemies // parameters are the start x and y of our path path = this.add.path(150, 150); path.lineTo(300, 150); path.lineTo(300, 300); path.lineTo(150, 300); path.lineTo(150, 150); graphics.lineStyle(3, 0xffffff, 1); // visualize the path /* path.draw(graphics); */ enemy = this.add.follower(path, 0, 0, 'npc3'); // what is 0, 0 enemy.startFollow({ positionOnPath: true, duration: 8000, repeat: -1, rotateToPath: false, verticalAdjust: true }); } function update (){ } Any help in getting pointed in the right direction would be appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts