Jump to content
Sign in to follow this  
brooke_theperson

How to make a div "collect coins" with jquery

Recommended Posts

I was just wondering, how do you make a div, or a character run and when it comes in contact with a coin, it collects the coin? Like if mario were running and he collects a coin.

Share this post


Link to post
Share on other sites

You can't do that with jQuery. You need to program that in Javascript. It's called a collision detection algorithm. The simplest ones are either rectangular collision testing or circular collision testing.

 

Looks like MDN even has an article about it: https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection

 

You're entering the realm of game development, I warn you that nothing is easy in game development.

Share this post


Link to post
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.

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...
Sign in to follow this  

×
×
  • Create New...