Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Phaser & jQuery : good idea?


BobDylan
 Share

Recommended Posts

In my web-applications I use jQuery a lot, for example $.each() to iterate over arrays, etc.

I would like to use these in a Phaser game as well.

I could also use jQuery Mobile which is a bit lighter.

 

Is this a good idea, or is this very likely to slow my game down?

(Of course I understand I cannot use the DOM-selectors that jQuery is famous for).

Link to comment
Share on other sites

jQuery and Phaser play fine together, though some of the stuff like jQuery's each function is implemented already in most places it'd be useful, i.e. groups:

group.forEach(function(sprite) {  sprite.doSomething();});

And in fact, if you're using Phaser, the browsers that it supports already have the native Array.forEach function available to them (which has exactly the same syntax as above, but works on all arrays) which is what jQuery's solution was partially created to do in case of older browsers not having it. jQuery's most useful feature in relation to Phaser is its ajax stuff - but most of its other functionality is pretty specific to DOM manipulation and cross-browser compatibility etc, which isn't directly useful in Phaser.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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