Melomancheto Posted November 4, 2020 Share Posted November 4, 2020 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 ;( Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 5, 2020 Share Posted November 5, 2020 double pixi, again rm -rf node_modules; rm package.lock npm i Melomancheto 1 Quote Link to comment Share on other sites More sharing options...
Melomancheto Posted November 5, 2020 Author Share Posted November 5, 2020 (edited) I will try that. I managed to get it working with const builder = new Builder(app, { autoPreventDefault: true, }); but I will try this for sure. thanks Worked like a charm, thanks Edited November 5, 2020 by Melomancheto 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.