Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Collision detection in panda


lars
 Share

Recommended Posts

Hello

 

Im new to panda, so this is proberly a very basic q:

 

game.createClass('Alien', {        name: 'Hans',        health: 10,        init: function(myX, myY) {            Ninja = new game.Animation('media/ninja_1.png', 'media/ninja_2.png', 'media/ninja_3.png','media/ninja_4.png');            Ninja.animationSpeed = 0.1;            Ninja.position.set(game.system.width / 2 - Ninja.width / 2, game.system.height - Ninja.height);            //Ninja.anchor.set(0,1);            Ninja.addTo(game.scene.stage);              this.shape = new game.Rectangle(Ninja.width,Ninja.height);                        this.body = new game.Body({            position: {x: 100, y: 100},            collisionGroup: 1,            collideAgainst: 0          });                    this.body.addShape(this.shape);          //this.body.collide = this.collide.bind(this);                                 }, //init        mousedown: function() {            console.log("allo");            game.audio.playSound("swipe", false);        }    });

I keep getting a error when I add this:

this.body.collide = this.collide.bind(this); 

The error is:

Cannot read property 'bind' of undefined

 

 

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...