How to Destroy bodies and change gravity of a world?

Discuss issues specific to the Flash/AS3 port of Box2D
MattBox
Posts: 21
Joined: Sun Nov 11, 2012 11:31 am

How to Destroy bodies and change gravity of a world?

Postby MattBox » Sun Nov 11, 2012 11:50 am

Hi,
i'm new to the forum and have been using Wck components in Flash for a while and I'm really enjoying it.

I'm no expert at AS3, and I'm not using an external class.

I create World MovieClips and drop my Bodies straight onto the stage and give them instance names. So far this is working great, and I can add functionality with code on my MCs. For instance, I can start with a static object, then:

Code: Select all

Block.type = 'Dynamic';
(To make it active)

So while I can effect objects like this, I have not found the right code to :

a) change the gravity of the World MC once it is set (e.g starting with GravityY=1 to GravityY=-1)

b) I cannot destroy objects at all! (I've tried: MC.Destroy(); and MC.destroyBody - neither work, as the function is not recognised)

I'm not using linkage instances, just on my MCs on the timeline. Hope this is possible! Please help, as these are very crucial problems!

Thanks,
Matt

MattBox
Posts: 21
Joined: Sun Nov 11, 2012 11:31 am

Re: How to Destroy bodies and change gravity of a world?

Postby MattBox » Sun Nov 11, 2012 11:58 am

Well, turned out part b was easier than I thought - can't believe I hadn't tried it..

Code: Select all

Blocker.remove();
(the body is now gone!)

So that just leaves the Gravity change question....anyone?? :shock:

jayther
Posts: 266
Joined: Sun Oct 25, 2009 3:28 am
Contact:

Re: How to Destroy bodies and change gravity of a world?

Postby jayther » Thu Nov 15, 2012 3:49 am

I believe that's a better question for the WCK forum (one of the sections here in Box2D forum).


Return to “Flash”



Who is online

Users browsing this forum: Bing [Bot] and 1 guest