J
JeZxLee
Guest
Hi,
We are trying to get a some small colored balls to fall.
We are using physics "Fixtures" and "Objects" and trying to do physics in script code.
Here is our current code which runs and does not show any errors:
________________________________________________________________
// Initialize code:
global.NumberOfColoredBalls = 0;
for (var index = 0; index < 99; index+=1)
{
global.ColoredBallFixtureIndex[index] = physics_fixture_create();
global.ColoredBallMyFixtureIndex[index] = -1;
global.ColoredBallSpriteIndex[index] = 0;
global.ColoredBallScreenX[index] = 0;
global.ColoredBallScreenY[index] = 0;
global.ColoredBallDirectAngle[index] = 0;
global.ColoredBallSpeed[index] = 0;
}
________________________________________________________________
// Game logic code:
else if (global.PlayerStatus == End)
{
for (var indexY = 0; indexY < 3; indexY+=1)
{
for (var indexX = 0; indexX < 4; indexX+=1)
{
if (global.PlayfieldScale[indexX, indexY] > 0) global.PlayfieldScale[indexX, indexY]-=.1;
else global.PlayfieldScale[indexX, indexY] = 0;
}
}
global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] = global.ColorToChoose;
global.ColoredBallScreenX[global.NumberOfColoredBalls] = global.BigColorToChooseScreenX;
global.ColoredBallScreenY[global.NumberOfColoredBalls] = global.BigColorToChooseScreenY+100;
var inst;
physics_fixture_set_circle_shape(global.ColoredBallFixtureIndex[global.NumberOfColoredBalls], 16);
physics_fixture_set_density(global.ColoredBallFixtureIndex[global.NumberOfColoredBalls], 1.0);
if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 1) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectRedObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 2) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectOrangeObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 3) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectYellowObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 4) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectGreenObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 5) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectBlueObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 6) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectPurpleObject);
global.ColoredBallMyFixtureIndex[global.NumberOfColoredBalls] = physics_fixture_bind(global.ColoredBallFixtureIndex[global.NumberOfColoredBalls], inst);
global.PlayerStatus = Begin;
SetupColorToChooseAndPlayfield();
}
________________________________________________________________
Our problem now is the newly created Fixtures are not being drawn on the game screen?
How can we draw the Fixtures?
Thanks!
We are trying to get a some small colored balls to fall.
We are using physics "Fixtures" and "Objects" and trying to do physics in script code.
Here is our current code which runs and does not show any errors:
________________________________________________________________
// Initialize code:
global.NumberOfColoredBalls = 0;
for (var index = 0; index < 99; index+=1)
{
global.ColoredBallFixtureIndex[index] = physics_fixture_create();
global.ColoredBallMyFixtureIndex[index] = -1;
global.ColoredBallSpriteIndex[index] = 0;
global.ColoredBallScreenX[index] = 0;
global.ColoredBallScreenY[index] = 0;
global.ColoredBallDirectAngle[index] = 0;
global.ColoredBallSpeed[index] = 0;
}
________________________________________________________________
// Game logic code:
else if (global.PlayerStatus == End)
{
for (var indexY = 0; indexY < 3; indexY+=1)
{
for (var indexX = 0; indexX < 4; indexX+=1)
{
if (global.PlayfieldScale[indexX, indexY] > 0) global.PlayfieldScale[indexX, indexY]-=.1;
else global.PlayfieldScale[indexX, indexY] = 0;
}
}
global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] = global.ColorToChoose;
global.ColoredBallScreenX[global.NumberOfColoredBalls] = global.BigColorToChooseScreenX;
global.ColoredBallScreenY[global.NumberOfColoredBalls] = global.BigColorToChooseScreenY+100;
var inst;
physics_fixture_set_circle_shape(global.ColoredBallFixtureIndex[global.NumberOfColoredBalls], 16);
physics_fixture_set_density(global.ColoredBallFixtureIndex[global.NumberOfColoredBalls], 1.0);
if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 1) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectRedObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 2) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectOrangeObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 3) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectYellowObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 4) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectGreenObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 5) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectBlueObject);
else if (global.ColoredBallSpriteIndex[global.NumberOfColoredBalls] == 6) inst = instance_create(global.ColoredBallScreenX[global.NumberOfColoredBalls], global.ColoredBallScreenY[global.NumberOfColoredBalls], SelectPurpleObject);
global.ColoredBallMyFixtureIndex[global.NumberOfColoredBalls] = physics_fixture_bind(global.ColoredBallFixtureIndex[global.NumberOfColoredBalls], inst);
global.PlayerStatus = Begin;
SetupColorToChooseAndPlayfield();
}
________________________________________________________________
Our problem now is the newly created Fixtures are not being drawn on the game screen?
How can we draw the Fixtures?
Thanks!