I have a problem in my game . is there a way to make a physics body make able to apply force and throw it in any direction?Please help me out ..
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
apply force to an object
Try this:
1 2 3 | vx, vy = item:getLinearVelocity() item:applyLinearImpulse(vx, vy) |
There is a helpful example of this already on your computer;
CoronaSDK > SampleCode > Physics > MultiPuck
Peach :)
thanks for the help..But I could not understand how to use as nthing is happening.. please help me..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | physics = require( "physics" ) physics.start() physics.setGravity( 0, 9.8 ) ball = display.newCircle(400,100,100,100) physics.addBody(ball) function ballf(event) if event.phase == "ended" then vx, vy = ball:getLinearVelocity() ball:applyLinearImpulse(vx, vy) end end ball:addEventListener("touch", ballf) |
Play with the multipuck code, read through it, bit by bit - your code is missing some important stuff multipuck is using.
views:1808 update:2011/12/29 9:44:01
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
Ball Frenzy - ready for sale
Director 1.3 Scene Reload
Swipe on ipad with Director
I iz in your corner, stealing your thread views!
Code Completion with the Built-In editor
Spritesheet scales, slivers of pixels
Please fix xScale and yScale with Box2D
Iterating through display group and rotating objects
is it possible to have portrait and landscape on the one app?
Infinity Airplane - New iPhone Game - Promo Code Inside
Director 1.3 Scene Reload
Swipe on ipad with Director
I iz in your corner, stealing your thread views!
Code Completion with the Built-In editor
Spritesheet scales, slivers of pixels
Please fix xScale and yScale with Box2D
Iterating through display group and rotating objects
is it possible to have portrait and landscape on the one app?
Infinity Airplane - New iPhone Game - Promo Code Inside
corona forums © 2003-2011