Jump to content

Search the Community

Showing results for tags 'CollisionGroups'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

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 3 results

  1. Hi guys. I've recently started to learn Phaser and i think it's pretty awesome but i have a little problem. I'm using P2 Physics. I have an image-based rectangle(1 img for vertical parts, 1 for horizontonal) and 2 circles in my game. One of the circles is player and other one is the ball. I wrote the player and ball collision parts successfully, but when i press SHIFT key(pressing shift means you hit the ball in my game and ball accelerates with speed 400) sometimes ball just ignores the walls and passes them. I spent all my day and night without sleep but i couldn't make it. Some help would be nice, take care of yourselves By the way, there is no player and wall collision so i seperated and used them as collisionGroups.
  2. i dont know about the internals of phaser but i could imagine that using collision groups instead of letting everything collide with everything and filter the relevant infos in the begincontact event would be faster because phaser/p2 doesnt need to check everything against everything.. right or totally wrong because collisiongroups create an aditional overthead?
  3. Cross posted from here. I've got a prefab class that inherits from Group. var PipeGroup = function(game, x, y, collisionGroup, collidesWith) {Phaser.Group.call(this, game);var topPipe = this.create(0,0,'pipes');topPipe.physicsEnabled = true;topPipe.body.kinematic = true;topPipe.body.setRectangle();topPipe.body.setCollisionGroup(collisionGroup);topPipe.body.collides(collidesWith);this.x = x;this.y = y,}; PipeGroup.prototype = Object.create(Phaser.Group.prototype);PipeGroup.prototype.constructor = PipeGroup;And in my main game's create function: create = function() { .. this.playerCG = game.physics.createCollisionGroup(); this.pipeCG = game.physics.createCollisionGroup(); // add our player to the stage this.player = this.add.sprite(game.world.width/3,220,'bird'); // enable physics on our player this.player.physicsEnabled = true; // add our player to the player collision group this.player.body.setCollisionGroup(this.playerCG); this.player.body.collides([this.pipeCG], this.death, this); .. game.time.events.loop(Phaser.Timer.SECOND,this.generatePipes, this);}and generatePipes looks like: generatePipes: function() { var pipeY = game.rnd.integerInRange(-120,120); var pipes = new PipeGroup(game,game.world.width + 32, pipeY, this.pipeCG, this.playerCG); this.player.body.collides([this.pipeCG], this.death, this);}However, the player is never colliding with the pipes. Can you modify a collision group after the create phase of a state? I'm a bit at a loss to figure out why this doesn't work.
×
×
  • Create New...