Good morning everyone,
I've got a problem which won't let me go to sleep!
I create many Cubes and each has got 12 Edges, so I create 12 Edges for every Cube! The Cube has got three skills: rotating, scaling, moving. If a Cube changes its form the edges have to change its form, too. Therefore I've simply written an action which moves, scales and rotates each Edge of a cube.
The Problem: By increasing the number of Cubes (with 12 edges each) the game crashes. Why does this happen?
Thanks for ur help!
action Edge()
{
var rot[3];
//the relative vector pointing from the
// middle of the non-rotated Cube to the Edge
//First, the edge searches for its cube
//skill53 = number of the Cube
//skill54 = number of the edge (1..12)
//or zero for the Cube
you = ent_next(NULL);
while (!((you.skill53==my.skill53)&&(you.skill54==0)))
you = ent_next(you);
//Each frame the Edge calculates its position, rotation and scaling.
while(1)
{
switch (my.skill54)
{
case 1:
{
rot[0] = 0;
rot[1] = -you.scale_y/2;
rot[2] = you.scale_z/2;
my.scale_x = you.scale_x + 5;
my.scale_y = 5;
my.scale_z = 5;
}
[...]
case 12:
{
rot[0] = you.scale_x/2;
rot[1] = you.scale_y/2;
rot[2] = 0;
my.scale_x = 5;
my.scale_y = 5;
my.scale_z = you.scale_z-5;
}
}
vec_rotate (rot,vector(you.pan, you.tilt, you.roll));
my.x = you.x;
vec_add(my.x, rot);
my.roll = you.roll;
my.tilt = you.tilt;
my.pan = you.pan;
wait (1);
}
}
Good night!