raj-tess Posted January 27, 2019 Share Posted January 27, 2019 var config = { type: Phaser.AUTO, parent: 'phaser-example', scene: { preload: preload, create: create, update: update }, width: 800, height: 600 }; var game = new Phaser.Game(config); var player; function preload() { this.load.baseURL = '//examples.phaser.io/'; this.load.crossOrigin = 'anonymous'; this.load.image('dude', 'assets/sprites/phaser-dude.png'); } function create() { player= this.add.sprite(256,50,'dude'); player1= this.add.sprite(256,150,'dude'); player1.setInteractive(); player1.on('pointerdown', function(){ console.log('clicked'); this.tweens.add({ targets: player, x: 500, yoyo:false, duration: 1000, delay: 1000 }); }) } function update() {} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.