There's something wrong with a task I made, and I know what it is, but I don't know how to solve it.
Here's a simplified version that emulates the problem:
task Boolat(xpos,ypos,speed,angle){
let frame=0;
let red=Obj_Create(OBJ_SHOT);
Obj_SetPosition(red,xpos,ypos);
Obj_SetAngle(red,angle);
Obj_SetSpeed(red,speed);
ObjShot_SetGraphic(red,RED02);
while(!Obj_BeDeleted(red)){
if(frame==60){
let blue=Obj_Create(OBJ_SHOT);
Obj_SetPosition(blue,Obj_GetX(red),Obj_GetY(red));
Obj_SetAngle(blue,angle+40);
Obj_SetSpeed(blue,1);
ObjShot_SetGraphic(blue,BLUE01);
while(!Obj_BeDeleted(blue)){
if(Obj_GetX(blue)<=minx){
Obj_SetAngle(blue,180-Obj_GetAngle(blue));
Obj_SetX(blue,minx);
}
if(Obj_GetX(blue)>=maxx){
Obj_SetAngle(blue,180-Obj_GetAngle(blue));
Obj_SetX(blue,maxx);
}
wait(1);
}
}
Obj_SetAngle(red,angle+(frame*3));
frame++;
wait(1);
}
}
The RED02 bullet has to spin around, and the BLUE01 bullet has to bounce off the screen.
60 frames after the RED02 bullet is made, a BLUE01 bullet is created on RED02's current location.
When that happens, I don't want it to, but RED02 stop spinning, and the script only pays attention to BLUE01, which will bounce off the edges of the screen.
I know that's because there are two "while" statements inside each other, but how do I make them independent from each other, so the RED02 bullet will keep on spinning, and the BLUE01 bullet appears on RED02's location and will still bounce?
This is just an example, in reality I want to make the player's familiars shoot bouncing bullets, but the same thing goes wrong (the familiars that shoot bouncing bullets get stuck in place until said bullets are deleted)
Also, Danmakufu crashes if you forget to write ObjShot_SetGraphic *near-ragequit*