lars Posted October 26, 2015 Share Posted October 26, 2015 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 Quote Link to comment Share on other sites More sharing options...
lars Posted October 26, 2015 Author Share Posted October 26, 2015 Ohhh. needed this: collide: function(opponent) {} Sorry :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.