I'm trying to make it so that a bullet will, when it hits the side of the screen, reflect off of it. This is the code I'm using:task fire01{
let dir = 0;
let i = 0;
loop{
bullet01(GetEnemyX,GetEnemyY,3,dir,PURPLE12,5);
if(dir>=0 && i==0 && dir!=45){
dir++;
}
if(dir==45 && i==0){
dir--;
i = 1;
}
if(dir<=45 && i==1 && dir!=0){
dir--;
}
if(dir==0 && i==1){
dir++;
i = 0;
}
wait(2.5);
}
}
function bullet01(x,y,s,dir,g,d){
let obj01 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj01,x,y);
Obj_SetSpeed(obj01,s);
Obj_SetAngle(obj01,dir);
ObjShot_SetGraphic(obj01,g);
ObjShot_SetDelay(obj01,d);
while(!Obj_BeDeleted(obj01)){
if(Obj_GetX(obj01)>GetClipMaxX){
Obj_SetAngle(obj01,rand(105,179));
}
yield;
}
}
However, the problem is that, once one bullet is fired, the next bullet won't be fired until the first bullet has been deleted. Is there a way to make it so that the next bullet will fire before first is deleted?