Jump to content

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

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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