Jump to content

InteractionManager - Cannot read property '1' of undefined


Melomancheto
 Share

Recommended Posts

I'm trying to se my interaction mode to true so I can set my sprite to follow my cursor. I've managed to do this before i Added ES6 and webpack.

Here is a code example:

import * as PIXI from 'pixi.js';
// App with width and height of the page
const app = new PIXI.Application({
	width: 500,
	height: 500,
	resolution: 1,
	backgroundColor: 0xAAAAAA,
});

document.body.appendChild(app.view);

let player = new PIXI.Sprite.from('assets/dirt.png');
player.anchor.set(0.5);
player.x = app.view.width / 2;
player.y = app.view.height / 2;

app.stage.addChild(player);

const movePlayer = function (e) {
	let pos = e.data.global;

	player.x = pos.x;
	player.y = pos.y;
}

app.stage.interactive = true;
app.stage.on("pointermove", movePlayer);

Console screenshot:
https://i.imgur.com/w4fAcb9.png


I think that the problem may be related to webpack somehow ;(

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...