aghgghghh i need help
I did a bunch of editing to try and have both the player bullet variables and target variable in the same task so that they could reference each other. It's not working because the collision detection function is done while the bullet isn't deleted. The thing is that because they both work on a different BeDeleted segment.
Like what the fuck do I have to smash the entire target code into the option bullet code? I'm just posting the entire goddamn thing.
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Reimu D2]
#Text[Hakurei Reimu type D
?uConcentrated attack type?v
Shot: ?uAbsolution Needle?v
Bomb: ?uWild Annihilation Dance?v]
#Image[.\sl_pl00.png]
#ReplayName[ReimuD2]
script_player_main{
#include_function ".\common.txt"
let c = GetCurrentScriptDirectory();
let bNextShot = false;
let optiona = 0;
let focusalpha = 0;
let focussize = 1;
let drawcount = 0;
let shotcount = -1;
let rad = 45;
task DrawHitbox(){
let hitbox = Obj_Create(OBJ_SHOT);
Obj_SetSpeed(hitbox,0);
Obj_SetCollisionToPlayer(hitbox, false);
ObjShot_SetBombResist(hitbox, true);
ObjShot_SetGraphic(hitbox, 100);
while(!Obj_BeDeleted(hitbox)){
if(IsPressRight()==true){
if(IsPressDown()==true){ Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY+1); //Right+Down
}else if(IsPressUp()==true){ Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY-2); //Right+Up
}else{ Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY);} //Right
}else if(IsPressLeft()==true){
if(IsPressDown()==true){ Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY+1); //Left+Down
}else if(IsPressUp()==true){ Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY-2); //Left+Up
}else{ Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY);} //Left
}else if(IsPressDown()==true){ Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY+1); //Down
}else if(IsPressUp()==true){ Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY-2); //Up
}else{ Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY); //Neutral
}
Obj_SetAngle(hitbox, optiona);
Obj_SetAlpha(hitbox, focusalpha);
yield;
}
}
task OptionScript{
if(IsPressShot()==true && shotcount==-1){shotcount=0;}
if(IsPressSlow()==true){rad = 20;}else{rad = 45;}
if(shotcount%5 == 0){
PlaySE(c~"se_plst00.wav");
let r = rand(-5,5);
ShotScript(GetPlayerX+8, GetPlayerY-10, GetPlayerX+(rad*cos(optiona)), GetPlayerY+(rad*sin(optiona)), r, true);
r = rand(-5,5);
ShotScript(GetPlayerX-8, GetPlayerY-10, GetPlayerX+(rad*cos(optiona)), GetPlayerY-(rad*sin(optiona)), r, true);
r = rand(-5,5);
ShotScript(0, 0, GetPlayerX-(rad*cos(optiona)), GetPlayerY+(rad*sin(optiona)), r, false);
r = rand(-5,5);
ShotScript(0, 0, GetPlayerX-(rad*cos(optiona)), GetPlayerY-(rad*sin(optiona)), r, false);
}
if(shotcount>=0){shotcount++;}
if(shotcount>=5){shotcount=-1;}
yield;
}
task ShotScript(x1,y1,x2,y2,r,m){
//TARGET
let f = 0;
ascent(enemy in EnumEnemyBegin..EnumEnemyEnd){
let enemyID = EnumEnemyGetID(enemy);
let target = Obj_Create(OBJ_LASER);
Obj_SetX(target, GetEnemyInfo(enemyID, ENEMY_X));
Obj_SetY(target, GetEnemyInfo(enemyID, ENEMY_Y));
Obj_SetSpeed(target, 0);
Obj_SetCollisionToPlayer(target, false);
ObjShot_SetBombResist(target, true);
ObjShot_SetGraphic(target, 101);
ObjLaser_SetLength(target, 100);
ObjLaser_SetWidth(target, 500);
ObjLaser_SetSource(target, false);
while(!Obj_BeDeleted(target)){
Obj_SetX(target, GetEnemyInfo(enemyID, ENEMY_X));
Obj_SetY(target, GetEnemyInfo(enemyID, ENEMY_Y));
f++;
if(f>2){Obj_Delete(target);}
yield;
}
}
//MAIN BULLET
if(m==true){
let g = 103;
let i = -2;
let a = 115;
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x1, y1);
Obj_SetAngle(obj, 270);
ObjShot_SetGraphic(obj, g);
Obj_SetAlpha(obj, a);
Obj_SetSpeed(obj, 10);
ObjShot_SetBombResist(obj, true);
ObjShot_SetDamage(obj, 1);
ObjShot_SetPenetration(obj, 10);
Obj_SetCollisionToObject(obj, true);
while(!Obj_BeDeleted(obj)){
/*if(Collision_Obj_Obj(obj,obj)==true){
i = 0;
}else{
g = 103;
}*/
if(i>=0){
ObjShot_SetDamage(obj, 0);
i++;
a-=3;
}
if(i>=0 && i<6){
g = 104;
Obj_SetSpeed(obj, 1.5);
}else if(i>=6 && i<12){
a = 35;
g = 105;
Obj_SetSpeed(obj, 1.5);
}else if(i>16){
Obj_Delete(obj);
}
ObjShot_SetGraphic(obj, g);
Obj_SetAlpha(obj, a);
yield;
}
}
//OPTION BULLET
let g = 101;
let i = -2;
let a = 170;
let opt = Obj_Create(OBJ_SHOT);
Obj_SetPosition(opt, x2, y2);
Obj_SetAngle(opt, 270);
ObjShot_SetGraphic(opt, g);
Obj_SetAlpha(opt, a);
Obj_SetSpeed(opt, 10);
ObjShot_SetBombResist(opt, true);
ObjShot_SetDamage(opt, 0.7);
ObjShot_SetPenetration(opt, 10);
while(!Obj_BeDeleted(opt)){
//if(Obj_IsIntersected(opt)==true){
if(Collision_Obj_Obj(opt,target)==true){
i = 0;
a = 220;
Obj_SetAngle(opt, 270+r);
}else{
g = 101;
}
if(i>=0){
ObjShot_SetDamage(opt, 0);
Obj_SetSpeed(opt, 1.5);
i++;
g = 102;
a-=2;
}
if(i>16){
Obj_Delete(opt);
}
ObjShot_SetGraphic(opt, g);
Obj_SetAlpha(opt, a);
yield;
}
}
@Initialize{
LoadGraphic(c~"pl00.png");
LoadPlayerShotData(c~"plshot00.txt");
SetPlayerLifeImage(c~"pl00.png", 213, 293, 247, 325);
SetRibirthFrame(15);
SetSpeed(4, 1.5);
DrawHitbox;
}
@MainLoop{
drawcount++;
SetIntersectionCircle(GetPlayerX, GetPlayerY, 1);
optiona+=3; if(optiona>=360){optiona = 0;}
OptionScript;
yield;
}
@Missed{}
@SpellCard{
SetSpeed(4, 1.5);
UseSpellCard("WildAnnihilationDance", 0);
}
@DrawLoop{
SetTexture(c~"pl00.png");
SetAlpha(255);
SetGraphicScale(1,1);
//Draw player
SetGraphicAngle(0,0,0);
if(IsPressRight()==true){
SetGraphicRect(228, 102, 260, 146);
}else if(IsPressLeft()==true){
SetGraphicRect(230, 53, 261, 97);
}else{
if(drawcount<10){SetGraphicRect(5, 3, 38, 51);}
if(drawcount>=10 && drawcount<20){SetGraphicRect(37, 3, 70, 51);}
if(drawcount>=20 && drawcount<30){SetGraphicRect(69, 3, 102, 51);}
if(drawcount>=30 && drawcount<40){SetGraphicRect(101, 3, 134, 51);}
if(drawcount>=40 && drawcount<50){SetGraphicRect(134, 3, 165, 51);}
if(drawcount>=50 && drawcount<60){SetGraphicRect(165, 3, 198, 51);}
if(drawcount>=60 && drawcount<70){SetGraphicRect(198, 3, 229, 51);}
if(drawcount>=70 && drawcount<80){SetGraphicRect(228, 3, 262, 51);}
}
DrawGraphic(GetPlayerX, GetPlayerY);
//Draw options
SetGraphicRect(70, 148, 84, 162);
SetGraphicAngle(0,0,optiona*-1);
DrawGraphic(GetPlayerX+(rad*cos(optiona)), GetPlayerY+(rad*sin(optiona)));
DrawGraphic(GetPlayerX+(rad*cos(optiona)), GetPlayerY-(rad*sin(optiona)));
DrawGraphic(GetPlayerX-(rad*cos(optiona)), GetPlayerY+(rad*sin(optiona)));
DrawGraphic(GetPlayerX-(rad*cos(optiona)), GetPlayerY-(rad*sin(optiona)));
//Draw focus circle
if(IsPressSlow==true){
focusalpha+=30;
if(focusalpha>250){focusalpha=250;}
}else{
focusalpha-=30;
if(focusalpha<0){focusalpha=0;}
}
if(focusalpha>210){
focussize-=0.04;
if(focussize<=1){focussize=1;}
}else{
focussize = (focusalpha/240)+0.4;
}
SetAlpha(focusalpha);
SetGraphicRect(213, 151, 285, 213);
SetGraphicScale(focussize, focussize);
SetGraphicAngle(0,0,0);
DrawGraphic(GetPlayerX, GetPlayerY);
/*SetGraphicScale(1,1);
SetGraphicAngle(0,0,optiona);
DrawGraphic(GetPlayerX, GetPlayerY);*/
drawcount++;
if(drawcount>=80){drawcount=0;}
}
@Finalize{}
}
script_spell WildAnnihilationDance{
let frame = 0;
@Initialize{
SetPlayerInvincibility(120);
DeleteEnemyShotToItem(SHOT);
CollectItems;
}
@MainLoop{
frame++;
if(frame>120){End;}
yield;
}
@Finalize{
}
}