1)get the game code-- put it nywer
2) make ur class as dynamic
3)upload game
4)go for leadership board and get the code for high score
Thursday, June 25, 2009
Wednesday, June 24, 2009
Tiled Layer
var maze:b2Body;
var mazeArr:Array = [[1,1,1,1,1,1,1,1,1],[1,0,0,0,0,0,0,0,1],[1,1,1,1,1,1,1,0,1],[1,0,0,0,1,0,0,0,1],[1,0,1,0,1,0,1,1,1],[1,0,1,0,1,0,0,0,1],[1,0,1,1,1,1,1,0,1],[1,0,0,0,0,0,0,0,1],[1,1,1,1,1,1,1,1,1]];
// Add the Maze
var bodyDefk = new b2BodyDef();
bodyDefk.position.Set(6.5, 3.5);
maze = m_world.CreateBody(bodyDefk);
for (var j:int = 0; j < 3; j++)
{
for (var k:int = 0; k < 3; k++)
{
if (mazeArr[j][k] == 1)
{
var boxDefk = new b2PolygonDef();
boxDefk.SetAsOrientedBox(0.5, 0.5, new b2Vec2(-4 + k, -4 + j), 0);
boxDefk.density = 4;
boxDefk.friction = 1;
boxDefk.restitution = 0.1;
maze.CreateShape(boxDefk);
bodies.push(maze);
}
}
}
maze.SetMassFromShapes();*/
var mazeArr:Array = [[1,1,1,1,1,1,1,1,1],[1,0,0,0,0,0,0,0,1],[1,1,1,1,1,1,1,0,1],[1,0,0,0,1,0,0,0,1],[1,0,1,0,1,0,1,1,1],[1,0,1,0,1,0,0,0,1],[1,0,1,1,1,1,1,0,1],[1,0,0,0,0,0,0,0,1],[1,1,1,1,1,1,1,1,1]];
// Add the Maze
var bodyDefk = new b2BodyDef();
bodyDefk.position.Set(6.5, 3.5);
maze = m_world.CreateBody(bodyDefk);
for (var j:int = 0; j < 3; j++)
{
for (var k:int = 0; k < 3; k++)
{
if (mazeArr[j][k] == 1)
{
var boxDefk = new b2PolygonDef();
boxDefk.SetAsOrientedBox(0.5, 0.5, new b2Vec2(-4 + k, -4 + j), 0);
boxDefk.density = 4;
boxDefk.friction = 1;
boxDefk.restitution = 0.1;
maze.CreateShape(boxDefk);
bodies.push(maze);
}
}
}
maze.SetMassFromShapes();*/
Tuesday, June 2, 2009
back to basics
body.ApplyForce(new b2Vec2(20,0), body.GetWorldCenter())
body ---->
var bodyDef:b2BodyDef = new b2BodyDef();
//bodyDef.isBullet = true;/// penetrate object
var boxDef:b2PolygonDef = new b2PolygonDef();
boxDef.density = 1.0;
// Override the default friction.
boxDef.friction = 0.1;
boxDef.restitution = .4;
boxDef.SetAsBox(.5,.8);
bodyDef.position.Set(10,1);
bodyDef.angle = 45//Math.random() * Math.PI;
body = m_world.CreateBody(bodyDef);
shape1=body.CreateShape(boxDef);//collsion wer shape1:*
body.SetMassFromShapes();
/////////////////////////////////////////////////////////////////
Skin------>
wheel.x=body.GetPosition().x* 30;
wheel.y=body.GetPosition().y* 30
;
wheel.rotation = body.GetAngle() * (180/Math.PI);
m_sprite.addChild(wheel);
///////////////////////////////////////////////////////////////////////
body ---->
var bodyDef:b2BodyDef = new b2BodyDef();
//bodyDef.isBullet = true;/// penetrate object
var boxDef:b2PolygonDef = new b2PolygonDef();
boxDef.density = 1.0;
// Override the default friction.
boxDef.friction = 0.1;
boxDef.restitution = .4;
boxDef.SetAsBox(.5,.8);
bodyDef.position.Set(10,1);
bodyDef.angle = 45//Math.random() * Math.PI;
body = m_world.CreateBody(bodyDef);
shape1=body.CreateShape(boxDef);//collsion wer shape1:*
body.SetMassFromShapes();
/////////////////////////////////////////////////////////////////
Skin------>
wheel.x=body.GetPosition().x* 30;
wheel.y=body.GetPosition().y* 30
;
wheel.rotation = body.GetAngle() * (180/Math.PI);
m_sprite.addChild(wheel);
///////////////////////////////////////////////////////////////////////
Subscribe to:
Posts (Atom)