Well, that spellcard's done, but I'm having trouble with the next one.
Yes, this is for a boss...
#TouhouDanmakufu
#Title[Reflection Sniper]
#Text[Looks more like a bomb than a bullet]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "Materials\Graphics\PlaceholderBoss.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
@Initialize{
SetLife(1000);
SetDamageRate(25,15);
SetTimer(40);
SetScore(1000);
SetMovePosition02(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
ShotInit;
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
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{
wait(60);
startmove;
wait(60);
SniperGun;
ascent(i in -1..1){
ReflectPod(GetAngle+60*i);
}
}
task startmove{
let cirno=9;
let anglechange;
let curvetime = 0;
SetSpeed(1);
SetAngle(rand(0,360));
let selected = GetAngle;
while(cirno==9){
SetAngle(selected);
SetSpeed(1);
anglechange=rand(-0.2,0.2);
if(curvetime>=120){
loop(150){
SetAngle(GetAngle+anglechange);
SetSpeed(1);
if(GetEnemyX<GetClipMinX){
SetAngle(rand(-90,90));
}
if(GetEnemyX>GetClipMaxX){
SetAngle(rand(90,270));
}
if(GetEnemyY<GetClipMinY){
SetAngle(rand(0,180));
}
if(GetEnemyY>GetClipMaxY){
SetAngle(rand(180,360));
}
yield;
}
curvetime=0;
selected=rand(0,360);
SetSpeed(0);
wait(120);
}
curvetime++;
if(GetEnemyX<GetClipMinX){
SetAngle(rand(-90,90));
selected = GetAngle;
SetSpeed(1);
}
if(GetEnemyX>GetClipMaxX){
SetAngle(rand(90,270));
selected = GetAngle;
SetSpeed(1);
}
if(GetEnemyY<GetClipMinY){
SetAngle(rand(0,180));
selected = GetAngle;
SetSpeed(1);
}
if(GetEnemyY>GetClipMaxY){
SetAngle(rand(180,360));
selected = GetAngle;
SetSpeed(1);
}
yield;
}
}
task fire{
}
task ReflectPod(angle){
let reflecttime=0;
let reflect = Obj_Create(OBJ_SHOT);
Obj_SetPosition(reflect,GetX,GetY);
Obj_SetAngle(reflect,angle);
ObjShot_SetGraphic(reflect,ORANGE02);
Obj_SetSpeed(reflect,1);
ObjShot_SetBombResist(reflect,true);
Obj_SetCollisionToPlayer(reflect,false);
while(!Obj_BeDeleted(reflect)){
if(Obj_GetX(reflect)<=GetClipMinX||Obj_GetX(reflect)>=GetClipMaxX){
Obj_SetAngle(reflect,180-angle);
}
if(Obj_GetY(reflect)<=GetClipMinY||Obj_GetY(reflect)>=GetClipMaxY){
Obj_SetAngle(reflect,360-angle);
}
if(reflecttime==540){
explosion(Obj_GetX(reflect),Obj_GetY(reflect));
Obj_Delete(reflect);
}
if(GetDistance(Obj_GetX(reflect),Obj_GetY(reflect),GetPlayerX,GetPlayerY)<12){
explosion(Obj_GetX(reflect),Obj_GetY(reflect));
Obj_Delete(reflect);
}
reflecttime++;
wait(1);
}
}
task SniperGun{
CreateLaser01(GetX,GetY,5,GetAngleToPlayer,100,25,PURPLE41,0);
}
task DualBomb{
}
function explosion(x,y){
let dir = 90;
loop(5){
CreateShotA(1,x,y,0);
SetShotDataA(1,0,0.1,dir,0.5,0,0,ORANGE03);
SetShotKillTime(1,240);
CreateShotA(2,0,0,0);
SetShotDataA(2,0,5,dir,0,-0.8,1,ORANGE01);
ascent(m in 1..24){
AddShot(m*10,1,2,0);
}
FireShot(1);
dir+=360/5;
}
loop(25){
CreateShot01(x,y,1,dir,RED01,0);
dir+=360/25;
}
}
function wait(w){
loop(w){yield;}
}
function GetDistance(x1,y1,x2,y2){
return(((x2-x1)^2+(y2-y1)^2)^(1/2))
}
}
There are several problems:
1. Only 2 reflect objectshots are being spawned. Where's the third one?
2. The reflect objectshots will bounce in the opposite direction of the one they were traveling rather than actually reflect (but only after they've bounced once; the first bounce is a true reflection)
3. Only one ORANGE01 shot is spawned from the explosion function. There should be one every ten frames.