Titus

Members
  • Content count

    30
  • Joined

  • Last visited

About Titus

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    turnerjordan855

Recent Profile Visitors

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

  1. Titus

    Kill emitter particle on overlap

    Hi @samme, thanks for the reply and sorry for my delayed one. I do have collide set to true in the makeParticles method and neither this.emitter.removeChild() or this.emitter.removeChildAt(0) remove the overlapping particle from the game world. They just move through it. Am i using these methods in the correct way (to remove the overlapping particles)? The overlap is definitely triggering because I have other stuff in the game that is working within the same IF statment.
  2. Hello, Just a quick question. I want to kill any emitter particles that overlap with a sprite. I've tried: if(this.game.physics.arcade.overlap(this.emitter, this.sprite)) { this.emitter.removeChildAt(0); //and this.emitter.removeChild(); }
  3. Titus

    Emitter Rotation Question

    @samme Thank you, that's exactly what I needed. I'm still not sure why setting emitter.rotation/angle == frontArm.rotation/angle in the update caused the emit point to move. I'm guessing the actual emitter is a rectangle with an anchor of 0,0 and it was updating the rotation/angle of that whereas setAngle() is updating the actual emit locations angle. Appreciate the help regardless!
  4. Titus

    Emitter Rotation Question

    @samme If I do that then the spray will always go directly forward, even if the arm is aiming up/down. I've more or less achieved what I wanted by placing a sprite with a null texture right at the end of the nozel of the extinguisher and then added the particle as addChild() of the frontArm sprite. Then in the update I have emiiter.emitX/Y = this.particle.world.x/y. This makes it so the spray always starts at the end of the nozel but still the spray always shoots directly to the right, even when the nozel is being pointed up or down. Any other suggestions?
  5. Titus

    Emitter Rotation Question

    Hi, I'm having some trouble with my emitter that is used as spray particles for a fire extinguisher. I've set the emitX and emitY to position relative to the player's front arm and set the emitter.rotation = frontArm.rotation. The problem I'm having is that when the arm rotates the particle's emit location is moved. I've attached some screenshots and code to show what I mean. I'm sure it is something simple that I'm missing but I've searched on the forums for quite a while and can't seem to find a solution. Any help would be appreciated. FireSim.test = { create: function() { this.game.stage.backgroundColor = "#d36a6a"; this.waterSpray = this.game.add.emitter(0, 0);// (x, y, max particles) this.waterSpray.makeParticles('whiteParticle', '', 5000, true, false); this.waterSpray.maxParticleScale = 5; this.waterSpray.minParticleScale = 1; this.waterSpray.flow(1000, 100, 50, -1, false); this.waterSpray.minParticleSpeed.setTo(400); this.waterSpray.maxParticleSpeed.setTo(800); this.waterSpray.setYSpeed(-30, 30); this.waterSpray.gravity = 0; this.frontArm = this.game.add.sprite(150, 100, 'frontArm5'); }, update: function() { if(this.game.physics.arcade.angleToPointer(this.frontArm.world) < 1) //only move the arms towards the mouse angle if it is less than 1. This prevents erratic movement when the mouse pointer is positioned behind the player { this.frontArm.rotation = this.game.physics.arcade.angleToPointer(this.frontArm.world); } this.waterSpray.emitX = this.frontArm.world.x + 270; this.waterSpray.emitY = this.frontArm.world.y + 160; this.waterSpray.rotation = this.frontArm.rotation; if (this.game.input.activePointer.isDown) { this.waterSpray.on = true; } else { this.waterSpray.on = false; } }, };
  6. Titus

    init parameters is undefined

    @smdool Thanks for posting your solution. Same thing was happening to me and i'm not sure I would have figured that out without coming here!
  7. Titus

    tileSprite looks to have padding or margin

    I've actually fixed this now. Weirdly I had to cut the area of the texture pixel perfect in Photoshop and not leave any of the chequered canvas around the png (which is usually ignored). The most confusing part is that I had used this texture previously as a tileSprite without this happening.
  8. Titus

    tileSprite looks to have padding or margin

    Nobody got any ideas what's causing this?
  9. Hi guys, I'm having an issue with a tileSprite I'm using to cover my game screen. It looks like the repeating texture has spacing/margin added on all sides which creates this grid like effect in the screenshot below. I have no idea how this has happened because yesterday when I was working on the game (and all times previously) the tileSprite formed a solid texture the size of the game world. I've tried this with 2 separate textures, in different states/browsers and I'm starting to think I'm going crazy. Any help advice would be greatly appreciated. Thanks!
  10. Titus

    Overlap Between Emitter and Group

    @samme Excellent, thank you!
  11. Hi guys, just a quick question. I'm trying to detect overlap between emitter particles and a group like so: create: function() { this.emitter = this.game.add.emitter(0, 0, 1000); this.emitter.enableBody = true; this.emitter.makeParticles('whiteParticle'); this.emitter.minParticleSpeed.setTo(100); this.emitter.maxParticleSpeed.setTo(800); this.emitter.gravity = 50; this.emitter.maxParticleScale = 3; this.emitter.minParticleScale = 0.1; this.emitter.setYSpeed(-150, 150); this.emitter.flow(1500, 100, 100, -1, false); //lifespan, frequency, quantity, total, immediate this.emitter.checkWorldBounds = true; this.emitter.outOfBoundsKill = true; this.fire = this.game.add.group(); this.fire.enableBody = true; this.fire3 = this.game.add.sprite(1423, 500, 'fireL3'); this.fire2 = this.game.add.sprite(1423, 500, 'fireL2'); this.fire1 = this.game.add.sprite(1423, 500, 'fireL1'); this.fire.add(this.fire3); this.fire.add(this.fire2); this.fire.add(this.fire1); }, update: function(){ this.game.physics.arcade.overlap(this.emitter, this.fire, this.damageFire, null, this); } damageFire: function(){ console.log('fire damaged!'); }, I can get this to work fine if I check for overlap between 2 sprites/groups, but I cannot get it to work for the emitter. Could anyone point me in the right direction? Thanks
  12. Titus

    Large Texture Atlas

    Thanks again @Skeptron. Have you used Spine yourself? I might have to give it another look if the current way are doing things is just too heavy. I've done a bit of research but it wasn't clear to me if it's possible to use Spine animations with Phaser.
  13. Titus

    Large Texture Atlas

    @Skeptron Thanks for the suggestions. I really don't think that Spine or Spriter would be what I need. Mainly because my animations aren't really skeletal, except the player character, which I don't really have this issue with. I'm very new to game development but I've been tasked with creating this game primary for web browsers on PC but should to work for mobile devices. I have someone making the assets using Abode After Effects. It's a fire extinguisher simulation. An example here is I have a state that is shown for game over if the user selects the wrong type of extinguisher. The animation on that page shows the player (half body framing) getting electrocuted , but there isn't really any skeletal movement. I have exports of all the frames for a 3 second animation at 24fps. That gives me 70+ images that I put into an atlas using Texture Packer. Each export is 1920 x 1080 with the player taking up about 1/3 to 1/2 of that size. Texture packer does a decent job of packing them together in the atlas. I was hoping that I was just doing something wrong but I'm now assuming that I just have too many textures that are too big for Phaser (or maybe any html5 framework) to load well. Interestingly I have noticed quite a bit of improvement by changing the render type from Phaser.AUTO to Phaser.CANVAS. That has surprised me quite a bit.. I'm using a PC and it's not super high end but it has a GTX 750 Ti so I thought that webgl would offer the better performance for sure and I also read that webgl would be best for most mobile devices.
  14. Titus

    Large Texture Atlas

    Hi Guys, I'm making a game that uses assets for a 1920 x 1080 screen and I'm having some issues with some states taking a long time to load. All my assets are loaded in a preload state which has a loading bar but the issue I'm having is that some states which access a large texture atlas (8,000 or higher) take 3-5 seconds to load, without any feedback to the user. I wouldn't mind if that extra time was added to the preload state with a loading bar but I'm confused as to why switching states takes so long if the assets are already loaded. I've run some tests with simply adding a single sprite to a page in a create function from a large texture atlas. The texture atlas is 7643 x 8488 (2.94MB) and I've used Texture Packer to create the png and JSON array. The atlas contains around 70 textures. create: function(){ this.game.stage.backgroundColor = "#db6565"; this.test = this.game.add.sprite(400, 50, 'wrongFoam'); } This state takes around 2-3 seconds to load after pressing the next button in the previous state. Am I doing something wrong here? I can't split the textures into multiple atlases because I need access all 70 textures for certain animations. I also don't believe that Phaser supports multipack from Texture Packer. Any help would be appreciated. Thanks
  15. Titus

    attach an emitter as child of sprite

    @samme Thanks you. That was very helpful. I had tried using the update function to attach the emitter to another sprite but I was using this.emitter.x instead of this.emitter.emitX and it didn't work. Interestingly when debugging the emitter (I had to use children[1] to get any debug info) I get coordinates of the first particle when it is not a child. As soon as I add it as a child of a sprite there is no debug information. Do you think there could be a bug in the current version of phaser?