Jump to content

Basic interaction between sprite and html objects


Recommended Posts

Hello and greetings from israel...

first of all, pixi is awesome, and i really want to incorporate in a project i'm working on...


My problem is this:  i am trying to get my sprites location during it's movement, so i can set interactions with html elements on the page (example: when the bunny reaches the <section> with id = "A", "A" disappears OR bunny stops moving).


I tried reading the API and found getBounds() and some other related, but could not get them to work properly (if they at all suppose to do what i thought)


thanks in advance and sorry if this is a stupid question or if my english is not that good...



Link to comment
Share on other sites

That's just simple collision detection. Just iterate over an array of elements after moving the bunny and do a rectangle hittest.

The html elements are not part of the stage so they don't have anything to do with the pixi api.


Or just post an example of your code to get more help  ;)

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.

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.


  • Recently Browsing   0 members

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