Search the Community

Showing results for tags 'phasercollisiongame'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. I was experimenting with spawning enemies from the right side of the game's canvas. The player, being on the left side shoots the enemies coming from the right. I have a problem though. When the player shoots the enemy while it spawns a couple pixels away from the right side of the screen, the enemy dies (I made a collision handler), but the problem comes when the enemy reaches halfway past the spawn point. It seems that if the enemy gets too close to the player the bullets don't seem to effect the enemy at all. The enemy seems to only die a couple of pixels away from the right side of the screen. Here is how I have things set up: Currently using Phaser 2.0 //Create function with bullets bullets = this.game.add.group(); bullets.enableBody = true; bullets.physicsBodyType = Phaser.Physics.ARCADE; bullets.createMultiple(50, 'bullet'); bullets.setAll('anchor.x', 0.5); bullets.setAll('anchor.y', 0.5); bullets.setAll('outOfBoundsKill', true);//UPDATE functionthis.game.physics.arcade.overlap(bullets, clone, this.enemyKill, null, this);//Method used to spawn enemies//I call a function named 'lvl1' that spawns enemies from the right side of the screen levelOne: function() { this.lvl1 = this.game.time.create(false); this.lvl1.start(); this.lvl1.onComplete.add(this.watchCounter, this); this.lvl1.repeat(Phaser.Timer.SECOND * 2, 10, this.enemyOne, this); },//This function uses the Phaser timer method to call a function to create enemies 10 times every 2 seconds//The function for the enemy is down below:enemyOne: function() { clone = this.game.add.sprite(this.game.world.height + 100, (100 + spawnLimit), 'CloneOne'); //I "bottlenecked" the spawn area to be between a specific areathis.game.physics.enable(clone, Phaser.Physics.ARCADE); clone.enableBody = true; clone.anchor.setTo(0.5, 0.5); clone.body.velocity.x = -110; clone.animations.add('run', [11, 10, 9, 8, 7, 6], 10, true); clone.animations.play('run'); },//Here is the collision handler enemyKill: function(bullet, clone) { bullet.kill(); clone.kill(); }//Here is the players fire methodfire: function() { if (this.game.time.now > nextFire && bullets.countDead() > 0) { var shoot = this.game.add.audio('shoot'); shoot.play(); nextFire = this.game.time.now + fireRate; bullet = bullets.getFirstDead(false); bullet.body.velocity.x = 350; bullet.reset((player.x + 65), (player.y + 20)); bullet.rotation = this.game.physics.arcade.moveToPointer(bullet, 300); } }, EDIT: I just did some debugging using the line of code below and discovered that when the enemy reaches halfway across the screen the collision box literally disappears. How can that be? EDIT: The only "enemy" that takes collision is the last enemy that is spawned. render: function() { this.game.debug.body(player); this.game.debug.body(clone); } Thank you all in advance.