Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let test = new Phaser.Scene('test');
- let config = {
- type: Phaser.AUTO,
- width: 1920,
- height: 1080,
- scene: test,
- title: 'TEST',
- pixelArt: true,
- backgroundColor: 0xFFFFFF,
- physics: {
- default: 'arcade',
- arcade: {
- gravity: {
- y: 0
- },
- debug: false
- }
- }
- };
- let game = new Phaser.Game(config);
- test.preload = function() {
- this.load.image('testImg', 'assets/images/blocks/dirt.png');
- };
- test.create = function() {
- this.playerObj = this.add.sprite(-20, -20, 'testImg');
- this.playerObj.setScale(8);
- this.physics.add.existing(this.playerObj);
- this.playerObj.setOrigin(0, 0);
- this.playerObj.body.onCollide = true;
- this.playerObj.setInteractive();
- this.playerObj.on('pointerdown', function(){
- console.log("Clicked");
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement