Search the Community

Showing results for tags 'p2.js'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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

Found 11 results

  1. This is version 2 of my game Descensus from several years ago. It's a simple but difficult 2D physics game in which you have to guide the ball to the ground by swiping bars on screen, bouncing it around spinning saws and off moving terrain objects. There's a time limit to reach each 100m stage, and you can use terrain objects to your advantage as well. It was written using the physics library p2.js and the rendering library Pixi.js. I wrote in in TypeScript, bundled with Webpack, developed using Visual Studio Code. The Android version was packaged using the cloud build system Monaca, bundling the Crosswalk webview (hence the relatively large APK size). It doesn't use any PhoneGap APIs - the sound is all HTML5 Audio. I did most of the testing on desktop so I know that it works nicely with both mouse and touch. I might possibly put it online in the future. Play Store link: Video:
  2. Hello, how can you change the orientation of the plane in p2.js? As for billiards. I read this article, but the answer did not find. I need plane to set the friction between the balls and the surface. Perhaps there are other variants? Thank you for your response.
  3. All good day from the start I want to apologize for my English. I need to create a pool and now I'm focused on the problem of when to make the play area. How best to do this? What I found - a rectangular area. I also need to know where this should be done in pixi.js or physical framework (like p2.js or physics.js) Thank you for your reply;)
  4. Is there an option to set a pre collision hook? Thanks.
  5. Hi, I started developing a HTML5 game with Box2d (without using editors), after I have developed 16 levels of the game (from total of 40 levels), I found that the performance is slow on many mobile devices, I heard that Phaser physics engines are excellent on mobile, but I am a little confused, should I redo the whole game on phaser framework? or I can just use the P2.js physics engine from Phaser to take advantage of the code structure that I have built? or I can refine my box2d game performance without using any other framework, any advice? Thank You, Salah Jaber
  6. Hey there ! In the last week I tested the Phaser and it was a wonderful experience. The project I made was a volley game ! You can see what the output became : And this is the project on github :
  7. Descensus is a simple 2D physics game which I've described as somewhere between a marble roll, tennis, and Tetris. Teris in the sense that gravity increases over time and you have to guide your object as it falls. It's built with my P2Pixi JavaScript framework: which is itself built around the excellent libraries p2.js (for physics) and PIXI (for WebGL rendering). It's packaged for Android using CocoonJS, which I have found to be by far the best of its bunch. I hope to also release it for iOS. It also works perfectly as an online game (though using a mouse rather than touch isn't as fun), although I haven't made it available online yet and I'm undecided if I will. Enjoy!
  8. I'm a total newb to both p2.js and phaser, but I can't seem to find any tutorials whatsoever for using p2.js for physics and phaser for rendereing. All I've found are threads here where they bring it up, and then someone replies that Phaser will integrate it soon, and the first guy either figures it out or does something else. Could someone please give an example of using the two, or even better a tutorial? Thanks in advance!
  9. Hello, im trying to do something like this (link). So, I started just with the hook, but i can't get the distanceConstraint work when i clicked on the box. This is my code: game.module( 'game.main' ) .require( 'engine.core', 'plugins.p2' ) .body(function() { game.addAsset('media/box.png', 'box'); game.addAsset('media/panda.png', 'panda'); Box = game.Class.extend({ init: function(x, y,body) { var pbody = body; var joint = null; var cbody = null; // Add body and shape var shape = new game.Rectangle(1,.5); var cbody = new game.Body({ mass: 1, //Static. position: [ x /, y / ], angularVelocity: 1 }); this.body = cbody; this.body.addShape(shape); // Add sprite this.sprite = new game.Sprite('box'); this.sprite.anchor.set(0.5, 0.5); this.sprite.interactive=true; this.sprite.buttonMode=true; = function(){ joint = new game.DistanceConstraint( cbody, pbody, 5, 10 );; }; this.update();; game.scene.container.addChild(this.sprite); //game.scene.addTimer(5000, this.remove.bind(this)); }, update: function() { this.sprite.position.x = this.body.position[0] *; this.sprite.position.y = this.body.position[1] *; this.sprite.rotation = this.body.angle; } }); Panda = game.Class.extend({ init: function(x, y) { // Add body and shape var shape = new game.Circle(63 / 2 /; this.body = new game.Body({ mass: 1, position: [ x /, y / ], angularVelocity: 1 }); this.body.addShape(shape); // Add sprite this.sprite = new game.Sprite('panda'); this.sprite.anchor.set(0.5, 0.5); var force = 500; var angle = Math.random() * Math.PI * 2; this.body.applyForce([ Math.sin(angle) * force, Math.cos(angle) * force ], this.body.position); this.update();; game.scene.container.addChild(this.sprite); }, update: function() { this.sprite.position.x = this.body.position[0] *; this.sprite.position.y = this.body.position[1] *; this.sprite.rotation = this.body.angle; } }); SceneGame = game.Scene.extend({ backgroundColor: 0x808080, init: function() { // Init world = new game.World(); = 100; // Add container this.container = new game.Container(); this.container.position.x = 0; this.container.position.y = game.system.height; this.container.scale.y = -1; // Flip container. this.stage.addChild(this.container); // Add plane var planeShape = new game.Plane(); var planeBody = new game.Body({ position: [0, 0] }); planeBody.addShape(planeShape);; // Add walls var wallShape = new game.Rectangle(2, game.system.height * 2 /; var wallBody = new game.Body({ position: [-1, game.system.height / 2 /] }); wallBody.addShape(wallShape);; wallShape = new game.Rectangle(2, game.system.height * 2 /; wallBody = new game.Body({ position: [game.system.width / + 1, game.system.height / 2 /] }); wallBody.addShape(wallShape);; var panda = new Panda(game.system.width / 2, game.system.height / 2); this.addObject(panda); var box = new Box(game.system.width / 2, game.system.height / 2, panda.body); this.addObject(box); }, }); game.System.width = window.innerWidth * game.device.pixelRatio; game.System.height = window.innerHeight * game.device.pixelRatio; game.DebugDraw.enabled = true; game.start(); }); When i was clicking the box, (it appers) i get this: "Uncaught TypeError: undefined is not a function"... in 39 line where i'm creating the constraint: joint = new game.DistanceConstraint( cbody, pbody, 5, 10 ); how can i do created the constraint? Also, i have some questions: What means the ratio value in 99 line? where is it, in the p2.js plugin or in the engine itself? i can't find it in the source code. why the container is fliped? i can't figure out why i should fliped. How it works? I set debugDraw to true and it's show me this: Thank you. P.D: I love the engine
  10. I started this recently as an attempt to bring together two very cool libraries - p2 for 2D physics and Pixi for rendering - in a way where I (and hopefully others now) could quickly put something cool together. Here is my first live demo: The PixiAdapter class draws heavily on the rendering logic from the p2 demos, but those demos use randomized flat fill colours for the shapes. I've added a means of customizing the p2 bodies which make up each of my GameObjects with their own Pixi styles, including a simple implementation of bitmap-textured shapes, by way of the mask property on sprites. I'm hoping to build some simple PhoneGap games with this. Tom
  11. Please tell me, how I can use P2.js physics in phaser framework? Whether there is an example of this? I have seen what p2 files included in sources framework? but I don't know how to call P2 physics in phaser. I would be very grateful for the help)