Sign in to follow this  

Removing a body

Recommended Posts



Having trouble removing my body from an event

game.createClass('ChristmasPackage', {            init: function(myimg,myscale) {                var myPumkingsVelocityArray = [100, 80, 60, 50, 40, 32, 45, 67, 78, 98, 90];                var pumkingVInterval = myPumkingsVelocityArray[Math.floor(Math.random() * myPumkingsVelocityArray.length)];                var x = Math.random(16, game.system.width);                this.pumkins = new game.Sprite(myimg);             this.pumkins.interactive=true;                this.pumkins.anchor.set(0.5, 0.5);                 this.pumkins.scale.set(myscale, myscale);                this.body = new game.Body({                    position: {                        x: x,                        y: -this.pumkins.height                    },                    velocity: {                        x: 0,                        y: pumkingVInterval                    },                    collisionGroup: 1,                    collideAgainst: [0],                    mass: 0,                });                this.body.collide = this.collide.bind(this, myimg);                var shape = new game.Rectangle(90, 90);                this.body.addShape(shape);                game.scene.stage.addChild(this.pumkins);      ;                game.scene.addObject(this);                               

 This is the function where i try to remove the body

                       = this.pumkins.tap = function(e) {             ;       //this.body.remove();             };//function end               }

Can anyone help me here ... :-)

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.