Sign in to follow this  

P2.js + Camera in Panda Editor Debug mode

Recommended Posts


I using Panda2 + P2.js to develop my next project, When I add Camera function to Panda Editor Debug mode.

the sprite bound is not displaying correctly ??



My full code:

    backgroundColor: '#272727',
    init: function() { = new game.Physics();
       'beginContact', function(data) {
        });'impact', function(data) {
        });'postStep', function(data) {
        this.container = new game.Container();
        var ratio =;
        var wallShape, wallBody;
        // Left wall
        wallShape = new p2.Box({ width: 2, height: game.height / ratio });
        wallBody = new game.Body({
            position: [-1, game.height / 2 / ratio]
             .......... //same width Panda2 P2.js "Main" Example

        this.mouseBody = new game.Body();
        this.player2 = new game.Player(game.width / 2, game.height / 2);
         //Add Camera Function = new game.Camera(this.player2.sprite);;;
    addConstraint: function(x, y, player) {
        this.mousemove(x, y);
        .......... //same width Panda2 P2.js Player class Example
    mousemove: function(x, y) {
        this.mouseBody.position[0] = x /;
        this.mouseBody.position[1] = y /;
    mouseup: function() {
        .......... //same width Panda2 P2.js Player class Example

game.createClass('Player', {
    init: function(x, y) {
        .......... //same width Panda2 P2.js Player class Example


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.