#TouhouDanmakufu
#Title[Danmaku Upgrade "Alpha Shock"]
#Text[An attack from somewhere else, as a Spell Card!]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "system\PlaceholderBoss.png";
#include_function "lib\ExpandedShotData\shot_replace.dnh";
@Initialize{
SetLife(1000);
SetTimer(80);
SetScore(1000000);
SetMovePosition01(GetCenterX,GetCenterY-60,5);
SetEnemyMarker(true);
SetInvincibility(5);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
mainTask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,64,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
}
@Finalize{
DeleteGraphic(imgBoss);
}
task mainTask{
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}
task fire{
let n = 0;
let dx = 0;
let xa = (448/4)+dx;
let xb = (448*3/4)+dx;
let xc = (448/2)+dx;
wait(200);
//YELLOW01 is 16 px tall and the play field is 480 px tall, but this leaves safe lines
//create two lightning bolts from 1/3 and 2/3 the width of the screen starting at the top
while(n<480/12){
//if n is an odd number, the bullet will move to the right; otherwise it moves to the left
if(floor(n/2) < n/2){
lightning(xa+dx,12*n,0,0,YELLOW01,n);
lightning(xb+dx,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dx,12*n,0,180,YELLOW01,n);
lightning(xb+dx,12*n,0,180,YELLOW01,n);
}
wait(1);
dx=rand_int(-8,8);
xa+=dx;
xb+=dx;
n++;
}
n = 0;
dx = 0;
xa = (448/4);
xb = (448*3/4);
}
task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
wait(200);
//create a lightning bolt starting from the top middle
while(n<480/12){
//bullets in the middle chain will have the opposite system from that above
if(floor(n/2) < n/2){
lightning(xc+dx,12*n,0,180,YELLOW01,n);
}else{
lightning(xc+dx,12*n,0,0,YELLOW01,n);
}
wait(1);
dx=rand_int(-8,8);
n++;
}
n = 0;
dx = 0;
xc = (448/2);
}
function wait(w){
loop(w){yield;}
}
//generate object bullet
task lightning(x,y,v,dir,graphic,delay){
let shard = Obj_Create(OBJ_SHOT);
Obj_SetPosition(shard,x,y);
Obj_SetAngle(shard,dir);
ObjShot_SetGraphic(shard,graphic);
ObjShot_SetDelay(shard,delay);
ObjShot_SetBombResist(shard,false);
wait(90+delay);
Obj_SetSpeed(shard,1.5);
}
}
Okay, I've made some improvements and it's playable, except for the fact that the boss is invinvicle. For some reason, Sanae A's homeing works but does no damage, but Reimu A's does not.
Is something wrong with the SetInvincibility or the SetCollision?