Jump to content


  • Content Count

  • Joined

  • Last visited

About Taz

  • Rank
    Advanced Member

Recent Profile Visitors

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

  1. Not if you want this code to call your constructor instead of PIXI.Sprite's: var bee = new beeSprite();
  2. "it seems both are blurred when size is doubled with or without cacheasbitmap": AFAIK potentially creating artifacts like blurriness and jaggedness is simply the cost of scaling on the fly like this. "When I scaled my image with no cacheasbitmap, the sharp edges were retained": It sounds like (from prev replies) that cacheasbitmap isn't needed in this case, otherwise I would prob ask for a CodePen demo of the issue and try to help debug cacheasbitmap or find some work-around...
  3. Looks like maybe you're restarting the sound's playback every frame until the the left key is released, at which point the sound is allowed to play through without restarting it every 16 ms (that's about how often your update function is called at 60 FPS). I'm guessing the fist 16 ms of the sound is inaudible due to a fade-in... EDIT: Sorry I assumed that was an update handler for some reason, but if it's an input handler that gets called once per press then NM the above;)
  4. looks like maybe a problem is that when you create them with exists param = true, then all of them exist and are alive, so you're add function always returns on the first iteration of the loop without doing anything since getFirstDead() always returns null - since they're all alive. So I think they are all drawn to the same position since the add function returns before handling the positioning, never calling reset(posX, 200), so I would expect them to all be drawn at position (0, 0) which matches your second picture if you have some padding on your image I think... Maybe using callAll would w
  5. looks like you'll be creating a PIXI.Sprite instead of a beeSprite. Here's how to assign the constructor (the step that's missing): beeSprite = function () { var beeTexture = new PIXI.Texture.fromImage("img/bee.svg"); PIXI.Sprite.call(this,this.beeTexture); this.position.x = 100; this.position.y = 100; }; beeSprite.prototype = Object.create( PIXI.Sprite.prototype ); beeSprite.prototype.constructor = beeSprite;
  6. Here's a little extension to Phaser.Group for example that adds the method getLastExists. The params/usage matches the getFirstExists method. The CodePen demonstrates using it for health bar:
  7. I copy and pasted your code for the left sprite and the right sprite is w/out cacheAsBitmap: Here's the playground I made to test it if you want to fork and try to re-create the issue: https://phaser.io/sandbox/edit/SLtwpbdc
  8. Alternatively you can also use forEach to repeat your update process for each enemy, like this for instance:
  9. Pixel perfect collision systems tend to be heavier/slower - systems like Arcade and Bump are easier and faster by dealing with rectangular and circular bounds only (i.e. not pixel perfect for other shapes). Pixel perfect bounds will likely be harder to implement and slower to execute, so it might be worth exploring to see if the easier and faster way works before going down the pixel-perfect collisions road... Also fast-moving sprites can make fudging the bounds less noticeable so it's prob worth a try before worrying about the pixel perfect part, especially for a fast-paced space shooter type
  10. Pixi doesn't have that built-in, you'll have to roll your own or find a library you like. You might find that you wont need pixel-perfect collision bounds thou - especially for a space shooter things might be moving fast enough that pixel perfect won't matter so much. The only collisions library I know of that's made specifically for pixi is bump (it targets v3 but I've used it for V4 too and for reference).
  11. Ninja physics handle it for you - ignoring it lets Arcade be lighter and quicker I think...
  12. You didn't mention what isn't working - or what happens - when you posted the original code, but it's hard to help debug/fix without knowing the issue:) Also it will look the same whether you kill the bot when it goes out of screen or not IMO so IDK how you're monitoring whether it works or not, unless you add some debugging (console.log("KILLED") after bot.kill() would prob do)...
  13. game.make.sprite() is used to create the sprite w/out adding it to the world. Then later you can add it to the world manually like this: game.world.add(bot); // instead of game.add(bot);
  14. bulletAngleOffset is what you're after if I read you right: weapon.bulletAngleOffset = 180;
  15. Taz

    Rotation control?

    I think on pointerdown you could store the start rotation of the target and the start position for the button, then on pointermove set the target's rotation to start rotation + angle, where angle is Math.atan2(p2.y - p1.y, p2.x - p1.x), where p2 is the button's start position and p1 is the button's current position. That's just grabbing the formula and stuff off the top of my head but I think it would work -also the idea is adapted from drag-and-drop concepts that I learned from the projection example's drag and drop so maybe that could help too (the interaction code at the bottom of the examp
  • Create New...