Ok i got a lot of questions, but for now imma start with the one's that's been bothering me for a while.
I've been trying to make bullets appear around the spot you were at at the time they spawned and they spin in relation to that same spot, the final objective is to make them spin inwards towards the spot and leave trails of bullets on the way (like on Orin's card: Malicious Spirit "Spleen Eater", except here the bullets stay and never move), but i cant even make them keep spinning over that same spot, let alone make them spin inwards.
First i tried by making them detect the angle to the player (-90 or +90) and rotate, it's good... until the player moves.
Second i stored the angle towards the player in the task that spawned the bullets in another array, so for every bullet i get the angle stored, and do (-90 or +90) the bullets rotate but seem to spin outwards which is the total opposite of what i wanted.
Third i stored the player's coordinates at the time, on 2 different arrays (one for X and one for Y) and just used atan2 everytime they were moving, but i got the same result as on the second try.
Fourth i returned to the angle and removed the (+90 or -90) to check if the bullets were really aiming at the player position, and i found out they were indeed aiming at the player position, so i was running out of options.
Fifth i changed the angle modifier to (+10 or -10) and now noticed the bullets spinned inwards but leave like a small hole in the center of idk what radious (maybe 10) and spin around it then spin outward... this is what i wanted... except i need them to converge in the very center not spin around it.
Since i ran out of options, i decided to go with this result and add some extra stuff to the spellcard and made the fairies spawn bullets instead, plus some extra stuff to make it harder, the ocassional bullets going around you were forcing you to stop for a second unless you were able enough to squeeze through their gaps, but i still want to know how to make the things to converge on the spot.
Here's the current code:
#TouhouDanmakufu
#Title[Orin Spell 1]
#Text[Orin's First SpellCard]
#BGM[.\system\OrinTheme.mp3]
#PlayLevel[Extra]
#player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let FairyZ = CSD ~ "FairyZ01.txt";
let imgBoss = CSD ~ "system\Orin.png";
let SpellCircle = CSD ~"system\SpellCircle.png";
let cut = CSD ~ "system\orincut.png";
let bg = CSD ~ "system\OrinBGa.png";
let bg2 = CSD ~ "system\OrinBGb.png";
let shotSE = CSD ~ "system\shotSE.wav";
let chargeSE = CSD ~ "system\charging.wav";
let TO1 = CSD ~ "system\se_timeout.wav";
let TO2 = CSD ~ "system\se_timeout2.wav";
let frame = 0;
let frame2 = 0;
let frame3 = 0;
let frame4 = 0;
let angle = 0;
let angle2 = 360/6;
let angleTilt = 0;
let Circle = 0;
let PlayerAngle = [];
let DrawAngle = 0;
let radious = 0;
let bullets = [];
let spiral = [];
let spawned = false;
@Initialize{
SetLife(1500);
SetTimer(25);
SetScore(1000000);
SetDamageRate(70,70);
SetInvincibility(120);
// Expert;
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
LoadGraphic(bg2);
LoadGraphic(SpellCircle);
LoadSE(shotSE);
LoadSE(chargeSE);
LoadSE(TO1);
LoadSE(TO2);
SetMovePosition02(100,GetCenterY-100,120);
CutIn(YOUMU,"Wheel of Hell ~ Zombie Fairies",cut,0,0,402,512);
}
@MainLoop{
SetCollisionA(GetX,GetY,30);
SetCollisionB(GetX,GetY,18);
frame++;
frame2++;
frame3++;
DrawAngle++;
if(frame==180){
SummonCircle(GetPlayerX,GetPlayerY);
frame=60;
}
if(frame2==120){
SetMovePosition02(GetPlayerX,GetCenterY-100,120);
if(spawned==false){
loop(10){
CreateEnemyFromFile(FairyZ,GetX,GetY,3,angle2,0);
angle2+=360/10;
}
spawned=true;
}
frame2=0;
}
if(frame3==120){
loop(2){
CreateShot01(GetX,GetY,5+rand(-3,3),0+angleTilt+rand(-3,3),GREEN01,2);
CreateShot01(GetX,GetY,5+rand(-3,3),180+angleTilt+rand(-3,3),GREEN01,2);
}
angleTilt++;
frame3=118;
}
let i = 0;
while(i<length(bullets)){
if(Obj_BeDeleted(bullets[i])){
bullets = erase(bullets,i);
PlayerAngle = erase(PlayerAngle,i);
i--;
}else{
let obj = bullets[i];
Obj_SetSpeed(obj,5);
Obj_SetAngle(obj,PlayerAngle[i]-10);
}
i++;
yield;
}
yield;
if(GetTimer>4&&GetTimer<=10&&frame%60==0){
PlaySE(TO1);
// wait(60);
}
if(GetTimer<=4&&frame%60==0){
PlaySE(TO2);
// wait(60);
}
}
task SummonCircle(x,y){
loop(8){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x+100*cos(angle),y+100*sin(angle));
PlayerAngle = PlayerAngle ~ [atan2(y-Obj_GetY(obj),x-Obj_GetX(obj))];
Obj_SetSpeed(obj,0);
Obj_SetAngle(obj,0);
ObjShot_SetDelay(obj,5);
ObjShot_SetGraphic(obj, RED04);
ObjShot_SetBombResist(obj, true);
bullets = bullets ~ [obj];
angle+=360/8;
}
yield;
}
task ShootSpiral{
}
@DrawLoop{
frame4++;
if(frame4<=60){
Circle+=1/60;
}
if(frame4>60 && frame4<=120){
Circle-=1/60;
}
if(frame4>120){
frame4=0;
}
DrawText("Rin Kaenbyou", 36, 39, 12, 225);
SetTexture(imgBoss);
SetColor(255,255,255);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,62,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
SetTexture(SpellCircle);
SetColor(255,255,255);
SetRenderState(ALPHA);
SetAlpha(60);
SetGraphicRect(0,0,126,125);
SetGraphicScale(Circle+1,Circle+1);
SetGraphicAngle(0,0,DrawAngle*2);
DrawGraphic(GetX,GetY);
}
@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(90);
SetGraphicRect(0,0,512,512);
SetGraphicAngle(0,0,DrawAngle);
SetGraphicScale(1,1);
DrawGraphic(GetCenterX,GetCenterY);
SetTexture(bg2);
SetRenderState(ALPHA);
SetAlpha(160);
SetGraphicRect(-DrawAngle,-DrawAngle,512-DrawAngle,512-DrawAngle);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteSE(shotSE);
DeleteSE(chargeSE);
DeleteSE(TO1);
DeleteSE(TO2);
SetCommonData("Vanish",true);
DeleteAllEnemyWithoutBoss;
loop(8){
CreateItem(ITEM_SCORE,GetX+rand(-50,50),GetY+rand(-50,50));
}
function wait(w){
loop(w){yield;}
}
}
As for the second question, I wanna know how to add my own bullets to the game, i wanted to recreate Murasa's Anchor, although i get an error everytime, or no sprite at all for it, here are the codes:
Bullet Code:
#UserShotData // Required
ShotImage = GetCurrentScriptDirectory~"system\anchor.png" // Image of Bullets
// Definition of bullet
ShotData {
id = 120 // Bullet ID
rect = (0, 0, 32, 32) // Region in the ShotImage
render = ALPHA // Render type
delay_color = (255, 128, 255) // Color of light on delay
angular_velocity = rand(-5, 5) // Ang. vel. of graphic rotation
}
And the Script where the bullet is supposed to appear (i commented out all the things i did to try to make it appear, and returned the bullet graphic to BLUE03, i left what i was using earlier in a comment too)
#TouhouDanmakufu
#Title[Satori Spellcard 2]
#Text[Satori's Second SpellCard]
#BGM[.\system\SatoriTheme.mp3]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss= CSD ~ "system\satori.PNG";
let cut= CSD ~ "system\satoricut.png";
let bg = CSD ~ "system\SatoriBGa.png";
let bg2 = CSD ~ "system\SatoriBGb.png";
// let ANCHOR = CSD~"Anchor.txt";
// let ANCHOR = LoadUserShotData(CSD~"Anchor".txt);
let shotSE = CSD ~ "system\shotSE.wav";
let chargeSE = CSD ~ "system\charging.wav";
let anchorSE = CSD ~ "system\se_boon00.wav";
let TO1 = CSD ~"system\se_timeout.wav";
let TO2 = CSD ~"system\se_timeout2.wav";
let frame = 0;
let frame2 = 0;
let frame3 = 0;
let angle = 0;
@Initialize{
SetLife(500);
SetTimer(60);
SetScore(110000);
SetDamageRate(10,0);
SetInvincibility(120);
// Expert;
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
LoadGraphic(bg2);
LoadSE(shotSE);
LoadSE(chargeSE);
LoadSE(anchorSE);
// LoadUserShotData(ANCHOR);
LoadSE(TO1);
LoadSE(TO2);
SetMovePosition02(GetCenterX, GetCenterY - 100, 120); //Move the boss to the top center of the screen.
CutIn(YOUMU,"Recolection ~ Death Anchor",cut,0,0,256,512);
Concentration01(120);
PlaySE(chargeSE);
}
@MainLoop{
if(OnBomb==false){
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,21);
}
frame ++;
frame2 ++;
if(GetTimer>4&&GetTimer<=10&&frame3%60==0){
PlaySE(TO1);
}
if(GetTimer<=4&&frame3%60==0){
PlaySE(TO2);
}
if(frame==120){
CreateShotA(1,GetX,GetY,10);
// SetShotDataA(1,0,1,GetAngleToPlayer,0,0.4,12,ANCHOR);
SetShotDataA(1,0,1,GetAngleToPlayer,0,0.4,12,BLUE03);
ascent(i in 1..60){
CreateShotA(2,0,0,0);
SetShotDataA(2,0,0,GetAngleToPlayer-90,0,0,0,AQUA01);
SetShotDataA(2,30,0,GetAngleToPlayer-90,0,0.3,8,AQUA01);
AddShot(i*2,1,2,0);
CreateShotA(2,0,0,0);
SetShotDataA(2,0,0,GetAngleToPlayer-90,0,0.0,0,AQUA01);
SetShotDataA(2,33,0,GetAngleToPlayer-90,0,0.2,8,AQUA01);
AddShot(i*2,1,2,0);
CreateShotA(2,0,0,0);
SetShotDataA(2,0,0,GetAngleToPlayer-90,0,0.0,0,AQUA01);
SetShotDataA(2,35,0,GetAngleToPlayer-90,0,0.1,8,AQUA01);
AddShot(i*2,1,2,0);
CreateShotA(2,0,0,0);
SetShotDataA(2,0,0,GetAngleToPlayer+90,0,0,0,AQUA01);
SetShotDataA(2,30,0,GetAngleToPlayer+90,0,0.3,8,AQUA01);
AddShot(i*2,1,2,0);
CreateShotA(2,0,0,0);
SetShotDataA(2,0,0,GetAngleToPlayer+90,0,0,0,AQUA01);
SetShotDataA(2,33,0,GetAngleToPlayer+90,0,0.2,8,AQUA01);
AddShot(i*2,1,2,0);
CreateShotA(2,0,0,0);
SetShotDataA(2,0,0,GetAngleToPlayer+90,0,0,0,AQUA01);
SetShotDataA(2,35,0,GetAngleToPlayer+90,0,0.1,8,AQUA01);
AddShot(i*2,1,2,0);
}
FireShot(1);
frame = 60;
PlayAnchor;
}
if(frame2==120){
loop(60){
CreateShot01(GetX,GetY,1,GetAngleToPlayer+angle,PURPLE31,5);
angle+=360/60;
}
PlaySE(shotSE);
angle=0;
frame2=60;
}
yield;
}
@DrawLoop{
SetColor(255,255,255);
SetRenderState(ALPHA);
if(OnBomb==false){
SetAlpha(255);
}else{
SetAlpha(150);
}
SetTexture(imgBoss);
SetGraphicRect(0,0,47,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
frame3++;
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(90);
SetGraphicRect(-frame3,0,512-frame3,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX, GetCenterY);
SetTexture(bg2);
SetRenderState(ALPHA);
SetAlpha(150);
SetGraphicRect(0,0,256,256);
SetGraphicAngle(0,0,frame3);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize
{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
DeleteSE(shotSE);
DeleteSE(chargeSE);
DeleteSE(anchorSE);
DeleteSE(TO1);
DeleteSE(TO2);
// DeleteUserShotData(ANCHOR);
loop(20){
CreateItem(ITEM_SCORE,GetX+rand(-50,50),GetY+rand(-50,50));
}
CreateItem(ITEM_1UP,GetX,GetY);
}
task PlayAnchor{
PlaySE(anchorSE);
wait(20);
PlaySE(anchorSE);
yield;
}
function wait(w){
loop(w){yield};
}
}
And for the last question, how can i make bullets glow? hope you guys can help me out