Hello!
My first post!
Firs, I just want to say a big thankyou to Erin and ofcourse to Boris for their great amount of time put in developing and porting this great library.
So.. 🙂 THANKYOU guys, awesome work!
Now the question:
In my TestCompund.as file I read this in the constructor function:
Here is my newbie questions:
1. whats up with the braket just before
There seems not to be a function definition, or anything known to my eye... 🙂
2. This type of notation can be made only in the constructor or anywhere in the class?
3. Is there a functional scope or just to group some code chunks?
Again thankyou for your great work and hope to get the depths of this great library 🙂
GF.
My first post!
Firs, I just want to say a big thankyou to Erin and ofcourse to Boris for their great amount of time put in developing and porting this great library.
So.. 🙂 THANKYOU guys, awesome work!
Now the question:
In my TestCompund.as file I read this in the constructor function:
Code:
public function TestCompound(){
// Set Text field
Main.m_aboutText.text = "Compound Shapes";
var bd:b2BodyDef;
var body:b2Body;
var i:int;
var x:Number;
{
var cd1:b2CircleShape = new b2CircleShape();
cd1.SetRadius(15.0/m_physScale);
cd1.SetLocalPosition(new b2Vec2( -15.0 / m_physScale, 15.0 / m_physScale));
var cd2:b2CircleShape = new b2CircleShape();
cd2.SetRadius(15.0/m_physScale);
cd2.SetLocalPosition(new b2Vec2(15.0 / m_physScale, 15.0 / m_physScale));
bd = new b2BodyDef();
bd.type = b2Body.b2_dynamicBody;
for (i = 0; i < 5; ++i)
{
x = 320.0 + b2Math.RandomRange(-3.0, 3.0);
bd.position.Set((x + 150.0)/m_physScale, (31.5 + 75.0 * -i + 300.0)/m_physScale);
bd.angle = b2Math.RandomRange(-Math.PI, Math.PI);
body = m_world.CreateBody(bd);
body.CreateFixture2(cd1, 2.0);
body.CreateFixture2(cd2, 0.0);
}
}
// some other code here...
}
// Set Text field
Main.m_aboutText.text = "Compound Shapes";
var bd:b2BodyDef;
var body:b2Body;
var i:int;
var x:Number;
{
var cd1:b2CircleShape = new b2CircleShape();
cd1.SetRadius(15.0/m_physScale);
cd1.SetLocalPosition(new b2Vec2( -15.0 / m_physScale, 15.0 / m_physScale));
var cd2:b2CircleShape = new b2CircleShape();
cd2.SetRadius(15.0/m_physScale);
cd2.SetLocalPosition(new b2Vec2(15.0 / m_physScale, 15.0 / m_physScale));
bd = new b2BodyDef();
bd.type = b2Body.b2_dynamicBody;
for (i = 0; i < 5; ++i)
{
x = 320.0 + b2Math.RandomRange(-3.0, 3.0);
bd.position.Set((x + 150.0)/m_physScale, (31.5 + 75.0 * -i + 300.0)/m_physScale);
bd.angle = b2Math.RandomRange(-Math.PI, Math.PI);
body = m_world.CreateBody(bd);
body.CreateFixture2(cd1, 2.0);
body.CreateFixture2(cd2, 0.0);
}
}
// some other code here...
}
Here is my newbie questions:
1. whats up with the braket just before
Code:
var cd1:b2CircleShape = new b2CircleShape();
?There seems not to be a function definition, or anything known to my eye... 🙂
2. This type of notation can be made only in the constructor or anywhere in the class?
3. Is there a functional scope or just to group some code chunks?
Again thankyou for your great work and hope to get the depths of this great library 🙂
GF.