Jump to content

Search the Community

Showing results for tags 'p2js'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





  1. Hello everyone, I have the same problem like in this topic I don't understand how to set P2 Physic mode or solve this problem in other way. Please help.
  2. Hi. Prismatic and Spring joints in p2js seem pretty straightforward. I was wondering why using constant rest length, stiffness and damping for a spring would change its behavior when a body's local anchor is changed. Fiddle: http://jsfiddle.net/gauravdixitv/83bkhr3f/ (phaser/p2js template from inkfood) From the fiddle, all the springs use share the same parameters except the local anchor of body A. Why do the springs behave differently? :/
  3. Hello guys, When I use p2js by default the borders are the limits of any body inside. I can use planes to reduce this area but it's still a rectangle. My question is the following: How to make an area with curves? Can physicseditor help in a way? Thanks
  4. Hi, I was wondering how can I do with P2JS to not collide with a given group ( I don't want the player to collide with others players ).
  5. Hello, In the tiled map editor is a tilecollision editor i was just wondering if there is any way to get the stuff u do in there to work in phaser, or any other way to set a specific collision polygon to a tile.
  6. Hi, I'm using p2js for physics for my game. The issue is p2js is having different behaviors in the same situations. I'm adding 4 units with the following shape to the scene to the same x and y in a loop each time I click on the page. "shape": [ 10,0, -10,0, 0,-20 ] As you can see in the screenshot, the first and second group of 4 units have different alignments while they are being added with the same function with no difference. It seems that p2js is using a random function in some cases to determine how to move the objects. Is there any way to make p2
  7. Hi, Guys. I am trying to create a blob ball using p2js. What I am trying to achieve is something like the "Sushi Cat" game. I created a blob using the structure in the picture A (attached). The gray orbits are allowed to penetrate each other, and the red lines are distantConstraint. But the problem is when the blob fell from a high place (or hitting corner), it becomes like in picture B. I tried to use spring, different constraint force, smaller orbits, but they are not working properly. My questions are; 1. What is the solution for this? 2. Is there any oth
  8. Hi all! How to move to the point of clicks at p2js? this.game.input.onDown.add(this.onClick, this); In the event handler I have "pointer.position". What's next? I did not find a single example. I found a similar question here, but there is no answer to it. http://stackoverflow.com/questions/36120249/precision-moving-a-body-using-phaser-and-p2-js-physics
  9. I'm trying to make a 2d space game involving a sort of space dogfight between the player and some ai bots. I need help with the enemy ship automatically rotating towards the player, but not being exactly pointed towards the ship 24/7. I want the enemy ship to have some "lag" in its response to the player's movement so it's more realistic. Right now I have a model which is not realistic and would probably be too hard for the player to win: update: function(){ //blah blah var tempAngle = Math.atan2(fightSprites.player.y-fightSprites.enemy[i].y, fightSprites.player.x - fig
  10. var game = new Phaser.Game(1024, 600, Phaser.auto, 'phaser-example', { preload: preload, create: create, update: update, render: render }); var result = 'Press a key'; function preload() { //load assets game.load.image("single_turret","./img/single_turret_64x64.png"); game.load.image("mouse","./img/mouse.png"); } function create() { //start physics game.physics.startSystem(Phaser.Physics.P2JS); single_turret = game.add.sprite(400,300,'single_turret'); mousep = game.add.sprite(50,50,'mouse'); //enable psysics on all items and enable debugged game.physics.p2.enable([single
  11. Hi, dear game developers. I had seen that link on examples load-polygon-1 or var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.image('contra2', 'assets/pics/contra2.png'); // Load our physics data exported from PhysicsEditor game.load.physics('physicsData', 'assets/physics/sprites.json'); } var contra; var start = false; function create() { // Enable p2 physics game.physics.startSystem(Phaser.Physics.P2JS); contra = game.add.sprite(400, 300, 'contra2
  12. Wahooiy

    P2JS Overlap

    I am currently using P2JS to handle collisions within a platform game I am making. There are objects within the objects layer in my level that I want to be able to interact with (Standing over it, press button, do action). How can I create a collision overlap function like in Arcade physics?
  13. I have a bouncing ball and I want to detect that the ball has "hit the floor" in my game. Is there any predefined method for detecting this?
  14. Hello everyone, i am trying to make it so the bodies of the objects dont overlap ( like they do in the picture), they already collide with each other and push eachother around but when i approach and hit it from the corner they overlap like this for a while then let go again. They both have collision groups, i am moving them by applying force. I have fixedRotation set to to true on the bodies. The outline you see on the picture is the debug.
  15. So, I'm developing my frist game right now, and after having lots of troubles choosing the best physics system, I think I'm going with p2, since I need circle collisions. I want to make a sprite, rotating a point, like an orbit, the problem is that when I set the anchor of that sprite, it doesnt rotate the collision body associated to it, it only rotates the image. As you can see in the image, the phaser logo rotates, but the collision body (little debug circle), does not displace itself to the center of the sprite.this.game.physics.p2.enable(this.sprite, true);this.sprite.body.setCircle(16);
  16. Hello, today, they released the BOX2D commercial Plugin for Phaser: http://phaser.io/examples/v2/category/box2d or at least came up with examples, so that somebody could start working with it. Anyways, I have been using P2JS on my ongoing development and have been pretty satisfied except that it is sometimes hard to work around issues with friction which applies on a body top but also side, so that a character will not slide on top but in return hangs on the side due to that friction, sure I found some workarounds but I was wondering if BOX2D would solve such issues better. Does someon
  17. Hi all. I just started using Phaser, and I’m excited by the potential. I could use some help with some problems in this game: http://davebsoft.com/web-games/invisible-maze/ https://github.com/dcbriccetti/web-games/commit/d814fe45a655e8fc0916149156fca95cb22c7a3c#diff-ad4eb6229e24f5cc681cc10695f640ca When the player character hits the “mines” (lightning bolts), he rotates. I don’t want him to. Sometimes the mines move about “aimlessly”. I don’t want them to move (except perhaps a little when the player character bumps them). I’ve looked at several examples and read some of the source cod
  18. The best example I've found of what I'm trying to achieve is this - http://schteppe.github.io/p2.js/demos/topDownVehicle.html However, instead of a car I have a tank, so the movement should be more... tankish, without this front-wheels-turning effect. But this is not a problem. The problem is that my tank's movement looks more like a boat on a water movement. I press UP for acceleration and when I press LEFT or RIGHT it still moves in the same direction for a while, like drifting. And if I release UP button and press LEFT or RIGHT again it drifts as well, without taking into account, that he
  19. create: function () { this.game.world.setBounds(0, 0, 1920, 120); this.game.physics.startSystem(Phaser.Physics.P2JS); this.game.physics.p2.defaultRestitution = 0.8; this.player = this.game.add.sprite(100, 100, 'player_spr'); this.game.physics.p2.enable(this.player); this.game.camera.follow(this.player); this.cursors = this.game.input.keyboard.createCursorKeys(); }, update: function () { if (this.cursors.right.isDown) { this.player.body.thrust(400); } else if (this.cursors.left.isDo
  20. Hello, I would like to know if it is possible to visually debug constraints when using P2JS (springs, revoluteconstraints, distanceconstraints, etc.) I found this image of box2d debug to illustrate what I mean Thanks in advance for any advice!
  21. Hello people, I have a problem with collision in my demo game. (800x800 pixels) It won't allow me to walk around. also there is no worldbounds because it doesn't work too. I have checked the console in different browser, but theres no error. EDIT: Yes, I have been checking out the examples etc, but got no clue what am doing wrong. window.RPG.Game.Main = function () { this.cursors = null;};window.RPG.Game.Main.prototype.preload = function() { // World map this.load.tilemap('demo-map', 'assets/tilemaps/demo-map.json', null, Phaser.Tilemap.TILED_JSON); // Sprites // {1} = Width frame //
  22. Edit: Problem fixed. My mistake. Never mind.
  23. Hello everyone, It's my first topic in that forum and I'm here today because I've an (logicial ?) issue with the physics librairy p2.js. I'll try to explain my problem in the simplest way possible. I'm working on a game based on my own framework coupled with p2.js. In that game, the physical world needs to be updated at a constant time. For now, I'm using a requestAnimationFrame to call the world.step function but that means if the player have a slower PC, the game will be slower and the opposite is also true. I've made an animation in Photoshop (not perfect but whatever) to show you wha
  24. Hi there, I'm using the method autoScroll on my sprite to make it the ground of my game, see https://github.com/maxailloud/Flappy-Plane/blob/using_p2/js/classes/Ground.js#L6. This work great for the displayed sprite but not for its body. Its body is not moving and so the body doesn't match the displayed sprite, as this one is scrolling. Look here http://maxailloud.github.io/Flappy-Plane/ the result, I display the body of each sprite to see the problem. Is there a way, I mean something already existing, to make the same behavior I got on the sprite but on the body on the sprite? I mig
  25. Hello everyone! I am making a game and i have some objects with triangular shape. I use p2js just for collision detection with onBeginContact (everything else is handled manually, like movement etc.). So i am wondering if there is a less expensive way to detect polygon collision. Thanks
  • Create New...