Jump to content

Beginner here. What's the simplest way to involve mousewheel and keyboard events?


eggborne
 Share

Recommended Posts

I would like to be able to refer to cursor.position.x and cursor.position.y the way I refer to sprite.position.x, etc., and be able to handle mousewheel events the way mousedown, mouseover, and the other built-in Pixi functions do.
 
Basically I am trying to achieve a sprite which rotates to point at the cursor, and can be moved with WASD.
 
I know jQuery can do things like this, but would using it (or another library) be overkill if it were just for this purpose, and only saved a few lines of code?
 
If someone could give me some advice and/or point me in the right direction, I would greatly appreciate it.

Link to comment
Share on other sites

You don't need jquery, just use DOM mouse events on the canvas. The interactions that pixi provides are just for specific events where you need to know the actual sprite in the scene that is being interacted with. Scroll you can just bind on the canvas (or document) and deal with normally.

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...