I am attempting to create a stage (extra-style stage, at that). I have a major problem with enemies, however.
At random times, an enemy will not technically "spawn" (it appears that they do in essence, because whatever sound effect they normally make still occurs, and that loops infinitely due to modulus). The enemy does not appear physically or shoot bullets.
I have no idea why this is happening. This especially occurs after defeating some prior enemies (which I do not believe should share anything at all relating to appearance on the field in their scripts), in which defeating a certain number of enemies before the next wave decreases the number of enemies in the proceeding wave.
Can anybody tell me why this is?
In case the scripts are needed:
\\\\\ Floats to the right side of the screen, firing intervals of bullets vertically
script_enemy_main yellowfairy
{
let yf = GetCurrentScriptDirectory ~ "img\enemy.png";
let count = rand_int(0, 30);
#include_script "script\Frazer\Movement for yellow fairy.txt";
@Initialize
{
SetLife(150);
SetDamageRate(100, 100);
SetAngle(0);
SetSpeed(3);
LoadGraphic(yf);
SetTexture(yf);
SetGraphicRect(0,257,32,288);
LoadUserShotData("script\Frazer\Shot.txt");
}
@MainLoop
{
SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 8);
if(count%60 <= 30 && GetX < GetClipMaxX + 10){
PlaySE("script\Frazer\se\Shot7.wav");
CreateShot01(GetX, GetY, 3, 90, 30, 2);
CreateShot01(GetX, GetY, 3, 270, 30, 2);
}
if(GetX > GetClipMaxX + 100){ VanishEnemy; }
count++;
setgraphicmove;
}
@DrawLoop {
DrawGraphic(GetX, GetY);
}
@Finalize {
loop(5){
CreateItem(ITEM_SCORE, GetX + rand(-25, 25), GetY + rand(-25, 25));
}
}
}
\\\\\ Appears in an explosion of a perfect ring of bullets, then rises up
script_enemy_main redfairy
{
let rf = GetCurrentScriptDirectory ~ "img\enemy.png";
let count = 0;
let count2 = 0;
let a = rand(0, 360);
#include_script "script\Frazer\Movement for red fairy.txt";
@Initialize
{
SetLife(50);
SetDamageRate(100, 100);
LoadGraphic(rf);
SetTexture(rf);
SetGraphicRect(0,257,32,288);
LoadUserShotData("script\Frazer\Shot.txt");
}
@MainLoop
{
SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 8);
if(count == 1){
SetMovePosition02(GetX + 100, GetClipMinY + 50, 1);
}
if(count == 2){
loop(30){
CreateShot01(GetX, GetY, 3, a, 51, 5);
a += 12;
}
}
if(count == 60){
SetMovePosition01(GetX + 100, -500, 5);
}
if(GetY < GetClipMinY - 100){ VanishEnemy; }
count++;
count2++;
setgraphicmoverf;
}
@DrawLoop {
DrawGraphic(GetX, GetY);
}
@Finalize {
loop(5){
CreateItem(ITEM_SCORE, GetX + rand(-25, 25), GetY + rand(-25, 25));
}
}
}