| 1 - | Step 1: The Walls |
| 2 - | Step 2: The Bouncy Block |
| 3 - | Step 3: Creating the first GUI Controls |
| 4 - | Step 4: Creating all of the GUI Controls |
| 5 - | Step 5: Creating the Script for the GUI |
function pongBounce()
{
// Setup some immovable walls and allow them to receive collisions only...
|
// Left.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
|
%sprite.setPosition( "-40 0" ); %sprite.setSize( "2 75" ); %sprite.setImageMap( tileMapImageMap ); %sprite.setCollisionActive( false, true ); %sprite.setImmovable(); |
sceneWindow2D.setCurrentCameraPosition( "0 0 100 75" ); |
// Setup some immovable walls and allow them to receive collisions only...
// Left.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "-40 0" );
%sprite.setSize( "2 75" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Right.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "40 0" );
%sprite.setSize( "2 75" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Top.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "0 -33" );
%sprite.setSize( "80 2" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Bottom.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "0 33" );
%sprite.setSize( "80 2" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
|
// Bouncy Material.
datablock fxCollisionMaterialDatablock2D(bouncyMaterial)
{
friction = 0;
restitution = 1.0;
relaxation = 0.5;
density = 0.01;
forceScale = 1;
damping = 0;
};
|
$blocks::ammount = 0; |
} |
function pongBounce()
{
// Setup some immovable walls and allow them to receive collisions only...
// Left.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "-40 0" );
%sprite.setSize( "2 75" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Right.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "40 0" );
%sprite.setSize( "2 75" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Top.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "0 -33" );
%sprite.setSize( "80 2" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Bottom.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "0 33" );
%sprite.setSize( "80 2" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Bouncy Material.
datablock fxCollisionMaterialDatablock2D(bouncyMaterial)
{
friction = 0;
restitution = 1.0;
relaxation = 0.5;
density = 0.01;
forceScale = 1;
damping = 0;
};
$blocks::ammount = 0;
}
|
function createBlock()
{
|
$blocks::names[$blocks::ammount] = "block" @ $blocks::ammount; |
%ball.setSize( 4 ); %ball.setImageMap( tileMapImageMap ); %ball.setCollisionActive( true, true ); %ball.setCollisionPhysics( true, true ); %ball.setCollisionMasks( BIT(0), BIT(0) ); %ball.setCollisionMaterial( bouncyMaterial ); %ball.setMaxAngularVelocity( 0 ); // Give it a random direction. %ball.setImpulseForcePolar( getRandom()*360, 700 ); $blocks::ammount++; |
} |
function createBlock()
{
$blocks::names[$blocks::ammount] = "block" @ $blocks::ammount;
// Create Bouncy Ball.
%ball = new fxStaticSprite2D($blocks::names[$blocks::ammount]) { scenegraph = t2dSceneGraph; };
%ball.setSize( 4 );
%ball.setImageMap( tileMapImageMap );
%ball.setCollisionActive( true, true );
%ball.setCollisionPhysics( true, true );
//%ball.setLayer( 0 );
//%ball.setGroup( 0 );
%ball.setCollisionMasks( BIT(0), BIT(0) );
%ball.setCollisionMaterial( bouncyMaterial );
%ball.setMaxAngularVelocity( 0 );
// Give it a random direction.
%ball.setImpulseForcePolar( getRandom()*360, 700 );
$blocks::ammount++;
}
|
exec("./mainScreenGui.gui");
|
exec("./bounce.cs");
|
// ************************************************************************
//
// Add your custom code here...
// ************************************************************************
|
pongBounce(); |
createBlock(); |
function pongBounce()
{
// Setup some immovable walls and allow them to receive collisions only...
// Left.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "-40 0" );
%sprite.setSize( "2 75" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Right.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "40 0" );
%sprite.setSize( "2 75" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Top.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "0 -33" );
%sprite.setSize( "80 2" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Bottom.
%sprite = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
%sprite.setPosition( "0 33" );
%sprite.setSize( "80 2" );
%sprite.setImageMap( tileMapImageMap );
%sprite.setCollisionActive( false, true );
%sprite.setImmovable();
// Bouncy Material.
datablock fxCollisionMaterialDatablock2D(bouncyMaterial)
{
friction = 0;
restitution = 1.0;
relaxation = 0.5;
density = 0.01;
forceScale = 1;
damping = 0;
};
$blocks::ammount = 0;
}
function createBlock()
{
$blocks::names[$blocks::ammount] = "block" @ $blocks::ammount;
// Create Bouncy Ball.
%ball = new fxStaticSprite2D($blocks::names[$blocks::ammount]) { scenegraph = t2dSceneGraph; };
%ball.setSize( 4 );
%ball.setImageMap( tileMapImageMap );
%ball.setCollisionActive( true, true );
%ball.setCollisionPhysics( true, true );
//%ball.setLayer( 0 );
//%ball.setGroup( 0 );
%ball.setCollisionMasks( BIT(0), BIT(0) );
%ball.setCollisionMaterial( bouncyMaterial );
%ball.setMaxAngularVelocity( 0 );
// Give it a random direction.
%ball.setImpulseForcePolar( getRandom()*360, 700 );
$blocks::ammount++;
}
|
// ************************************************************************ // // Add your custom code here... // // ************************************************************************ |
//--- OBJECT WRITE BEGIN ---
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiSliderCtrl() {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "2 19";
extent = "174 45";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "57 5";
extent = "26 18";
minExtent = "8 2";
visible = "1";
text = "Label";
maxLength = "255";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "25 59";
extent = "140 30";
minExtent = "8 2";
visible = "1";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
};
};
//--- OBJECT WRITE END ---
|
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 2";
visible = "1";
|
this is straight from the source code
enum horizSizingOptions
{
horizResizeRight = 0, ///< fixed on the left and width
horizResizeWidth, ///< fixed on the left and right
horizResizeLeft, ///< fixed on the right and width
horizResizeCenter,
horizResizeRelative ///< resize relative
};
enum vertSizingOptions
{
vertResizeBottom = 0, ///< fixed on the top and in height
vertResizeHeight, ///< fixed on the top and bottom
vertResizeTop, ///< fixed in height and on the bottom
vertResizeCenter,
vertResizeRelative ///< resize relative
|
if(!isObject(GuiPhysicsTextProfile)) new GuiControlProfile (GuiPhysicsTextProfile)
{
fontColor = "255 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
|
if(!isObject( |
if(!isObject(GuiPhysicsTextProfile)) new GuiControlProfile (GuiPhysicsTextProfile)
{
fontColor = "255 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
//--- OBJECT WRITE BEGIN ---
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiSliderCtrl() {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "2 19";
extent = "174 45";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "57 5";
extent = "26 18";
minExtent = "8 2";
visible = "1";
text = "Label";
maxLength = "255";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "25 59";
extent = "140 30";
minExtent = "8 2";
visible = "1";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
};
};
//--- OBJECT WRITE END ---
|
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 2";
visible = "1";
|
new GuiSliderCtrl() {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "2 19";
extent = "174 45";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "57 5";
extent = "26 18";
minExtent = "8 2";
visible = "1";
text = "Label";
maxLength = "255";
}
|
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "57 5";
extent = "26 18";
minExtent = "8 2";
visible = "1";
text = "Label";
maxLength = "255";
};
new GuiSliderCtrl() {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "2 19";
extent = "174 45";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
|
if(!isObject(GuiPhysicsTextProfile)) new GuiControlProfile (GuiPhysicsTextProfile)
{
fontColor = "255 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
//--- OBJECT WRITE BEGIN ---
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 20";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 0";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Label";
maxLength = "255";
};
new GuiSliderCtrl() {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 10";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "25 59";
extent = "140 30";
minExtent = "8 2";
visible = "1";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
};
};
//--- OBJECT WRITE END ---
|
exec("./mainScreenGui.gui");
|
exec("./slidersGUI.gui");
|
mainScreenGui.add(slidersGUI); |
if(!isObject(GuiPhysicsTextProfile)) new GuiControlProfile (GuiPhysicsTextProfile)
{
fontColor = "255 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
//--- OBJECT WRITE BEGIN ---
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 20";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 0";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Friction";
maxLength = "255";
};
new GuiSliderCtrl(guiFrictionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 10";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 40";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Restitution";
maxLength = "255";
};
new GuiSliderCtrl(guiRestSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 50";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 80";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Relaxation";
maxLength = "255";
};
new GuiSliderCtrl(guiRelaxSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 90";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 120";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Density";
maxLength = "255";
};
new GuiSliderCtrl(guiDensSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 130";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 160";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Damping";
maxLength = "255";
};
new GuiSliderCtrl(guiDampSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 170";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 200";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Angular Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxAngularSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 210";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 240";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Linear Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxLinearSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 250";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 280";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiForceDirecSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 290";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 320";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiForceSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 330";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 360";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseDirectionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 370";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 400";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 410";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "25 59";
extent = "140 30";
minExtent = "8 2";
visible = "0";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
};
};
//--- OBJECT WRITE END ---
|
if(!isObject(GuiPhysicsTextProfile)) new GuiControlProfile (GuiPhysicsTextProfile)
{
fontColor = "255 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
//--- OBJECT WRITE BEGIN ---
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 20";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 0";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Friction";
maxLength = "255";
};
new GuiSliderCtrl(guiFrictionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 10";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 0.500000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 40";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Restitution";
maxLength = "255";
};
new GuiSliderCtrl(guiRestSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 50";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 80";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Relaxation";
maxLength = "255";
};
new GuiSliderCtrl(guiRelaxSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 90";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 120";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Density";
maxLength = "255";
};
new GuiSliderCtrl(guiDensSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 130";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 160";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Damping";
maxLength = "255";
};
new GuiSliderCtrl(guiDampSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 170";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 200";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Angular Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxAngularSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 210";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 240";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Linear Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxLinearSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 250";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 2000.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 280";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiForceDirecSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 290";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 360.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 320";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiForceSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 330";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 360";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseDirectionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 370";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 360.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 400";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 410";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0.5";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "25 59";
extent = "140 30";
minExtent = "8 2";
visible = "0";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
};
};
//--- OBJECT WRITE END ---
|
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 440";
extent = "80 15";
minExtent = "8 2";
visible = "1";
text = "Impulse Force!";
groupNum = "-1";
buttonType = "PushButton";
};
|
if(!isObject(GuiPhysicsTextProfile)) new GuiControlProfile (GuiPhysicsTextProfile)
{
fontColor = "255 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
//--- OBJECT WRITE BEGIN ---
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 20";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 0";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Friction";
maxLength = "255";
};
new GuiSliderCtrl(guiFrictionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 10";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 0.500000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 40";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Restitution";
maxLength = "255";
};
new GuiSliderCtrl(guiRestSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 50";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "1";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 80";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Relaxation";
maxLength = "255";
};
new GuiSliderCtrl(guiRelaxSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 90";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 120";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Density";
maxLength = "255";
};
new GuiSliderCtrl(guiDensSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 130";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.1";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 160";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Damping";
maxLength = "255";
};
new GuiSliderCtrl(guiDampSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 170";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 200";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Angular Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxAngularSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 210";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 240";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Linear Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxLinearSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 250";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 2000.000000";
ticks = "10";
value = "400";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 280";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiForceDirecSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 290";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 360.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 320";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiForceSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 330";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 360";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseDirectionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 370";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 360.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 400";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 410";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 440";
extent = "80 15";
minExtent = "8 2";
visible = "1";
text = "Impulse Force!";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "85 440";
extent = "105 15";
minExtent = "8 2";
visible = "1";
text = "Add a Bouncy Block";
groupNum = "-1";
buttonType = "PushButton";
};
};
//--- OBJECT WRITE END ---
|
function setDensity(%val)
{
object.setDensity(%val);
}
function setFriction(%val)
{
object.setFriction(%val);
}
function setDamping(%val)
{
object.setDamping(%val);
}
|
function set(%type, %val)
{
object.set(%type)(%val);
}
|
function set(%type, %val)
{
eval("object.set" @ %type @ "(%val);");
}
|
eval("echo(test)");
|
set(Friciton, 0.5); |
eval("object.set" @ %type @ "(%val);");
|
eval("object.setFriction(0.5);");
|
function set(%type, %val)
{
eval("object.set" @ %type @ "(%val);");
}
|
for(%i=0 |
for(%i=0;%i<$blocks::ammount |
for(%i=0;%i<$blocks::ammount;%i++) |
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".set" @ %type @ "(%val);");
}
|
eval($blocks::names[0] @ ".set" @ Friction @ "(0.5);"); |
eval(Block0 @ ".setFriction(0.5);"); |
Block0.setFriction(0.5); |
Block1.setFriction(0.5); |
function set(%type, %val)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".set" @ %type @ "(%val);");
}
}
|
function slidersGUI::set(%this, %type, %val)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".set" @ %type @ "(%val);");
}
}
|
slidersGUI.set(Friction, 0.5); |
function slidersGUI::test(%this)
{
echo("test");
}
|
function slidersGUI::set(%this, %type, %val)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".set" @ %type @ "(%val);");
echo("Setting the" SPC %type SPC "to" SPC %val);
}
}
|
eval("bouncyMaterial." @ %type @ "=" @ %val @ ";");
|
createBlock(); |
slidersGUI.set(Friction, 0.5); |
if(!isObject(GuiPhysicsTextProfile)) new GuiControlProfile (GuiPhysicsTextProfile)
{
fontColor = "255 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
//--- OBJECT WRITE BEGIN ---
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 20";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 0";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Friction";
maxLength = "255";
};
new GuiSliderCtrl(guiFrictionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 10";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 0.500000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 40";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Restitution";
maxLength = "255";
};
new GuiSliderCtrl(guiRestSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 50";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "1";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 80";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Relaxation";
maxLength = "255";
};
new GuiSliderCtrl(guiRelaxSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 90";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 120";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Density";
maxLength = "255";
};
new GuiSliderCtrl(guiDensSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 130";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.1";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 160";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Damping";
maxLength = "255";
};
new GuiSliderCtrl(guiDampSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 170";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 200";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Angular Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxAngularSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 210";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 240";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Linear Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxLinearSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 250";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 2000.000000";
ticks = "10";
value = "400";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 280";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiForceDirecSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 290";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 360.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 320";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiForceSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 330";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 360";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseDirectionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 370";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 360.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 400";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 410";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 440";
extent = "80 15";
minExtent = "8 2";
visible = "1";
text = "Impulse Force!";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "85 440";
extent = "105 15";
minExtent = "8 2";
visible = "1";
text = "Add a Bouncy Block";
groupNum = "-1";
buttonType = "PushButton";
};
};
//--- OBJECT WRITE END ---
function slidersGUI::set(%this, %type, %val)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".set" @ %type @ "(%val);");
echo("Setting the" SPC %type SPC "to" SPC %val);
}
eval("bouncyMaterial." @ %type @ "=" @ %val @ ";");
}
|
function slidersGUI::setForce(%this, %direc, %speed)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".setConstantForcePolar(%direc, %speed);");
echo("setting force direc:" SPC %direc SPC "and speed:" SPC %speed);
}
}
|
createBlock(); |
slidersGUI.setForce(180, 400); |
function slidersGUI::setImpulse(%this, %direc, %force)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".setImpulseForcePolar(%direc, %force);");
echo ("setting impulse force for num:" SPC %i SPC "direc = " @ %direc SPC "force = " @ %force);
}
}
|
createBlock(); |
slidersGUI.setImpulse(180, 400); |
new GuiSliderCtrl(guiFrictionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 10";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 0.500000";
ticks = "10";
value = "0";
};
|
new GuiSliderCtrl(guiFrictionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 10";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 0.500000";
ticks = "10";
value = "0";
command = "slidersGUI.set(Friction, guiFrictionSlider.value);";
};
|
createBlock(); |
if(!isObject(GuiPhysicsTextProfile)) new GuiControlProfile (GuiPhysicsTextProfile)
{
fontColor = "255 0 0";
fontColorLink = "255 96 96";
fontColorLinkHL = "0 0 255";
autoSizeWidth = true;
autoSizeHeight = true;
};
//--- OBJECT WRITE BEGIN ---
new GuiControl(slidersGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 20";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 0";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Friction";
maxLength = "255";
};
new GuiSliderCtrl(guiFrictionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 10";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 0.500000";
ticks = "10";
value = "0";
command = "slidersGUI.set(Friction, guiFrictionSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 40";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Restitution";
maxLength = "255";
};
new GuiSliderCtrl(guiRestSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 50";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "1";
command = "slidersGUI.set(Restitution, guiRestSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 80";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Relaxation";
maxLength = "255";
};
new GuiSliderCtrl(guiRelaxSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 90";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.5";
command = "slidersGUI.set(Relaxation, guiRelaxSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 120";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Density";
maxLength = "255";
};
new GuiSliderCtrl(guiDensSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 130";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 1.000000";
ticks = "10";
value = "0.1";
command = "slidersGUI.set(Density, guiDensSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 160";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Damping";
maxLength = "255";
};
new GuiSliderCtrl(guiDampSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 170";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5.000000";
ticks = "10";
value = "0";
command = "slidersGUI.set(Damping, guiDampSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 200";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Angular Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxAngularSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 210";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
command = "slidersGUI.set(MaxAngularVelocity, guiMaxAngularSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 240";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Max Linear Velocity";
maxLength = "255";
};
new GuiSliderCtrl(guiMaxLinearSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 250";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 2000.000000";
ticks = "10";
value = "400";
command = "slidersGUI.set(MaxLinearVelocity, guiMaxLinearSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 280";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiForceDirecSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 290";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 360.000000";
ticks = "10";
value = "0";
command = "slidersGUI.setForce(guiForceDirecSlider.value, guiForceSpeedSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 320";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Constant Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiForceSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 330";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
command = "slidersGUI.setForce(guiForceDirecSlider.value, guiForceSpeedSlider.value);";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 360";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Direction";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseDirectionSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 370";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 360.000000";
ticks = "10";
value = "0";
};
new GuiTextCtrl() {
profile = "GuiPhysicsTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "75 400";
extent = "35 18";
minExtent = "8 2";
visible = "1";
text = "Impulse Force Speed";
maxLength = "255";
};
new GuiSliderCtrl(guiImpulseSpeedSlider) {
profile = "GuiSliderProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 410";
extent = "205 40";
minExtent = "8 2";
visible = "1";
range = "0.000000 5000.000000";
ticks = "10";
value = "0";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 440";
extent = "80 15";
minExtent = "8 2";
visible = "1";
text = "Impulse Force!";
groupNum = "-1";
buttonType = "PushButton";
command = "slidersGUI.setImpulse( guiImpulseDirectionSlider.value, guiImpulseSpeedSlider.value );";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "85 440";
extent = "105 15";
minExtent = "8 2";
visible = "1";
text = "Add a Bouncy Block";
groupNum = "-1";
buttonType = "PushButton";
command = "createBlock();";
};
};
//--- OBJECT WRITE END ---
function slidersGUI::set(%this, %type, %val)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".set" @ %type @ "(%val);");
echo("Setting the" SPC %type SPC "to" SPC %val);
}
eval("bouncyMaterial." @ %type @ "=" @ %val @ ";");
}
function slidersGUI::setForce(%this, %direc, %speed)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".setConstantForcePolar(%direc, %speed);");
echo("setting force direc:" SPC %direc SPC "and speed:" SPC %speed);
}
}
function slidersGUI::setImpulse(%this, %direc, %force)
{
for(%i=0;%i<$blocks::ammount;%i++)
{
eval($blocks::names[%i] @ ".setImpulseForcePolar(%direc, %force);");
echo ("setting impulse force for num:" SPC %i SPC "direc = " @ %direc SPC "force = " @ %force);
}
}
|