#TouhouDanmakufu #Title[Light Sign uReflection/Refractionv (v2)] #Text[Random Card by Nuclear Cheese ... lasers and bullets abound; watch from all angles. Revised v2 ... thanks Blargel for finding a way to abuse the first one] #Player[FREE] #ScriptVersion[2] script_enemy_main { let count; let count2; let lasers; let lasers2; let lasersfixed; let bullets; let bulletdelay; let spread; let hardercounter; let timer; @Initialize { count = 80; count2 = 180; hardercounter = 24; spread = 15; timer = 89; lasers = []; lasers2 = []; bullets = []; bulletdelay = []; lasersfixed = []; SetLife(700); LoadGraphic("script\img\ExRumia.png"); SetGraphicRect(64, 1, 127, 64); SetMovePosition02(GetCenterX(), 120, 60); SetScore(180000); SetTimer(60); SetDamageRate(16, 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 { let distx = GetPlayerX() - GetX(); let disty = GetPlayerY() - GetY(); distx = distx * distx; disty = disty * disty; if ((distx + disty) < 8100 && (count2 % 5) == 0 && timer < 89) { let a = GetAngleToPlayer(); let d = -180; while (d < 180) { 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 + 15; } } count--; if (count <= 0) { if (length(lasersfixed) == 0) { let obj = Obj_Create(OBJ_LASER); Obj_SetPosition(obj, GetX() - 80, GetY() - 50); Obj_SetSpeed(obj, 0); ObjLaser_SetLength(obj, 0); ObjShot_SetGraphic(obj, RED11); Obj_SetAngle(obj, 135); ObjLaser_SetWidth(obj, 12); lasersfixed = lasersfixed ~ [obj]; obj = Obj_Create(OBJ_LASER); Obj_SetPosition(obj, GetX() + 80, GetY() - 50); Obj_SetSpeed(obj, 0); ObjLaser_SetLength(obj, 0); ObjShot_SetGraphic(obj, RED11); Obj_SetAngle(obj, 45); ObjLaser_SetWidth(obj, 12); lasersfixed = lasersfixed ~ [obj]; count = 60; } else { 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 = 467 + (length(lasers) * 80); if (count2 < (timer / 2)) { count2 = timer / 2; } } } 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 ~ [5]; d = d + spread; } count2 = timer; if (count < (timer / 2)) { count = timer / 2; } timer = timer - 0.09; 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.1); 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.1); bullets = bullets ~ [obj]; bulletdelay = bulletdelay ~ [15]; } m++; } k = length(lasersfixed); m = 0; while (m < k) { if (Collision_Obj_Obj(bullets[j], lasersfixed[m])) { let ang1 = Obj_GetAngle(bullets[j]); let ang2 = Obj_GetAngle(lasersfixed[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, RED21); let dy = Obj_GetY(bullets[j]) - GetPlayerY(); let dx = Obj_GetX(bullets[j]) - GetPlayerX(); let a = 180 + atan2(dy, dx); Obj_SetAngle(obj, a); Obj_SetSpeed(obj, Obj_GetSpeed(bullets[j]) * 1.1); bullets = bullets ~ [obj]; bulletdelay = bulletdelay ~ [15]; } m++; } } else { bulletdelay[j] = bulletdelay[j] - 1; } } j++; } i = length(lasersfixed); j = 0; while (j < i) { if (ObjLaser_GetEndY(lasersfixed[j]) < GetClipMaxY()) { ObjLaser_SetLength(lasersfixed[j], ObjLaser_GetLength(lasersfixed[j]) + 5); } j++; } if (i > 0) { Obj_SetAngle(lasersfixed[0], Obj_GetAngle(lasersfixed[0]) - 0.0105); Obj_SetAngle(lasersfixed[1], Obj_GetAngle(lasersfixed[1]) + 0.0105); } 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 = 20; if (GotSpellCardBonus) { amnt = 50; } let i = 0; while (i < amnt) { CreateItem(ITEM_SCORE, GetCenterX() + prand(-100, 100), 100 + prand(-60, 60)); i++; } } }