So I’m working on a game with a pre-existing code base, so I don’t know my way fully around it. The character uses applyForce to move, however I want to put in an invisible wall so I would like to simply set the force to 0 however I am having trouble figuring out how to find the current force being applied to the character. [import]uid: 178013 topic_id: 35258 reply_id: 335258[/import]
You might take a look at:
http://docs.coronalabs.com/api/type/Body/getLinearVelocity.html
And to set it
http://docs.coronalabs.com/api/type/Body/applyForce.html
[lua]body:applyForce( 0, 0, body.x, body.y ) --untested[/lua] [import]uid: 202223 topic_id: 35258 reply_id: 140152[/import]
Very helpful thank you. Worked perfectly. [import]uid: 178013 topic_id: 35258 reply_id: 140156[/import]
You might take a look at:
http://docs.coronalabs.com/api/type/Body/getLinearVelocity.html
And to set it
http://docs.coronalabs.com/api/type/Body/applyForce.html
[lua]body:applyForce( 0, 0, body.x, body.y ) --untested[/lua] [import]uid: 202223 topic_id: 35258 reply_id: 140152[/import]
Very helpful thank you. Worked perfectly. [import]uid: 178013 topic_id: 35258 reply_id: 140156[/import]