#TouhouDanmakufu #Title[Light Sign uReflection/Refractionv] #Text[Random Card by Nuclear Cheese ... lasers and bullets abound; watch from all angles.] #Player[FREE] #ScriptVersion[2] script_enemy_main { let count; let count2; let lasers; let lasers2; let bullets; let bulletdelay; let spread; let hardercounter; let timer; @Initialize { count = 80; count2 = 120; hardercounter = 18; spread = 15; timer = 60; lasers = []; lasers2 = []; bullets = []; bulletdelay = []; SetLife(700); LoadGraphic("script\img\ExRumia.png"); SetGraphicRect(64, 1, 127, 64); SetMovePosition02(GetCenterX(), 120, 60); SetScore(150000); SetTimer(60); SetDamageRate(15, 8); SetInvincibility(150); CutIn(YOUMU, "Light Sign uReflection/Refractionv", 0, 0, 0, 0, 0); SetShotDirectionType(ABSOLUTE); MagicCircle(false); // the 'magic circle' makes it hard to see the lasers v_v } @MainLoop { count--; if (count <= 0) { let obj = Obj_Create(OBJ_LASER); Obj_SetPosition(obj, GetX(), GetY()); Obj_SetSpeed(obj, 0); ObjLaser_SetLength(obj, 0); ObjShot_SetGraphic(obj, PURPLE11); Obj_SetAngle(obj, GetAngleToPlayer()); ObjLaser_SetWidth(obj, 12); ObjLaser_SetSource(obj, false); Obj_SetAutoDelete(obj, false); lasers = lasers ~ [obj]; count = 292; } count2--; if (count2 <= 0) { let a = GetAngleToPlayer(); let d = -45; while (d <= 45) { let obj = Obj_Create(OBJ_SHOT); Obj_SetPosition(obj, GetX(), GetY()); Obj_SetAngle(obj, a+d); Obj_SetSpeed(obj, 3); ObjShot_SetGraphic(obj, GREEN21); bullets = bullets ~ [obj]; bulletdelay = bulletdelay ~ [0]; d = d + spread; } count2 = timer; timer = timer - 0.2; hardercounter--; if (hardercounter <= 0 && spread > 10) { spread = spread - 5; hardercounter = 15; } } let i = length(lasers); let j = 0; while (j < i) { let l = ObjLaser_GetLength(lasers[j]); if (l < 160) { ObjLaser_SetLength(lasers[j], l+4); } else { Obj_SetPosition(lasers[j], ObjLaser_GetEndX(lasers[j]), ObjLaser_GetEndY(lasers[j])); Obj_SetAngle(lasers[j], 180 + Obj_GetAngle(lasers[j])); lasers2 = lasers2 ~ [lasers[j]]; lasers = erase(lasers, j); i--; j--; } j++; } i = length(lasers2); j = 0; while (j < i) { let l = ObjLaser_GetLength(lasers2[j]); if (l > 0) { ObjLaser_SetLength(lasers2[j], l-4); } else { let dy = Obj_GetY(lasers2[j]) - GetPlayerY(); let dx = Obj_GetX(lasers2[j]) - GetPlayerX(); let a = 180+atan2(dy, dx);; Obj_SetAngle(lasers2[j], a); lasers = lasers ~ [lasers2[j]]; lasers2 = erase(lasers2, j); i--; j--; } j++; } i = length(bullets); j = 0; while (j < i) { if (Obj_BeDeleted(bullets[j])) { bullets = erase(bullets, j); bulletdelay = erase(bulletdelay, j); j--; i--; } else { if (bulletdelay[j] <= 0) { let k = length(lasers); let m = 0; while (m < k) { if (Collision_Obj_Obj(bullets[j], lasers[m])) { let ang1 = Obj_GetAngle(bullets[j]); let ang2 = Obj_GetAngle(lasers[m]); let ad = ang1 - ang2; Obj_SetAngle(bullets[j], ang1 - 2 * ad); bulletdelay[j] = 15; let obj = Obj_Create(OBJ_SHOT); Obj_SetPosition(obj, Obj_GetX(bullets[j]), Obj_GetY(bullets[j])); ObjShot_SetGraphic(obj, PURPLE21); Obj_SetAngle(obj, GetAngleToPlayer()); Obj_SetSpeed(obj, Obj_GetSpeed(bullets[j]) * 1.2); bullets = bullets ~ [obj]; bulletdelay = bulletdelay ~ [15]; } m++; } k = length(lasers2); m = 0; while (m < k) { if (Collision_Obj_Obj(bullets[j], lasers2[m])) { let ang1 = Obj_GetAngle(bullets[j]); let ang2 = Obj_GetAngle(lasers2[m]); let ad = ang1 - ang2; Obj_SetAngle(bullets[j], ang1 - 2 * ad); bulletdelay[j] = 15; let obj = Obj_Create(OBJ_SHOT); Obj_SetPosition(obj, Obj_GetX(bullets[j]), Obj_GetY(bullets[j])); ObjShot_SetGraphic(obj, PURPLE21); Obj_SetAngle(obj, GetAngleToPlayer()); Obj_SetSpeed(obj, Obj_GetSpeed(bullets[j]) * 1.2); bullets = bullets ~ [obj]; bulletdelay = bulletdelay ~ [15]; } m++; } } else { bulletdelay[j] = bulletdelay[j] - 1; } } j++; } SetCollisionA(GetX(), GetY(), 32); SetCollisionB(GetX(), GetY(), 24); } @DrawLoop { SetTexture("script\img\ExRumia.png"); DrawGraphic(GetX(), GetY()); } @Finalize { DeleteGraphic("script\img\ExRumia.png"); let amnt = 15; if (GotSpellCardBonus) { amnt = 45; } let i = 0; while (i < amnt) { CreateItem(ITEM_SCORE, GetCenterX() + prand(-100, 100), 100 + prand(-60, 60)); i++; } } }