#4392 - Daikath - Sat Mar 29, 2003 6:16 pm
Hi, I am reasonable new to programming, I am making a small demo wherein a couple of balls are on screen and you get to control one ball and the rest move along as though they are connected with a rubberband, this is just practice code to get the hang of it but when I move one ball around on screen the second just stays put. This is the function I use for the second ball to move.
I'd be very greatful if someone were to help me :).
_________________
?There are no stupid questions but there are a LOT of inquisitive idiots.?
Code: |
void Elastiek()
{ s16 var1; var1 = 0; var1 = x - x2; /*s16 acceleration; s16 speed;*/ s8 xleft; s8 xright; s8 possibility; u8 trigger; /*acceleration = 0; speed = 0;*/ xleft = 0; xright = 0; possibility = 0; trigger = 0; if ((var1 < 0) & (trigger == 0)) { possibility = 1; } if ((var1 > 0) & (trigger == 0)) { possibility = 2; } switch (possibility) { case '1': { trigger = 1; xleft = 0 - var1; xright = var1 - var1 - var1 - 3; while (trigger == 1) { if (x2 > xleft) { x2--; } trigger = 2; } while (trigger == 2) { if (x2 < xright) { x2++; } trigger = 0; } break; } case '2': { trigger = 3; xright = 0 + var1; xleft = var1 - var1 - var1 + 3; while (trigger == 3) { if (x2 < xright) { x2++; } trigger = 4; } while (trigger == 4) { if (x2 > xleft) { x2--; } } } break; } } |
I'd be very greatful if someone were to help me :).
_________________
?There are no stupid questions but there are a LOT of inquisitive idiots.?