GithubHelp home page GithubHelp logo

titanium_box2d's Introduction

Appcelerator Titanium Box2D Module for iOS

This is a Box2D module for iOS developed by Jeff Haynie.

Box2D is one of the most popular physics engines used for all sorts of cool things from popular games like Angry Birds to engineering simulations.

Basic usage:

var window = Ti.UI.createWindow();
var view = Ti.UI.createView();
window.add(view);
window.open();


// load the module
var box2d = require("ti.box2d");

// create the world, using view as the surface
var world = box2d.createWorld(view);

// create a block 
var redBlock = Ti.UI.createView({
	backgroundColor:"red",
	width:50,
	height:50,
	top:0
});

// add the block body to the world
var redBody = world.addBody(redBlock,{
	density:12.0,
	friction:0.3,
	restitution:0.4,
	type:"dynamic"
});

world.addEventListener("collision",function(e) {
	if ((e.a == redBody || e.b == redBody) && e.phase == "begin") {
		Ti.API.info("the redBody collided with something");
	}
});

// start the world
world.start();

TODO

There's a lot that's not currently supported and needs to be implemented. Right now, I basically only support adding either a rectangle or cirlce body to the world and the various body properties. No complex polygons.

HOW TO HELP

Here's how you can help me make this full featured.

  • Write lots of sample apps!
  • Write API documentation
  • Write better usage guides
  • Find and report bugs (for now, just use GitHub issues)
  • Fork it and add other missing APIs
  • Port to Android
  • Port to HTML5

LICENSE

Apache Public License version 2

COPYRIGHT

Copyright (c) 2011 by Jeff Haynie. All Rights Reserved.

titanium_box2d's People

Contributors

jhaynie avatar arnaudsj avatar

Stargazers

Sangcheol Park avatar

Watchers

Sangcheol Park avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.