Thursday, April 22, 2010

In the MVC design pattern, the model layer consists of objects that represent the data your application manages. The objects in this layer should be organized in the way that makes the most sense for the data. External interactions with model objects occur through a well-defined set of interfaces, whose job is to ensure the integrity of the underlying data at all times.

The view layer defines the presentation format and appearance of the application. This layer consists of your application’s windows, views, and controls. The views can be standard system views or custom views you create. You configure these views to display the data from your model objects in an appropriate way. In addition, your view objects need to generate notifications in response to events and user interactions with that data.

The controller layer acts as the bridge between the model and view layers. It receives the notifications generated by the view layer and uses them to make the corresponding changes in the data model. Similarly, if the data in the data layer changes for other reasons (perhaps because of some internal computation loop), it notifies an appropriate controller object, which then updates the views.


EXP--

View is just a GUI so when user interact with GUI (controller) and modify data indirectly(which is a model)

MVC

In the MVC design pattern, the model layer consists of objects that represent the data your application manages. The objects in this layer should be organized in the way that makes the most sense for the data. External interactions with model objects occur through a well-defined set of interfaces, whose job is to ensure the integrity of the underlying data at all times.

The view layer defines the presentation format and appearance of the application. This layer consists of your application’s windows, views, and controls. The views can be standard system views or custom views you create. You configure these views to display the data from your model objects in an appropriate way. In addition, your view objects need to generate notifications in response to events and user interactions with that data.

The controller layer acts as the bridge between the model and view layers. It receives the notifications generated by the view layer and uses them to make the corresponding changes in the data model. Similarly, if the data in the data layer changes for other reasons (perhaps because of some internal computation loop), it notifies an appropriate controller object, which then updates the views.

Wednesday, April 21, 2010

Revolute joint

public var rev1:b2RevoluteJoint;
var bodyDef2:b2BodyDef;
var boxDef2:b2PolygonDef;

bodyDef2 = new b2BodyDef();
bodyDef2.position.Set(26, 12.5);
//bodyDef2.angle = -.5;


boxDef2 = new b2PolygonDef();
boxDef2.SetAsBox(3, .1);//7
boxDef2.friction = .1;
boxDef2.density = 12.1;
/*
*/
body2 = m_world.CreateBody(bodyDef2);
body2.CreateShape(boxDef2);
body2.SetMassFromShapes();


/////////////// body 20

var bodyDef20:b2BodyDef;
var boxDef20:b2PolygonDef;

bodyDef20 = new b2BodyDef();
bodyDef20.position.Set(23, 12.5);
//bodyDef2.angle = -.5;


boxDef20 = new b2PolygonDef();
boxDef20.SetAsBox(.5, .1);//7
boxDef20.friction = .1;
boxDef20.density = 0;
/*
*/
body20 = m_world.CreateBody(bodyDef20);
body20.CreateShape(boxDef20);
body20.SetMassFromShapes();

///////////////////


var rjdDef:b2RevoluteJointDef = new b2RevoluteJointDef();
rjdDef.Initialize(body2, body20, body20.GetWorldCenter() );

rjdDef.enableLimit=true;
// rjdDef.maxMotorTorque=16600.0;
//rjdDef.motorSpeed=500.0;

rjdDef.enableMotor=true;
rjdDef.lowerAngle=-0.18*3.14
rjdDef. upperAngle=0.25*3.14
rev1 = m_world.CreateJoint(rjdDef) as b2RevoluteJoint;

/////// center is static and other is dynamic .. and you can play with dynamic///
somthing like this


body2.SetAngularVelocity(ang);

Wednesday, April 14, 2010

cocos2d updates implementation

http://code.google.com/p/cocos2d-iphone/source/browse/tags/release-0.99.0/README#87

Thursday, April 8, 2010

Particle effect Implementation

CCParticleSystem *emitter = [CCParticleExplosion node];

emitter = [[CCParticleMeteor alloc] init];
emitter = [[CCParticleFire alloc] init];
emitter.texture = [[CCTextureCache sharedTextureCache] addImage:@"fire.png"];
emitter.position = ccp(location.x,location.y);
emitter.life = 0.2f;
emitter.duration = 0.3f;
emitter.lifeVar = 0.3f;


[self addChild:emitter];

FEEDJIT Live