• Content Count

  • Joined

  • Last visited

About David

  • Rank
    Advanced Member

Contact Methods

  • Twitter

Recent Profile Visitors

767 profile views
  1. If you want to know if there is any meaningful difference, a bench mark can help: console.time('bench-mark1');//do test case 1 N timesconsole.timeEnd('bench-mark1);console.time('bench-mark2');//do test case 2 N timesconsole.timeEnd('bench-mark2);I usually run between 1k and 100k iterations depending on the test. I keep the setup code in a snippet in Chrome devtools. Note that you want to be sure you're test case isn't too simple. The optimizer can kick in and take unexpected shortcuts that give readings that don't reflect what you can expect in actual usage. If I have nothing else to do, I'll add 1 to an accumulator. Also, if you want to benchmark some non-Phaser dependent, jsperf is awesome. Bonus: Here's a bunchmark of mine that had some surprising results: var runCount = 10000000;var list = [];var temp = 0;//setupfor(var x = 0; x < runCount; x++) { list[x] = x;}console.time('bench1');for(var x = 0; x < runCount; x++) { temp += list[x];}console.timeEnd('bench1');temp = 0;console.time('bench2');underscore.each(list, function(item) { temp += item;});console.timeEnd('bench2');temp = 0;console.time('bench3');lodash.each(list, function(item) { temp += item;});console.timeEnd('bench3');temp = 0;console.time('bench4');list.forEach(function(item) { temp += item;});console.timeEnd('bench4');This assumes you're got both lodash and underscore assigned in noConflict tot their respective variables.
  2. It looks interesting. I look forward to checking it out once the linux build is available. It reminds me of A Wizards Lizard (also written in js) by the guys at Lost Decade Games which is tons of fun.
  3. In short, I want to get all the sprites at a given point. Currently, I'm getting the bounds of my sprites and testing if that Rect contains that point. I'm browsing through the code to see if there is a method on "Group" or something that I might be missing that already does this. Any ideas? If not, I can probably figure out a good place for it and do a pull request.
  4. Ah. My mistake. I only saw the "The following search terms are not allowed and were removed from your query" line. It's been a long day and it's late... Anywho, thanks for the update. Looking forward to 2.1.0!
  5. I see that the term "np" followed by "m" has been banned from searches (breaking it up in case it gets posts banned for some reason). Anyone know what this is about? Now for the question that led me to discover this banning. I see that the package "phaser" was recently unpublished. Is it going to get reinstated? It would remove a step for new projects in browserify or node-webkit.
  6. From what I've seen of the code, there is no double click event. However, there is an extra parameter passed into "onTap" that denotes double click: // Was it a double-tap?if (this.timeUp - this.previousTapTime < this.game.input.doubleTapRate){ // Yes, let's dispatch the signal then with the 2nd parameter set to true this.game.input.onTap.dispatch(this, true);That means you can have a double click handler by doing something like: game.input.onTap.add(function(pointer, isDoubleClick) { if(!isDoubleClick) { return; } // Handle double click.});Then again, you could also use the native dblclick event.
  7. Ah. Yeah, I just realized that I've never run it in anything other than Chrome. If you run it in firefox, it won't zoom. Oh, and you pan with WASD. As for the code configuration, yeah, I've got my own weird thing going (experimenting with architectures n' all). However, you might be able to gleen something from the methods I mentioned.
  8. I haven't had a chance to examine your code, but perhaps one of my prototypes could be of assistance. Take a look here: http://davidgranado.com:4583/ It's got zooming, panning, and parallax (thought that's a bit subtle). I just wanted to see if I could get these fundamentals working to get my idea off the ground. Anywho, you'll want to take a look in play.js. That is where you'll see methods like updateBackground, updateZoom, limitView, and also the event handler on mouse scroll that sets the zoom target (this probably needs a better place than being jammed into the state create method, but, meh, it works for now. If this doesn't give you any answers, I'll see if I can take the time to look at your post a little more in-depth.
  9. This project looks awesome. I can't wait to see more videos and how this progresses!
  10. Awesome! I'm looking forward to using this.
  11. How did I miss this method. This solves a TON of things for me! Thanks!
  12. I'm currently trying to hack around this one as well. I feel like it's there in the source somewhere, but I just haven't found it yet. Any takers for this one yet?
  13. I'm trying to create a drag selection tool. At the moment, I''m simply drawing a graphic, keeping a rectangle in sync with that graphic, and checking each sprite to see if they intersect. It works (well...after adjusting the library to allow intersections for negative widths and heights. after testing, it will probably become a pull request.) and it might be a premature optimization, but I'm anticipating a higher number of sprites in my game meaning a ton of comparisons. It wouldn't exactly be n^2, just n. But I feel as though I might be missing something in the api that might take care of this in a more optimized way. I was originally hoping to take advantage of the quad tree with the new "retrieve" method, but it doesn't seem to return contained sprites (I'm assuming that it's only going to return sprites that are at the boarders). Has anyone had to implement this control? Was there a more efficient way to do this check?
  14. @stasuss is correct. Your collisions will not work properly if you directly manipulate the position vs setting the velocity or acceleration. Here's a link to a solution someone provided for a similar issue someone was having (they were tweening, but in the end this is just directly manipulating the position value). Also you can see Rich's explanation here: Another possible solution could be using come from using customSeparateX/Y. However, I haven't actually used this yet.
  15. There isn't any difference. They have the same definition (since that's the case, I think one should just be a assigned as an alias for the other as opposed to duplicating). If you look at the code you will see "audio" here: audio: function (key, volume, loop, connect) { return this.game.sound.add(key, volume, loop, connect); },and sound: sound: function (key, volume, loop, connect) { return this.game.sound.add(key, volume, loop, connect); },