• Content Count

  • Joined

  • Last visited

About GreatBigBore

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I guess I'm not destined to be one of the cool kids. I was just about to post that example and realized I had the wrong Phaser tag checked out in my local fork. It doesn't happen with v2.6.2, not sure why. The code in checkWorldBounds() is the same; maybe the Planck length thing got fixed. Sorry for the false alarm.
  2. I'm pretty sure this is a bug, perhaps even two bugs, and it would be fun to be a true contributor to Phaser, but there are a couple of hurdles. Here's how it goes: arcade physics, circular body, collideWorldBounds = true, bounce = 0. My sprites get up against the world boundary and then can't get away from it. Problem is, inside Phaser.Physics.Arcade.Body#checkWorldBounds(), the sprite is officially out of bounds -- visually, I'm just up against the wall, but internally, I'm out of bounds by the tiniest amount, like 1e-308 (I think this is Number.MIN_VALUE). Seems like that's bug #1: with collideWorldBounds = true, the sprite shouldn't be allowed out of bounds, even by the Planck length. Bug #2 is in how this out-of-bounds condition is handled: checkWorldBounds() multiplies the sprite velocity by -1. That's a problem, if I'm trying to get away from the wall; the function is forcing me back into the wall, and I'm stuck forever. Or maybe it's three bugs? At the top of checkWorldBounds() there is a decision about whether to use worldBounce or the body bounce for the multiplier; it just uses a negative value, with no consideration for the bounds or the velocity. Maybe it's all just one bug; I'm not sure. So as I say, I'd love to be a contributor like one of the cool kids, but I'm not sure which aspect(s) should be considered the problem(s). Any advice from the cool kids?
  3. I think what you mean is you want to give the player one point for each collision. Is that what you mean? If so, then I would do it in the function that detects the collision. I think perhaps that is the function called spaceshipCollide(). Although you haven't shown that function, the name suggests that it is a good place to increment the score. But it's possible I've completely misunderstood your design and your intent, so forgive me if this is a useless answer. As for the question, "Is that possible?" Yes, I promise you, whatever you're trying to do, there are a million ways to do it. With JavaScript, it's a million plus one.
  4. In case anyone else runs into something similar: I'm not entirely sure of this, because now it's working fine again, and I'm too busy curing cancer to bother with trying to re-break it. But I think it has something to do with using body.position instead of when moving my guys around. Maybe I'm just asking for trouble by moving the body around manually, but I had to in order to get natural-looking motion, to get them to accelerate and decelerate smoothly while tracking targets. Anyway,, not body.position. That might not be it after all, but it's my best guess.
  5. I had this problem a while back, and fixed it, but I don't remember how I fixed it, or whether I even understood what I had done to fix it. I have circular physics bodies. I use setSize() followed by setCircle() -- I'm not sure whether the setSize() is necessary; it's possible I'm doing it for superstitious reasons relating to the last time I had this problem. I have collideWorldBounds turned on, but my sprites can go about 15px off the bottom and right of the world, and they stop about 15px short of the top and left of the world, like their centers are off. I can see, when I turn on game.debug.body and game.debug.spriteBounds, that everything looks perfect: square sprite bounds and round body bounds, all perfectly centered. As I say, I had it fixed, but I don't remember what I did, and so far I haven't figured out what I did to break it again. Using arcade physics. Also, body.syncBounds = true, although I tried it false too, out of superstitious desperation. Anchors set to 0.5, 0.5. Thoughts?
  6. Not sure how to try for myself. Do you mean turning off the drawing to the canvas? That's what I was thinking of, but I don't know how to do it. Is it just an easy switch somewhere?
  7. Is it just the computation, or is it mostly the I/O, like talking to the browser and waiting for it to push a bunch of pixel data to the hardware? I ask because I wonder if I could fast-forward my game (for a sort of time-travel effect) just by telling Phaser to stop drawing and keep time going forward, but a zillion times faster than the normal frame rate. But if the slow part is really just computing all the physics and stuff, I guess there's no way to fast-forward. Anyone know anything about the guts of graphics libs?
  8. I take it back; my solution didn't work. But reset seems promising. My code doesn't like it, so I'll have to make some adjustments, but it seems promising. Thanks!
  9. Will try that. Also, I realized that I'm killing sprites and reviving them on the same update cycle. I wondered if that might be a problem, so I changed the revive code to wait a couple of ticks, and problem solved. But I'll try reset too -- I might learn something. Thanks much.
  10. I have a pool of 500 sprites I created with createMultiple(). They're food for my main characters. When the character eats a piece of food, another piece appears in a random location. Or, that's the idea. When the character eats the food, I kill the food sprite and choose a new, random location, but then reviving it is problematic. They behave perfectly when I first bring them into the world, but I revive them, they don't go where I told them to. I'm setting the body position and the sprite position, with no luck. Not only does it go to the wrong place, the vast majority of the time it goes to the world boundary (top and left, never bottom and right -- no idea what that means), so I have a bunch of food lined on the top and left sides of my screen. I'm certain I'm doing something wrong, but I have no idea what. Anyone have any advice? Wild guesses?
  11. So I thought it was a bug in my code, been working on it for weeks, but I've finally traced it to Phaser.Physics.Arcade.Body.checkWorldBounds(). I'm using Arcade physics, circular body, collideWorldBounds true, bounce zero. My guys hit the wall and then try to turn around, but checkWorldBounds() prevents them. Two problems: the code that checks whether I'm out of bounds finds that I am indeed, by 1e-308. Fair enough, out of bounds is out of bounds, even if it's by less than the Planck length. The problem happens when the function corrects my intended velocity, even though it's a velocity that would move me away from the wall, by my bounce factor, which of course is zero. So no matter what velocity I set, it gets zeroed out. I would fix it and submit a pull request, but as I've discovered before, Phaser is complex, and I'm sure there are other considerations that I would fail to take into account. I'll change my own copy, of course. Awesome library, by the way. Can't believe it's free.
  12. My characters need to be able to find their food. They can smell things a certain distance away -- each guy is attached to a big, circular (invisible) sprite that represents his smell range. I need to detect the overlap between the smell particles and their sensor, so they know the food is there, how much is there, how far away, what direction, that sort of thing.
  13. Turns out the loop() function works where repeat(-1) didn't. I guess I'm using repeat() wrong?
  14. I thought it would be obvious how to make this work, but it's not working. It goes one time, and then stops forever. I've re-read the doc on chaining and repeating ten times, and I've tried to follow through the tween code in the Phaser lib. I must be missing something obvious from looking at it too much. What am I doing wrong? this.midnightToSunup = game.add.tween(this.sunChariot).to( { x: - 100 }, 5000/*this.dayLength*/, Phaser.Easing.Sinusoidal.In ); this.sunupToNoon = game.add.tween(this.sunChariot).to( { x: game.width / 2 }, 5000/*this.dayLength*/, Phaser.Easing.Sinusoidal.In, false ); this.noonToSundown = game.add.tween(this.sunChariot).to( { x: game.width + 100 }, 5000/*this.dayLength*/, Phaser.Easing.Sinusoidal.In ); this.sundownToMidnight = game.add.tween(this.sunChariot).to( { x: game.width / 2 }, 5000/*this.dayLength*/, Phaser.Easing.Sinusoidal.In ); this.sunupToNoon.chain(this.noonToSundown, this.sundownToMidnight, this.midnightToSunup); this.sunupToNoon.repeat(-1); this.sunupToNoon.start();
  15. I'm making sprites that smell bad -- they spew particles of smell wherever they go. I use overlap so the other sprites can smell them. So I need physics bodies. The problem is that when I set .visible = false, the physics bodies stop moving entirely. They just sit there while my smell particles fly around. I discovered this by turning on debug.body and debug.spriteBounds. I found an old issue where someone had found the opposite problem: they wanted the bodies to be turned off when the sprite is invisible. Looks like an option was added to allow for that, but maybe that broke the case I need? Or maybe I'm just doing something wrong in my setup? For now, I'm working around the problem by setting alpha to zero. And I think that will work for me -- I probably never need to set alpha to anything else for particles of smell. But I'm interested whether this is a bug, or just something I'm doing wrong.