@ Sami-Fire:
The wiggling doesn't happen because objcount doesn't bounce between 240 and 60.
I'll use & comment your code here for reference:
task LostWaves{
let angleT = rand(0, 360);
let objcount = 40; // objcount is initialized here
//let oscount = 0;
loop{
loop(5){
let obj = CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2, angleT, 796, 5);
angleT += 360/5;
wait(0.001); //???
}
//angleT += sin(objcount) * 8; //BOWAP- Sine makes the oscillation, * 6 ensures there are gaps.
// if-else block is here and down
if(objcount >= 240){ // A
angleT -= sin(objcount) * 8;
objcount -= 3;
}else if(objcount <= 60){ // B
angleT -= sin(objcount) * 8;
objcount += 3;
}else{ // C
angleT -= sin(objcount) * 8;
objcount += 3;
}
yield;
}
}
The main issue is that the if-else block is tested every frame (actually every sixth frame but I'll discuss that later).
When objcount is initialized, the part I marked C is selected until objcount gets past 60 (61 to be exact) where the part I marked B happens.
As an aside note, B and C look like they do the same thing. is there any reason they're both there?
when objcount reaches A, it has the value of 241. Since this test occurs every (sixth) frame, A is triggered, which reduces objcount by 3.
This means it goes down to 238, thus triggering B, and adding 3, triggering A and taking 3, etc.
The sequence of values looks roughly like:
220, 223, 226, 229, 232, 235, 238, 241, 238, 241, 238, 241, 238, etc.
This is where it seems to get stuck : /\
The stuck behaviour occurs beccause (the sin of) objcount controls the change in angle, rather than the plain angle.
If (the sin of) objcount controlled the actual angle what happened would look a lot more obvious, as the shots would just form straight lines.
On another note, I'll point out that the wait() function (assuming it's the one I'm thinking of) rounds to an integer (whole number), so 0.001 is turned into 1.
The wait function acts as a number of frames rather than a number of seconds, so replacing the current line with wait(1); or just a yield; would functionally change nothing.
The diagram is much clearer, I'll play around and see if I can come up with anything.