The below code is for FlashBuilder 4, If you are using FlexBuilder3 use addChild() instead of the commented block in the following code.
Adobe AIR, Alert, b2CircleShape, Box2D, contentLoaderInfo, CreateBody, CreateFixture, density, FLASH, FlashBuilder, FLEX, function, Loader, new, restitution, ui:UIComponent, UIComponent, URLRequest
write the below code in “ccTouchesBegan” function and you are done. Here the ballBody represents the bullet body. You can increase the power variable to increase bullet speed.
Amp, ApplyLinearImpulse, b2_dynamicBody, b2FixtureDef, Ball Position, ballBodyDef, Box2D, Bullet Speed, ccpMult, ccpNormalize, CGPoint, density, Direction, Friction, How to shoot a bullet in the direction of touch in Box2D iphone?, iphone, Position X, Ptm, PTM_RATIO, Radius, restitution, shape, Speed Java, Speed Touch, touches, Type B2, variable
The below code helps you to rotate a body in Box2D manually. Here the body is named “rotating_body” which is going to rotate and a sprite named “rot_sprite” is it’s userData, please give your own image for it. Make sure that you have it in your resources otherwise your program will crash. Note: call this…
Read More »
Amp, Body World, Box2D, categoryBits, Crash, density, Friction, function, groupIndex, Interval, Intervals, java, maskBits, Png, Pos, Quot, restitution, Schedular, selector, SetTransform, shape, Sprite