Titanium Appcelerator Box2d simple example part 4


/ Published in: JavaScript
Save to your folder(s)

This example adds a wall to keep the ball from rolling into space


Copy this code and paste it in your HTML
  1. // create a wall
  2. var leftWall = Ti.UI.createView({
  3. backgroundColor:'#fff',
  4. width:2,
  5. height:200,
  6. bottom:0,
  7. left:0
  8. });
  9.  
  10. world.addBody(leftWall, {
  11. density:12.0,
  12. friction:0.3,
  13. restitution:0.4,
  14. type:'static'
  15. });

URL: http://lancespellman.com/2011/12/20/cool-box2d-stuff-with-appcelerator-titanium/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.