caymanbruce Posted December 10, 2016 Share Posted December 10, 2016 Hi I am new to PIXI. I want to make my player sprite follow my mouse on the screen. How can I achieve that? I am using PIXI v4. I have read the docs and I have found PIXI.interactions.InterationManager which takes a renderer as its parameter. Something like this: Quote let manager = new PIXI.interactions.InteractionManager(renderer); manager.on('mousemove', moveHanlder, false); I have also found some codes that just listen to the `mousemove` event on the stage or on the sprite. Which one is the correct way to do in PIXI v4? I assume this is a very simple task because I can do it easily with pure javascript. But I just can't get it to work in PIXI. I wish I could find the solution on the books or the examples but all they mention are just dragging the sprites which is not what I want. I also want to know if I should put the event listening out of my animation function or inside it because it seems it can get the mouse position outside of my animation function. 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.