is it locked now?
A more interesting question (what would be done to the author of the 1001st post?)
Btw, Can I include a stage (script) inside a stage (script)?
After posting my question about recreating Cirno's Diamond Blizzard and what else I'd need to know to make it a success, I started messing around with what I already know, and I think I've got something pretty close.Code: [Select]#TouhouDanmakufu
#Title[Snow Sign "Diamond Blizzard"]
#Text[My first attempt at recreating a card.]
#BackGround[IceMountain]
//#BGM[.\bgm\th06_05.wav]
#Player[REIMU, MARISA, player\Rumia\Rumia.txt]
#ScriptVersion[2]
script_enemy_main {
let ImgBoss = "script\img\ExRumia.png";
//let imgSpellBackdrop=GetCurrentScriptDirectory~"img\icewall.png";
let frame = -120;
let movecount = -120;
@Initialize {
SetScore(50000);
SetLife(240);
SetDamageRate(10,10);
SetTimer(60);
SetInvincibility(30);
SetGraphicRect(1, 1, 64, 64);
LoadGraphic(ImgBoss);
//LoadGraphic(imgSpellBackdrop);
SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
CutIn(KOUMA, "Snow Sign "\""Diamond Blizzard"\", 0, 0, 0, 0, 0);
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if(frame == 10) {
let leftright = rand(-100, 100);
let updown = rand(-50, 50);
loop(10) {
CreateShot01(GetX+leftright, GetY+updown, rand(0.5, 4), rand(0, 359), AQUA23, 20);
}
frame = 0;
}
if(movecount == 120) {
SetMovePositionRandom01(50,20,5,GetClipMinX()+100,30,GetClipMaxX()-100,100);
movecount = 0;
}
frame++;
movecount++;
}
@Finalize {
DeleteGraphic(ImgBoss);
//DeleteGraphic(imgSpellBackdrop);
}
@DrawLoop {
SetAlpha(255);
SetTexture(ImgBoss);
SetGraphicRect(1,1,64,64);
DrawGraphic(GetX(),GetY());
}
// @BackGround {
// SetAlpha(150);
// SetTexture(imgSpellBackdrop);
// SetGraphicRect(0,0,384,448);
// DrawGraphic(GetCenterX,GetCenterY);
}
}
Now my question is, how can I clean this up so that it looks like the one from Embodiment of Scarlet Devil? Obviously, I need to figure out how to make a Cirno boss sprite so that it's not Rumia firing things, but what else could I change to make it a better match?
can i let enemies draw 3d backgrounds?
#TouhouDanmakufu
#Title[Satori Spellcard 2 - B]
#Text[Satori's Second SpellCard]
#BGM[.\system\SatoriTheme.mp3]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
#include_function ".\cutin.txt"
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,0,0);
cutin("NAZRIN",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&&frame%60==0){
CreateEnemyFromFile(ANCHOR,GetX,GetY,1,GetAngleToPlayer,GetAngleToPlayer);
}
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};
}
}
}
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgAnchor = CSD ~ "system\anchor.png";
let WaterSE = CSD ~ "system\se_water.png";
let A = GetArgument;
let S = 0;
let X0 = GetX;
let Y0 = GetY;
let HasCrashed = false;
@Initialize{
SetLife(1);
LoadGraphic(imgAnchor);
LoadSE(WaterSE);
}
@MainLoop{
SetCollisionB(GetX,GetY,40);
if(!HasCrashed){
SetSpeed(S);
S+=0.15;
}
if(GetX<=GetClipMinX || GetX>=GetClipMaxX || GetY<=GetClipMinY || GetY>=GetClipMaxY){
if(!HasCrashed){
PlaySE(WaterSE);
SetSpeed(0);
S=0;
}
HasCrashed = true;
}
if(HasCrashed){
SetSpeed(S);
S-=0.15;
if(GetX==X0&&GetY==Y0){
VanishEnemy;
}
}
}
@DrawLoop{
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(imgAnchor);
SetGraphicRect(0,0,125,128);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,A);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgAnchor);
DeleteSE(WaterSE);
}
}
Basically the problem is that when an anchor returns to the boss all anchors go invisible, and then it doesnt check anymore for a bit, then it checks again and same thing happensNote: Is there a way to revert the background back when im not playing PoSR? because i think i overwrote the other one and didnt save a backup copy DX and it looks weird when im not playing PoSR
You should be able to, yes; enemy scripts can take @Background in addition to @DrawLoop.then, why won't you use enemies as stages?
Edit3: Ok i'll leave that other code for later, for now i got a troublesome problem, i got this code here for a boss summoning Murasa's Anchors on this script:The solution is simple... just delete this DeleteGraphic line at @Finalize of the anchor script.
@Finalize{
DeleteGraphic(imgAnchor);
DeleteSE(WaterSE);
}
then, why won't you use enemies as stages?
#TouhouDanmakufu[Stage]
#Title[RoND Stage 1 CIRNO!]
#Text[Idiot vs Idiot - Made by CAsercan3]
#Player[player\Rumia2\Rumia.txt]
#ScriptVersion[2]
script_stage_main
{
let normpoint = 150;
let alpha_effect = 0;
let bpicker = 1;
let rotation2 = 255;
SetCommonData("HelloBoss",1);
SetCommonData("MakeSprite",0);
let rotation = 0;
let redfog = 255;
let bluefog = 255;
let greenfog = 255;
let imagefile = GetCurrentScriptDirectory ~ "sky-33.jpg";
let imagefile2 = GetCurrentScriptDirectory ~ "sea.jpg";
let imagefile3 = GetCurrentScriptDirectory ~ "stg4bg.png";
LoadGraphic(imagefile3);
let counter = 0;
let counter2 = 0;
let alpha = 0;
let counter3 = 0;
let frame = 0;
let frame2 = -120;
let p = 0;
function Wait( w ){ loop( w ){ yield }; }
function WaitForZeroEnemy(){
while(GetEnemyNum() != 0){yield;}
}
function WaitForOneEnemy(){
while(GetEnemyNum() > 1){yield;}
}
task StageTask{
loop(3){
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe07.txt",rand(GetCenterX -100,GetClipMaxX),GetClipMinY ,0,0,-1);
Wait(10);
}
Wait(60);
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe07.txt",rand(GetClipMinX,GetCenterX +100),GetClipMinY ,0,0,1);
Wait(10);
}
}
loop(2){
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMinX -50,75 +p,0,0,1);
Wait(7);
}
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMaxX,75 +p,0,0,-1);
Wait(7);
}
}
loop(7){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe06.txt",rand(GetCenterX,GetClipMaxX),GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe06.txt",rand(GetClipMinX,GetCenterX),GetClipMinY ,0,0,1);
Wait(75);
}
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe02.txt",GetClipMaxX,75 ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe02.txt",GetClipMinX,75 ,0,0,1);
Wait(7);
}
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe03.txt",GetClipMaxX - rand(1,100),75 ,0,0,-1);
Wait(20);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe03.txt",GetClipMinX + rand(1,100),75 ,0,0,1);
Wait(20);
}
p=10;
loop(3){
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMinX -50,75 +p,0,0,1);
Wait(7);
}
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMaxX,75 +p,0,0,-1);
Wait(7);
}
}
//midboss
//end midboss
Wait(60);
loop(20){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe04.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe04.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
Wait(40);
}
Wait(50);
loop(2){
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMinX -50,75 +p,0,0,1);
Wait(7);
}
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMaxX,75 +p,0,0,-1);
Wait(7);
}
}
}
ClearStage;
//magical red knives
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe09.txt",GetClipMinX +100,GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe09.txt",GetClipMaxX -100,GetClipMinY ,0,0,1);
Wait(110);
}
//magical blue knives
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMinX +100,GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMaxX -100,GetClipMinY ,0,0,1);
Wait(30);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMinX +120,GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMaxX -120,GetClipMinY ,0,0,1);
Wait(30);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMinX +140,GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe08.txt",GetClipMaxX -140,GetClipMinY ,0,0,1);
Wait(120);
}
//suicidal kunai spam fairies
loop(3){
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe07.txt",rand(GetCenterX -100,GetClipMaxX),GetClipMinY ,0,0,-1);
Wait(10);
}
Wait(60);
loop(6){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe07.txt",rand(GetClipMinX,GetCenterX +100),GetClipMinY ,0,0,1);
Wait(10);
}
}
//wall shooters
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe06.txt",rand(GetCenterX,GetClipMaxX),GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe06.txt",rand(GetClipMinX,GetCenterX),GetClipMinY ,0,0,1);
Wait(80);
}
//rocket orbs
Wait(120);
loop(20){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe05.txt",rand(GetClipMinX,GetClipMaxX),GetClipMinY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe05.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
Wait(60);
}
//rocket fairies
loop(20){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe04.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe04.txt",rand(GetClipMinX,GetClipMaxX),GetClipMaxY ,0,0,-1);
Wait(40);
}
//ringmen
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe03.txt",GetClipMaxX - rand(1,100),75 ,0,0,-1);
Wait(20);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe03.txt",GetClipMinX + rand(1,100),75 ,0,0,1);
Wait(20);
}
//fork shots
loop(3){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe02.txt",GetClipMaxX,75 ,0,0,-1);
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe02.txt",GetClipMinX,75 ,0,0,1);
Wait(7);
}
//8way shots
loop(3){
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMinX -50,75 +p,0,0,1);
Wait(7);
}
p+=20;
loop(10){
CreateEnemyFromFile(GetCurrentScriptDirectory ~ "foe01.txt",GetClipMaxX,75 +p,0,0,-1);
Wait(7);
}
}
WaitForZeroEnemy;
Wait(60);
SetCommonData("HelloBoss",-5);
Wait(255);
SetCommonData("HelloBoss",-4);
Wait(255);
SetCommonData("HelloBoss",-3);
Wait(255);
SetCommonData("HelloBoss",0);
Wait(1000);
SetCommonData("HelloBoss",4);
Wait(255);
ClearStage;
}
@Initialize
{
LoadGraphic(imagefile2);
LoadGraphic(imagefile);
SetAllowedContinueCount(4);
SetNormPoint(150);
}
@MainLoop
{
yield;
frame++;
frame2+=GetCommonData("HelloBoss");
if(frame2 == 1){
StageTask;
}
if(GetPoint >= 150 && normpoint == 150){
SetNormPoint(400);
normpoint = 400;
ExtendPlayer(1);
}
if(GetPoint >= 400 && normpoint == 400){
SetNormPoint(900);
normpoint = 900;
ExtendPlayer(1);
}
if(GetPoint >= 900 && normpoint ==900){
SetNormPoint(9999);
normpoint = 9999;
ExtendPlayer(1);
}
rotation++;
rotation2++;
if(GetCommonData("HelloBoss") == 3){
redfog++;
}
if(GetCommonData("HelloBoss") == -3){
redfog--;
}
if(GetCommonData("HelloBoss") == 4){
greenfog++;
}
if(GetCommonData("HelloBoss") == -4){
greenfog--;
}
if(GetCommonData("HelloBoss") == 5){
bluefog++;
}
if(GetCommonData("HelloBoss") == -5){
bluefog--;
}
}
@BackGround
{
if(rotation > 255 *2){
rotation = 0;
}
if(rotation2 > 255 *4){
rotation2 = 0;
}
SetFog(500 , 2500 , redfog, greenfog, bluefog);
WriteZBuffer(true);
UseZBuffer(true);
SetRenderState(ALPHA);
SetViewTo(250 , 0 , 0 );
SetViewFrom( 1500 , 0, 15 );
SetPerspectiveClip(10,2000);
SetGraphicAngle(90, 90, 0);
SetGraphicRect(1 , 1- rotation, 255 *6 , 255 * 6- rotation);
SetTexture(imagefile2);
// SetColor(200,200,200);
SetGraphicScale(2,2);
DrawGraphic3D( -150, -5 , -50);
SetTexture(imagefile);
SetGraphicRect(1 , 1, 255 *6 , 255 * 6);
SetGraphicAngle(0, 90, 180);
SetAlpha(255);
DrawGraphic3D( -250, sin(frame2 /2) *7, sin(frame2 /2) *7);
SetTexture(imagefile3);
SetGraphicRect(258,1,490,254);
DrawGraphic3D( rotation *5 -1000, 900 - rotation, -100 );
DrawGraphic3D( rotation *6 -1000, 1000 - rotation, 100 );
DrawGraphic3D( rotation2 *5 -1000, 1100 - rotation2 *1.2, -120 );
DrawGraphic3D( rotation2 *6 -1000, 1000 - rotation2, 80 );
}
@Finalize
{
DeleteGraphic(imagefile);
}
}
The solution is simple... just delete this DeleteGraphic line at @Finalize of the anchor script.yeah i did that, however it still stopped checking for a while after the 1st anchor so i dunno what happened, it's like it only wants to check when it wants
Basically 1 anchor poofs and the others dont poof for a while, then another poofs and then the others dont poof, and so on kinda hard to explain X_X
Edit: Is there a command that makes all the bullets dissapear from the screen without converting them to items?
windows gives an error .
when i disable the whole stage task, the stage works normally but nothing happens.
Basically 1 anchor poofs and the others dont poof for a while, then another poofs and then the others dont poof, and so on kinda hard to explain X_X
Edit: Is there a command that makes all the bullets dissapear from the screen without converting them to items?
#TouhouDanmakufu
#Title[OMFG]
#Text[...Which isn't even a PATTERN.]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = "script\img\ExRumia.png";
let frame = -180;
let frame2 = -180;
let spread = 0;
let trap = 60;
function se(sound) {
loop(10) { yield; }
PlaySE(sound);
}
@Initialize {
SetLife(2400); SetDamageRate(40, 0);
SetEnemyMarker(true);
LoadGraphic(BossImage);
SetTexture(BossImage);
SetGraphicRect(0, 0, 64, 64);
SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
CutIn(KOUMA,"「Danmakufu Paranoia」", "", 0, 0, 0, 0);
SetScore(1000000); SetDurableSpellCard;
}
@MainLoop {
SetCollisionA(GetX, GetY, 32); //32 for boss, 10 for fairy
SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
if(frame == 30) {
spread=rand(-5, 5);
se("se\11\se_tan01.wav");
CreateShot01(GetX, GetY, 1, GetAngleToPlayer+spread, ORANGE02, 10);
ascent(i in 0..15) {
CreateShot01(GetX, GetY, 1, GetAngleToPlayer+i*6+spread, ORANGE02, 10);
CreateShot01(GetX, GetY, 1, GetAngleToPlayer-i*6+spread, ORANGE02, 10);
}
frame = 0;
}
if(frame2 == 3) {
se("se\11\se_kira01.wav");
function paranoia(angle) {
CreateShot01(GetPlayerX+100*cos(angle), GetPlayerY+100*sin(angle), 1, atan2(GetPlayerY-(GetPlayerY+100*sin(angle)), GetPlayerX-(GetPlayerX+100*cos(angle)))-15, WHITE01, 10);
}
loop(3) {
paranoia(rand(0, 360));
}
frame2 = 0;
}
frame++;
frame2++;
yield;
}
@DrawLoop {
SetTexture(BossImage);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(BossImage);
}
}
Also, if there are any mistakes, then fix them and ...please tell me what I did wrong while making an exact copy of Koishi's SC. O_o Did I put this in the wrong place? :V
#TouhouDanmakufu
#Title[OMFG]
#Text[...Which isn't even a PATTERN.]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = "script\img\ExRumia.png";
let frame = -180;
let frame2 = -180;
function se(sound) {
loop(10) { yield; }
PlaySE(sound);
}
@Initialize {
SetLife(2400);
SetDamageRate(40, 0);
SetEnemyMarker(true);
LoadGraphic(BossImage);
SetTexture(BossImage);
SetGraphicRect(0, 0, 64, 64);
SetMovePosition02(GetCenterX, GetClipMinY+120, 60);
CutIn(KOUMA,"?Danmakufu Paranoia?", "", 0, 0, 0, 0);
SetScore(1000000);
SetDurableSpellCard;
}
@MainLoop {
let rm = rand_int(0, 260);
SetCollisionA(GetX, GetY, 32); //32 for boss, 10 for fairy
SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
if(frame == 30) {
se("se\11\se_tan01.wav");
ascent(i in 0..15) {
CreateShot01(GetX, GetY, 0.8, GetAngleToPlayer - 42 + (i*6), WHITE02, 1);
}
}
if(frame == 60) {
se("se\11\se_tan01.wav");
ascent(i in 0..16) {
CreateShot01(GetX, GetY, 0.8, GetAngleToPlayer - 45 + (i*6), WHITE02, 10);
}
frame = 0;
}
if(frame2>=0){
let r = rand(40, 60);
let a = rand(0, 360);
CreateShotA(0, GetPlayerX + r*cos(a), GetPlayerY + r*sin(a), 10);
SetShotDataA(0, 0, 2, a + rand(90, 120), ((2*(3.1415)*r)/4)/60, -0.025, 0, PURPLE31);
SetShotDataA(0, 80, 0, NULL, 0, 0, 0, PURPLE31);
SetShotKillTime(0, 90);
FireShot(0);
}
if(rm==20){
SetMovePosition03(GetPlayerX + rand(-30, 30), GetClipMinY+rand(120, 160), 10, 0.5);
}
frame++;
frame2++;
}
@DrawLoop{
SetTexture(BossImage);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(BossImage);
}
}
#TouhouDanmakufu
#Title[Symbol - Danmaku Paranoia]
#Text[Description]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main
{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let Sprite = "script\img\ExRumia.png";
@Initialize
{
shotinit;
LoadGraphic(Sprite);
SetInvincibility(60);
SetLife(1000);
SetDamageRate(10, 0);
SetTimer(60);
SetEnemyMarker(true);
SetScore(100000);
CutIn(YOUMU, "Symbol - Danmaku Paranoia", 0, 0, 0, 0, 0);
SetEffectForZeroLife(60,60,0);
Concentration01(120);
maintask;
}
task maintask
{
SetMovePosition02(GetCenterX, GetCenterY-120, 60);
Wait(90);
let delay = 96;
kunai;
loop
{
ascent(i in -4..5){CreateShot01(GetX,GetY,0.8,GetAngleToPlayer+i*11,WHITE02,10);}
Wait(delay);
ascent(i in -4..4){CreateShot01(GetX,GetY,0.8,GetAngleToPlayer+5.5+i*11,WHITE02,10);}
Wait(delay);
if (delay > 24){delay -= 8;}
else{SetDamageRate(30, 0);}
}
}
task kunai
{
loop
{
let angle = rand(0,360);
let r = rand(48, 64);
CreateShotA(0,GetPlayerX+cos(angle)*r,GetPlayerY+sin(angle)*r,10);
SetShotDataA(0, 0, 2, angle + rand(90, 120), ((2*(3.1415)*r)/4)/60, -0.025, 0, PURPLE31);
SetShotDataA(0,100,0,NULL,0,0,0,PURPLE31);
SetShotKillTime(0,121);
CreateShotA(1,0,0,10);
SetShotDataA(1,0,0,0,0,0,0,PURPLE31);
SetShotKillTime(1,10);
AddShot(120,0,1,0);
FireShot(0);
Wait(4);
}
}
function Wait(t)
{
loop(t){yield;}
}
@MainLoop
{
if (OnBomb == false){SetCollisionA(GetX,GetY,32);}
SetCollisionB(GetX,GetY,24);
yield;
}
@DrawLoop
{
SetTexture(Sprite);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(0,0,64,64);
DrawGraphic(GetX,GetY);
}
@Finalize
{
DeleteGraphic(Sprite);
}
}
#TouhouDanmakufu
#Title[Moon-Metal Sign "Sunshine reflector"]
#Text[The danmaku version of the card with same name in SWR]
#Player[FREE]
#BackGround[User()]
#BGM[script\Patchouli\bgm\lockedgirl.wav]
#ScriptVersion[2]
script_enemy_main {
let frame = -120;
let bg = "script\Patchouli\images\Bossbggrey.jpg";
let random;
let i;
let j;
let radius;
let bullets=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
let laser=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
let size=0;
let angle=0;
#include_function "..\drawing.txt"
@Initialize {
SetLife(1500);
SetTimer(60);
SetScore(1000000);
SetDamageRate(25,0);
SetMovePosition02(GetCenterX, GetClipMinY+120, 120);
SetInvincibility(120);
Concentration01(120);
PlaySE("script\Patchouli\SFX\Charge.wav");
CutIn(YOUMU, "Moon-Metal Sign "\""Sunshine reflector"\", "", 0, 0, 0, 0);
LoadGraphic(ImgBoss);
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 64, 64);
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if(frame==60){
ascent(i in 0..6){
ascent(j in 0..2){
Laser(60, 0, GetAngleToPlayer+i*60, -120*j, 60, 0, 60, 1+j);
}
ascent(j in 0..2){
Laser(60, 60*3^0.5, GetAngleToPlayer+i*360/6, 120*j, 60, 10, 60, 2);
Laser(30, 90*3^0.5, GetAngleToPlayer+i*360/6, 180-120*j, 60, 20, 60, 1);
}
Laser(150, -30*3^0.5, GetAngleToPlayer+i*60, 0, 60, 30, 60, 1);
}
}
if(frame%75==0&&frame>75){
random=rand(0,360);
ascent(i in 0..8){
ShootBullet(GetX, GetY, 1.5, random+i*360/8, 10);
}
}
if(frame%20==0&&frame>120){
ascent(i in 0..12){
CreateShot01(GetX, GetY, 1, angle+i*30, 253, 10);
}
angle+=3.7;
}
frame++;
yield;
}
@DrawLoop {
bossSC;
}
@BackGround{
backgroundSC;
}
task Laser(x,y,slant,angle,length,delay,delay2,type){
loop(delay){yield;}
let obj=Obj_Create(OBJ_LASER);
let no;
let type2=type;
Obj_SetPosition(obj, GetX+cos(slant)*x-y*sin(slant), GetY+sin(slant)*x+y*cos(slant));
Obj_SetAngle(obj, slant+angle);
Obj_SetSpeed(obj, 0);
ObjLaser_SetLength(obj, length);
ObjLaser_SetWidth(obj, 10);
ObjLaser_SetSource(obj, false);
Obj_SetCollisionToObject(obj,true);
bullets[size]=obj;
laser[size]=type2;
no=size;
size++;
if(type2%3==0){
ObjShot_SetGraphic(obj, 160);
}
if(type2%3==1){
ObjShot_SetGraphic(obj, 158);
}
if(type2%3==2){
ObjShot_SetGraphic(obj, 153);
}
ObjShot_SetDelay (obj, delay2);
while(Obj_BeDeleted(obj)==false){
yield;
}
}
task ShootBullet(x,y,v,angle,delay){
loop(delay){yield;}
let obj=Obj_Create(OBJ_SHOT);
let frame2=0;
let count=5;
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, 11);
Obj_SetCollisionToObject(obj,true);
while(Obj_BeDeleted(obj)==false&&count>0){
ascent(i in 0..size){
if(Collision_Obj_Obj(obj, bullets[i])&&frame2>20){
if(laser[i]==1||laser[i]==2){
Obj_SetAngle(obj, 2*Obj_GetAngle(bullets[i])-Obj_GetAngle(obj));
}
if(laser[i]%3==2){
ascent(i in -4..5){
CreateShot01(Obj_GetX(obj), Obj_GetY(obj), 1.5, Obj_GetAngle(obj)+i*12, 43, 10);
}
}
count--;
frame2=0;
}
}
frame2++;
yield;
}
}
@Finalize {
finalize;
}
}
@Frazer:
Are you coding with tasks? If you delcare all your variables in a task then your object bullets will not be replaced, since tasks have their own scope (let obj = Obj_Create(OBJ_SHOT);, etc. will only exist inside of that task). If you're just using the @MainLoop to create and spawn the object bullets then you'll need to keep track of them using an array, then call out the specific one you want to use when you want to use it. Kind of need to see your code.
A spellcard has SetScore(..); and usually CutIn(..); declared somewhere in the file. A regular attack has neither.
#TouhouDanmakufu
#Title[Scarlet Gensokyo Object]
#Text[Test script]
#Player[FREE]
#BGM[.\Remilia.mp3]
#ScriptVersion[2]
script_enemy_main {
let ImgBoss = GetCurrentScriptDirectory ~ "img\ExRumia.png";
let count = -60;
task Spawn(x, y, v, angle, angular) {
let obj=Obj_Create(OBJ_SHOT);
let obj2=Obj_Create(OBJ_SHOT);
let move=0;
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, RED03);
while(Obj_BeDeleted(obj)==false){
let wave=false;
if(count >= 60 && count <= 180 && count%5 == 0){
Obj_SetPosition(obj2, Obj_GetX(obj), Obj_GetY(obj));
Obj_SetAngle(obj2, rand(0, 360));
Obj_SetSpeed(obj2, 0);
ObjShot_SetGraphic(obj2, RED01);
}
if(count == 240){
wave = true;
}
if(count == 245){
wave = false;
}
if(!wave == true){
Obj_SetSpeed(obj2, 1);
ObjShot_SetGraphic(obj2, PURPLE01);
}
yield;
}
}
@Initialize {
SetLife(2500);
SetTimer(60);
SetScore(10000000);
SetEnemyMarker(true);
SetMovePosition02(225, 120, 60);
LoadGraphic(ImgBoss);
SetGraphicRect(0, 0, 64, 64);
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
if(count == 60) {
Spawn(GetX, GetY, 3, 0, 0);
}
count++;
}
@DrawLoop {
SetTexture(ImgBoss);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(ImgBoss);
}
}
#TouhouDanmakufu
#Title[Flower Test]
#Text[????]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = "script\img\ExRumia.png";
let frame = -60;
let a = 0;
let num = 10;
let graphic = [RED12, ORANGE12, YELLOW12, GREEN12, AQUA12, BLUE12, PURPLE12, WHITE12];
@Initialize {
SetLife(2400);
SetDamageRate(40, 0);
SetEnemyMarker(true);
LoadGraphic(BossImage);
SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
CutIn(KOUMA,"「花の色は良いですか?」", "", 0, 0, 0, 0);
SetScore(1000000);
SetDurableSpellCard;
}
@MainLoop {
SetCollisionA(GetX, GetY, 32); //32 for boss, 10 for fairy
SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
if(frame == 90) {
loop(num) {
ascent (i in 0..8) {
ascent (j in 0..8) {
CreateShot01(GetX, GetY, 0.75*(i+j*0.5)+1, a+i*2.75, graphic[j], 10);
CreateShot01(GetX, GetY, 0.75*(i+j*0.5)+1, a-i*2.75, graphic[j], 10);
}
}
a+=360/num;
}
a+=9.5;
frame = 0;
}
frame++;
}
@DrawLoop {
SetTexture(BossImage);
SetGraphicRect(0, 0, 64, 64);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(BossImage);
}
}
While working on my Halloween Contest entry, I was fiddling with the BGM for a spellcard, and found that the MP3 I'm using doesn't work when I call it with #BGM. Strange, because a test spellcard I made the other day also uses an MP3, and that track works just fine.I've never gotten a .mp3 to work and somehow it works when converted to .wav, maybe you can try that.
Should I find a different MP3, or come back to that later?
I've never gotten a .mp3 to work and somehow it works when converted to .wav, maybe you can try that.I tried a freeware converter I found, and not only did it not work, but it magically changed the file size from 4.5 MB to 30 MB. :V
#TouhouDanmakufu
#Title[Water Sign [Flowing Current]]
#Text[]
#BackGround[Default]
#PlayLevel[Probably Hard]
#ScriptVersion[2]
script_enemy_main{
let frame = 0;
let count = 0;
let angle2 = 15;
let count2 = 0;
#include_function "lib\ExpandedShotData\shot_replace.dnh";
@Initialize{
SetLife(8000);
SetScore(100000);
SetMovePosition01(GetCenterX, GetCenterY - 60, 3);
SetInvincibility(300);
CutIn(YOUMU, "Water Sign [Flowing Current]", 0, 0, 0, 0, 0);
shotinit;
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame+=5;
count++;
count2++;
if(count==2){
CreateShot01(GetX, GetY, 2, frame+GetAngleToPlayer, SP02, 0);
CreateShot01(GetX, GetY, 2, 0-frame+GetAngleToPlayer, SP02, 0);
count=0;
}
if(count2==72){
loop(30){
CreateShot01(GetX, GetY, 2, GetAngleToPlayer-angle2, WHITE02, 0);
angle2--;
}
angle2=15;
count2 =0;
}
}
@DrawLoop{}
@Finalize{}
@BackGround{}
}//end script
And now it doesn't call the extra bullets that are in that shotdata and raises and error ^^
While working on my Halloween Contest entry, I was fiddling with the BGM for a spellcard, and found that the MP3 I'm using doesn't work when I call it with #BGM. Strange, because a test spellcard I made the other day also uses an MP3, and that track works just fine.
Should I find a different MP3, or come back to that later?
Can somebody tell me about the usage of "~" character in Danmakufu?
It keeps giving me errors about "SP02"
So far i've managed mp3s to work, i usually record a "video?" with Hypercam or rip videos off youtube with the sound i want, then i put it into windows movie maker on the external audio portion and save it, so it saves as .wma then i use a freeware .wma > mp3 converter, and with that so far all mp3s have worked. (Note: when i just change the extension wma > mp3 without applying a converter it doesnt work, maybe that was the problem with yours?)It turns out that the problem with my mp3 was that I had an extra LoadGraphic statement. Not sure why that interfered, but my BGM works now.
I thought it didn't have a shot replace ???
It doesn't therefor you should learn to spawn them by ID :V
ascent( (variable) in (first value)..(limit value) ) {
(statements)
}
variable++;
but with a starting and ending limit, right?Edit: Infinite?!. If you could do that, the program would freeze because it has to do infite things in a single frame. What exactly do you want to accomplish..?
Um, I don't think there is, but it sounds like whatever you want to accomplish would be easier if you just had a task with a while(GetEnemyLife>0){ *stuff* } that gets called during @Initialize and that includes a yield; and a variable increment.
Also, if you really need to go to a point where the program doesn't execute your orders anymore because you give it too many per frame, I think it may be time to reconsider the script you are trying to make.
Obj_SetPosition(obj, Obj_GetX(obj) + speed*cos(angle), Obj_GetY(obj) + speed*sin(angle) );
#TouhouDanmakufu
#Title[new74570253]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let frame2 = 0;
let angle = 0;
let ahoaha = 0;
let n = rand(0, 360);
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY,0);
SetTimer(90);
shotinit;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%70==0){
CreateLaserA(0, GetX, GetY, 400, 60, BLUE60, 30);
SetLaserDataA(0, 0, GetAngleToPlayer, 0, 0, 1, 180);
SetLaserDataA(0, 30, NULL, 0, 0, 0, 180);
SetShotKillTime(0, 60);
FireShot(0);
CreateLaserA(1, GetX, GetY, 400, 60, BLUE60, 30);
SetLaserDataA(1, 0, GetAngleToPlayer, 0, 0, -1, 180);
SetLaserDataA(1, 30, NULL, 0, 0, 0, 180);
SetShotKillTime(1, 60);
FireShot(1);
AddShot(50, 0,2, 30);
CreateShotA(2, 0, 0, 0);
SetShotDataA(2, 0, 3, rand(0, 360), 1, 0, 0, AQUA02);
AddShot(50, 1,3, 30);
CreateShotA(3, 0, 0, 0);
SetShotDataA(3, 0, 3, rand(0, 360), 1, 0, 0, AQUA02);
}}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
}
why isn't the lasers firing the bullets?ive messed around with it for days and i cant figure it out.Code: [Select]#TouhouDanmakufu
#Title[new74570253]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let frame2 = 0;
let angle = 0;
let ahoaha = 0;
let n = rand(0, 360);
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY,0);
SetTimer(90);
shotinit;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%70==0){
CreateLaserA(0, GetX, GetY, 400, 60, BLUE60, 30);
SetLaserDataA(0, 0, GetAngleToPlayer, 0, 0, 1, 180);
SetLaserDataA(0, 30, NULL, 0, 0, 0, 180);
SetShotKillTime(0, 60);
FireShot(0);
CreateLaserA(1, GetX, GetY, 400, 60, BLUE60, 30);
SetLaserDataA(1, 0, GetAngleToPlayer, 0, 0, -1, 180);
SetLaserDataA(1, 30, NULL, 0, 0, 0, 180);
SetShotKillTime(1, 60);
FireShot(1);
AddShot(50, 0,2, 30);
CreateShotA(2, 0, 0, 0);
SetShotDataA(2, 0, 3, rand(0, 360), 1, 0, 0, AQUA02);
AddShot(50, 1,3, 30);
CreateShotA(3, 0, 0, 0);
SetShotDataA(3, 0, 3, rand(0, 360), 1, 0, 0, AQUA02);
}}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
}
BLEGH
Ok shotdata V4 isn't working for me.
How do I brighten up a bullet ingame?
render = ADD
in the shot replacement script. @MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if (frame == 0) {
let ID = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(ID, Texture);
ObjEffect_SetPrimitiveType(ID, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(ID, 4);
ObjEffect_SetVertexXY(ID, 0, 150, 0);
ObjEffect_SetVertexXY(ID, 1, 234, 0);
ObjEffect_SetVertexXY(ID, 2, 150, 448);
ObjEffect_SetVertexXY(ID, 3, 234, 448);
ObjEffect_SetVertexUV(ID, 0, 0, 0);
ObjEffect_SetVertexUV(ID, 1, 84, 0);
ObjEffect_SetVertexUV(ID, 2, 0, 448);
ObjEffect_SetVertexUV(ID, 3, 84, 448);
ObjEffect_SetVertexColor(ID, 0, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 1, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 2, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 3, 150, 150, 0, 150);
}
if (frame == 120) {
Obj_Delete(ID);
frame = -120;
}
frame++;
}
The error in question would be the Obj_Delete(ID) near the end. The only reason I can think of for it messing up is that it's in a different if statement, but I can't just let the object stack on top of itself for the entire script. Any advice?
So, effect objects. It's my first time using them, so I've been sure to read how the functions work and everything. I decided to test a script, and got an error. Here's the MainLoop from my code; it's really the only relevant part:
code goes here
The error in question would be the Obj_Delete(ID) near the end. The only reason I can think of for it messing up is that it's in a different if statement, but I can't just let the object stack on top of itself for the entire script. Any advice?
task effect {
let ID = Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(ID, Texture);
ObjEffect_SetPrimitiveType(ID, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(ID, 4);
ObjEffect_SetVertexXY(ID, 0, 150, 0);
ObjEffect_SetVertexXY(ID, 1, 234, 0);
ObjEffect_SetVertexXY(ID, 2, 150, 448);
ObjEffect_SetVertexXY(ID, 3, 234, 448);
ObjEffect_SetVertexUV(ID, 0, 0, 0);
ObjEffect_SetVertexUV(ID, 1, 84, 0);
ObjEffect_SetVertexUV(ID, 2, 0, 448);
ObjEffect_SetVertexUV(ID, 3, 84, 448);
ObjEffect_SetVertexColor(ID, 0, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 1, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 2, 150, 150, 0, 150);
ObjEffect_SetVertexColor(ID, 3, 150, 150, 0, 150);
while(Obj_BeDeleted(ID) == false){
if(frame == 120){
Obj_Delete(ID);
frame = -120;
}
yield;
}
}
if(frame == 0){
effect;
}
if(count%5 == 0 && count >=60 && count <=120){
CreateShotA(0, GetX, GetY, 10);
SetShotDataA(0, 0, 2, 90, 0, 0, 0, RED01);
SetShotDataA(0, 180-count, 2, 180, 0, 0, 0, RED01);
FireShot(0);
}
ascent(i in 0..13){
CreateShotA(0, GetX, GetY, i*5+10);
SetShotDataA(0, 0, 2, 90, 0, 0, 0, RED01);
SetShotDataA(0, 120-i*5, 2, 180, 0, 0, 0, RED01);
FireShot(0);
}
I asked this a little while ago but got no response (sorry if it seems like I'm attention hogging; this just seems like it should be very simple, yet I can't find the answer). Is there any way to remove or replace the default sound effect made by destroyed enemies (the one that sounds like paper ripping)? Also, is there a way to make the enemy do something when destroyed by your character, but not when you call VanishEnemy? @Finalize{} seems to run for both.
@Finalize { if(!BeVanished) { DoSomething(put, parameters, here); } }
Default Sound effect for destroyed enemy would be found in your se folder. Then put in a "seEnemyExplode01.wav" which is whatever sound you want to be played when your enemy is defeated.Is there any way to do that without telling the user of the script to put this file in that directory (I.E., somehow override the file with something from the script directory)? If not, it's not too big of a deal, but it would simplify things a little. As for the other answer, thanks, I must have overlooked that function when going through the list...
Is there any way to do that without telling the user of the script to put this file in that directory (I.E., somehow override the file with something from the script directory)?
May I ask about original image file from th_dnh.dat in danmakufu?
I look in old thread and find that I can change GUI by replace new file in img / sfx danmakufu root folder. So I think about change something a bit.
Working with 32*32 grid number png feel like trapped in reimu's last spell.
By the way, is there a way to make Byakuren's & Shinki's Curved Laser (Fixed position)?
oh, there is a thread about this, but it is quite hard to do the puzzle, in fact. (none of us had considerable result of that)
By the way, is there a way to make Byakuren's & Shinki's Curved Laser (Fixed position)?
task byaphase
{
let angle = 0;
let anglechange = 0.5;
loop
{
CreateShot01(GetX-64,GetY-96,4,angle+95,BLUE21,30); //top left
CreateShot01(GetX-64,GetY-96,4,angle+155,BLUE21,30);
CreateShot01(GetX-64,GetY-96,4,angle+35,BLUE21,30);
CreateShot01(GetX+64,GetY-96,4,-angle+85,BLUE21,30); //top right
CreateShot01(GetX+64,GetY-96,4,-angle+145,BLUE21,30);
CreateShot01(GetX+64,GetY-96,4,-angle+25,BLUE21,30);
CreateShot01(GetX-128,GetY+32,4,-angle+80,BLUE21,30); //bottom left
CreateShot01(GetX-128,GetY+32,4,-angle+140,BLUE21,30);
CreateShot01(GetX-128,GetY+32,4,-angle+20,BLUE21,30);
CreateShot01(GetX+128,GetY+32,4,angle+100,BLUE21,30); //bottom right
CreateShot01(GetX+128,GetY+32,4,angle+160,BLUE21,30);
CreateShot01(GetX+128,GetY+32,4,angle+40,BLUE21,30);
if (angle > 12 || angle < -12){anglechange = -anglechange;}
angle += anglechange;
loop(4){yield;}
}
}
#TouhouDanmakufu
#Title[Sakuya Scarlet]
#Text[Remilia Izayoi]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = "script\img\ExRumia.png";
let IsSelectingColour = true; let delaystart = -120;
let startingplayercoordinates = [GetPlayerX, GetPlayerY];
let destinycolour = 0; let destinytext = ["Red", "Orange", "Yellow", "Green", "Aqua", "Blue", "Purple", "White"];
let destinyfont = [[255, 0, 0], [255, 192, 128], [255, 255, 0], [0, 255, 0], [128, 192, 255], [0, 0, 255], [255, 0, 255], [255, 255, 255]];
let frame = -180;
let a = rand(0, 360);
let num = 5;
let graphic_knife = [RED32, ORANGE32, YELLOW32, GREEN32, AQUA32, BLUE32, PURPLE32, WHITE32];
let graphic_bubble = [RED03, ORANGE03, YELLOW03, GREEN03, AQUA03, BLUE03, PURPLE03, WHITE03];
@Initialize {
SetLife(2400); SetDamageRate(40, 0);
SetEnemyMarker(true);
SetTimer(60);
LoadGraphic(BossImage);
SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
CutIn(KOUMA,"「Destiny-Defined Colour」", "", 0, 0, 0, 0);
SetScore(1000000); SetDurableSpellCard;
}
@MainLoop {
if(frame > 0) {
loop(num) {
CreateShot01(GetX, GetY, 3, a+rand(-3, 3), graphic_knife[destinycolour], 10);
CreateShot01(GetX, GetY, 3, -a+rand(-3, 3), graphic_knife[destinycolour], 10);
a+=360/num;
}
a+=num/2+3;
}
if(frame == 180) {
loop(40) {
CreateShot01(GetX, GetY, 3, a, graphic_bubble[destinycolour], 10);
a+=360/40;
}
}
if(frame == 180) {
frame = -120;
a = rand(0, 360);
SetMovePosition03(rand(GetClipMinX+50, GetClipMaxX-50), rand(GetClipMinY+50, GetCenterY-50), 10, 2);
}
if(IsSelectingColour) {
SetTimer(GetTimer+1); ForbidShot(true); ForbidBomb(true);
SetPlayerX(startingplayercoordinates[0]); SetPlayerY(startingplayercoordinates[1]);
if(GetKeyState(VK_DOWN) == KEY_PUSH) { destinycolour++; }
if(GetKeyState(VK_UP) == KEY_PUSH) { destinycolour--; }
if(destinycolour < 0) { destinycolour = 0; } if(destinycolour > 7) { destinycolour = 7; }
if(GetKeyState(VK_SHOT) == KEY_PUSH && delaystart >= 0){ ForbidShot(false); ForbidBomb(false); IsSelectingColour = false; }
if(delaystart < 60) { delaystart++; }
}
if(!IsSelectingColour) {
SetCollisionA(GetX, GetY, 32); //32 for boss, 10 for fairy
SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
frame++;
}
}
@DrawLoop {
if(IsSelectingColour) {
DrawText("Select Colour.", GetClipMaxX/4, GetClipMaxY*3/4-12, 12, 255);
SetFontColor(destinyfont[destinycolour][0], destinyfont[destinycolour][1], destinyfont[destinycolour][2], destinyfont[destinycolour][0], destinyfont[destinycolour][1], destinyfont[destinycolour][2]);
DrawText(destinytext[destinycolour], GetClipMaxX/4, GetClipMaxY*3/4, 24, 255);
}
SetFontColor(destinyfont[destinycolour][0], destinyfont[destinycolour][1], destinyfont[destinycolour][2], destinyfont[destinycolour][0], destinyfont[destinycolour][1], destinyfont[destinycolour][2]);
DrawText("海龍 爾夜知", 40, 36, 12, 255);
SetTexture(BossImage);
SetGraphicRect(0, 0, 64, 64);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(BossImage);
}
}
Rate. Now. Is tidiness even necessary when you make a game??If you want other people to understand what the hell you're doing/you to understand when you come back to it later, yes.
It's honestly stupidly random and unnecessarily hard. I like how you experimented with the colors, but the vibe just isn't there for me.
Assuming you're not talking about the actual curved lasers (which are made with LaserC functions):Code: [Select]task byaphase
{
let angle = 0;
let anglechange = 0.5;
loop
{
CreateShot01(GetX-64,GetY-96,4,angle+95,BLUE21,30); //top left
CreateShot01(GetX-64,GetY-96,4,angle+155,BLUE21,30);
CreateShot01(GetX-64,GetY-96,4,angle+35,BLUE21,30);
CreateShot01(GetX+64,GetY-96,4,-angle+85,BLUE21,30); //top right
CreateShot01(GetX+64,GetY-96,4,-angle+145,BLUE21,30);
CreateShot01(GetX+64,GetY-96,4,-angle+25,BLUE21,30);
CreateShot01(GetX-128,GetY+32,4,-angle+80,BLUE21,30); //bottom left
CreateShot01(GetX-128,GetY+32,4,-angle+140,BLUE21,30);
CreateShot01(GetX-128,GetY+32,4,-angle+20,BLUE21,30);
CreateShot01(GetX+128,GetY+32,4,angle+100,BLUE21,30); //bottom right
CreateShot01(GetX+128,GetY+32,4,angle+160,BLUE21,30);
CreateShot01(GetX+128,GetY+32,4,angle+40,BLUE21,30);
if (angle > 12 || angle < -12){anglechange = -anglechange;}
angle += anglechange;
loop(4){yield;}
}
}
You may want to tweak the positions they spawn from and the exact angle, but this matches fairly well.
Question ze:
I am trying to fool around with custom life bars by creating a function for it. However my math is amazing as ever and can't get the size proportions right. It is like this:
Enemy Life is, let's say: 1000. The static size of the lifebar is ALWAYS 300 pixels long. Now depending on a math function I have to convert the 1000 life to equal size of 300. Meaning if the enemy takes 100 damage, the life bar has to decrease with the same %. Eventually if the enemy life hits 0, the lifebar should be 0 pixels wide as well.
But I keep messing up the math , either my lifebar is shrinking too slow or too fast >.<
enemy_script_main{
let maxLife;
let currentLife;
let percentage;
let lifeBarLeft;
@Initialize{
SetLife(1000);
maxLife = GetEnemyLife();
CustomLifeBar;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@Finalize{
}
task CustomLifeBar{
currentLife = GetEnemyLife();
percentage = currentLife/maxLife;
lifeBarLeft = ceil(300*percentage);
//Do stuff with lifeBarLeft which now stores how many pixels your life bar should be.
yield;
}
}
SetLength(healthbar, 300-((300/totallife)*GetLife());
And just run it every frame.--- Declaring above maxLife and inside @initialize before calling hpBar I do maxLife = GetEnemyLife;
--- function
// hp life
task hpBar{
// vars
let lifebarSize = 0;
let lifebarReady = 0;
let enyLife;
let hpp; // hp percentage
let nhp; // new hp (updated aka left over)
let obj = Obj_Create(OBJ_EFFECT);
// effect functions etc.
ObjEffect_SetTexture(obj,lifebar);
Obj_SetPosition(obj,40,40);
ObjEffect_SetLayer(obj,7);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
while(! Obj_BeDeleted(obj)) {
// requires to be inside loop for update
ObjEffect_SetVertexXY(obj, 0, 0, -4);
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexXY(obj, 1, lifebarSize, -4);
ObjEffect_SetVertexUV(obj, 1, 128, 0);
ObjEffect_SetVertexXY(obj, 2, 0, 4);
ObjEffect_SetVertexUV(obj, 2, 0, 32);
ObjEffect_SetVertexXY(obj, 3, lifebarSize, 4);
ObjEffect_SetVertexUV(obj, 3, 128, 32);
if(lifebarSize<300 && lifebarReady == 0){ lifebarSize+=5; } // prepares the lifebar to 300
if(lifebarSize==300){ lifebarReady = 1;} // switch
if(lifebarReady==1){ // start animating it
enyLife = GetEnemyLife;
hpp = enyLife/maxLife;
nhp = ceil(300*hpp);
lifebarSize -= nhp;
}
yield;
}
}
if(lifebarReady==1){ // start animating it
lifebarSize = 300-ceil((300/maxLife)*GetEnemyLife());
}
Let's hope the code I write makes sense without explanation.Code: [Select]enemy_script_main{
let maxLife;
let currentLife;
let percentage;
let lifeBarLeft;
@Initialize{
SetLife(1000);
maxLife = GetEnemyLife();
CustomLifeBar;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@Finalize{
}
task CustomLifeBar{
currentLife = GetEnemyLife();
percentage = currentLife/maxLife;
lifeBarLeft = ceil(300*percentage);
//Do stuff with lifeBarLeft which now stores how many pixels your life bar should be.
yield;
}
}
Enemy starts with 1000. First iteration does this:
hpp = 1000/1000 = 1
nhp = ceil(300*1) = 300
lifebarSize = 300 - 300 = 0
You also shouldn't need another variable for GetEnemyLife if it does it every frame. If this code works you can break it into separate variables if you want.Code: [Select]if(lifebarReady==1){ // start animating it
lifebarSize = 300-ceil((300/maxLife)*GetEnemyLife());
}
PLEASE WAIT WARMLY AS I ATTEMPT AGAIN ( hits head against the desk a few times )I tried it too, but the effect obbject doesn't shrink. Am I doing something wrong?
Edit: the lifebar bar now jumps suddenly to some unknown location lol. Like diagonal. What the hell ?
Edit2: %$#FAFADADASD ** goes to boot laptop and copy the code over from there **
What, "enemy_script_main"? No!
Anyways, custom life bar, as in Satori's things at the end?
Make an effect object, declare it's vertices and such and then ObjEffect_SetLayer(obj, 4); or 5 or something.
task DrawTitle
{
let obj=Obj_Create(OBJ_EFFECT);
let alpha = 0;
let x = 100;
ObjEffect_SetTexture(obj,Title);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetLayer(obj,6);
ObjEffect_CreateVertex(obj,4); //Set the 4 corners of the graphic
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,320,0);
ObjEffect_SetVertexUV(obj,2,320,240);
ObjEffect_SetVertexUV(obj,3,0,240);
ObjEffect_SetVertexXY(obj,0,-160,-120); //Set where those corners draw relative to the object
ObjEffect_SetVertexXY(obj,1,160,-120);
ObjEffect_SetVertexXY(obj,2,160,120);
ObjEffect_SetVertexXY(obj,3,-160,120);
while(alpha<255) //while still fading in...
{
ascent(vertex in 0..4){ObjEffect_SetVertexColor(obj,vertex,alpha,255,255,255);} //Updates the object alpha
Obj_SetPosition(obj,x,200);
alpha+=3;
x++;
yield;
}
loop(120) //wait a bit...
{
Obj_SetPosition(obj,x,200);
x++;
yield;
}
while(alpha>0) //while fading out...
{
ascent(vertex in 0..4){ObjEffect_SetVertexColor(obj,vertex,alpha,255,255,255);}
Obj_SetPosition(obj,x,200);
alpha-=3;
x++;
yield;
}
Obj_Delete(obj);
}
task ohjesus{
let l2 = Obj_Create(OBJ_EFFECT); //l2 is the farthest section of the ..., not attached to the ....
ObjEffect_SetTexture(l2, gfs);
ObjEffect_CreateVertex(l2, 4);
ObjEffect_SetRenderState(l2, ALPHA);
ObjEffect_SetPrimitiveType(l2, PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(l2, 0, 79, 12);
ObjEffect_SetVertexUV(l2, 1, 116, 12);
ObjEffect_SetVertexUV(l2, 2, 116, 101);
ObjEffect_SetVertexUV(l2, 3, 76, 101);
let l1 = Obj_Create(OBJ_EFFECT); //l1 is the closest section of the ..., attached to the .... Drawn second so it appears above l2.
ObjEffect_SetTexture(l1, gfs);
ObjEffect_CreateVertex(l1, 4);
ObjEffect_SetRenderState(l1, ALPHA);
ObjEffect_SetPrimitiveType(l1, PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(l1, 0, 11, 12);
ObjEffect_SetVertexUV(l1, 1, 52, 12);
ObjEffect_SetVertexUV(l1, 2, 52, 100);
ObjEffect_SetVertexUV(l1, 3, 11, 100);
let x = 948 - 80; //coordinates of the tip of the ....
let y = 480;
let hy = 100;
let counter = -10;
loop{
counter++;
if(counter>=30 && counter<45){
x-=4;
y-=8;
}
if(counter>=45 && counter<60){
x-=4;
y+=8;
}
if(counter>=90 && counter<105){
x-=4;
y-=8;
}
if(counter>=105 && counter<120){
x-=4;
y+=8;
}
if(counter>=150 && counter<165){
x-=4;
y-=8;
}
if(counter>=165 && counter<180){
x-=4;
y+=8;
}
if(counter>=210 && counter<225){
x-=4;
y-=8;
}
if(counter>=225 && counter<240){
x-=4;
y+=8;
}
if(counter>=270 && counter<285){
x-=4;
y-=8;
}
if(counter>=285 && counter<300){
x-=4;
y+=8;
}
if(counter>=330 && counter<345){
x-=4;
y-=8;
}
if(counter>=345 && counter<360){
x-=4;
y+=8;
}
if(counter>=440 && counter<455){
x-=6;
y-=6;
}
if(counter>=455 && counter<460){
x-=6.5;
y-=2;
}
let ang = atan2(y - kingy, x - kingx); //Angle from the ... to the tip of the ....
let x1 = ((kingx + x)/2) + (((hy^2) - ((kingx + x)/2))^0.5)*cos(ang + 90); //X coordinate of the ....
let y1 = ((kingy + y)/2) + (((hy^2) - ((kingy + y)/2))^0.5)*sin(ang + 90); //Y coordinate of the ....
let ang1 = atan2(y1 - kingy, x1 - kingx); //Angle from the ... to the ....
let ang2 = atan2(y - y1, x - x1); //Angle from the ... to the tip of the ....
ObjEffect_SetVertexXY(l2, 0, x1 + 20*cos(ang1 - 45), y1 + 20*sin(ang1 - 45));
ObjEffect_SetVertexXY(l2, 1, x1 + 20*cos(ang1 + 45), y1 + 20*sin(ang1 + 45));
ObjEffect_SetVertexXY(l2, 2, kingx + 20*cos(ang1 + 135), kingy + 20*sin(ang1 + 135));
ObjEffect_SetVertexXY(l2, 3, kingx + 20*cos(ang1 + 225), kingy + 20*sin(ang1 + 225));
ObjEffect_SetVertexXY(l1, 0, x1 + 20*cos(ang2 - 95), y1 + 20*sin(ang2 - 95));
ObjEffect_SetVertexXY(l1, 1, x1 + 20*cos(ang2 + 95), y1 + 20*sin(ang2 + 95));
ObjEffect_SetVertexXY(l1, 2, x + 20*cos(ang2 + 135), y + 20*sin(ang2 + 135));
ObjEffect_SetVertexXY(l1, 3, x + 20*cos(ang2 + 225), y + 20*sin(ang2 + 225));
if(((x - GetPlayerX)^2 + ((y - 20) - GetPlayerY)^2)^0.5<20 || ((x1 - GetPlayerX)^2 + (y1 - GetPlayerY)^2)^0.5<20 && variable==1){
ShootDownPlayer;
variable=2;
}
yield;
} //end loop
} //end task
is there a way to have a layered image go down the field? like its scrolling down?DrawGraphic(<x-co>, yvariable);
SetMovePositionHermite(GetCenterX*2-GetX, GetY, 10, 90, 10, -90, 60);
Is there any way (or workaround) to add a 3D background to a plural-script that's more than one layer deep? If there's no way to make it 3D, is there any way to get it multi-layered anyway?
If neither are possible, it's not too big of a deal (I'm making a stage anyway), but it would be nice to use the same background when you choose to just practice the boss.
let RED_GRAPHIC = "lib\Ikareimu\img\RedShield.png";
let BLUE_GRAPHIC = "lib\Ikareimu\img\BlueShield.png";
let ShieldObj;
task CreateShield(
yield;
ShieldObj = Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(ShieldObj, 255);
// GetCurrentColor is a function that gets common data.
// RED and BLUE are variables.
// These are defined in an #include_function so don't worry about them.
if(GetCurrentColor == RED){
ObjEffect_SetTexture(ShieldObj, RED_GRAPHIC);
}
if(GetCurrentColor == BLUE){
ObjEffect_SetTexture(ShieldObj, BLUE_GRAPHIC);
}
Obj_SetCollisionToObject(ShieldObj, true);
ObjEffect_SetRenderState(ShieldObj, ADD);
ObjEffect_CreateVertex(ShieldObj, 4);
ObjEffect_SetPrimitiveType(ShieldObj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(ShieldObj, 0, 1, 1);
ObjEffect_SetVertexUV(ShieldObj, 1, 64, 1);
ObjEffect_SetVertexUV(ShieldObj, 2, 64, 64);
ObjEffect_SetVertexUV(ShieldObj, 3, 1, 64);
while(!Obj_BeDeleted(ShieldObj)){
Shield_update;
Obj_SetPosition(ShieldObj, GetPlayerX, GetPlayerY);
if(GetCurrentColor == RED){
ObjEffect_SetTexture(ShieldObj, RED_GRAPHIC);
}
if(GetCurrentColor == BLUE){
ObjEffect_SetTexture(ShieldObj, BLUE_GRAPHIC);
}
yield;
}
}
@Initialize{
LoadGraphic(RED_GRAPHIC);
LoadGraphic(BLUE_GRAPHIC);
CreateShield;
}
@MainLoop{
yield;
}
Despite your edit, I'll answer your question anyways. ObjEffect_SetVertexUV declares the vertices on your image, ObjEffect_SetVertexXY plots the corresponding vertices on to the Danmakufu field. You're missing the XY portion of an ObjEffect (you're not telling Danmakufu where to draw the image), so nothing is drawn.
Before you say "yes I am", Obj_SetPosition does not work with ObjEffects, nor does Obj_SetAlpha for that matter (to set the alpha value of an ObjEffect, you need to use ObjEffect_SetVertexColor(id, vertex, alpha, red, green, blue); ). A pain in the ass, but setting each vertex also allows you to bend and distort the image however you please. Useful when you get used to it.
#TouhouDanmakufu
#Title[Fantasy Seal Lol not]
#Text[blahblah]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "system\cirno.png";
let cut = CSD ~ "system\cirnocut.png";
let bg = CSD ~ "system\lake.png";
@Initialize{
SetLife(1000);
SetTimer(60);
SetScore(100000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
shotinit;
CutIn(YOUMU,"Holy Amulet -Spread-",cut,0,0,300,384);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,110,110);
SetGraphicScale(0.7,0.7);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
task mainTask{
wait(120);
yield;
fire;
movement;
}
task movement{
loop{
SetMovePosition01(GetCenterX-100,120,5);
wait(120);
SetMovePosition01(GetCenterX+100,120,5);
wait(120);
yield;
}
}
task fire{
let x = 0;
let dir = 0;
let dira = 0;
loop{
while(x<36){
CreateShotA(1,GetEnemyX+75*cos(dir),GetEnemyY+75*sin(dir),30);
SetShotDataA(1,0,0,dir,0,0,0,RED01);
SetShotDataA(1,60,2,dir,0.5,0,2,YELLOW01);
FireShot(1);
CreateShotA(2,GetEnemyX+75*sin(dir),GetEnemyY+75*cos(dir),30);
SetShotDataA(2,0,0,dira,0,0,0,YELLOW01);
SetShotDataA(2,60,2,dira,-0.5,0,2,RED01);
FireShot(2);
}
dir+=360/36;
dira-=360/36;
x++;
x = 0;
dir = 0;
dira = 0;
wait(60);
yield;
}
}
function wait(w){
loop(w){yield;}
}
}
Im such a noob....
Please help with this one. I keep getting "Bad Allocation".
task fire{
let x = 0;
let dir = 0;
let dira = 0;
loop{
while(x<36){
CreateShotA(1,GetEnemyX+75*cos(dir),GetEnemyY+75*sin(dir),30);
SetShotDataA(1,0,0,dir,0,0,0,RED01);
SetShotDataA(1,60,2,dir,0.5,0,2,YELLOW01);
FireShot(1);
CreateShotA(2,GetEnemyX+75*sin(dir),GetEnemyY+75*cos(dir),30);
SetShotDataA(2,0,0,dira,0,0,0,YELLOW01);
SetShotDataA(2,60,2,dira,-0.5,0,2,RED01);
FireShot(2);
dir+=360/36;
dira-=360/36;
x++;
}
x = 0;
dir = 0;
dira = 0;
wait(60);
yield;
}
}
SetGraphicAngle(0, 180, 0);
, right?)
I'm not sure which fourm to post this on but since its a question, ill post it here...
how would you change a sprite when its moving left or right? and how about when its getting ready to attack?
Credit goes to Alwaysthe(9) for the sprite sheet:(http://i600.photobucket.com/albums/tt84/Happyhobo810/normalguykokomustil.png)
i tried using the snippet for the Satori boss Onthenet helped me wiht but i can not get it right >_<, and thanks in advance!!
You certainly can reflect a sprite like that, but keep in mind that some characters aren't symmetrical. For example, if you were to flip Marisa, she has a single braid and a ribbon on her hat that would be on the wrong side for one of the directions. Of course, not many people are going to actually notice minor details like that so it's up to you whether you do that or not.
You certainly can reflect a sprite like that, but keep in mind that some characters aren't symmetrical. For example, if you were to flip Marisa, she has a single braid and a ribbon on her hat that would be on the wrong side for one of the directions. Of course, not many people are going to actually notice minor details like that so it's up to you whether you do that or not.
task amulet(x, y, ang, v, d){
let obj = Obj_Create(OBJ_SHOT);
let angleBOOM = ang;
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, v);
let xx = x;
let yy = y;
let xc = xx;
let yc = yy;
ObjShot_SetGraphic(obj, 7);
ObjShot_SetDamage(obj, d);
ObjShot_SetBombResist(obj, true);
ObjShot_SetPenetration(obj, 2);
while(! Obj_BeDeleted(obj)){
xc = Obj_GetX(obj);
yc = Obj_GetY(obj);
}
let amul=Obj_Create(OBJ_EFFECT);
let Yvar = 8;
ObjEffect_SetTexture(amul,GetCurrentScriptDirectory~"reimu.png");
ObjEffect_SetRenderState(amul,ALPHA);
ObjEffect_SetPrimitiveType(amul,PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(amul,4);
ObjEffect_SetVertexColor(amul, 0, 205, 200, 255, 255);
ObjEffect_SetVertexColor(amul, 1, 205, 200, 255, 255);
ObjEffect_SetVertexColor(amul, 2, 205, 200, 255, 255);
ObjEffect_SetVertexColor(amul, 3, 205, 200, 255, 255);
loop(2){
ObjEffect_SetVertexUV(amul,0,49,143);
ObjEffect_SetVertexUV(amul,1,61,143);
ObjEffect_SetVertexUV(amul,2,61,161);
ObjEffect_SetVertexUV(amul,3,49,161);
ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
Yvar+=8;
yield;}
loop(2){
ObjEffect_SetVertexUV(amul,0,49,161);
ObjEffect_SetVertexUV(amul,1,61,161);
ObjEffect_SetVertexUV(amul,2,61,179);
ObjEffect_SetVertexUV(amul,3,49,179);
ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
Yvar+=8;
yield;}
loop(2){
ObjEffect_SetVertexUV(amul,0,49,179);
ObjEffect_SetVertexUV(amul,1,61,179);
ObjEffect_SetVertexUV(amul,2,61,197);
ObjEffect_SetVertexUV(amul,3,49,197);
ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
Yvar+=8;
yield;}
loop(2){
ObjEffect_SetVertexUV(amul,0,36,143);
ObjEffect_SetVertexUV(amul,1,48,143);
ObjEffect_SetVertexUV(amul,2,48,161);
ObjEffect_SetVertexUV(amul,3,36,161);
ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
Yvar+=8;
yield;}
Obj_Delete(amul);
}
task amuletbreak(xc,yc) {
let amul=Obj_Create(OBJ_EFFECT);
let Yvar = 8;
ObjEffect_SetTexture(amul,GetCurrentScriptDirectory~"sanae.png");
ObjEffect_SetRenderState(amul,ADD);
ObjEffect_SetLayer(amul, 8);
ObjEffect_SetPrimitiveType(amul,PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(amul,4);
ObjEffect_SetVertexColor(amul, 0, 255, 200, 255, 255);
ObjEffect_SetVertexColor(amul, 1, 255, 200, 255, 255);
ObjEffect_SetVertexColor(amul, 2, 255, 200, 255, 255);
ObjEffect_SetVertexColor(amul, 3, 255, 200, 255, 255);
loop(2){
ObjEffect_SetVertexUV(amul,0,49,143);
ObjEffect_SetVertexUV(amul,1,61,143);
ObjEffect_SetVertexUV(amul,2,61,161);
ObjEffect_SetVertexUV(amul,3,49,161);
ObjEffect_SetVertexXY(amul,0,xc,yc - 17);
ObjEffect_SetVertexXY(amul,1,xc,yc - 17);
ObjEffect_SetVertexXY(amul,2,xc,yc + 16);
ObjEffect_SetVertexXY(amul,3,xc,yc + 16);
Yvar+=8;
yield;}
loop(2){
ObjEffect_SetVertexUV(amul,0,49,161);
ObjEffect_SetVertexUV(amul,1,61,161);
ObjEffect_SetVertexUV(amul,2,61,179);
ObjEffect_SetVertexUV(amul,3,49,179);
ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
Yvar+=8;
yield;}
loop(2){
ObjEffect_SetVertexUV(amul,0,49,179);
ObjEffect_SetVertexUV(amul,1,61,179);
ObjEffect_SetVertexUV(amul,2,61,197);
ObjEffect_SetVertexUV(amul,3,49,197);
ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
Yvar+=8;
yield;}
loop(2){
ObjEffect_SetVertexUV(amul,0,36,143);
ObjEffect_SetVertexUV(amul,1,48,143);
ObjEffect_SetVertexUV(amul,2,48,161);
ObjEffect_SetVertexUV(amul,3,36,161);
ObjEffect_SetVertexXY(amul,0,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,1,xc,yc - Yvar);
ObjEffect_SetVertexXY(amul,2,xc,yc + Yvar);
ObjEffect_SetVertexXY(amul,3,xc,yc + Yvar);
Yvar+=8;
yield;}
Obj_Delete(amul);
}
I'm not sure which fourm to post this on but since its a question, ill post it here...
how would you change a sprite when its moving left or right? and how about when its getting ready to attack?
Credit goes to Alwaysthe(9) for the sprite sheet: (pixely image)
i tried using the snippet for the Satori boss Onthenet helped me wiht but i can not get it right >_<, and thanks in advance!!
SetRenderState(ALPHA);
SetAlpha(255);
SetTexture(imgExRumia);
if(int(GetSpeedX())==0){SetGraphicRect(64,1,127,64);}
else if(GetSpeedX()>0){SetGraphicRect(192,1,255,64);}
else if(GetSpeedX()<0){SetGraphicRect(128,1,191,64);}
DrawGraphic(GetX(),GetY());
You can also use a variable like "animation" and increment it every frame. Then you can use in @DrawLoop: if(int(GetSpeedX) == 0) { if(animation == <value>) { SetGraphicRect(left, top, right, bottom); } repeat_setting_graphic_coordinates; }
and all that.
#TouhouDanmakufu
#Title[magic circle]
#Text[]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let imagefile = GetCurrentScriptDirectory ~ "etama3.png";
let objid;
@Initialize{
SetMovePosition02(GetCenterX,GetCenterY-100,0);
SetLife(1);
LoadGraphic(imagefile);
object;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
task object{ yield; yield;
objid = Obj_Create(OBJ_EFFECT);
Obj_SetX(objid, GetX);
Obj_SetY(objid, GetY);
ObjEffect_SetScale(objid,1,1);
ObjEffect_SetRenderState(objid,ADD);
ObjEffect_SetTexture(objid, imagefile);
ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
let totalradius=250;
let angle=0; let repeat=8; ////how many times the image is repeated
let sides=100; let i=0; let d=0; let Z=0; let RotateSpeed=0.5;
ObjEffect_CreateVertex(objid, sides*2+2); /// vertices
loop(sides+1){ ///the sides are done in pairs, the added loop is to finish the circle
ObjEffect_SetVertexUV(objid,i*2,16,d*repeat/sides);
ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
ObjEffect_SetVertexXY(objid, i*2, totalradius*cos(angle), totalradius*sin(angle));
ObjEffect_SetVertexXY(objid, i*2+1, (totalradius+22)*cos(angle), (totalradius+22)*sin(angle));
angle+=360/sides; //// number of sides
i++; //// the id # increases by 1 every loop
d+=-128; /// the vertical size of the spellcard shown
}
while(Obj_BeDeleted(objid)==!true){ ObjEffect_SetAngle(objid,0,0,Z); Z+=RotateSpeed; yield;}
}
}
while(Obj_BeDeleted(objid)==!true){
ObjEffect_SetAngle(objid,0,0,Z);
Z+=RotateSpeed;
if( conditions for making the circle shrink == true ){
totalradius -= 0.01;
ascent(i in 0..202){ //where 202 is the number of vertices
ObjEffect_SetVertexXY(objid, i, totalradius*cos(angle), totalradius*sin(angle));
}
}
yield;
}
#TouhouDanmakufu
#Title[magic circle]
#Text[]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let imagefile = GetCurrentScriptDirectory ~ "etama3.png";
let objid;
@Initialize{
SetMovePosition02(GetCenterX,GetCenterY-100,0);
SetLife(1);
LoadGraphic(imagefile);
SetTimer(30);
object;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
task object{
objid = Obj_Create(OBJ_EFFECT);
Obj_SetX(objid, GetX);
Obj_SetY(objid, GetY);
ObjEffect_SetScale(objid,1,1);
ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetRenderState(objid,ADD);
ObjEffect_SetTexture(objid, imagefile);
let totalradius=0;
let repeat=8; ////how many times the image is repeated
let sides=100;
let d=0;
let Z=0;
let RotateSpeed=0.5;
let ctime = GetTimer*60;
let itime = ctime;
ObjEffect_CreateVertex(objid, sides*2+2); /// vertices
ascent(i in 0..(sides+1)){ ///the sides are done in pairs, the added loop is to finish the circle
ObjEffect_SetVertexUV(objid,i*2,16,d*repeat/sides);
ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
d+=-128; /// the vertical size of the spellcard shown
}
while(!Obj_BeDeleted(objid)){
ascent(i in 0..sides+1) {
ObjEffect_SetVertexXY(objid, i*2, totalradius*ctime/itime*cos(i*360/sides + Z), totalradius*ctime/itime*sin(i*360/sides + Z));
ObjEffect_SetVertexXY(objid, i*2+1, (totalradius*ctime/itime+22)*cos(i*360/sides + Z), (totalradius*ctime/itime+22)*sin(i*360/sides + Z));
}
Z+=RotateSpeed;
if (totalradius < 250) {
totalradius+= 3; //The bigger this number is, the quicker the circle will expand.
}
ctime--;
yield;
}
}
}
lord Mokou
Haha wow. What a title!
#TouhouDanmakufu
#Title[magic circle 3]
#Text[]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let imagefile = GetCurrentScriptDirectory ~ "etama3.png";
let objid;
@Initialize{
SetMovePosition02(GetCenterX,GetCenterY-100,0);
SetLife(1);
LoadGraphic(imagefile);
SetTimer(60);
object;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
task object{ yield; yield;
objid = Obj_Create(OBJ_EFFECT);
Obj_SetX(objid, GetX);
Obj_SetY(objid, GetY);
ObjEffect_SetScale(objid,1,1);
ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetRenderState(objid,ADD);
ObjEffect_SetTexture(objid, imagefile);
let totalradius=250;
let repeat=8;
let sides=80;
let d=0;
let rotate=0;
let RotateSpeed=0;
let IN=0;
let OUT=30;
let timer=50*60;
let timer2=timer;
let accelerate=-20;
ObjEffect_CreateVertex(objid, sides*2+2);
ascent(i in 0..sides+1){
ObjEffect_SetVertexUV(objid,i*2,16,d*repeat/sides);
ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
d+=-128;
}
while(!Obj_BeDeleted(objid)){
ascent(i in 0..sides+1){ ///inside
let radiusINX=(totalradius*timer/timer2 +IN)*cos(i*360/sides +rotate);
let radiusINY=(totalradius*timer/timer2 +IN)*sin(i*360/sides +rotate);
let radiusOUTX=(totalradius*timer/timer2 +OUT)*cos(i*360/sides +rotate);
let radiusOUTY=(totalradius*timer/timer2 +OUT)*sin(i*360/sides +rotate);
ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);
}
rotate+=RotateSpeed;
timer+=accelerate;
accelerate+=-2;
yield;
if(timer/timer2<-0.06){Obj_Delete(objid);}
}
}
}
{
if (frame == 200)
{
CreateLaser01(+rand(0, 900), +rand(0, 200), 50, GetAngleToPlayer, 9000000, 30, YELLOW05, 60);
frame=0;
CreateLaser01(+rand(0, 900), +rand(0, 200), 50, +rand(0, 180), 9000000, 30, GREEN05, 60);
frame=0;
}
frame++;
}
This probably a really common problem that newfags ask for help with all the time. :|
uh can you tell me whats wrong here
<image>
im trying to make a long laser that sticks around for a while because of its length.
but after a while, the SPRITE the laser moves on an axis, but the hitbox stays where the laser was originally shot.
im basically usingCode: [Select]{
if (frame == 200)
{
CreateLaser01(+rand(0, 900), +rand(0, 200), 50, GetAngleToPlayer, 9000000, 30, YELLOW05, 60);
frame=0;
CreateLaser01(+rand(0, 900), +rand(0, 200), 50, +rand(0, 180), 9000000, 30, GREEN05, 60);
frame=0;
}
frame++;
}
Hey, just wondering if it was possible to make dialogue in danmakufu? And if so, how?
Thanks, I'll have to look that up sometime...
My apologies if this is one of those things that've already been asked, but I was wodering how to get an event script to stop everything else from continuing. What I mean is when I have an event script start right before the boss, the boss will still come in and start their first attack while the conversation is still going on. I'd appreciate it if someone could let me know. :)in the first boss attack script:
if(!OnEvent) {
functions; //including like, incr.ing counting variables... and stuff.
}
From my memory, so I can't be 100% sure if this is how you do it.CreateEventFromScript("talk");
while(OnEvent==true){
yield;
}
CreateEnemyBossFromFile(...);
What AlwaysThe⑨ posted is incorrect, if(!OnEvent){} means "if not currently playing an event". If you're using the way I taught in the intermediate tutorial (tasks), simply put:Code: [Select]CreateEventFromScript("talk");
while(OnEvent==true){
yield;
}
CreateEnemyBossFromFile(...);
The while code get if an event is currently running, and suspends the task until it finishes. Thus, when your event script ends, the boss script starts.
{
if (frame == 200)
{
CreateLaserA(1, GetX, GetY, 300, 20, GREEN01,0);
SetLaserDataA(1, 90, 0, 0, 0, 0, 180);
frame=0;
CreateLaser01(230,200, 50, GetAngleToPlayer, 9000000, 30, YELLOW05, 10);
frame=0;
CreateLaser01(+rand(37, 230),+rand(0, 200), 50, +rand(0, 90), 9000000, 30, RED05, 60);
frame=0;
}
frame++;
}
Uh, I can't seem to get CreateLaserA to work.You need a FireShot(1); in there.
i just start the script and no green laser ever appears, and i tried different X Y starting points that getx and gety but i still don't know how to make the laser happen. (this was based on an issue i had on the last page)
using:Code: [Select]{
if (frame == 200)
{
CreateLaserA(1, GetX, GetY, 300, 20, GREEN01,0);
SetLaserDataA(1, 90, 0, 0, 0, 0, 180);
frame=0;
CreateLaser01(230,200, 50, GetAngleToPlayer, 9000000, 30, YELLOW05, 10);
frame=0;
CreateLaser01(+rand(37, 230),+rand(0, 200), 50, +rand(0, 90), 9000000, 30, RED05, 60);
frame=0;
}
frame++;
}
atan2(GetPlayerY - GetY, GetPlayerX - GetX)
atan2 is usually used to find the angle from a certain point from boss (or anywhere else a bullet is spawned) to a player (or some other destination, whatever you want)
You put this one in the angle parameter, it's used to get the angle from the boss to the player.
Uh, is that what you're looking for?
task bullet1
{
let obj = Obj_Create(OBJ_SHOT);
*insert the typical stuff*
while(Obj_BeDeleted(obj)==false && Obj_GetY(obj)>GetClipMinY+16){yield;} //yield while still existing and not at top of screen
if (Obj_BeDeleted(obj)==false){Obj_SetAngle(obj,atan2(GetPlayerY-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj)));} //if bullet still exists, aim it at player
}
angletoitem = atan2(Obj_GetY(obj) - GetPlayerY, Obj_GetX(obj) - GetPlayerX);
if(Obj_GetY(obj) - GetPlayerY <= sin(angletoitem) * 50 && Obj_GetX(obj) - GetPlayerX <=cos (angletoitem) * 50){
Obj_Delete(obj);
}
This would be how I would do it, anyway.
You'll learn something out of this, damn it!
Despite your edit, I'll answer your question anyways. ObjEffect_SetVertexUV declares the vertices on your image, ObjEffect_SetVertexXY plots the corresponding vertices on to the Danmakufu field. You're missing the XY portion of an ObjEffect (you're not telling Danmakufu where to draw the image), so nothing is drawn.Ah, I see. Well, hopefully I'll get it right the second time when I really need to use an effect object for something. Thanks!
Before you say "yes I am", Obj_SetPosition does not work with ObjEffects, nor does Obj_SetAlpha for that matter (to set the alpha value of an ObjEffect, you need to use ObjEffect_SetVertexColor(id, vertex, alpha, red, green, blue); ). A pain in the ass, but setting each vertex also allows you to bend and distort the image however you please. Useful when you get used to it.
atan2(GetPlayerY - BulletY, GetPlayerX - BulletX)Thank you very much Naut :3
Bullet spawned on (224, 240):
CreateShot01(224, 240, 3, atan2(GetPlayerY - 240, GetPlayerX - 224), RED01, 10);
kyle, it almost looks like a graphical problem. Like videocard drivers or settings. But I never encountered such a thing before.
Question: how can I show players score after the fight is over?
idk what goes herealpha of the text (how opaque the text is? idk what it really means. transparency?)
#TouhouDanmakufu
#Title[???]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let angle2 = 1;
let go = 0;
let random = rand(0, 360);
let graze = GetGraze;
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY-120,0);
shotinit;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%10==0){
angle2-=0.010;
ascent(o in 1..8){
CreateShotA(0, GetX, GetY, 0);
SetShotDataA(0, 0, 1*o, 15, 0, -0.05, 0.005, RED21);
SetShotDataA(0, 30, 1.8, 90, 0, 0, 0, WHITE21);
SetShotDataA(0, 80, 1.8, 90, -angle2, 0, 0, RED21);
SetShotKillTime(0, 340);
FireShot(0);
CreateShotA(1, GetX, GetY, 0);
SetShotDataA(1, 0, 1*o, 165, 0, -0.05, 0.005, RED21);
SetShotDataA(1, 30, 1.8, 90, 0, 0, 0, WHITE21);
SetShotDataA(1, 80, 1.8, 90, angle2, 0, 0, RED21);
SetShotKillTime(1, 340);
FireShot(1);}}
if(angle2<-0.5){
angle2=0.6;}
if(GetPlayerY<250){
CreateShot01(GetPlayerX, GetPlayerY, 1, rand(0, 360), ORANGE02, 80);}
}
@DrawLoop{}
@Finalize{}
}
Is there any way i can make this script harder?:It is already hard enough, but if it should be harder:Code: [Select]#TouhouDanmakufu
#Title[???]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let angle2 = 1;
let go = 0;
let random = rand(0, 360);
let graze = GetGraze;
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY-120,0);
shotinit;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%10==0){
angle2-=0.010;
ascent(o in 1..8){
CreateShotA(0, GetX, GetY, 0);
SetShotDataA(0, 0, 1*o, 15, 0, -0.05, 0.005, RED21);
SetShotDataA(0, 30, 1.8, 90, 0, 0, 0, WHITE21);
SetShotDataA(0, 80, 1.8, 90, -angle2, 0, 0, RED21);
SetShotKillTime(0, 340);
FireShot(0);
CreateShotA(1, GetX, GetY, 0);
SetShotDataA(1, 0, 1*o, 165, 0, -0.05, 0.005, RED21);
SetShotDataA(1, 30, 1.8, 90, 0, 0, 0, WHITE21);
SetShotDataA(1, 80, 1.8, 90, angle2, 0, 0, RED21);
SetShotKillTime(1, 340);
FireShot(1);}}
if(angle2<-0.5){
angle2=0.6;}
if(GetPlayerY<250){
CreateShot01(GetPlayerX, GetPlayerY, 1, rand(0, 360), ORANGE02, 80);}
}
@DrawLoop{}
@Finalize{}
}
#TouhouDanmakufu
#Title[???]
#Text[「」]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let frame = 0;
let angle2 = 1;
let go = 0;
let random = rand(0, 360);
let graze = GetGraze;
@Initialize{
SetLife(800);
SetMovePosition02(GetCenterX,GetCenterY-120,0);
shotinit;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
frame++;
if(frame%10==0){
angle2-=0.010;
ascent(o in 1..8){
CreateShotA(0, GetX, GetY, 0);
SetShotDataA(0, 0, 1*o, 15, 0, -0.05, 0.005, RED21);
SetShotDataA(0, 30, 1.8, 115, 0, 0, 0, WHITE21);
SetShotDataA(0, 80, 1.8, 115, -angle2, 0, 0, RED21);
SetShotKillTime(0, 340);
FireShot(0);
CreateShotA(1, GetX, GetY, 0);
SetShotDataA(1, 0, 1*o, 165, 0, -0.05, 0.005, RED21);
SetShotDataA(1, 30, 1.8, 75, 0, 0, 0, WHITE21);
SetShotDataA(1, 80, 1.8, 75, angle2, 0, 0, RED21);
SetShotKillTime(1, 340);
FireShot(1);}}
if(angle2<-0.5){
angle2=0.6;}
if(GetPlayerY<250){
CreateShot01(GetPlayerX, GetPlayerY, 1, rand(0, 360), ORANGE02, 80);}
}
@DrawLoop{}
@Finalize{}
}
#TouhouDanmakufu
#Title[Test 3: トイレ練習]
#Text[XXをできました!]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\irm88.mp3]
#PlayLevel[Easy, Lunatic?]
#ScriptVersion[2]
script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\flandresprite.png";
let cut = CSD ~ "img\flandrecutin.png";
let bg = CSD ~ "img\toilet.png";
let timer = 157;
@Initialize{
shotinit;
SetLife(5000);
SetTimer(157);
SetScore(80200);
SetDurableSpellCard;
SetDamageRate(0,0);
SetMovePosition01(GetCenterX,100,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"?│?? ?u?g?C?????K?v",cut,0,0,500,400);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
timer--;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@Background{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
task mainTask{
wait(90);
fire;
yield;
}
task fire{
let x = 0;
let dir = 0;
loop{
yield;
if(GetTimer==148){
CreateShot01(GetX,GetY,8,GetAngleToPlayer,RED03,90);
wait(60);
}
while(GetTimer<=123){
CreateShot01(GetX,GetY,3,GetAngleToPlayer,BLUE12,50);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+50,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+40,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-50,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-40,BLUE12,60);
CreateShot01(GetX,GetY,4,GetAngleToPlayer-90,BLUE12,60);
CreateShot01(GetX,GetY,5,GetAngleToPlayer-70,BLUE12,60);
CreateShot01(GetX,GetY,3.7,GetAngleToPlayer+23,BLUE12,47);
CreateShot01(GetX,GetY,4.1,GetAngleToPlayer+14,BLUE12,28);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+5,BLUE12,40);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-8,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-14,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+8,BLUE12,96);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-6,BLUE12,35);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-5,BLUE12,60);
wait(20);
}
while(GetTimer<=100){
CreateShot01(GetX,GetY,4,GetAngleToPlayer,YELLOW54,50);
wait(20);
}
}
}
function wait(w){
loop(w){yield;}
}
}
How do you edit/view the bullet and laser graphics?
First off, I have graphic problems, one of which is why can't I see the SetEffectForZeroLifeEffect?
Second, I'm trying to use the timer to set up certain patterns. But for some reason, it doesn't let me access the while loop which activates at 100 seconds left and under. Can I only have one?Code: [Select]#TouhouDanmakufu
#Title[Test 3: トイレ練習]
#Text[XXをできました!]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\irm88.mp3]
#PlayLevel[Easy, Lunatic?]
#ScriptVersion[2]
script_enemy_main{
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\flandresprite.png";
let cut = CSD ~ "img\flandrecutin.png";
let bg = CSD ~ "img\toilet.png";
let timer = 157;
@Initialize{
shotinit;
SetLife(5000);
SetTimer(157);
SetScore(80200);
SetDurableSpellCard;
SetDamageRate(0,0);
SetMovePosition01(GetCenterX,100,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"?│?? ?u?g?C?????K?v",cut,0,0,500,400);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
timer--;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@Background{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
task mainTask{
wait(90);
fire;
yield;
}
task fire{
let x = 0;
let dir = 0;
loop{
yield;
if(GetTimer==148){
CreateShot01(GetX,GetY,8,GetAngleToPlayer,RED03,90);
wait(60);
}
while(GetTimer<=123){
CreateShot01(GetX,GetY,3,GetAngleToPlayer,BLUE12,50);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+50,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+40,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-50,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-40,BLUE12,60);
CreateShot01(GetX,GetY,4,GetAngleToPlayer-90,BLUE12,60);
CreateShot01(GetX,GetY,5,GetAngleToPlayer-70,BLUE12,60);
CreateShot01(GetX,GetY,3.7,GetAngleToPlayer+23,BLUE12,47);
CreateShot01(GetX,GetY,4.1,GetAngleToPlayer+14,BLUE12,28);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+5,BLUE12,40);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-8,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-14,BLUE12,60);
CreateShot01(GetX,GetY,2,GetAngleToPlayer+8,BLUE12,96);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-6,BLUE12,35);
CreateShot01(GetX,GetY,2,GetAngleToPlayer-5,BLUE12,60);
wait(20);
}
while(GetTimer<=100){
CreateShot01(GetX,GetY,4,GetAngleToPlayer,YELLOW54,50);
wait(20);
}
}
}
function wait(w){
loop(w){yield;}
}
}
Thanks for reading this![/color]
I am sorry I can only answer one of your questions, i do not see a SetEffectForZeroLife in your script.It's not in this one. My other script runs smoothly, yet when the effect, all the bullet graphics dissapear.
kyle, it almost looks like a graphical problem. Like videocard drivers or settings. But I never encountered such a thing before.
When working on 3d backgrounds, is there a way to make the camera rotate on the Z-axis, so it looks like a room is spinning?
So far, all I can do is make it spin on the Y-axis by changing the azimuthal angle value in
SetViewFrom(focus,azimuthal, elevation);
Try the parameters of SetViewTo. I think I asked before a similar question. Though it was in the old Q&A thread.
I'm not really sure if this is an "appropriate" question for this thread but,Colour can match up to something like... immaturity... dishonesty... That stuff.
What kind of emotion and bullets match with the colour purple?
on another note, this may seem like an "ehheh" question (what ever that is) but,
How exactly to while and else statements work? If they go in an if statement wouldnt that make them if statements?
while loops are like if statements and loops combined, they keep looping until the statement is false.
else dictates what code to run if the 'if' statement is false
examples:
if(person == Naut){
Set difficulty = HAHAHAHAHA
}
else{
Set difficulty = Normal
}
In this theoretical example, if the statement is true, ie the variable called 'person' is equal to "Naut", then it runs whatever is in that segment (which would be set the difficult to HAHAHAHA(ry). The else segment is only excecuted if the original if statment is false, ie the person is not Naut.
Furthermore "else if" statements run if all the other if and else if statements before it in the chain are false.
example:
if(person == Naut){
Set difficulty = HAHAHAHAHA
}
else if(person == Suikama){
Set difficulty = Extra
}
else if(person == GIL){
Set difficulty = beyond humanly possible
}
else{
Set difficulty = Normal
}
If the person is GIL, then only the code in that section will run (difficultly = lolimpossible). If the person is me, then difficulty will be extra. And so on. If the person is none of the above then else runs.
Now while loop examples
while(lives >=0){
keepplaying = true;
}
So as long as the variable lives is bigger than 0, that loop will keep running. As a result, becareful when using while loops. If the statement never becomes false, then you could end up with an infinite loop, which could result in danmakufu freezing.
Oh. My friggin' gawd.Technically depends. Typically it would be a string (with the quotation marks and what not), but if Naut was a variable (like Naut = 9001 or something), then it wouldn't be a String.
But would person = "Naut", and not Naut?
Er, yeah.
Technically depends. Typically it would be a string (with the quotation marks and what not), but if Naut was a variable (like Naut = 9001 or something), then it wouldn't be a String.Err, yeah, I forgot to say strings and variables and stuff.
let distance = 50; //or something
ascent(i in 0..36){
CreateShot01(GetX + distance*cos(i*10), GetY + distance*sin(i*10), speed, i*10, graphic, delay);
distance--;
}
CreateShot01(GetX+radius*cos(ANGLE), GetY+radius*sin(ANGLE), speed, ANGLE+alter, graphic, delay);
derpWait why did you remove distance--;? He wants the bullets to go in towards the player.
Yeah bros, totally a tutorial for that. (http://www.shrinemaiden.org/forum/index.php?topic=865.msg31776#msg31776)DERP
@Suikama, whatever he typed I do not get what you said out of it :|
Plus, what you coded would make them spin in towards the boss, not the player.
let k = 36;For some reason I forgot that bullets actually moved on thier own
let angle = 0;
loop(k){
CreateShot01(GetPlayerX + 70*cos(angle), GetPlayerY + 70*sin(angle), 2, angle - 180, RED32, 30);
angle+=360/k;
}
Did anyone figure out how to spin the camera about Z axis yet?
Btw quite funny ZUN uses the glowing round bullets as shotdelay effect. He uses it like everywhere. And the lasers in MoF/SA/UFO are spawned with the same bullets except rotating very fast.IDs 149-155. People tend to use them for actual bullets, but in reality their purpose is only for bullet delay. For all types of bullets, too.
Me needs to do some more investigation regarding this.
As far as I can gather, the only way to do this is to rotate the whole world rather than the camera. Unless there's a function missing in the wiki... which is pretty likely.
Something tells me, you don't have to move the whole world, but the camera instead.
If you've played SA Phantasm, you'll see the camera swerve left and right, and rotate on the Z axis just a bit. If you look even more closely, it turns counterclockwise a bit as it swerves toward the left wall, and clockwise a bit as it swerves toward the right wall. I don't know how to do that, but I hope I can find out.
(images)
You know what I'm talking about, right?
Add it to the new good wiki.
#TouhouDanmakufu
#Title[Trig Pattern]
#Text[...WOOT TRIG!!]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = "script\img\ExRumia.png";
let frame = -120;
let a = 0;
let num = 20;
@Initialize {
SetLife(2400); SetDamageRate(40, 0);
SetEnemyMarker(true);
LoadGraphic(BossImage);
SetTexture(BossImage);
SetGraphicRect(0, 0, 64, 64);
SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
CutIn(KOUMA,"Danmaku Sign「Made in Danmakufu」", "", 0, 0, 0, 0);
SetScore(1000000); SetDurableSpellCard;
}
@MainLoop {
SetCollisionA(GetX, GetY, 32); //32 for boss, 10 for fairy
SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
if(frame <= 360 && frame > 0) {
CreateShot01(GetX+100*cos(a+180+90), GetY-100*cos(a+90), 3, -a, RED21, 10);
CreateShot01(GetX+100*cos(a+180+90), GetY-100*cos(a+90), 3, a, RED21, 10);
CreateShot01(GetX-100*cos(a+90), GetY+100*cos(a+90), 3, a, RED21, 10);
CreateShot01(GetX-100*cos(a+90), GetY+100*cos(a+90), 3, -a, RED21, 10);
a+=3;
}
if(frame > 420 && frame <= 720) {
CreateShot01(GetX+100*cos(a+180+90), GetY-50*cos(a+90), 3, -a, ORANGE21, 10);
CreateShot01(GetX+100*cos(a+180+90), GetY-50*cos(a+90), 3, a, ORANGE21, 10);
CreateShot01(GetX-100*cos(a-90), GetY+50*cos(a-90), 3, a, ORANGE21, 10);
CreateShot01(GetX-100*cos(a-90), GetY+50*cos(a-90), 3, -a, ORANGE21, 10);
a-=3;
}
if(frame == 720) { frame = -60; }
frame++;
}
@DrawLoop {
SetTexture(BossImage);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(BossImage);
}
}
Came up with this when trying to replicate Roarschach. Doesn't even look like Rorschach at all.
EDIT2:Added.
Not exactly a question, but I'm so close to getting this magic circle thing down properly, I can almost feel it ;DWell, if I know anything about effect objects, and I don't, then you make the object rotate by calling a function that sets the angle of the objects relative to its actual angle, right? To make it stop spinning in a way that doesn't look stupid, just have the amount the angle rotates by each frame be determined by a variable which is reduced every frame right after the angle setting function. I believe exponential deceleration would be both easier and look better in this case, so just have the angular velocity of your object be vspin and call "vspin=vspin*0.995" or something like that.
(http://img23.imageshack.us/img23/7334/thdnh2009110513391506.png)
BUT IT WON'T STOP SPINNING AND IT'S DRIVING ME CRAZY AKJFJDKLFAKL;DJKLAKL
<snip>Well, if I understand your way correctly (and I think I don't), then just replace the
Let us pray that Blargel has another fit of boredom.
beast.jpg
Thanks for the contribution. I love you <3
But now I have to translate it all.
How do I get get a random number to not repeat itself?
let result;
let resultIndex;
let randomIntegers = [];
let smallestInteger = -12; //change to whatever you want it to be
let largestInteger = 15; //change this to whatever value too
ascent(i in smallestInteger..largestInteger+1){
randomIntegers = randomIntegers ~ [i];
}
...
if(length(randomIntegers) > 0){
resultIndex = rand_int(0, length(randomIntegers)-1);
result = randomIntegers[resultIndex];
randomIntegers = erase(randomIntegers, resultIndex);
}
else{
//Whatever's in here will be run if you ran out of integers.
}
Something tells me, you don't have to move the whole world, but the camera instead.
If you've played SA Phantasm, you'll see the camera swerve left and right, and rotate on the Z axis just a bit. If you look even more closely, it turns counterclockwise a bit as it swerves toward the left wall, and clockwise a bit as it swerves toward the right wall. I don't know how to do that, but I hope I can find out.
Double-post, but it's relatively important! The mystery of the SA Phantasm camera z-rotation is solved. The result? It's impossible to rotate the camera about the z-axis in Danmakufu!
SA Phantasm does indeed make the camera rotate to achieve the effect you're going for, but not on the z-axis. As I thought previously, it was with the second parameter of SetViewFrom, aka the y-axis. What they did was build the environment on the x-y plane and moved the camera's y-position in SetViewTo to simulate moving forward rather than build the environment on the x-z plane and moving the camera's z-position.
This pretty much means you're gonna need to flip your 3-D environment and camera 90 degrees forward. and then change the second parameter of SetViewFrom to make it rotate on the "z"-axis (which is really the y-axis now according to Danmakufu).
#TouhouDanmakufu[Stage]
#Title[How do I rotate about Z?]
#Text[you need the colorful box for this]
#Player[FREE]
#ScriptVersion[2]
script_stage_main
{
let rotation = 0;
let imagefile = GetCurrentScriptDirectory ~ "bg1.png";
let viewX=0;
let viewY=0;
let viewZ= 10;
let focus = 250;
let azimuthal=90;
let elevation=-55;
let frame=0;
let number=63;
let depth_buffer_enable = true;
@Initialize
{
LoadGraphic(imagefile);
makeithappen;
}
@MainLoop
{
yield;
}
@DrawLoop
{
}
@BackGround
{
WriteZBuffer(depth_buffer_enable);
UseZBuffer(depth_buffer_enable);
SetViewTo(viewX, viewY, viewZ);
SetViewFrom(focus, azimuthal, elevation);
SetFog(200, 350, 0, 0, 0);
// Draw the box
SetAlpha(255);
SetTexture(imagefile);
SetGraphicRect(0, 0, 127, 127);
SetGraphicAngle(0, -180, 0);
DrawGraphic3D(0, 0, 63);
SetGraphicAngle(0, -180, 0);
DrawGraphic3D(0, number*2, 63);
SetGraphicAngle(0, -180, 0);
DrawGraphic3D(0, number*4, 63);
SetGraphicAngle(0, -180, 0);
DrawGraphic3D(0, number*6, 63);
SetGraphicAngle(0, -180, 0);
DrawGraphic3D(0, number*8, 63);
SetGraphicAngle(0, -180, 0);
DrawGraphic3D(0, number*10, 63);
SetGraphicAngle(0, 90, 0);
DrawGraphic3D(63, 0, 0);
SetGraphicAngle(0, 90, 0);
DrawGraphic3D(63, number*2, 0);
SetGraphicAngle(0, 90, 0);
DrawGraphic3D(63, number*4, 0);
SetGraphicAngle(0, 90, 0);
DrawGraphic3D(63, number*6, 0);
SetGraphicAngle(0, 90, 0);
DrawGraphic3D(63, number*8, 0);
SetGraphicAngle(0, 90, 0);
DrawGraphic3D(63, number*10, 0);
SetGraphicAngle(0, 90, 0);
DrawGraphic3D(63, number*12, 0);
SetGraphicAngle(0, 270, 0);
DrawGraphic3D(-63, 0, 0);
SetGraphicAngle(0, 270, 0);
DrawGraphic3D(-63, number*2, 0);
SetGraphicAngle(0, 270, 0);
DrawGraphic3D(-63, number*4, 0);
SetGraphicAngle(0, 270, 0);
DrawGraphic3D(-63, number*6, 0);
SetGraphicAngle(0, 270, 0);
DrawGraphic3D(-63, number*8, 0);
SetGraphicAngle(0, 270, 0);
DrawGraphic3D(-63, number*10, 0);
SetGraphicAngle(0, 270, 0);
DrawGraphic3D(-63, number*12, 0);
SetGraphicAngle(90, 0, 0);
DrawGraphic3D(0, 63, 0);
SetGraphicAngle(-90, 0, 0);
DrawGraphic3D(0, -63, 0);
}
@Finalize
{
DeleteGraphic(imagefile);
}
task makeithappen{ let digit=0;
loop{ digit+=2;
azimuthal+=cos(digit); yield; viewY++; if(viewY>number*6){viewY=number*4} }
}
}
#TouhouDanmakufu
#Title[Stuff 2]
#Text[OMFG THE INK BLOTS!
THE INK BLOTS!!!!
This one may very well be impossible.]
#ScriptVersion[2]
script_enemy_main {
let frame = 0;
let frame2 = -120;
let x = GetX;
let y = GetY; //+170;
let a = 0;
function wait(k){
loop(k){yield;}
}
@Initialize {
SetLife(1500); if(GetPlayerType == REIMU_A || GetPlayerType == REIMU_B) { SetDamageRate(40, 0); } else { SetDamageRate(20, 0); } SetTimer(75);
SetEnemyMarker(true);
SetMovePosition02(GetCenterX, GetClipMinY+100, 60);
CutIn(KOUMA,"Little Rock「Rorschach Test」", "", 0, 0, 0, 0);
SetScore(10000000);
SetShotAutoDeleteClip(500, 500, 500, 500);
}
@MainLoop {
x = GetX;
y = GetY;
if(frame < 300) { frame++; }
frame2++;
if(frame2 == 60) { SetMovePosition02(GetClipMinX+50, GetClipMaxY-25, 120); }
if(frame2 == 180) { SetMovePosition02(GetClipMaxX-50, GetClipMaxY-25, 120); }
if(frame2 == 300) { SetMovePosition02(GetCenterX, GetClipMinY+150, 120); }
if(frame2 == 420) { PlaySE(GetCurrentScriptDirectory~"se\se_ch00.wav"); SetColor(0, 0, 255); Concentration02(120); }
if(frame2 == 540) { SetMovePosition02(GetCenterX, GetClipMaxY, 10); }
if(frame2 == 560) {
PlaySE(GetCurrentScriptDirectory~"se\se_water.wav");
ascent(i in -6..6) {
CreateShot01(GetX, GetY, 5, GetAngleToPlayer+i*12, BLUE03, 10);
}
SetMovePosition02(GetCenterX, GetClipMinY+50, 30);
frame2 = 0;
}
if(frame == 120) { lissajous; }
if(!OnBomb) { SetCollisionA(GetX, GetY, 32); } //32 for boss, 10 for fairy
SetCollisionB(GetX, GetY, 24);//24 for boss, 5 for fairy
yield;
}
@DrawLoop {
}
@Finalize {
if(GotSpellCardBonus) {
loop(50) { CreateItem(ITEM_SCORE, GetX+rand(-150, 150), GetY+rand(-50, 50)); }
} else {
loop(5) { CreateItem(ITEM_SCORE, GetX+rand(-150, 150), GetY+rand(-50, 50)); }
}
}
task lissajous {
x = GetX;
y = GetY; //+170;
loop(300) {
CreateShot02(x-100*cos(a-90), y-75*cos(a-90), -5, -a, 0.1, 3, RED04, 10);
CreateShot02(x-100*cos(a+90), y+75*cos(a+90), -5, a+180, 0.1, 3, RED04, 10);
a+=6.5;
wait(1);
}
wait(1);
loop(300) {
CreateShot02(x-75*cos(a-90), y-125*cos(a-90), -5, -a, 0.1, 3, ORANGE04, 10);
CreateShot02(x-75*cos(a+90), y+125*cos(a+90), -5, a+180, 0.1, 3, ORANGE04, 10);
a+=6.5;
wait(1);
}
lissajous;
}
}
#TouhouDanmakufu
#Title[Help needed]
#Text[The task seems to freeze it. Why?]
#Image[]
#BackGround[IceMountain]
#BGM[.\bgm.mp3]
#PlayLevel[Fix]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = ".\script\Arthur\Images\Boss.png";
let BossCutIn = ".\script\Arthur\Images\BossCutIn.png";
let cx=GetCenterX();
let cy=GetCenterY();
let frame=0;
let a=0; // Angle.
let time=0;
let bullet=0; // To test for 'add' (which is to check if we count up the time or not).
task eye (a) {
let add=0;
if(bullet==0) {
bullet++;
add++;
}
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, cx+60*cos(a), 170+15*sin(a));
Obj_SetAngle(obj, atan2(sin(a), 4*cos(a)));
Obj_SetSpeed(obj, 0.75);
ObjShot_SetGraphic(obj, WHITE05);
ObjShot_SetDelay (obj, 0);
ObjShot_SetBombResist (obj, true);
while(Obj_BeDeleted(obj)==false) {
if(add==1) {time++;}
if(time==120) {Obj_SetSpeed(obj, 0);}
yield;
}
}
@Initialize {
LoadGraphic(BossImage);
SetMovePosition02(cx+0, 170, 50);
SetLife(2500);
SetDamageRate(10, 10);
SetTimer(300);
SetInvincibility(100);
CutIn(KOUMA, "Default", BossCutIn, 0, 0, 34, 48);
SetScore(1000000);
SetEnemyMarker(true);
SetDurableSpellCard;
Concentration01(50);
MagicCircle(false);
SetEffectForZeroLife(60, 100, 0);
}
@MainLoop {
SetCollisionA(GetX, GetY, 9);
SetCollisionB(GetX, GetY, 15);
if(frame>=60) {
if(frame==60) {
CreateShotA(0, cx, 170, 0);
SetShotDataA(0, 0, 0, 0, 0, 0, 0, AQUA01);
FireShot(0);
ascent (a in 1..361) {
if(a%2==0) {
eye (a); // The eyeball shape.
}
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0); // Starting from here...
SetShotDataA(a, 0, 0.225, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a);
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0);
SetShotDataA(a, 0, 0.0975, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a); // To here, it'd all for the iris...
}
}
yield;
}
frame++
}
@DrawLoop
{
SetColor(255,255,255);
SetTexture(BossImage);
if(GetSpeedX()>0){
SetGraphicRect(65, 1, 95, 61);
} else if(GetSpeedX()<0){
SetGraphicRect(1, 1, 31, 61);
} else {
SetGraphicRect(33, 1, 63, 61);
} // Draw him moving correctly.
DrawGraphic(GetX(), GetY());
}
@Finalize
{
DeleteGraphic(BossImage);
}
}
#TouhouDanmakufu
#Title[Help needed]
#Text[The task seems to freeze it. Why?]
#Image[]
#BackGround[IceMountain]
#BGM[.\bgm.mp3]
#PlayLevel[Fix]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = ".\script\Arthur\Images\Boss.png";
let BossCutIn = ".\script\Arthur\Images\BossCutIn.png";
let cx=GetCenterX();
let cy=GetCenterY();
let frame=0;
let a=0; // Angle.
let time=0;
let bullet=0; // To test for 'add' (which is to check if we count up the time or not).
task eye (a) {
let ad=0;
if(bullet==0) {
bullet++;
ad++;
}
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, cx+60*cos(a), 170+15*sin(a));
Obj_SetAngle(obj, atan2(sin(a), 4*cos(a)));
Obj_SetSpeed(obj, 0.75);
ObjShot_SetGraphic(obj, WHITE05);
ObjShot_SetDelay (obj, 0);
ObjShot_SetBombResist (obj, true);
while(Obj_BeDeleted(obj)==false) {
if(ad==1) {time++;}
if(time==120) {Obj_SetSpeed(obj, 0);}
yield;
}
}
@Initialize {
LoadGraphic(BossImage);
SetMovePosition02(cx+0, 170, 50);
SetLife(2500);
SetDamageRate(10, 10);
SetTimer(300);
SetInvincibility(100);
CutIn(KOUMA, "Default", BossCutIn, 0, 0, 34, 48);
SetScore(1000000);
SetEnemyMarker(true);
SetDurableSpellCard;
Concentration01(50);
MagicCircle(false);
SetEffectForZeroLife(60, 100, 0);
}
@MainLoop {
SetCollisionA(GetX, GetY, 9);
SetCollisionB(GetX, GetY, 15);
if(frame>=60) {
if(frame==60) {
CreateShotA(0, cx, 170, 0);
SetShotDataA(0, 0, 0, 0, 0, 0, 0, AQUA01);
FireShot(0);
ascent (a in 1..361) {
if(a%2==0) {
eye (a); // The eyeball shape.
}
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0); // Starting from here...
SetShotDataA(a, 0, 0.225, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a);
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0);
SetShotDataA(a, 0, 0.0975, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a); // To here, it'd all for the iris...
}
}
yield;
}
frame++
}
@DrawLoop
{
SetColor(255,255,255);
SetTexture(BossImage);
if(GetSpeedX()>0){
SetGraphicRect(65, 1, 95, 61);
} else if(GetSpeedX()<0){
SetGraphicRect(1, 1, 31, 61);
} else {
SetGraphicRect(33, 1, 63, 61);
} // Draw him moving correctly.
DrawGraphic(GetX(), GetY());
}
@Finalize
{
DeleteGraphic(BossImage);
}
}
#TouhouDanmakufu
#Title[Help needed]
#Text[The task seems to freeze it. Why?]
#Image[]
#BackGround[IceMountain]
#BGM[.\bgm.mp3]
#PlayLevel[Fix]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = ".\script\Arthur\Images\Boss.png";
let BossCutIn = ".\script\Arthur\Images\BossCutIn.png";
let cx=GetCenterX();
let cy=GetCenterY();
let frame=0;
let a=0; // Angle.
let time=0;
let bullet=0; // To test for 'add' (which is to check if we count up the time or not).
task eye (a) {
let ad=0;
if(bullet==0) {
bullet++;
ad++;
}
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, cx+60*cos(a), 170+15*sin(a));
Obj_SetAngle(obj, atan2(sin(a), 4*cos(a)));
Obj_SetSpeed(obj, 0.75);
ObjShot_SetGraphic(obj, WHITE05);
ObjShot_SetDelay (obj, 0);
ObjShot_SetBombResist (obj, true);
while(Obj_BeDeleted(obj)==false) {
if(ad==1) {time++;}
if(time==120) {Obj_SetSpeed(obj, 0);}
yield;
}
}
@Initialize {
LoadGraphic(BossImage);
SetMovePosition02(cx+0, 170, 50);
SetLife(2500);
SetDamageRate(10, 10);
SetTimer(300);
SetInvincibility(100);
CutIn(KOUMA, "Default", BossCutIn, 0, 0, 34, 48);
SetScore(1000000);
SetEnemyMarker(true);
SetDurableSpellCard;
Concentration01(50);
MagicCircle(false);
SetEffectForZeroLife(60, 100, 0);
}
@MainLoop {
SetCollisionA(GetX, GetY, 9);
SetCollisionB(GetX, GetY, 15);
if(frame>=60) {
if(frame==60) {
CreateShotA(0, cx, 170, 0);
SetShotDataA(0, 0, 0, 0, 0, 0, 0, AQUA01);
FireShot(0);
ascent (a in 1..361) {
if(a%2==0) {
eye (a); // The eyeball shape.
}
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0); // Starting from here...
SetShotDataA(a, 0, 0.225, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a);
CreateShotA(a, cx+5*cos(a+90), 170+5*sin(a+90), 0);
SetShotDataA(a, 0, 0.0975, a+90, 0, 0, 0.25, AQUA01);
SetShotDataA(a, 120, 0, a+90, 0, 0, 0.25, AQUA01);
FireShot(a); // To here, it'd all for the iris...
}
}
yield;
}
frame++
}
@DrawLoop
{
SetColor(255,255,255);
SetTexture(BossImage);
if(GetSpeedX()>0){
SetGraphicRect(65, 1, 95, 61);
} else if(GetSpeedX()<0){
SetGraphicRect(1, 1, 31, 61);
} else {
SetGraphicRect(33, 1, 63, 61);
} // Draw him moving correctly.
DrawGraphic(GetX(), GetY());
}
@Finalize
{
DeleteGraphic(BossImage);
}
}
#TouhouDanmakufu
#Title[Test 4: ?J???@?u???z???v]
#Text[Can you escape this illusionary gate?]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\necroremix.mp3]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\yukarisprite.png";
let cut = CSD ~ "img\yukaricutin.png";
let bg = CSD ~ "img\eyebg.png";
let timer = 157;
@Initialize{
SetLife(5000);
SetTimer(60);
SetScore(103600);
//SetDurableSpellCard;
SetMovePosition01(GetCenterX,100,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"?J?? ?u???z???v",cut,0,0,600,553);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@Background{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
task mainTask{
wait(90);
fire;
yield;
}
task fire{
let x = 0;
let dir = 0;
loop{
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,5,GetAngleToPlayer,0.05,-0.07,3,PURPLE01);
SetShotDataA(1,60,5,GetAngleToPlayer,0.1,-0.07,3,PURPLE01);
FireShot(1);
CreateShotA(2,GetX,GetY,30);
SetShotDataA(2,0,6,GetAngleToPlayer,0.001,0.001,9,PURPLE01);
FireShot(2);
CreateShotA(6,GetX,GetY,30);
SetShotDataA(6,0,5,GetAngleToPlayer,-0.05,-0.07,3,PURPLE01);
SetShotDataA(6,60,5,GetAngleToPlayer,-0.1,-0.07,3,PURPLE01);
FireShot(6);
while(x<36){
CreateShotA(4,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(4,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(4,60,5,dir,60,0.1,2,PURPLE11);
FireShot(4);
dir+=360/60;
x++;
}
//while(x<36){
//CreateShotA(5,GetX+60*cos(dir),GetY+80*sin(dir),30);
//SetShotDataA(5,0,5,dir,0,0,0,PURPLE11);
//SetShotDataA(5,60,5,dir,-1.9,0,2,PURPLE11);
//FireShot(5);
//dir+=360/60;
//x++;
//}
x=0;
dir=0;
CreateLaserA(0,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(0,0,0,1,-1,2,180);
SetShotKillTime(0,180);
FireShot(0);
CreateLaserA(3,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(3,0,180,-1,-1,-2,180);
SetShotKillTime(3,180);
FireShot(3);
wait(60);
}
}
function wait(w){
loop(w){yield;}
}
}
[/color]
#TouhouDanmakufu
#Title[Test 4: ?J???@?u???z???v]
#Text[Can you escape this illusionary gate?]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\necroremix.mp3]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\yukarisprite.png";
let cut = CSD ~ "img\yukaricutin.png";
let bg = CSD ~ "img\eyebg.png";
let timer = 157;
@Initialize{
SetLife(5000);
SetTimer(60);
SetScore(103600);
//SetDurableSpellCard;
SetMovePosition01(GetCenterX,100,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"?J?? ?u???z???v",cut,0,0,600,553);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@Background{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
task mainTask{
wait(90);
fire;
yield;
}
task fire{
let x = 0;
let dir = 0;
loop{
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,5,GetAngleToPlayer,0.05,-0.07,3,PURPLE01);
SetShotDataA(1,60,5,GetAngleToPlayer,0.1,-0.07,3,PURPLE01);
FireShot(1);
CreateShotA(2,GetX,GetY,30);
SetShotDataA(2,0,6,GetAngleToPlayer,0.001,0.001,9,PURPLE01);
FireShot(2);
CreateShotA(6,GetX,GetY,30);
SetShotDataA(6,0,5,GetAngleToPlayer,-0.05,-0.07,3,PURPLE01);
SetShotDataA(6,60,5,GetAngleToPlayer,-0.1,-0.07,3,PURPLE01);
FireShot(6);
while(x<36){
CreateShotA(4,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(4,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(4,60,5,dir,60,0.1,2,PURPLE11);
FireShot(4);
CreateShotA(5,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(5,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(5,60,5,dir,-1.9,0,2,PURPLE11);
FireShot(5);
dir+=360/60;
x++;
}
x=0;
dir=0;
CreateLaserA(0,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(0,0,0,1,-1,2,180);
SetShotKillTime(0,180);
FireShot(0);
CreateLaserA(3,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(3,0,180,-1,-1,-2,180);
SetShotKillTime(3,180);
FireShot(3);
wait(60);
}
}
function wait(w){
loop(w){yield;}
}
}
Instead of trying to have two while loops run similtaneously, why not just spawn both rings in one loop?Tried that and it doesn't work. Even after I changed it to yours, it still spawns just the one.Code: [Select]#TouhouDanmakufu
#Title[Test 4: ?J???@?u???z???v]
#Text[Can you escape this illusionary gate?]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\necroremix.mp3]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\yukarisprite.png";
let cut = CSD ~ "img\yukaricutin.png";
let bg = CSD ~ "img\eyebg.png";
let timer = 157;
@Initialize{
SetLife(5000);
SetTimer(60);
SetScore(103600);
//SetDurableSpellCard;
SetMovePosition01(GetCenterX,100,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"?J?? ?u???z???v",cut,0,0,600,553);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@Background{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
task mainTask{
wait(90);
fire;
yield;
}
task fire{
let x = 0;
let dir = 0;
loop{
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,5,GetAngleToPlayer,0.05,-0.07,3,PURPLE01);
SetShotDataA(1,60,5,GetAngleToPlayer,0.1,-0.07,3,PURPLE01);
FireShot(1);
CreateShotA(2,GetX,GetY,30);
SetShotDataA(2,0,6,GetAngleToPlayer,0.001,0.001,9,PURPLE01);
FireShot(2);
CreateShotA(6,GetX,GetY,30);
SetShotDataA(6,0,5,GetAngleToPlayer,-0.05,-0.07,3,PURPLE01);
SetShotDataA(6,60,5,GetAngleToPlayer,-0.1,-0.07,3,PURPLE01);
FireShot(6);
while(x<36){
CreateShotA(4,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(4,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(4,60,5,dir,60,0.1,2,PURPLE11);
FireShot(4);
CreateShotA(5,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(5,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(5,60,5,dir,-1.9,0,2,PURPLE11);
FireShot(5);
dir+=360/60;
x++;
}
x=0;
dir=0;
CreateLaserA(0,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(0,0,0,1,-1,2,180);
SetShotKillTime(0,180);
FireShot(0);
CreateLaserA(3,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(3,0,180,-1,-1,-2,180);
SetShotKillTime(3,180);
FireShot(3);
wait(60);
}
}
function wait(w){
loop(w){yield;}
}
}
Tried that and it doesn't work. Even after I changed it to yours, it still spawns just the one.
#TouhouDanmakufu
#Title[Test 4: èJòäü@üuîÂæzûÕüv]
#Text[Can you escape this illusionary gate?]
#Player[FREE]
#Image[.\img\lulzsmiley.png]
#BGM[.\bgm\necroremix.mp3]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\yukarisprite.png";
let cut = CSD ~ "img\yukaricutin.png";
let bg = CSD ~ "img\eyebg.png";
let timer = 157;
@Initialize{
SetLife(5000);
SetTimer(60);
SetScore(103600);
//SetDurableSpellCard;
SetMovePosition01(GetCenterX,100,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"èJòä üuîÂæzûÕüv",cut,0,0,600,553);
SetEnemyMarker(true);
Concentration01(120);
MagicCircle(true);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,28);
SetCollisionB(GetX,GetY,20);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,128,128);
SetGraphicScale(0.6,0.6);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@Background{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
task mainTask{
wait(90);
fire;
yield;
}
task fire{
let x = 0;
let dir = 0;
loop{
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,0,5,GetAngleToPlayer,0.05,-0.07,3,PURPLE01);
SetShotDataA(1,60,5,GetAngleToPlayer,0.1,-0.07,3,PURPLE01);
FireShot(1);
CreateShotA(2,GetX,GetY,30);
SetShotDataA(2,0,6,GetAngleToPlayer,0.001,0.001,9,PURPLE01);
FireShot(2);
CreateShotA(6,GetX,GetY,30);
SetShotDataA(6,0,5,GetAngleToPlayer,-0.05,-0.07,3,PURPLE01);
SetShotDataA(6,60,5,GetAngleToPlayer,-0.1,-0.07,3,PURPLE01);
FireShot(6);
while(x<36){
CreateShotA(4,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(4,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(4,60,5,dir,60,0.1,2,PURPLE11);
FireShot(4);
CreateShotA(5,GetX+60*cos(dir),GetY+80*sin(dir),30);
SetShotDataA(5,0,5,dir,0,0,0,PURPLE11);
SetShotDataA(5,60,5,dir,-1.9,0,2,PURPLE11);
FireShot(5);
dir+=360/60;
x++;
}
x=0;
dir=0;
CreateLaserA(0,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(0,0,0,1,-1,2,180);
SetShotKillTime(0,180);
FireShot(0);
CreateLaserA(3,GetX,GetY,400,20,PURPLE03,0);
SetLaserDataA(3,0,180,-1,-1,-2,180);
SetShotKillTime(3,180);
FireShot(3);
wait(60);
}
}
function wait(w){
loop(w){yield;}
}
}
Okuu playerDammit Naut
Dammit Nautur slow
ur slowi no :<
quoted post
two-word analysisC-c-combo keeper
Grr..i have been into every page in Rika's Garage and I can not find the Shot Replace script that I accidentaly changed...and I have tried the Wiki and I still can not find it...know where I can find it?
Search here:
http://www.shrinemaiden.org/forum/index.php?topic=18.0 (http://www.shrinemaiden.org/forum/index.php?topic=18.0)
.....I am offically a 9 now....uploaded:
Edit: It wont let me download the file, I get some an error saying this:
Your Hosting Account is Suspended
Your account has been suspended by x10Hosting's administration.
uploaded:
http://www.mediafire.com/download.php?ddjmdue1jm0 (http://www.mediafire.com/download.php?ddjmdue1jm0)
script_enemy_main{
let enemyframe = 0;
let enemyframe2 = 0;
let imgAngle=0;
let imgEnemy=GetCurrentScriptDirectory~"..\..\img\enemy\devicered.png";
//--------------------------------------------------------------------------------------------------------------
@Initialize{
SetLife(50);
LoadGraphic(imgEnemy);
SetTexture(imgEnemy);
SetGraphicRect(0,0,32,32);
SetGraphicScale(1, 1);
SetMovePosition02(GetX, GetY, 0);
}
//--------------------------------------------------------------------------------------------------------------
@MainLoop
{
SetCollisionA(GetX(),GetY(),24);
SetCollisionB(GetX(),GetY(),24);
if (enemyframe2 == 30)
{
PlaySE(GetCurrentScriptDirectory~"..\..\sfx\Shot1.wav");
CreateShot01(GetX, GetY, 3, 60, GREEN01, 0);
CreateShot01(GetX, GetY, 3, 90, GREEN01, 0);
CreateShot01(GetX, GetY, 3, 120, GREEN01, 0);
SetMovePosition02(GetX-100, GetY+25, 30);
}
if (enemyframe2 == 60)
{
PlaySE(GetCurrentScriptDirectory~"..\..\sfx\Shot1.wav");
CreateShot01(GetX, GetY, 3, 60, GREEN01, 0);
CreateShot01(GetX, GetY, 3, 90, GREEN01, 0);
CreateShot01(GetX, GetY, 3, 120, GREEN01, 0);
SetMovePosition02(GetX+100, GetY+25, 30);
enemyframe2 = 0;
}
if (enemyframe == 600)
{
VanishEnemy;
}
enemyframe++;
enemyframe2++;
}
//--------------------------------------------------------------------------------------------------------------
@Finalize{
if(BeVanished==false){
loop(3){
CreateItem(ITEM_SCORE,GetX+rand(-25,25),GetY+rand(-25,25));
}
}
}
//--------------------------------------------------------------------------------------------------------------
@DrawLoop{
SetTexture(imgEnemy);
SetColor(255,255,255);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,imgAngle);
DrawGraphic(GetX(),GetY());
SetRenderState(ADD);
SetGraphicAngle(0,0,imgAngle);
DrawGraphic(GetX(),GetY());
imgAngle-=4;
if(imgAngle<-360){imgAngle=0;}
}
}
Also, is there a function for "CreateShotA" bullets that makes bombs unable to absorb them?You need object bullets for taht.
But white edge still appear every try.
Thank you very much, when remove SetRenderState(ADD); problem solve.
Try putting the actual image on a 512 by 512 png file with transparency if you use ALPHA rendering, or put it in with a black background if you use ADD. You'll get a clearer image, and it should solve your white edge problem. Danmakufu is very picky when it comes to input, so try to keep up to its standards.
Oh, and my question... I want to change some of Danmakufu's default sounds... what can I do? Anybody know?
Unraveling the mysteries of th_dnh.dat (http://www.shrinemaiden.org/forum/index.php?topic=3167.0)
ascent(i in 0..30){
bullets go here;
}
loop(30){
bullets go here;
}
loop{
loop(30){ bullets go here;}
yield;}
stuff happens;
stuff happens;
loop(30){yield;}
I want this to happen now;
stuff happens;
///somewhere in the script_stage_main brackets///
task I want this to happen now{
loop{ stuff happens; yield; }
}
I tried that and it does the same thing, im using CreateShotAs as well.
Then put the yield at wherever FireShot is, because that's the one that actually fires the bullet.
if(frame%40==0){
ascent(x in 2..60){
ascent(y in 1..60){
CreateShotA(0, 31*x, 16*y, 1);
SetShotDataA(0, 0, 0, 0, 0, 0, 0, BLUE01);
SetShotDataA(0, 20, 2, 90, 0, 0, 0, BLUE01);
yield;FireShot(0);
}}}//x,y,frame closure in order
this is what i have been using, and its in the mainloop.
How would i make bullets that start at the top left corner(32, 16) fill all of X and Y of the field in a downward, right way every frame? ive tried using ascents but it just spawns them at the same time. like this:
(http://i600.photobucket.com/albums/tt84/Happyhobo810/Cleaver.jpg)
Try using delayed bullets...
mainloop
Gah, I hate arrays. You really should microthread. It makes things a lot easier.
how?CreateShot01(x, y, velocity, angle, graphic, delay);
script_enemy_main{
@Initialize{
stuffhappens;
}
@DrawLoop{
}
@MainLoop{
yield;}
@Finalize{
}
task stuffhappens{ CreatShot...whatever you want to happen...
}
}
Okay, next Question(s)...2. you can visit nuclear cheese's effect object tutorial (here (http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Effect_Object_Tutorial))... just form lots of vertices... I think...
1. Do I use a separate task if I want to change the SetEffect_SetVertexUV coordinates of my player's Options...or do I just place that info somewhere in the task the handles my options...?
2. How do I get a line to form a circle like below(if a tutorial tells me how, point me to it)...
Unfortunately, Danmakufu doesn't have a function capable of clipping the image into a circle (available to us, that is, the Magic Circle function does this internally... Fffffff), so you'll have to make an ObjEffect with a trillion vertices, like AlwaysThe⑨ said.
@ChaoStar:
By "wont load", do you mean crashes on start up, or wont appear in the game menu? Any and all text files that do not start with #TouhouDanmakufu will not appear in the main menu. This way you can make runnable scripts that cannot be played individually (like how full games consist of many small scripts but none of them appear in the menu), perhaps this is the issue? Screenshots would be helpful towards clarification.
By 'won't load', I mean it crashes upon loading the spellcard. It gives me no error message, either.
Do you mean make a straight image and bend it into a circle? It's actually pretty simple, and I can show you how to do it if you want. I can even take that circle and bend it into a star, or whatever other shape you can think of. Both pointy edges and smooth. It took a while, but I've figured it out.
CreateShotA(idused, ((idused%48)*8)+32, (floor(idused/48)*8)+16), 5);
SetShotDataA(idused,0,0,270,0,0,0,WHITE05);
FireShot(idused);
gives me error 「CreateShotAの引数の数が違います」, which means "CreateShotA has the wrong number of arguments", except... there are four. Which there should be. I dun get it. Only thing I can think of is idused gets too big or something; it goes from 0 to 2351.
Only thing I can think of is idused gets too big or something; it goes from 0 to 2351.
Code: [Select](floor(idused/48)*8)+16)
Code: [Select]( ( ) ) )
let scale = 0.68;
let p = 0;
- Inside @initialize --> scale = 0.68/GetTimer
- Script boots . . . 'p' increases and decreases to its starting size --> 0.68.
- A task with delay of 60 frames does: p -= scale;
It works, as timer reaches 0 the circle is also like gone/small. But the stepping is unnatural and not smooth. I want a similar feeling like the build in spellcircle or the ones you see in the official games.
Try making a variable that stores GetTimer*60-1 and decrements every frame instead. Then you can update the circle every frame to make it smooth instead of jumpy every second. The -1 is so that it disappears the frame before the timer runs out and doesn't just stay there in as a minuscule circle.
The way I see it, one of three things could be happening. One, you're trying to load an object effect at Initialize without putting in yield; first. Two, you're spawning infinite bullets, or calling infinite tasks all in one frame by placing it in a loop and forgetting to put yield; in it. Or three, you're loading a filetype that danmakufu doesn't recognise (a different type of text file, a music file that isn't .mp3, .ogg, or .wav.
Try looking over the script. If the problem persists, post it here.
(**Back to here at last**)
Can I reflect the graphics by reversing the x-coordinates in SetGraphicRect?
let i = 0;
while (i < length(ninja)) {
let alph = ninja2[0] - 15;
ninja2 = erase(ninja2,0);
Obj_SetAlpha(ninja[i], alph);
if(alph <= 15) {
ninja = erase(ninja,i);
} else {
ninja2 = ninja2 ~ [alph];
i++;
}
}
Is there a way to change one value in an array without rebuilding the entire ****in' thing? I'm trying to get bullets to fade out, and this is what I ended up with:Code: [Select]let i = 0;
while (i < length(ninja)) {
let alph = ninja2[0] - 15;
ninja2 = erase(ninja2,0);
Obj_SetAlpha(ninja[i], alph);
if(alph <= 15) {
ninja = erase(ninja,i);
} else {
ninja2 = ninja2 ~ [alph];
i++;
}
}
Note what's happening to ninja2 there. It works, but it's almost certainly the ugliest hakcjob I've ever done.
script_enemy_main {
@Initialize{
SetLife(10);
Main();
yield;
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
}
@DrawLoop{
}
@Finalize{
CreateItem(ITEM_SCORE,GetX,GetY);
}
task Main(){
yield;
CreateShot01(GetX,GetY,2,rand(0,360),BLUE01,0);
}
#TouhouDanmakufu[Stage]
#Title[Stage 1 Easy]
#Text[...]
#Image[]
#Background[]
#BGM[.\SE\Iku.mp3]
#Player[FREE]
#ScriptVersion[2]
script_stage_main{
function Wait(let frames){
loop(frames){yield;}
}
function WaitForZeroEnemy{
while(GetEnemyNum != 0){yield;}
}
task stage{
CreateEnemyFromFile(GetCurrentScriptDirectory~"Enemy1.txt", GetCenterX, GetCenterY, 0, 0, 0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"TenshiBossE.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(180);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"IkuBossE.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(60);
Clear;
}
@Initialize{
stage;
}
@MainLoop{
yield;
}
@Background{
}
@Finalize{
}
}
#TouhouDanmakufu[Stage]
#Title[Stage 1 Easy]
#Text[...]
#Image[]
#Background[]
#BGM[.\SE\Iku.mp3]
#Player[FREE]
#ScriptVersion[2]
script_stage_main{
function Wait(let frames){
loop(frames){yield;}
}
function WaitForZeroEnemy{
while(GetEnemyNum != 0){yield;}
}
task stage{
Wait(2*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX-150, GetCenterY-175, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX+150, GetCenterY-175, 0, 0, 0);
WaitForZeroEnemy;
Wait(1*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX, GetCenterY-175, 0, 0, 0);
WaitForZeroEnemy;
Wait(3*60);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"TenshiBossE.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(1*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX, GetCenterY-175, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
WaitForZeroEnemy;
Wait(180);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"IkuBossE.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(60);
Clear;
}
@Initialize{
stage;
}
@MainLoop{
yield;
}
@Background{
}
@Finalize{
}
}
Ok it's fixed, but now in this script iku won't show up.Is Iku in the right script directory?Code: [Select]#TouhouDanmakufu[Stage]
#Title[Stage 1 Easy]
#Text[...]
#Image[]
#Background[]
#BGM[.\SE\Iku.mp3]
#Player[FREE]
#ScriptVersion[2]
script_stage_main{
function Wait(let frames){
loop(frames){yield;}
}
function WaitForZeroEnemy{
while(GetEnemyNum != 0){yield;}
}
task stage{
Wait(2*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX-150, GetCenterY-175, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX+150, GetCenterY-175, 0, 0, 0);
WaitForZeroEnemy;
Wait(1*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX, GetCenterY-175, 0, 0, 0);
WaitForZeroEnemy;
Wait(3*60);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"TenshiBossE.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(1*60);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy1.txt", GetCenterX, GetCenterY-175, 0, 0, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, GetCenterY-200, 2, 0, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, GetCenterY-200, 2, 180, 0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
Wait(10);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", 0, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
CreateEnemyFromFile(GetCurrentScriptDirectory~"\Enemy2.txt", GetCenterX+GetCenterX-1, rand(GetCenterY-100,GetCenterY-200), 2, 180, 0);
WaitForZeroEnemy;
Wait(180);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"IkuBossE.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(60);
Clear;
}
@Initialize{
stage;
}
@MainLoop{
yield;
}
@Background{
}
@Finalize{
}
}
task ImageCircle(graphic,left,top,right,bottom,centerX,centerY,radius,width,segments,rotation,layer,alpha,renderstate,red,green,blue){
yield;
let obj = Obj_Create(OBJ_EFFECT);
let n=0;
Obj_SetPosition (obj, centerX,centerY);
Obj_SetSpeed (obj, 0);
Obj_SetAngle(obj, 0);
ObjEffect_SetTexture(obj,graphic);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetAngle(obj,0,0,rotation);
ObjEffect_SetLayer(obj,layer);
ObjEffect_CreateVertex(obj,(segments*2)+2);
ObjEffect_SetRenderState(obj,renderstate);
n=0;
loop((segments*2)+2){
ObjEffect_SetVertexColor(obj,n,alpha,red,green,blue);
if(n%2==0){ObjEffect_SetVertexUV(obj,n,left+(right/segments)*floor(n/2),top);
} else { ObjEffect_SetVertexUV(obj,n,left+(right/segments)*floor(n/2),bottom);
}
ObjEffect_SetVertexXY(obj,n, cos((360/segments)*floor(n/2))*(radius-(n%2)*width), sin((360/segments)*floor(n/2))*(radius-(n%2)*width) );
n++;
}
yield;
Obj_Delete(obj);
}
#TouhouDanmakufu
#Title[magic circle 2]
#Text[]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let imagefile = GetCurrentScriptDirectory ~ "index.png";
@Initialize{
SetMovePosition02(GetCenterX,GetCenterY-100,0); ///the object will be on the boss's position
SetLife(1);
LoadGraphic(imagefile);
object;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
task object{ yield; yield; ///the yield needs to be in place so Danmakufu doesn't crash. Object effects cannot load directly at Initialize unless a couple of frames pass first.
let objid = Obj_Create(OBJ_EFFECT);
Obj_SetX(objid, GetX); ///the Object will be on the Boss's X and Y position
Obj_SetY(objid, GetY);
ObjEffect_SetScale(objid,1,1);
ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP); ///the basics you need to know
ObjEffect_SetRenderState(objid,ADD);
ObjEffect_SetTexture(objid, imagefile);
let totalradius=100; ////the real radius of the circle
let repeat=2; ////number of times the image is repeated in the circle. The higher, the more scrunched-up the circle will look. the lower, the more stretched the image will look (height-wise)
let sides=80; ////it's not a perfect circle. It actually has 80 "sides". If it were 3, it'd be a triangle.
let d=0; //// this will be used to determine the height of the image later
let Z=0; //// it will spin upon the Z axis
let RotateSpeed=1; ///added to Z to rotate the circle
let IN=0; ////added to the real radius, this will be where the inner vertices of the circle will be.
let OUT=30; ////added to the real radius, this will be where the outer vertices of the circle will be. It should be equal to the width of the desired image (not the whole image, just the part you want seen. A bigger number will stretch the image (width-wise). Experiment and see.
ObjEffect_CreateVertex(objid, 2+sides*2); ///here, we're making the vertices for the whole circle. A triangle with 3 sides would have 8 vertices, not 6, because the first two are used to "start" the triangle (or any other shape you're doing). The first is the inner verticy, the second is the outer verticy. Then inner again, then outer, and so on.
////everything below is explained in forum
ascent(i in 0..sides+1){ ///since we're doing the shape in pairs, the number vertices will be half of the ObjEffect_CreateVertex
ObjEffect_SetVertexUV(objid,i*2,32,d*repeat/sides); ///the first is the inner verticy
ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides); ///the second is outer verticy
d+=-256; ////the height of the actual png image. When it goes out of bounds, it repeats itself. This can be done infinitely.
}
////see the forum for explanation of everything below
while(!Obj_BeDeleted(objid)){
ascent(i in 0..sides+1){
let radiusINX=(totalradius +IN)*cos(i*360/sides +Z);
let radiusINY=(totalradius +IN)*sin(i*360/sides +Z);
let radiusOUTX=(totalradius +OUT)*cos(i*360/sides +Z);
let radiusOUTY=(totalradius +OUT)*sin(i*360/sides +Z);
ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);
}
yield;
}
}
}
ObjEffect_SetVertexUV(objid,0*2,32,d*repeat/sides);
ObjEffect_SetVertexUV(objid,0*2+1,32,d*repeat/sides);
ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
Remember, we're doing this in pairs, so there's an inner AND outer vertex for the circle. Two for each angle, so we also have thisObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);
Remember what we learned before about the vertex numbers? We apply it here too. So it's very simple. Same number of ascents as before since we're doing the verticies in pairs, and the same basic code. "i*2" for the inner, and "i*2+1" for the outer. Next, defining the X and Y parameters. It's actually a bit long, so I let a variable represent them to make them a bit shorter.let radiusINX=(totalradius +IN)*cos(i*360/sides +Z);
We're using cosine for the X parameter, as always. Basic stuff. Because of that, we have to use 360/sides in there, since there are 360 degrees in a full circle. Since we're not using 360 sides, we can't just plug in cosine(i+Z). Instead, we use (i*360/sides+Z). i being our actual angle which the verticy pairs will lay, and 360/sides being the format we lay it in. This way, we could use 8 sides to make an octagon, 3 sides to make a triangle, or whatever. We're not limited to having always using 360 sides because of cosine this way , we could use more or less, whichever we want. Now that 360/sides is out of the way, what's the "i" for? We use that for our angle. The first angle at 0 degrees, then (when i=1, we define our SECOND pair of vertices ) 2nd angle at 4.5 degrees (since we have 80 sides to our circle. 360/80=4.5) The added "Z" in our parameter is the added degrees we use that allows us to "spin" our circle. When i=2, we define our third pair of vertices, which will be 2*4.5, which is at 9 degrees. Smart, huh? 360 degrees divide by 4.5 degrees per angle equals 80. See why we use ascent (i in 0..80+1) now? And instead name it to (ascent i in..sides+1) instead? We'll easily make it from a pentagon to an 80-sided circle with only having to change 1 variable, instead of like 20. That's why we use the variable "sides". Remember, we need our added 1 there to actually finish our circle, since our first vertices will only be our starting angle.let radiusINY=(totalradius +IN)*sin(i*360/sides +Z);
It does the same exact thing, except the sin there is used for our Y parameter. Sine of zero degrees is 0, so our Y parameter doesn't change for GetY; , though the cosine(0 degrees)=1, so it's 100 pixels to the right. Now since that's out of the way, you might be wondering what the IN there is for? Well, first let me explain why we have the OUT in let radiusOUTX=(totalradius +OUT)*cos(i*360/sides +Z);
Since OUT=30, our radius for the second vertex in each pair of verticies will alway be 30 more than our "totalradius" value. This is especially useful when we want to shrink our circle without having to reduce the width of the displayed PNG image. Also, if we want to shrink our circle with the timer, we could just make a timer value. In the beginning of our script, we can put in let timer=GetTimer*60 (multiply by 60 because of 60 frames per second), then let timer2=timer.#TouhouDanmakufu
#Title[magic circle]
#Text[]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let imagefile = GetCurrentScriptDirectory ~ "index.png";
let objid;
@Initialize{
SetMovePosition02(GetCenterX,GetCenterY-100,0);
SetLife(1);
LoadGraphic(imagefile);
SetTimer(10);
object;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
task object{ yield; yield;
objid = Obj_Create(OBJ_EFFECT);
Obj_SetX(objid, GetX);
Obj_SetY(objid, GetY);
ObjEffect_SetScale(objid,1,1);
ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetRenderState(objid,ADD);
ObjEffect_SetTexture(objid, imagefile);
let totalradius=250;
let repeat=3;
let sides=80;
let d=0;
let rotate=0;
let RotateSpeed=1;
let timer=GetTimer*60;
let timer2=timer;
let IN=-totalradius;
let OUT=-totalradius;
ObjEffect_CreateVertex(objid, sides*2+2);
ascent(i in 0..sides+1){
ObjEffect_SetVertexUV(objid,i*2,32,d*repeat/sides);
ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
d+=-256;
}
while(!Obj_BeDeleted(objid)){
ascent(i in 0..sides+1){
let radiusINX=(totalradius*timer/timer2+IN)*cos(i*360/sides +rotate);
let radiusINY=(totalradius*timer/timer2+IN)*sin(i*360/sides +rotate);
let radiusOUTX=(totalradius*timer/timer2+OUT)*cos(i*360/sides +rotate);
let radiusOUTY=(totalradius*timer/timer2+OUT)*sin(i*360/sides +rotate);
ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);
}
if(IN<0){IN+=totalradius/100;}
if(OUT<30){OUT+=totalradius/20;}
rotate+=RotateSpeed;
timer--;
yield;
}
}
}
while(!Obj_BeDeleted(objid)){
all your SetVertexXY ascents here....
yield;
Z++; //or Z+=rotation, and define the rotation variable up near the top of the task
timer--;
whatever else;
}
let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
Then, in the ascent, since we want the value of "digit" to change while we're forming our circle, we also put this in the ascentdigit+=5;
Get it? If we had 360 sides, that'd also be 360 angles. 360/360=1. sin(1*5)=0.087 Which is what we want. The next angle, it would be sin(1*10)=0.17;, and so on for the next 360 angles. But because we use sin(360/sides), we don't have to have 360 sides in our circle for the sine to work, and can use less instead. sin(360/sides*digit) is what we want, and so it works. Basically what we did here is make 5 revolutions, and get the sin value of each degree in each revolution, and add that to the total radius of our circle as we make it. This is how we get that wavy effect. let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
let radiusINY=(radius+RadiusIN+extra*sin(360/sides*digit))*sin(i*angle +rotate);
let radiusOUTX=(radius+RadiusOUT+extra*sin(360/sides*digit))*cos(i*angle +rotate);
let radiusOUTY=(radius+RadiusOUT+extra*sin(360/sides*digit))*sin(i*angle +rotate);
ascent(i in 0..sides+1){
let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
let radiusINY=(radius+RadiusIN+extra*sin(360/sides*digit))*sin(i*angle +rotate);
let radiusOUTX=(radius+RadiusOUT+extra*sin(360/sides*digit))*cos(i*angle +rotate);
let radiusOUTY=(radius+RadiusOUT+extra*sin(360/sides*digit))*sin(i*angle +rotate);
digit+=5;
ObjEffect_SetVertexXY(circle, i*2, radiusINX, radiusINY);
ObjEffect_SetVertexXY(circle, i*2+1, radiusOUTX, radiusOUTY);
}
(radius+RadiusOUT+extra*sin((360(sides+1))*digit))*cos(i*angle +rotate);
, but then that X and Y coordinates for our last pair of verticies will be off, and the star doesn't connect to itself and looks funky because of the "digit+=5". It finishes our sine at 360 degrees, but because our first angle is use to start our circle (the one we use for our first pair of verticies), the last angle we use to define our last pair of IN and OUT verticies gets an extra 5, and our finishing verticies get the value of (360/sides*digit), with digit=405 (which, with our sine and our number of sides in our circle being 80, is equal to digit=5), where as the first angle for our first verticies get (360/sides*digit) with digit=0. So instead, we use our ascent without the added 1. This will make our star look good, but incomplete because the finishing angle is missing. That last pair of verticies will have to be added manually. I take the time to do it. NOTE: the variable lastdigit=digit. Initially, digit was 0 before the while(!Obj_BeDeleted(circle)) loop , so lastdigit is also 0. When the last pair of verticies are made, they are made with the exact same variables with just a few small differences. Our last angle is equal to our first angle, and the verticies along with it are also the same, so we must have the same variables altogether but with the variable lastdigit
equal to initial digit, before it adds a 5 to itself. i=0 in our first run of the ascent, so our last angle is also equal to zero degrees, + the added Z for rotation. This gives us a perfect star. while(!Obj_BeDeleted(circle)){
ascent(i in 0..sides){
let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
let radiusINY=(radius+RadiusIN+extra*sin(360/sides*digit))*sin(i*angle +rotate);
let radiusOUTX=(radius+RadiusOUT+extra*sin(360/sides*digit))*cos(i*angle +rotate);
let radiusOUTY=(radius+RadiusOUT+extra*sin(360/sides*digit))*sin(i*angle +rotate);
digit+=5;
ObjEffect_SetVertexXY(circle, i*2, radiusINX, radiusINY);
ObjEffect_SetVertexXY(circle, i*2+1, radiusOUTX, radiusOUTY);
}
let LastInX=(radius+RadiusIN+extra*sin(360/sides*lastdigit))*cos(0*angle +rotate);
let LastInY=(radius+RadiusIN+extra*sin(360/sides*lastdigit))*sin(0*angle +rotate);
let LastOutX=(radius+RadiusOUT+extra*sin(360/sides*lastdigit))*cos(0*angle +rotate);
let LastOutY=(radius+RadiusOUT+extra*sin(360/sides*lastdigit))*sin(0*angle +rotate);
ObjEffect_SetVertexXY(circle, sides*2, LastInX, LastInY);
ObjEffect_SetVertexXY(circle, sides*2+1, LastOutX, LastOutY);
if(extra>0){extra+=addtoextra;}
yield;
}
#TouhouDanmakufu
#Title[magic circle 3]
#Text[]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let imagefile = GetCurrentScriptDirectory ~ "index.png";
@Initialize{
SetMovePosition02(GetCenterX,GetCenterY-100,0);
SetLife(1);
LoadGraphic(imagefile);
SetTimer(60);
object;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
task object{ yield; yield;
let circle = Obj_Create(OBJ_EFFECT);
Obj_SetX(circle, GetX);
Obj_SetY(circle, GetY);
ObjEffect_SetScale(circle,1,1);
ObjEffect_SetPrimitiveType(circle, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetRenderState(circle,ADD);
ObjEffect_SetTexture(circle, imagefile);
let radius=100;
let RadiusIN=0;
let RadiusOUT=30;
let INA=0;
let OUTA=0;
let repeat=6;
let sides=60;
let d=0;
let rotate=0;
let RotateSpeed=1;
let angle=360/sides;
let angle2=0;
let digit=rand(0,180);
let lastdigit=digit;
let extra=40;
let addtoextra=-0.4;
ObjEffect_CreateVertex(circle, sides*2+2);
ascent(i in 0..sides+1){
ObjEffect_SetVertexUV(circle,i*2,32,d*repeat/sides);
ObjEffect_SetVertexUV(circle,i*2+1,0,d*repeat/sides);
d+=-256;
}
while(!Obj_BeDeleted(circle)){
ascent(i in 0..sides){
let radiusINX=(radius+RadiusIN+extra*sin(360/sides*digit))*cos(i*angle +rotate);
let radiusINY=(radius+RadiusIN+extra*sin(360/sides*digit))*sin(i*angle +rotate);
let radiusOUTX=(radius+RadiusOUT+extra*sin(360/sides*digit))*cos(i*angle +rotate);
let radiusOUTY=(radius+RadiusOUT+extra*sin(360/sides*digit))*sin(i*angle +rotate);
digit+=5;
ObjEffect_SetVertexXY(circle, i*2, radiusINX, radiusINY);
ObjEffect_SetVertexXY(circle, i*2+1, radiusOUTX, radiusOUTY);
}
let LastInX=(radius+RadiusIN+extra*sin(360/sides*lastdigit))*cos(0*angle +rotate);
let LastInY=(radius+RadiusIN+extra*sin(360/sides*lastdigit))*sin(0*angle +rotate);
let LastOutX=(radius+RadiusOUT+extra*sin(360/sides*lastdigit))*cos(0*angle +rotate);
let LastOutY=(radius+RadiusOUT+extra*sin(360/sides*lastdigit))*sin(0*angle +rotate);
ObjEffect_SetVertexXY(circle, sides*2, LastInX, LastInY);
ObjEffect_SetVertexXY(circle, sides*2+1, LastOutX, LastOutY);
if(extra>0){extra+=addtoextra;}
yield;
}
}
}
task flower(x, angle) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, GetClipMinY);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, 0);
ObjShot_SetGraphic(obj, RED12);
ObjShot_SetDelay(obj, 10);
ObjShot_SetBombResist(obj, true);
while(Obj_BeDeleted(obj)==false){
Obj_SetPosition(obj, Obj_GetX(obj) + rand(-2, 2), Obj_GetY(obj) + rand(1, 3));
Obj_SetAngle(obj, Obj_GetAngle(obj) + 3);
yield;
}
}
Hm. I have run into a situation with object bullets once more.
I am trying to make the bullets fall erratically down the screen, but they do not move at all.Code: [Select]task flower(x, angle) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, GetClipMinY);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, 0);
ObjShot_SetGraphic(obj, RED12);
ObjShot_SetDelay(obj, 10);
ObjShot_SetBombResist(obj, true);
while(Obj_BeDeleted(obj)==false){
Obj_SetPosition(obj, Obj_GetX(obj) + rand(-2, 2), Obj_GetY(obj) + rand(1, 3));
Obj_SetAngle(obj, Obj_GetAngle(obj) + 3);
yield;
}
}
The speed has nothing to do with it, because I want the bullets to fall in groups of four (i.e. shuriken shape). Neither the angle nor the position of the bullets change here, for some odd reason (practically everything inside "while(Obj_BeDeleted)" does not work). What is the problem here?
I haven't read it all yet, but that's still great. Especially if Hele can make use of this code. Probably deserves a spot somewhere as it's not exactly a tutorial, though. Post it on the wiki for sure.
That is extremely easy.(http://www.pocketonline.net/g2engine/d/36581-2/dd5a410049c49567386a3295c56b85bdfc241f87.jpg) (http://www.pocketonline.net/g2engine/d/36580-1/dd5a410049c49567386a3295c56b85bdfc241f87.jpg)
somewhere in the beginning: let scrolling = 0;
Inside @BackGround:
DrawGraphic(GetX, GetY+scrolling); <--- drawing
scrolling++; <-- scroll speed.
Remember the order of drawing, the first drawn image is always at the bottom. The 2nd is above it etc.
Example:
// ground
SetTexture(ground);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling);
// bushes / forest
SetTexture(forest);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling2); <-- different speed or unless you are math whiz add math
// clouds
SetTexture(clouds);
blabla SetGraphicRect, Angle etc.
DrawGraphic(GetX, GetY+scrolling3); <--- same as above
I wonder if someone here could possibly make the music i got, playable for danmakufu? because some songs make danmakufu act weird or crash!Try to see if there are any similarities in the bitrate/sample rate of the songs you are using that work, and convert the songs that don't work according to those values.
at certain points i am being forced to use songs i dont want to use or that dont fit very well...
or at least tell me how to make them playable using audacity
Alright, I'm hearing some people telling me that I should put that little tutorial earlier in a wiki or something.
Where exactly do you guys want me to put it?
Also, just a heads up, my stage will come out soon. Just letting you guys know.
Would you atleast be so kind to read other people's posts, commenting/asking things about your posts?
Neverless, I don't see the reason to move the vertices around unless you want them to warp. It needs at the end some math to achieve. ( not my expertise anyway )
#TouhouDanmakufu
#Title[magic circle]
#Text[]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let imagefile = GetCurrentScriptDirectory ~ "index.png";
@Initialize{
SetMovePosition02(GetCenterX,GetCenterY-100,0);
SetLife(1);
LoadGraphic(imagefile);
object;
}
@MainLoop{
yield;
}
@DrawLoop{
}
@BackGround{
}
@Finalize{
}
task object{ yield; yield;
let objid = Obj_Create(OBJ_EFFECT);
Obj_SetX(objid, GetX);
Obj_SetY(objid, GetY);
ObjEffect_SetScale(objid,1,1);
ObjEffect_SetPrimitiveType(objid, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetRenderState(objid,ALPHA);
ObjEffect_SetTexture(objid, imagefile);
let totalradius=100;
let repeat=2;
let sides=80;
let d=0;
let Z=0;
let RotateSpeed=1;
let IN=0;
let OUT=30;
Obj_SetAlpha(objid,0);
ObjEffect_CreateVertex(objid, 2+sides*2);
ascent(i in 0..sides+1){
ObjEffect_SetVertexUV(objid,i*2,32,d*repeat/sides);
ObjEffect_SetVertexUV(objid,i*2+1,0,d*repeat/sides);
d+=-256;
}
while(!Obj_BeDeleted(objid)){
ascent(i in 0..sides+1){
let radiusINX=(totalradius+IN)*cos(i*360/sides +Z);
let radiusINY=(totalradius+IN)*sin(i*360/sides +Z);
let radiusOUTX=(totalradius+OUT)*cos(i*360/sides +Z);
let radiusOUTY=(totalradius+OUT)*sin(i*360/sides +Z);
ObjEffect_SetVertexXY(objid, i*2, radiusINX, radiusINY);
ObjEffect_SetVertexXY(objid, i*2+1, radiusOUTX, radiusOUTY);
}
yield;
}
}
}
Why isn't Obj_SetAlpha working? It's so puzzling, I want to change alpha value without SetVertexColor.
task spiral(minx,miny,freq,amp){
let count = 0;
while(count<GetClipMaxY-miny){
CreateShot01(minx, miny+(count),0,90,WHITE05,10);
CreateShot01(minx+((sin((miny+(count))*freq))*amp), miny+(count),0,90,WHITE05,10);
count+=3;
yield;
}
}
Whenever I start danmakufu, nothing happens. The process is up, but the window doesn't appear. Then, whenever I delete the process, it deletes explorer.exe too. I think the explorer.exe part is just my computer however. Any help?
How would you make bullets that intertwine with another stream? like in Kanako's Cross spell thing...errr like this
Lol sorry for the horrible picture, done with out glasses and in MS paint..
task spiral(minx,miny,angle,freq,amp,dens){
let count = 0;
let posx = minx;
let posy = miny;
while(posx<GetClipMaxX && posy<GetClipMaxY && posx>GetClipMinX && posy>GetClipMinY){
CreateShot01(minx+(cos(angle)*count),miny+(sin(angle)*count),1,count*4,WHITE05,10);
CreateShot01(minx+(cos(angle)*count)+(cos(sin(angle)*count*freq)*amp),miny+(sin(angle)*count)+(sin(cos(angle)*count*freq)*amp),1,count*4,WHITE05,10);
count+=dens;
posx+=cos(angle)*dens;
posy+=sin(angle)*dens;
yield;
}
}
let ar = [];
let enx = 0;
let eny = 0;
if(GetEnemyNum>0){
ascent(i in EnumEnemyBegin..EnumEnemyEnd){
let ene = EnumEnemyGetID(i);
ar = ar ~ ene;
}
let r = ar[rand_int(0, length(ar))];
enx = GetEnemyInfo(r, ENEMY_X);
eny = GetEnemyInfo(r, ENEMY_Y)
}else{
enx = rand(50, 398);
eny = rand(50, 150);
}
Hi guys am I not allowed to add enemy IDs to an array orCode: [Select]let ar = [];
let enx = 0;
let eny = 0;
if(GetEnemyNum>0){
ascent(i in EnumEnemyBegin..EnumEnemyEnd){
let ene = EnumEnemyGetID(i);
ar = ar ~ ene;
}
let r = ar[rand_int(0, length(ar))];
enx = GetEnemyInfo(r, ENEMY_X);
eny = GetEnemyInfo(r, ENEMY_Y)
}else{
enx = rand(50, 398);
eny = rand(50, 150);
}
image
i r not gud wit arrays wat i do
{
task THomingShot (GetX, GetY, 2, 90, RED02, 10);
{
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition (obj, GetX, GetY);
Obj_SetSpeed (obj, 2);
ObjShot_SetGraphic(obj, RED02);
ObjShot_SetDelay (obj, 10);
let maxTraverse = 0.5;
while(! Obj_BeDeleted(obj)) {
Obj_SetAngle(obj, 90);
yield;
let dir = atan2(GetPlayerY - Obj_GetY(obj),
GetPlayerX - Obj_GetX(obj));
let diff = dir - angle;
while(diff >= 180) { diff -= 360; }
while(diff < -180) { diff += 360; }
let diffAbs = (|diff|);
if(diffAbs < maxTraverse) {
angle = dir;
} else {
angle += maxTraverse * diff / diffAbs;
}
}
}
Okay to answer this question, I need to start somewhere small and work my way up. Bear with me for a bit. :-XCode: [Select]{
task THomingShot (GetX, GetY, 2, 90, RED02, 10);
{
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition (obj, GetX, GetY);
Obj_SetSpeed (obj, 2);
ObjShot_SetGraphic(obj, RED02);
ObjShot_SetDelay (obj, 10);
let maxTraverse = 0.5;
while(! Obj_BeDeleted(obj)) {
Obj_SetAngle(obj, 90);
yield;
let dir = atan2(GetPlayerY - Obj_GetY(obj),
GetPlayerX - Obj_GetX(obj));
let diff = dir - angle;
while(diff >= 180) { diff -= 360; }
while(diff < -180) { diff += 360; }
let diffAbs = (|diff|);
if(diffAbs < maxTraverse) {
angle = dir;
} else {
angle += maxTraverse * diff / diffAbs;
}
}
}
it says i need a parathesis somewhere, or something
what
sub CreateRingShot {
ascent(i in 0..36) {
CreateShot01(GetX, GetY, 2, i*10, RED01, 10);
}
}
function CreateRingShot(speed, graphic, delay) {
ascent(i in 0..36) {
CreateShot01(GetX, GetY, speed, i*10, graphic, delay);
}
}
task CreateRingShot(speed, graphic, delay) {
ascent(i in 0..36) {
CreateShot01(GetX, GetY, speed, i*10, graphic, delay);
yield;
}
}
hi, yeah, another question...how do I get an enemy to move along a path that looks like a complete circle...?SetMovePosition02(x+radius*cos(a), y+radius*sin(a), frames);
can't quite get it...
hi, yeah, another question...how do I get an enemy to move along a path that looks like a complete circle...?
can't quite get it...
use SetMovePositionHerminte, its in the Tutorials
oh, my bad, not used to enemy scripts...I'll umm, check that out then...thanks...if(GetTimer < a certain number) { variable++; } is what I use to make stuff happen after like, the timer reads 60 secs and under.
anywho...next question...
How the hell, do I use "GetTimer" to make something happen at a certain point after
the spellcard has started like 30secs into the spellcard attack?
...I don't even understand the parameters of this function...
#TouhouDanmakufu
#Title[Pattern003]
#Text[]
#Image[.\system\ArtMirror.png]
#BackGround[.\system\BGMirror.png]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory();
let imgBoss = CSD ~ ".\system\Mirror.png";
let m = 0;
@Initialize{
SetLife(4000);
SetTimer(66);
SetInvincibility(180);
SetScore(666666);
MagicCircle(false);
Expert;
SetMovePosition01(GetCenterX, GetCenterY-150, 1);
LoadGraphic(imgBoss);
mainTask;
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(250);
SetGraphicScale(1, 1);
SetGraphicAngle(0, 0, 0);
if(GetEnemyLife>2000){SetGraphicRect(0, 44, 47, 75);} //Purple
if(GetEnemyLife<2000){SetGraphicRect(51, 44, 98, 75);} //Orchid?...
if(GetEnemyLife<750){SetGraphicRect(102, 44, 149, 75);} //Gray
}
DrawGraphic(GetX, GetY);
m++;
if(m==30){m=0;}
}
@Background{
}
@Finalize{
DeleteGraphic(imgBoss);
}
task mainTask{
wait(90);
yield;
movement;
fire;
}
task movement{
loop{
SetMovePosition02(GetCenterX+50, GetCenterY-100, 60);
wait(61);
SetMovePosition02(GetCenterX, GetCenterY-50, 60);
wait(61);
SetMovePosition02(GetCenterX-50, GetCenterY-100, 60);
wait(61);
SetMovePosition02(GetCenterX, GetCenterY-150, 60);
wait(61);
yield;
}
}
task fire{
let x = 0;
let dirf = 0;
loop{
while(x<36){
CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
SetShotDataA(5, 0, 2, dirf, 0.4, 0, 3, WHITE05);
FireShot(5);
CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
SetShotDataA(5, 90, 2, dirf, -0.2, 0, 3, WHITE05);
FireShot(5);
CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
SetShotDataA(5, 180, 2, dirf, 0.4, 0, 3, WHITE05);
FireShot(5);
CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
SetShotDataA(5, 270, 2, dirf, -0.2, 0, 3, WHITE05);
FireShot(5);
dirf+=360/36;
x++;
}
x = 0;
dirf = 0;
wait(60);
yield;
}
}
function wait(w){
loop(w){yield;}
}
}
it keeps returning the error below;
thanks Always お⑨烏...
last question for now...hopefully...
what the hell is wrong with this script(& it's not a directory issue I know that already, thus no image files...)...?Code: [Select]#TouhouDanmakufu
it keeps returning the error below;
#Title[Pattern003]
#Text[]
#Image[.\system\ArtMirror.png]
#BackGround[.\system\BGMirror.png]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory();
let imgBoss = CSD ~ ".\system\Mirror.png";
let m = 0;
@Initialize{
SetLife(4000);
SetTimer(66);
SetInvincibility(180);
SetScore(666666);
MagicCircle(false);
Expert;
SetMovePosition01(GetCenterX, GetCenterY-150, 1);
LoadGraphic(imgBoss);
mainTask;
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(250);
SetGraphicScale(1, 1);
SetGraphicAngle(0, 0, 0);
if(GetEnemyLife>2000){SetGraphicRect(0, 44, 47, 75);} //Purple
if(GetEnemyLife<2000){SetGraphicRect(51, 44, 98, 75);} //Orchid?...
if(GetEnemyLife<750){SetGraphicRect(102, 44, 149, 75);} //Gray
}
DrawGraphic(GetX, GetY);
m++;
if(m==30){m=0;}
}
@Background{
}
@Finalize{
DeleteGraphic(imgBoss);
}
task mainTask{
wait(90);
yield;
movement;
fire;
}
task movement{
loop{
SetMovePosition02(GetCenterX+50, GetCenterY-100, 60);
wait(61);
SetMovePosition02(GetCenterX, GetCenterY-50, 60);
wait(61);
SetMovePosition02(GetCenterX-50, GetCenterY-100, 60);
wait(61);
SetMovePosition02(GetCenterX, GetCenterY-150, 60);
wait(61);
yield;
}
}
task fire{
let x = 0;
let dirf = 0;
loop{
while(x<36){
CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
SetShotDataA(5, 0, 2, dirf, 0.4, 0, 3, WHITE05);
FireShot(5);
CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
SetShotDataA(5, 90, 2, dirf, -0.2, 0, 3, WHITE05);
FireShot(5);
CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
SetShotDataA(5, 180, 2, dirf, 0.4, 0, 3, WHITE05);
FireShot(5);
CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
SetShotDataA(5, 270, 2, dirf, -0.2, 0, 3, WHITE05);
FireShot(5);
dirf+=360/36;
x++;
}
x = 0;
dirf = 0;
wait(60);
yield;
}
}
function wait(w){
loop(w){yield;}
}
}
It's an issue with brackets. Yes, seriously. Your @DrawLoop has an extra } before the DrawGraphic.
What do you mean reflect? Like create a 2nd image next to it being mirrored? Or are you trying to simply flip/mirror a graphic?I meant just reflect it.
Brainfart: How do you calculate the distance between two objects again?
I'm making something like SetMovePosition03, but for all objects, not bosses alone.
use the pythagorean theorem a^2+b^2=c^2 or in this case
((objaX-objbX)^2+(objaY-objbY)^2)^0.5
alright new question...
I want my player to have it's option shots change among more then two styles one at a time
each time I press C(& only if I press C & not otherwise)...I'm even having trouble using the
GetKeyState(VK_USER) function which I don't even know if it will help me here...how do I approach this exactly?
Oh wait......no I do not...a matter of fact, I mean if I press C & then let go...then my forward shot will now be a spread shot...in other words...press C(while forward shot is activated) to then activate spread shot...
Do you mean "if you are pressing or holding C, make the option do this, otherwise if not not pressing C, do this other thing"?
Obviously you want to set double statements like
If(GetKeyState(VK_USER)==KEY_PUSH && GetKeyState(alltheothers)==KEY_FREE) { do stuff }
I hope.
script_enemy_main {
let frame=0;
let cx=GetCenterX();
let circlepic=GetCurrentScriptDirectory~"circlepic.png";
task circle
{
let timera=GetTimer*60; //set the 2 timer variables that deal with the shrinking of the circle
let timerb=GetTimer*60;
let radius=0; //set the radius as 0 because of the growing effect at the start
let radiusstart=150; //set the radius of wanted circle, may be changed to whatever you want
let circlethickness=30; //set the thinkness or width of the circle, may be changed as wanted
let growcounter=0; //set counter
let growtime=60; //set how long the circle would take to grow, may be changed to anything
let x=GetX; //set where the circle would appear
let y=GetY; //set where the circle would appear
let vertexnum=500; //set the number of vertices, may be changed to whatever
let graphendY=256; //set the bottom of the graphic (I put it here for easier understanding)
let graphendX=32; //set the rightmost part of the graphic (I put it here for easier understanding)
let angle=0; //set the starting angle
let rotatespeed=2; //set how fast it rotates
let circle=Obj_Create(OBJ_EFFECT); //create the circle
ObjEffect_SetTexture(circle, circlepic); //set graphic
ObjEffect_CreateVertex(circle, vertexnum+2); //create vertices (the plus 2 is because it won't be a complete circle without it)
ObjEffect_SetPrimitiveType(circle, PRIMITIVE_TRIANGLESTRIP); //set primitive state
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexUV(circle, i, 0, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture (graphendY and graphendX, later, were used to make things clearer)
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set locations in the game (the center of the circle + the distance in x and y using sine and cosine)
}else{
ObjEffect_SetVertexUV(circle, i, graphendX, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle)); //set locations in the game
}
}
while(Obj_BeDeleted(circle)==false)
{
yield;
angle+=rotatespeed;
timerb--; //remove if you don't want the circle to shrink
x=GetX; //change to whereever you want the circle to be
y=GetY; //change to whereever you want the circle to be
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}else{
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}
}
growcounter++; //handle growing
if(growcounter<=growtime)
{
radius+=radiusstart/growtime; //growth
}else{
radius=radiusstart*(timerb/timera)-1; //shrinking
}
}
}
@Initialize
{
SetLife(1);
SetTimer(60);
LoadGraphic(circlepic);
SetMovePosition02(cx,120,50);
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
if(frame==1)
{
circle;
}
}
@Finalize
{
DeleteGraphic(circlepic);
}
@DrawLoop
{
}
}
Ok, umm... so I couldn't really understand what azure and fujiwara were saying about bending lines into circles as effect objects, so I thought up of my own way to do it. Problem is... this would probably be just the same thing as they said, and I'm thinking that this would have some flexibility issues too... anyway... I just wanted to ask that this is already technically the basics of it right? (no I didn't take any ideas from anyone, this was just how I thought of doing it)Code: [Select]script_enemy_main {
let frame=0;
let cx=GetCenterX();
let circlepic=GetCurrentScriptDirectory~"circlepic.png";
task circle
{
let timera=GetTimer*60; //set the 2 timer variables that deal with the shrinking of the circle
let timerb=GetTimer*60;
let radius=0; //set the radius as 0 because of the growing effect at the start
let radiusstart=150; //set the radius of wanted circle, may be changed to whatever you want
let circlethickness=30; //set the thinkness or width of the circle, may be changed as wanted
let growcounter=0; //set counter
let growtime=60; //set how long the circle would take to grow, may be changed to anything
let x=GetX; //set where the circle would appear
let y=GetY; //set where the circle would appear
let vertexnum=500; //set the number of vertices, may be changed to whatever
let graphendY=256; //set the bottom of the graphic (I put it here for easier understanding)
let graphendX=32; //set the rightmost part of the graphic (I put it here for easier understanding)
let angle=0; //set the starting angle
let rotatespeed=2; //set how fast it rotates
let circle=Obj_Create(OBJ_EFFECT); //create the circle
ObjEffect_SetTexture(circle, circlepic); //set graphic
ObjEffect_CreateVertex(circle, vertexnum+2); //create vertices (the plus 2 is because it won't be a complete circle without it)
ObjEffect_SetPrimitiveType(circle, PRIMITIVE_TRIANGLESTRIP); //set primitive state
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexUV(circle, i, 0, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture (graphendY and graphendX, later, were used to make things clearer)
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set locations in the game (the center of the circle + the distance in x and y using sine and cosine)
}else{
ObjEffect_SetVertexUV(circle, i, graphendX, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle)); //set locations in the game
}
}
while(Obj_BeDeleted(circle)==false)
{
yield;
angle+=rotatespeed;
timerb--; //remove if you don't want the circle to shrink
x=GetX; //change to whereever you want the circle to be
y=GetY; //change to whereever you want the circle to be
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}else{
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}
}
growcounter++; //handle growing
if(growcounter<=growtime)
{
radius+=radiusstart/growtime; //growth
}else{
radius=radiusstart*(timerb/timera)-1; //shrinking
}
}
}
@Initialize
{
SetLife(1);
SetTimer(60);
LoadGraphic(circlepic);
SetMovePosition02(cx,120,50);
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
if(frame==1)
{
circle;
}
}
@Finalize
{
DeleteGraphic(circlepic);
}
@DrawLoop
{
}
}
Hmmm, it looks a bit chaotic. My tutorial isn't that hard to understand, is it?
From what I see, you're getting the basics right, but I don't see why you take the long route to do some things, like set the individual X and Y parameters for the circle instead of Obj_SetPosition(id#,GetX,GetY);. It would get some of those annoying variables out of the way. But aside from those things, you pretty much have it down. Also, what's that "floor" variable doing there?
Drake, I didn't understand a thing of the spellcircle slingshot effect code. Therefor reasking it again =.=. I am a failure in math so this is the following I want to achieve by math (else I could take the long road)
- My spellcircle has starting size: 80.
- I want it to grow to 180 with an accelerating speed.
- When it reaches close to 180 I want it to deaccelerate
- At size 180 it should start shrinking with acceleration untill it reaches it's final size: 150
HOW ?!
Drake, I didn't understand a thing of the spellcircle slingshot effect code. Therefor reasking it again =.=. I am a failure in math so this is the following I want to achieve by math (else I could take the long road)
- My spellcircle has starting size: 80.
- I want it to grow to 180 with an accelerating speed.
- When it reaches close to 180 I want it to deaccelerate
- At size 180 it should start shrinking with acceleration untill it reaches it's final size: 150
HOW ?!
I think I see what you're trying to do. You want it to start at 0, accelerate to 180, and then decelerate as it closes in on 150, which it stops at.Correct. And if there is one thing I hate myself for is math :V I need it indeed but blending it into danmakufu is hard. I started messing with parabola formulas and all kind of stuff. ( I didn't even knew I had to use sinus ) I just ended up with cos and by some random luck it worked out. Yay me ( horrible presentation though )
You're going to have to use a bit of trigonometry for this one. What you're looking for is sine. I can't do the entire math in my head, but from what I already know, what you want to do is A*sin(X*F).
A -being the top speed (magnitude). X-being the angle you'll get the sine of, and F, being how "quick" the acceleration and deceleration will be altogether.
Then, increase the value of X by a set amount of frames. There's math behind it, and you'll need it.
task animation1(start,endframe){
let anim = 0;
if(anim<5){SetGraphicRect(0, 229, 34, 300);}
if(anim>=5 && anim<10){SetGraphicRect(34, 229, 34, 300);}
if(anim>=10 && anim<15){SetGraphicRect(68, 229, 68, 300);}
if(anim>=15 && anim<20){SetGraphicRect(102, 229, 102, 300);}
if(anim==endframe){
start = 0;}
if(start>0){
anim++;}}
How would you put SetGraphicRects in a task and how would you call it? Ive tried a code like this:Code: [Select]task animation1(start,endframe){
let anim = 0;
if(anim<5){SetGraphicRect(0, 229, 34, 300);}
if(anim>=5 && anim<10){SetGraphicRect(34, 229, 34, 300);}
if(anim>=10 && anim<15){SetGraphicRect(68, 229, 68, 300);}
if(anim>=15 && anim<20){SetGraphicRect(102, 229, 102, 300);}
if(anim==endframe){
start = 0;}
if(start>0){
anim++;}}
And when called, it does nothing...any ideas?
Can anyone tell me how to use custom danmaku?
#UserShotData \\Defines as Shot Data
ShotImage = ".\img\shot.png" \\Loads the image
ShotData{//Opens the ShotData data
id = 1337 //Id used to fire the bullet
rect = ( 0, 0, 64, 64) //Rect, or location, where the bullet is located on the sheet. (left, up, right down)
render = ALPHA //"Just use it"
delay_color = ( 128, 128, 128 ) //Color of the delay that will shot up (red, blue, yellow)
angular_velocity = 0 //Decides if the bullet rotates, negative for counterclockwise, vice versa
} //Closes the Shot Data
I'll be assuming you mean custom shots/All your \\ replace by //
First, you will need a shot sheet with the bullets you want to fire.
Second, you will need to make a .txt with #UserShotData in the first line.
Third, you will need to load the Shot Sheet.
Before i go on, here is an example:Code: [Select]#UserShotData \\Defines as Shot Data
ShotImage = ".\img\shot.png" \\Loads the image
ShotData{\\Opens the ShotData data
id = 1337 \\Id used to fire the bullet
rect = ( 0, 0, 64, 64) \\Rect, or location, where the bullet is located on the sheet. (left, up, right down)
render = ALPHA \\"Just use it"
delay_color = ( 128, 128, 128 ) \\Color of the delay that will shot up (red, blue, yellow)
angular_velocity = 0 \\Decides if the bullet rotates, negative for counterclockwise, vice versa
} \\Closes the Shot Data
Then in the script you want to call the bullet in, call:
#LoadUserShotData in the Initalize, such as if we named the ShotData shot.txt:
#LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
Then call the bullet with the Id you have specified...
*faints*
let test=[];
task Tconvert(X){
let array = [];
let array2 = [0];
let array3 = [];
while(X>=1){
array2[0]=X;
X=floor(X/10);
array2[0]=array2[0]-10*X;
array=array ~ array2;
}
descent(i in (length(array))..0) {
array2[0]=array[i];
array3=array3~array;
}
test=array3;
}
let itempic="lib\system\items.png";
LoadGraphic(itempic);
task item(type, x, y)
{
let counter=0;
let xpos=x;
let ypos=y;
let obj=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj, itempic);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
if(type=="POWER_S")
{
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 16, 0);
ObjEffect_SetVertexUV(obj, 2, 0, 16);
ObjEffect_SetVertexUV(obj, 3, 16, 16);
}
if(type=="POINT")
{
ObjEffect_SetVertexUV(obj, 0, 16, 0);
ObjEffect_SetVertexUV(obj, 1, 32, 0);
ObjEffect_SetVertexUV(obj, 2, 16, 16);
ObjEffect_SetVertexUV(obj, 3, 32, 16);
}
if(type=="COLLECT")
{
ObjEffect_SetVertexUV(obj, 0, 32, 0);
ObjEffect_SetVertexUV(obj, 1, 48, 0);
ObjEffect_SetVertexUV(obj, 2, 32, 16);
ObjEffect_SetVertexUV(obj, 3, 48, 16);
}
if(type=="POWER_L")
{
ObjEffect_SetVertexUV(obj, 0, 48, 0);
ObjEffect_SetVertexUV(obj, 1, 64, 0);
ObjEffect_SetVertexUV(obj, 2, 48, 16);
ObjEffect_SetVertexUV(obj, 3, 64, 16);
}
if(type=="POWER_F")
{
ObjEffect_SetVertexUV(obj, 0, 96, 0);
ObjEffect_SetVertexUV(obj, 1, 112, 0);
ObjEffect_SetVertexUV(obj, 2, 96, 16);
ObjEffect_SetVertexUV(obj, 3, 112, 16);
}
while(Obj_BeDeleted(obj)==false)
{
yield;
counter++;
if(counter<20)
{
ypos-=2;
}else{
ypos++;
}
ObjEffect_SetVertexXY(obj, 0, xpos-8, ypos-8);
ObjEffect_SetVertexXY(obj, 1, xpos+8, ypos-8);
ObjEffect_SetVertexXY(obj, 2, xpos-8, ypos+8);
ObjEffect_SetVertexXY(obj, 3, xpos+8, ypos+8);
if(((xpos-GetPlayerX)^2+(ypos-GetPlayerY)^2)^0.5<=10)
{
if(type=="POWER_S")
{
SetCommonData("power", GetCommonData("power")+1);
}
if(type=="POWER_L")
{
SetCommonData("power", GetCommonData("power")+10);
}
if(type=="POWER_F")
{
SetCommonData("power", 100);
}
if(type=="POINT")
{
AddScore(5000*(GetGraze/100)/((GetPlayerY-GetClipMinY-120)/50));
AddPoint(1);
}
if(type=="COLLECT")
{
SetCommonData("collect", GetCommonData("collect")+1);
}
Obj_Delete(obj);
}
}
}
script_enemy_main {
#include_function ".\enemy1anim.txt"
#include_function "lib\items.txt"
let frame = 0;
let frame2 = 0;
let item = 0;
@Initialize {
SetLife(50);
SetDamageRate(180, 100);
LoadUserShotData("lib\SHOT_REPLACE\shot_all.dnh");
}
@MainLoop{
SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 6);
frame ++;
frame2 ++;
if(frame == 1){
if(GetX<GetCenterX)
{
SetMovePositionHermite(GetClipMaxX+100,GetY+rand(-100,100),300,270,300,0,300);
}else{
SetMovePositionHermite(GetClipMinX-100,GetY+rand(-100,100),300,90,300,180,300);
}
}
if(frame2>20 && frame2%10==0){
PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
CreateShotA(1, GetX, GetY, 10);
SetShotDataA_XY(1, 0, rand(-3, 3), rand(-1, -3), rand(-0.01, 0.01), rand(0.01, 0.05), rand(-3, 3), rand(2, 4), 3);
FireShot(1);
}
if(GetY > GetClipMaxY || GetX>GetClipMaxX || GetX<GetClipMinX || GetY<GetClipMinY){
VanishEnemy();
item = 1;
}
}
@DrawLoop {
anim2;
}
@Finalize {
if(item == 0){
item("POWER_S", GetX, GetY);
}
}
}
}
if(GetEnemyInfo(enemy, ENEMY_LIFE)==false){
enemy=-1;
}
if(GetEnemyNum>0 && enemy==-1){
if(!IsBossExisting){
ascent(i in EnumEnemyBegin..EnumEnemyEnd) {
enemy=EnumEnemyGetID(i);
i=EnumEnemyEnd;
}
}else{
i = EnumEnemyBegin;
enemy=EnumEnemyGetID(i);
}
ex = GetEnemyInfo(enemy, ENEMY_X);
ey = GetEnemyInfo(enemy, ENEMY_Y);
}else{
ex = vv + 100*cos(osc);
ey = 0;
}
if(GetEnemyInfoDefault(enemy, ENEMY_LIFE, 1)==1){
enemy=-1;
}
if(GetEnemyNum>0 && enemy==-1){
if(!IsBossExisting){
ascent(i in EnumEnemyBegin..EnumEnemyEnd) {
enemy=EnumEnemyGetID(i);
i=EnumEnemyEnd;
}
}else{
i = EnumEnemyBegin;
enemy=EnumEnemyGetID(i);
}
ex = GetEnemyInfo(enemy, ENEMY_X);
ey = GetEnemyInfo(enemy, ENEMY_Y);
}else{
ex = vv + 100*cos(osc);
ey = 0;
}
//choose target closest to it
let target = -1;
let targetX = 0;
let targetY = 0;
let closestDistance = 65535;
ascent(enemy in EnumEnemyBegin..EnumEnemyEnd){
let enemyID = EnumEnemyGetID(enemy);
let enemyX = GetEnemyInfo(enemyID, ENEMY_X);
let enemyY = GetEnemyInfo(enemyID, ENEMY_Y);
let enemyLife = GetEnemyInfo(enemyID, ENEMY_LIFE);
let enemyDistance = GetDistance(Obj_GetX(obj), Obj_GetY(obj), enemyX, enemyY);
if(enemyDistance < closestDistance && enemyLife > 0){
closestDistance = enemyDistance;
target = enemyID;
targetX = enemyX;
targetY = enemyY;
}
}
//change behavior per frame based on conditions until deleted
while(!Obj_BeDeleted(obj)){
//if there is a target
if(GetEnemyInfoDefault(target, ENEMY_LIFE, 0) > 0){
//logic on what to do if the enemy is alive goes here
}
else {
//logic on what to do if the enemy is dead goes here
}
yield;
}
You set task name and variable with same name =w=/
task item(type, x, y)
let item = 0;
Set task name to other like itemdrop(type,x ,y) instead.
let itempic="lib\system\items.png";
LoadGraphic(itempic);
task itemdrop(type, x, y)
{
let counter=0;
let collection=0;
let xpos=x;
let ypos=y;
let obj=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj, itempic);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
if(type=="POWER_S")
{
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 16, 0);
ObjEffect_SetVertexUV(obj, 2, 0, 16);
ObjEffect_SetVertexUV(obj, 3, 16, 16);
}
if(type=="POINT")
{
ObjEffect_SetVertexUV(obj, 0, 16, 0);
ObjEffect_SetVertexUV(obj, 1, 32, 0);
ObjEffect_SetVertexUV(obj, 2, 16, 16);
ObjEffect_SetVertexUV(obj, 3, 32, 16);
}
if(type=="COLLECT")
{
ObjEffect_SetVertexUV(obj, 0, 32, 0);
ObjEffect_SetVertexUV(obj, 1, 48, 0);
ObjEffect_SetVertexUV(obj, 2, 32, 16);
ObjEffect_SetVertexUV(obj, 3, 48, 16);
}
if(type=="POWER_L")
{
ObjEffect_SetVertexUV(obj, 0, 48, 0);
ObjEffect_SetVertexUV(obj, 1, 64, 0);
ObjEffect_SetVertexUV(obj, 2, 48, 16);
ObjEffect_SetVertexUV(obj, 3, 64, 16);
}
if(type=="POWER_F")
{
ObjEffect_SetVertexUV(obj, 0, 96, 0);
ObjEffect_SetVertexUV(obj, 1, 112, 0);
ObjEffect_SetVertexUV(obj, 2, 96, 16);
ObjEffect_SetVertexUV(obj, 3, 112, 16);
}
while(Obj_BeDeleted(obj)==false)
{
yield;
counter++;
if(counter<20)
{
ypos-=2;
}else{
ypos++;
}
ObjEffect_SetVertexXY(obj, 0, xpos-8, ypos-8);
ObjEffect_SetVertexXY(obj, 1, xpos+8, ypos-8);
ObjEffect_SetVertexXY(obj, 2, xpos-8, ypos+8);
ObjEffect_SetVertexXY(obj, 3, xpos+8, ypos+8);
if(((xpos-GetPlayerX)^2+(ypos-GetPlayerY)^2)^0.5<=10)
{
if(type=="POWER_S")
{
SetCommonData("power", GetCommonData("power")+1);
}
if(type=="POWER_L")
{
SetCommonData("power", GetCommonData("power")+10);
}
if(type=="POWER_F")
{
SetCommonData("power", 100);
}
if(type=="POINT")
{
AddScore(5000*(GetGraze/100)/((GetPlayerY-GetClipMinY-120)/50));
AddPoint(1);
}
if(type=="COLLECT")
{
SetCommonData("collect", GetCommonData("collect")+1);
}
Obj_Delete(obj);
}
if(GetPlayerY<GetClipMinY+120)
{
collection=1;
}
if(collection==1)
{
xpos+=5*cos(atan2(GetPlayerY-ypos, GetPlayerX-xpos));
ypos+=5*sin(atan2(GetPlayerY-ypos, GetPlayerX-xpos));
}
}
}
script_enemy_main {
#include_function ".\enemy1anim.txt"
#include_function "lib\items.txt"
let frame = 0;
let frame2 = 0;
let item = 0;
@Initialize {
SetLife(50);
SetDamageRate(180, 100);
LoadUserShotData("lib\SHOT_REPLACE\shot_all.dnh");
}
@MainLoop{
SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 6);
frame ++;
frame2 ++;
if(frame == 1){
if(GetX<GetCenterX)
{
SetMovePositionHermite(GetClipMaxX+100,GetY+rand(-100,100),300,270,300,0,300);
}else{
SetMovePositionHermite(GetClipMinX-100,GetY+rand(-100,100),300,90,300,180,300);
}
}
if(frame2>20 && frame2%10==0){
PlaySE(GetCurrentScriptDirectory~"sound\Shot1.wav");
CreateShotA(1, GetX, GetY, 10);
SetShotDataA_XY(1, 0, rand(-3, 3), rand(-1, -3), rand(-0.01, 0.01), rand(0.01, 0.05), rand(-3, 3), rand(2, 4), 3);
FireShot(1);
}
if(GetY > GetClipMaxY || GetX>GetClipMaxX || GetX<GetClipMinX || GetY<GetClipMinY){
VanishEnemy();
item = 1;
}
}
@DrawLoop {
anim2;
}
@Finalize {
if(item == 0){
itemdrop("POWER_S", GetX, GetY);
}
}
}
}
You're calling LoadGraphic in the wrong place. Put it in the @Initialize of every enemy that's gonna drop items instead of in the separate file.
Alternatively, call it in the @Initialize of the stages you'll be making so you only need to write it once.
Oh, I know why. And you're not gonna like the reason.
When the enemy calls the task, it keeps going until it reaches a yield right? Well the damn task won't continue until the enemy script encounters another yield, which is usually in @MainLoop. However... the enemy is dead. You CAN'T continue the task so it's just floating there waiting for the enemy to tell it to yield. This means that the object is being created and the VertexUV points are being set, but the VertexXY points aren't. Danmakufu doesn't know where to put draw it so it just doesn't.
This is very similar to the problem I had where the enemies stopped processing something that needed to be processed after they died. I had a stupid work around for that where I made the enemies have 10,000 more hp than they should have and "died" (which means they stopped shooting bullets and drawing their graphics) when the hp reached under 10,000 but the yield and other necessary functions for processing were left running.
If you don't like that solution, you'll need to make some sort of god enemy script that spawns all the items for you from conditions managed by common data or something. Maybe there's an easier solution, I dunno.
LoadGraphic(objface);
ObjEffect_SetTexture(obj,objface);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexXY(obj, 0, -200, -256); //The same vertices for every cutin
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexXY(obj, 1, 200, -256);
ObjEffect_SetVertexUV(obj, 1, 400, 0);
ObjEffect_SetVertexXY(obj, 2, -200, 256);
ObjEffect_SetVertexUV(obj, 2, 0, 512);
ObjEffect_SetVertexXY(obj, 3, 200, 256);
ObjEffect_SetVertexUV(obj, 3, 400, 512);
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\ExRumia.png";
@Initialize{
SetLife(1000);
SetTimer(600);
SetInvincibility(30);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(64,1,127,64);
SetGraphicScale(01,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
SetTexture(NULL);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,500,500);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
}
task mainTask{
yield;
mainFire;
movement;
}
task movement{
SetMovePosition01(GetCenterX,120,5);
yield;
}
task mainFire{
let count = 0;
loop{
spock(GetEnemyX,GetEnemyY,3,sin(count)*30+90,RED31,0);
yield;
}
}
task spock(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,graphic);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);
while(!Obj_BeDeleted(obj)){
if(Obj_GetY(obj) > GetClipMaxY){
Obj_SetAngle(obj,-dir);
yield;
}
}
}
function wait(w){
loop(w){yield;}
}
}
#TouhouDanmakufu
#Title[HI]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\ExRumia.png";
@Initialize{
SetLife(1000);
SetTimer(600);
SetInvincibility(30);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(64,1,127,64);
SetGraphicScale(01,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
SetTexture(NULL);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,500,500);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
}
task mainTask{
yield;
mainFire;
movement;
}
task movement{
SetMovePosition01(GetCenterX,120,5);
yield;
}
task mainFire{
let count = 0;
spock(GetX,GetY,3,sin(count)*30+90,RED31,10);
loop(1) { yield; }
mainFire;
}
task spock(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj, v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);
while(!Obj_BeDeleted(obj)){
if(Obj_GetY(obj) > GetClipMaxY){
Obj_SetAngle(obj,-dir);
}
yield;
}
}
}
function wait(w){
loop(w){yield;}
}
}
I THINK you forgot a }.
#TouhouDanmakufu
#Title[HI]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\ExRumia.png";
@Initialize{
SetLife(1000);
SetTimer(600);
SetInvincibility(30);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(64,1,127,64);
SetGraphicScale(01,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
SetTexture(NULL);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,500,500);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
}
task mainTask{
loop{ //loop causes it to constantly run. Without it, it only runs once.
mainFire;
SetMovePosition01(GetCenterX+rand(-50,50),120+rand(-20,20),5); //Just planted "movement" here and changed it because calling this every few frames with the same movement is redundant.
loop(50){yield;} //You definitely do not want everything run every frame.
}
}
//movement task deleted for simplicity
task mainFire{
let count = 0;
loop(20){
spock(GetEnemyX,GetEnemyY,3,count+90,RED31,0); //sin gets the y position of the angle on a circle of radius 1. Read up on your trig, maybe?
count+=3; //I'm guessing you want this too.
yield; //stops a frame before firing the next spock, just gives a different effect
}
}
task spock(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj, v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);
while(!Obj_BeDeleted(obj)){
if(Obj_GetY(obj) > GetClipMaxY){
Obj_SetAngle(obj,-dir); //yay for bouncing
}
yield;
}
}
}
function wait(w){
loop(w){yield;}
}
}
Is there anyway for Enemy Enumeration to keep selecting the same enemy until it dies, instead of switching between new enemies as they spawn? I've tried a couple different things (like putting whiles inside of whiles, hoo boy) and they have all yielded very interesting error messages, so I'll ask here in case anybody has already solved this problem.
The replay file will save the state you chose in your makeshift menu. As long as you're getting commondata in the player script which you've set in the main script, then the replay will mimic this action. So if I transferred a replay to somebody else's computer that had me choose "c" as my polar shift button in the makeshift menu, then the replay will show that and save the data accordingly when it plays on somebody else's computer.I realized that already, but something like that really does belong in an options menu rather than being selected every time you wanna play. If I were some random gamer who was ignorant of the flaws of Danmakufu, I'd wonder why the options menu sucked so much.
So essentially, you should have to force the player to choose what polar state they want everytime they play the game. Which is not a big deal, methinks.
Otherwise, no, it's not really possible to do unless you transfer the .dat file with the .rpy file, and correctly put them into their respective folders... Which isn't really worth doing.Actually, if there's no real solution to this, I was thinking that whoever is sharing replays should just post what settings they used so that the replay viewers can match the settings before viewing. Which is almost as bad. :V
I'll keep thinking about it though, you might be able to set some odd commondata and use if(IsReplay==true && GetCommonData("dicksdicksdicks")=="CTRL"){ doshit; } statements to get it working, but I dunno.I was thinking something similar to that before posting. I can't really think of a way to use IsReplay to detect which switching type the replay is using though. :x
I honestly don't think so. You can't make a hardcoded detection program change in different conditions, unless you somehow create a different replay system included in the game, somehow.I was also seriously considering constructing my own replay player, but I realized that if I saved the replay, it'd be in the common data and therefore unsharable without sharing unlock data as well.
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "img\ExRumia.png";
let back = CSD ~ "img\white.png";
@Initialize{
SetLife(4000);
SetTimer(600);
SetScore(350000);
SetInvincibility(30);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(back);
LoadGraphic(imgBoss);
CutIn(YOUMU,"Night Sign: Black Butterfly",NULL,0,0,0,0);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(64,1,127,64);
SetGraphicScale(01,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
SetTexture(back);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,1,1);
SetGraphicScale(512,512);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
}
task mainTask{
yield;
mainFire;
movement;
}
task movement{
SetMovePosition01(GetCenterX,120,5);
yield;
}
task mainFire{
let x = 0;
let dir = 0;
loop{
while(x<25){
SetShotColor(0,0,0);
CreateShotA(1,GetX,GetY,30);
SetShotDataA(1,60,2,dir,-0.2,0,0,RED22);
FireShot(1);
SetShotColor(255,255,255);
dir+=360/25;
x++;
}
x = 0;
dir = 0;
wait(50);
yield;
}
}
function wait(w){
loop(w){yield;}
}
}
There is no way unless it is an object bullet, which is more of an advanced technique to use for bullet pattern creation. If you know how to use an object bullet, the function is Obj_GetX(objID) and Obj_GetY(objID).
To learn how to use object bullets, you should take a look at the tutorials thread to see if it can help you.
task cloudshot(x, y, z) {
let obj = Obj_Create(OBJ_SHOT);
let killtime = 0;
Obj_SetPosition(obj, x, y);
ObjShot_SetGraphic(obj, WHITE03);
ObjShot_SetBombResist(obj, true);
ObjShot_SetDelay(obj, z);
while(!Obj_BeDeleted(obj)) {
if(killtime == 210+z) {
ObjShot_FadeDelete(obj);
}
if(Obj_IsIntersected(obj) == true) {
loop(5) {
CreateShot12(x, y, rand(-1, 1), rand(0.5, 1), 0, -0.05, 2, 2, WHITE05, 10);
}
PlaySE(GetCurrentScriptDirectory~"sfx\se_kira00.wav");
ObjShot_FadeDelete(obj);
}
killtime++;
yield;
}
}
while(!Obj_BeDeleted(obj)) {
if(killtime == 210+z) {
ObjShot_FadeDelete(obj);
}
killtime++;
yield;
}
if(Obj_IsIntersected(obj) == true) {
loop(5) {
CreateShot12(x, y, rand(-1, 1), rand(-1, -0.5), 0, 0.02, 2, 2, WHITE05, 10);
}
PlaySE(GetCurrentScriptDirectory~"sfx\se_kira00.wav");
ObjShot_FadeDelete(obj);
}
let distanceToBoss = ((Obj_GetX(obj)-GetX)^2 + (Obj_GetY(obj)-GetY)^2)^0.5
if(distanceToBoss < 64){
do stuff;
}
while(!Obj_BeDeleted(obj)) {
if(killtime == 210+z) {
ObjShot_Delete(obj); //Using FadeDelete with other shots spawning looks weird
}
killtime++;
yield;
}
PlaySE(GetCurrentScriptDirectory~"sfx\se_kira00.wav");
loop(5) {
//CreateShot12(x, y, rand(-1, 1), rand(-1, -0.5), 0, 0.02, 2, 2, WHITE05, 10);
//do something else
}
My background is black! It's not supposed to be black! Help me, onii-sama!
@BackGround{
SetTexture(back);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,1024,1024);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
while(!Obj_BeDeleted(obj)) {
if(killtime == 210+z) {
trigger = 0;
ObjShot_FadeDelete(obj);
}
let distanceToBoss = ((Obj_GetX(obj)-GetX)^2 + (Obj_GetY(obj)-GetY)^2)^0.5;
if(distanceToBoss < 48){
Obj_Delete(obj); //Using FadeDelete with other shots spawning looks weird
}
killtime++;
yield;
}
if(trigger == 1) {
PlaySE(GetCurrentScriptDirectory~"sfx\se_kira00.wav");
loop(5) {
CreateShot12(x, y, rand(-1, 1), rand(-1, -0.5), 0, 0.02, 2, 2, WHITE05, 10);
//do something else
}
}
ah thanks... now I get it... thanks again... ;D
I was able to make a master item enemy... nice...
Okay, I'm still relatively new at this, so...
Could someone show me how to create patterns similar to Rumia's Demarcation or Suwako's Mishaguji-Sama? That kind of stuff, yeah.
ascent(i in 0..20) {
CreateShotA(i, GetX, GetY, 10);
SetShotDataA(i, 0, 2, GetAngleToPlayer+i*18, 0, 0, 2, RED11);
SetShotDataA(i, 60, 2, GetAngleToPlayer+i*18-90, -1, 0, 2, RED11);
SetShotDataA(i, 90, 2, NULL, 0, 0, 2, RED11);
FireShot(i);
}
Creating things similar to Demarcation requires some knowledge of how the CreateShotA series of functions works:This also applies to Misyaguzi-sama, doesn't it?
CreateShotA(id, x-position, y-position, delay);
SetShotDataA(id, frame, speed, angle, turn speed, acceleration, minimum/maximum speed, graphic);
FireShot(id);
What SetShotDataA does is tell the bullet what it will do once it's fired. The "frame" parameter is especially important. For example, take the following code:Code: [Select]ascent(i in 0..20) {
CreateShotA(i, GetX, GetY, 10);
SetShotDataA(i, 0, 2, GetAngleToPlayer+i*18, 0, 0, 2, RED11);
SetShotDataA(i, 60, 2, GetAngleToPlayer+i*18-90, -1, 0, 2, RED11);
SetShotDataA(i, 90, 2, NULL, 0, 0, 2, RED11);
FireShot(i);
}
Twenty bullets are created at the boss's position. The first SetShotDataA function tells the bullets to fire in a circle as soon as they're created with a speed of 2. Sixty frames later, the bullets will begin turning, and thirty frames after that (frame 90 after shooting), the bullets will travel at whatever angle they had at the time.
To make it look similar to Rumia's Demarcation, simply create another ascent loop, but in the second SetShotDataA function, change the -90 and -1 to +90 and 1, respectively. This will create a mirrored ring of bullets that will intersect with the other one.
Does that help? I can go into SetShotDataA in more detail if you'd like.
This also applies to Misyaguzi-sama, doesn't it?
Creating things similar to Demarcation requires some knowledge of how the CreateShotA series of functions works:
CreateShotA(id, x-position, y-position, delay);
SetShotDataA(id, frame, speed, angle, turn speed, acceleration, minimum/maximum speed, graphic);
FireShot(id);
What SetShotDataA does is tell the bullet what it will do once it's fired. The "frame" parameter is especially important. For example, take the following code:Code: [Select]ascent(i in 0..20) {
CreateShotA(i, GetX, GetY, 10);
SetShotDataA(i, 0, 2, GetAngleToPlayer+i*18, 0, 0, 2, RED11);
SetShotDataA(i, 60, 2, GetAngleToPlayer+i*18-90, -1, 0, 2, RED11);
SetShotDataA(i, 90, 2, NULL, 0, 0, 2, RED11);
FireShot(i);
}
Twenty bullets are created at the boss's position. The first SetShotDataA function tells the bullets to fire in a circle as soon as they're created with a speed of 2. Sixty frames later, the bullets will begin turning, and thirty frames after that (frame 90 after shooting), the bullets will travel at whatever angle they had at the time.
To make it look similar to Rumia's Demarcation, simply create another ascent loop, but in the second SetShotDataA function, change the -90 and -1 to +90 and 1, respectively. This will create a mirrored ring of bullets that will intersect with the other one.
Does that help? I can go into SetShotDataA in more detail if you'd like.
Unless your name is Blargel and insert custom complex functions into your game.
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisan]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]
script_player_main{
let CSD = GetCurrentScriptDirectory;
let imgPlayer = CSD ~ "KaguyaSheet.png";
let frodo = 0; //frodo is for frames.
let kirk = 0; //kirk is for count.
let ImpossibleRequest = 1;
@Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;
}
@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
if(GetKeyState(VK_USER)==KEY_PUSH){ImpossibleRequest++; if(ImpossibleRequest==6){ImpossibleRequest=1;}}
yield;
}
@Missed{
}
@Spellcard{
}
@DrawLoop{
SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
DrawGraphic(GetPlayerX(), GetPlayerY());
}
@Finalize{
}
task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){dostuff;} else if(ImpossibleRequest==4){dostuff;} else if(ImpossibleRequest==5){dostuff;}
yield;
}
}
task dostuff{
loop{
yield;
}
}
task JewelBranch;
loop{
redFire;
greenFire;
blueFire;
pinkFire;
yellowFire;
yield;
}
task redFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*3+270,2.6,1,1); kirk += 13;}}frodo++;
}
task greenFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*10+270,2.6,1,3); kirk += 3;}frodo++;
}
task blueFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); kirk += 3;}frodo++;
}
task pinkFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*90+270,2.6,1,4); kirk += 3;}frodo++;
}
task yellowFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,3,sin(kirk)*60+270,2.6,1,5); kirk += 1;}frodo++;
}
task fireLoveLaser{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,270,4,3,6);} frodo++;
}
task FireCape{
loop{
fireLoveLaser;
//fireball;
yield;
}
}
}
script_spell ScriptName{
@Initialize{
}
@MainLoop{
}
@Finalize{
}
}
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisanfailure]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]
script_player_main{
let CSD = GetCurrentScriptDirectory;
let imgPlayer = CSD ~ "KaguyaSheet.png";
let frodo = 0; //frodo is for frames.
let kirk = 0; //kirk is for count.
let ImpossibleRequest = 1;
@Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;
}
@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
if(GetKeyState(VK_USER)==KEY_PUSH){ImpossibleRequest++; if(ImpossibleRequest==6){ImpossibleRequest=1;}}
yield;
}
@Missed{
}
@Spellcard{
}
@DrawLoop{
SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
DrawGraphic(GetPlayerX(), GetPlayerY());
}
@Finalize{
}
task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){dostuff;} else if(ImpossibleRequest==4){dostuff;}else if(ImpossibleRequest==5){dostuff;}
yield;
}
}
task dostuff{
loop{
yield;
}
}
task JewelBranch{
loop{
redFire;
greenFire;
blueFire;
pinkFire;
yellowFire;
yield;
}
}
task redFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*3+270,2.6,1,1); kirk += 13;}frodo++;
}
task greenFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%10==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*10+270,2.6,1,3); kirk += 3;}frodo++;
}
task blueFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%10==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); kirk += 3;}frodo++;
}
task pinkFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%10==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*90+270,2.6,1,4); kirk += 3;}frodo++;
}
task yellowFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%10==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,3,sin(kirk)*60+270,2.6,1,5); kirk += 1;}frodo++;
}
task fireLoveLaser{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,270,4,3,6);} frodo++;
}
task FireCape{
loop{
fireLoveLaser;
//fireball;
yield;
}
}
}
script_spell ScriptName{
@Initialize{
}
@MainLoop{
}
@Finalize{
}
}
I don't know exactly what it is supposed to look like, but by skimming over you script, I noticed that you have included if(frodo%1==0) several times. Frodo being a variable that, as far as I can tell, has only integers as values, this condition is always true. Should the problem be that Kaguya fires too rapidly, it may stem from this. :-\
If that's not the problem, please elaborate what exactly doesn't work as intended there so we can help you.
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisan]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]
script_player_main{
let CSD = GetCurrentScriptDirectory;
let imgPlayer = CSD ~ "KaguyaSheet.png";
let frodo = 0; //frodo is for frames.
let kirk = 0; //kirk is for count.
@Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;
}
@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
yield;
}
@Missed{
}
@Spellcard{
}
@DrawLoop{
SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
DrawGraphic(GetPlayerX(), GetPlayerY());
}
@Finalize{
}
task mainTask{
loop{
redFire;
greenFire;
blueFire;
pinkFire;
yellowFire;
yield;
}
task redFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*3+270,2.6,1,1); kirk += 13;}}frodo++;
}
task greenFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*10+270,2.6,1,3); kirk += 3;}frodo++;
}
task blueFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); kirk += 3;}frodo++;
}
task pinkFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*90+270,2.6,1,4); kirk += 3;}frodo++;
}
task yellowFire{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,3,sin(kirk)*60+270,2.6,1,5); kirk += 1;}frodo++;
}
//task redFocus{
//if((GetKeyState(VK_SLOWMOVE) == KEY_PUSH || GetKeyState(VK_SLOWMOVE) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY+5,6,270,3,1,1);} else {redFire;}frodo++;
//}
}
script_spell ScriptName{
@Initialize{
}
@MainLoop{
}
@Finalize{
}
}
task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){dostuff;} else if(ImpossibleRequest==4){dostuff;}else if(ImpossibleRequest==5){dostuff;}
yield;
}
}
task JewelBranch{
loop{
redFire;
greenFire;
blueFire;
pinkFire;
yellowFire;
yield;
}
}
Something's wrong; the Sanae player scripts refuse to show up during player selection...
#Player[REIMU,MARISA]
near the top? If so, change everything inside the brackets to FREE -- that should fix it.
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisan]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]
script_player_main{
let CSD = GetCurrentScriptDirectory;
let imgPlayer = CSD ~ "KaguyaSheet.png";
let frodo = 0; //frodo is for frames.
let kirk = 0; //kirk is for count.
let ImpossibleRequest = 1;
@Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;
}
@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
if(GetKeyState(VK_USER)==KEY_PUSH){ImpossibleRequest++; if(ImpossibleRequest==6){ImpossibleRequest=1;}}
yield;
}
@Missed{
}
@Spellcard{
}
@DrawLoop{
SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
DrawGraphic(GetPlayerX(), GetPlayerY());
}
@Finalize{
}
task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){DragonNecklace;} else if(ImpossibleRequest==4){StoneBowl}else if(ImpossibleRequest==5){CowryShell;}
yield;
}
}
task dostuff{
loop{
yield;
}
}
task JewelBranch{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*3+270,2.6,1,1); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*10+270,2.6,1,3); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*90+270,2.6,1,4); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,3,sin(kirk)*60+270,2.6,1,5); kirk += 13;}frodo++;
}
task FireCape{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,8,rand_int(250,290),10,3,6); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*20+250,4.5,1,7); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+290,4.5,1,7); CreatePlayerShot01(GetPlayerX+rand_int(-30,30),GetPlayerY+rand_int(-30,30),1,270+rand_int(-10,10),4.5,1,6); kirk += 13;} frodo++;
}
task DragonNecklace{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+250,2.8,5,8); CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+290,2.8,5,11); CreatePlayerShot01(GetPlayerX,GetPlayerY,9,atan2(GetEnemyY-GetPlayerY, GetEnemyX-GetPlayerX),2.8,5,9); CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+rand_int(200,340),2.8,5,10); kirk += 13;} frodo++;
}
task StoneBowl{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {BuddhaBullet(GetPlayerX,GetPlayerY,2.5,270+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,235+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,190+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,145+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,100+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,55+kirk,2.5,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,10+kirk,2.5,255,13); BuddhaBullet(GetPlayerX,GetPlayerY,2.5,-35+kirk,2.5,255,13); kirk += 13;} frodo++;
}
task CowryShell{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk)*10+270,6,1,14); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*10+270,6,1,15); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*30+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*35+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*40+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*45+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*50+270,2.5,1,2);kirk += 13;} frodo++;
}
task BuddhaBullet(x,y,v,dir,damage,penetration,graphic){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetBombResist(obj,true);
ObjShot_SetDamage(obj, damage);
ObjShot_SetPenetration(obj, penetration);
while(!Obj_BeDeleted(obj)){
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD)){
ObjShot_SetDamage(obj,1+picard);
picard += 0.1;
}
yield;
}
}
}
script_spell ScriptName{
@Initialize{
}
@MainLoop{
}
@Finalize{
}
}
Whenever I try to use the Expanded Shot Replace script, it doesn't work properly. What might be wrong?
#TouhouDanmakufu
#Title[Force Round]
#Text[Based on something I can't remeber the name of]
#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(40);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
shotinit;
mainTask;
let xmax = 3;
}
@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{
yield;
fire;
}
task fire{
let x = 0;
let dirmod = 0;
xmax++;
while(x<xmax){
homingshot(GetX+25*cos(GetAngleToPlayer+dirmod),GetY+25*sin(GetAngleToPlayer+dirmod),0,0,YELLOW214,0);
dirmod+=360/xmax;
x++;
}
x=0;
dirmod=0;
wait(45);
}
function wait(w){
loop(w){yield;}
}
task homingshot(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
while(Obj_BeDeleted(obj)==false){
Obj_SetAngle(obj,atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - Obj_GetX(obj)));
ObjShot_SetGraphic(obj,YELLOW214);
Obj_SetSpeed(obj,1);
wait(30);
yield;
}
}
}
This pattern is supposed to produce slow-moving aimed large stars.
"#include_function(で(two kanji)するフ(more katakana)[file path](more japanese text)".Just screenshot it and we'll see.
Can't find any of the other characters...
Let's try this again.Touhou Danmakufu can't find the "shot_replace.dnh" in libExpandedShotData folder. (Did I say that properly?)
(http://i50.tinypic.com/2m7x3xj.png)
There.
...Perchance I should have veiled up my name there.
task mainTask{
loop{
loop(20){yield;}
fire;
}
}
or something. Also remember to reset xmax, or after a while it'll start shitting stars like IaMP.
#TouhouDanmakufu[Player]
#ScriptVersion[2]
#Menu[Kaguya Houraisan]
#Text[Lunatic Princess. Designed by ChaoStar.]
#Image[.\KaguyaProfile.png]
#ReplayName[Short player name]
script_player_main{
let CSD = GetCurrentScriptDirectory;
let imgPlayer = CSD ~ "KaguyaSheet.png";
let frodo = 0; //frodo is for frames.
let kirk = 0; //kirk is for count.
let ImpossibleRequest = 1;
@Initialize{
LoadPlayerShotData(GetCurrentScriptDirectory~"Kaguya_shotdata.txt");
LoadGraphic(imgPlayer);
SetPlayerLifeImage(imgPlayer,45,34,59,47);
SetItemCollectLine(128);
SetSpeed(4.6, 1.8);
mainTask;
}
@MainLoop{
SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
if(GetKeyState(VK_USER)==KEY_PUSH){ImpossibleRequest++; if(ImpossibleRequest==6){ImpossibleRequest=1;}}
yield;
}
@Missed{
}
@Spellcard{
UseSpellCard("EternityManipulation", 0);
}
@DrawLoop{
SetTexture(imgPlayer);
SetGraphicRect(24,54,64,95);
DrawGraphic(GetPlayerX(), GetPlayerY());
}
@Finalize{
}
task mainTask{
loop{
if(ImpossibleRequest==1){JewelBranch;} else if(ImpossibleRequest==2){FireCape;} else if(ImpossibleRequest==3){DragonNecklace;} else if(ImpossibleRequest==4){StoneBowl}else if(ImpossibleRequest==5){CowryShell;}
yield;
}
}
task dostuff{
loop{
yield;
}
}
task JewelBranch{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%1==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-10,6,sin(kirk)*3+270,2.6,1,1); CreatePlayerShot01(GetPlayerX,GetPlayerY-10,6,sin(kirk)*10+270,2.6,1,3); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+270,2.6,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-10,6,sin(kirk)*90+270,2.6,1,4); CreatePlayerShot01(GetPlayerX,GetPlayerY-10,3,sin(kirk)*60+270,2.6,1,5); kirk += 13;}frodo++;
}
task FireCape{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,8,rand_int(250,290),10,3,6); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*20+250,4.5,1,7); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,6,sin(kirk)*30+290,4.5,1,7); CreatePlayerShot01(GetPlayerX+rand_int(-30,30),GetPlayerY+rand_int(-30,30),1,270+rand_int(-10,10),4.5,1,6); kirk += 13;} frodo++;
}
task DragonNecklace{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+250,2.8,5,8); CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+290,2.8,5,11); CreatePlayerShot01(GetPlayerX,GetPlayerY,9,atan2(GetEnemyY-GetPlayerY, GetEnemyX-GetPlayerX),1.5,1,9); CreatePlayerShot01(GetPlayerX,GetPlayerY,7,sin(kirk)*30+rand_int(200,340),2.8,5,10); kirk += 13;} frodo++;
}
task StoneBowl{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,135+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,180+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,225+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,270+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,315+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,360+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,405+kirk,1,255,13); CreatePlayerShot01(GetPlayerX,GetPlayerY,2.5,450+kirk,1,255,13); kirk += 13;} frodo++;
}
task CowryShell{
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && frodo%3==0) {CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk)*10+270,6,1,14); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*10+270,6,1,15); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*30+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*35+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*40+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*45+270,2.5,1,2); CreatePlayerShot01(GetPlayerX,GetPlayerY-5,7,sin(kirk+180)*50+270,2.5,1,2);kirk += 13;} frodo++;
}
}
script_spell EternityManipulation{
let img_spell = GetCurrentScriptDirectory()~"KaguyaSheet.png";
function wait(w){
loop(w){yield;}
}
task run{
SetPlayerInvincibility(540);
ForbidShot(true);
loop(26){
let dir = rand(-180, 180);
ascent(samwise in 0..25){
CreatePlayerShot01(GetPlayerX,GetPlayerY-10,7,dir+(samwise*(360/25)),3.5,255,15);
}
wait(120);
yield;
end();
}
}
@Initialize{
LoadGraphic(img_spell);
run();
}
@MainLoop{
CollectItems();
yield;
}
@Finalize{
DeleteGraphic(img_spell);
}
}
I wouldn't use 1337 as a number as danmakufu only allows a range from 1 to 255 :V
Sorry for bringing this up so late in the post, but actually I have a bullet id at 300 and it fires.Anything over 255 counts as 255.
Okay,different question:
If I want to use CutIn without a boss cut-in image (as in Resurrection Butterfly or Cat's Walk), what should CutIn's arguments be?
CutIn(YOUMU, "card name here", "", 0, 0, 0, 0);
#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(40);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOAMU,"Danmaku Upgrade "\"Alpha Shock"\","",0,0,0,0);
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{
yield;
fire;
}
}
task fire{
let n = 0;
let dx = 0;
//YELLOW01 is 16 px tall and the play field is 480 px tall
//create two lightning bolts from 1/3 and 2/3 the width of the screen, starting at the top
while(n<480/16){
//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(448/3+dx,16*n,0,0,YELLOW01,0);
lightning(448*2/3+dx,16*n,0,0,YELLOW01,0);
}else{
lightning(448/3+dx,16*n,0,180,YELLOW01,0);
lightning(448*2/3+dx,16*n,0,180,YELLOW01,0);
}
wait(5);
dx=rand_int(-8,8)
n++;
}
n = 0;
dx = 0;
wait(45);
//create a lightning bolt starting from the top middle
while(n<480/16){
//bullets in the middle chain will appear to split and move both left and right
lightning(448/2+dx,16*n,0,180,YELLOW01,0);
lightning(448/2+dx,16*n,0,0,YELLOW01,0);
wait(5);
dx=rand_int(-8,8)
n++;
}
n = 0;
dx = 0;
wait(45);
}
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);
Obj_SetSpeed(shard,v);
wait(10);
Obj_SetSpeed(shard,3);
}
}
KOUMA, silly.
...oops.
Turns out that wasn't the only thing...
error image
Another error the wiki doesn't have... This one has something to do with ).
I think he's missing a quotation mark just before Alpha, as well.
#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);
SetDamageRate(25,25);
SetMovePosition01(GetCenterX,GetCenterY-60,5);
SetEnemyMarker(true);
SetInvincibility(50);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
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{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
loop{
fire;
wait(240);
}
}
task fire{
let n = 0;
let dx = 0;
let xa = (448/4)+dx;
let xb = (448*3/4)+dx;
let xc = (448/2)+dx;
//YELLOW01 is 16 px tall and the play field is 480 px tall
//create two lightning bolts from 1/3 and 2/3 the width of the screen starting at the top
while(n<480/16){
//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,16*n,0,0,YELLOW01,0);
lightning(xb+dx,16*n,0,0,YELLOW01,0);
}else{
lightning(xa+dx,16*n,0,180,YELLOW01,0);
lightning(xb+dx,16*n,0,180,YELLOW01,0);
}
wait(5);
dx=rand_int(-8,8);
xa+=dx;
xb+=dx;
n++;
}
n = 0;
dx = 0;
xa = (448/4);
xb = (448*3/4);
wait(90);
//create a lightning bolt starting from the top middle
while(n<480/16){
//bullets in the middle chain will have the opposite system from that above
if(floor(n/2) < n/2){
lightning(xc+dx,16*n,0,180,YELLOW01,0);
}else{
lightning(xc+dx,16*n,0,0,YELLOW01,0);
}
wait(5);
dx=rand_int(-8,8);
n++;
}
n = 0;
dx = 0;
xc = (448/2);
wait(90);
}
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);
Obj_SetSpeed(shard,v);
wait(45);
Obj_SetSpeed(shard,1);
}
}
Read the damn tutorial.
@Spellcard{
UseSpellCard("EternityManipulation", 0);
}
#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);
}
}
Switch X and Y. atan2(destY-sourceY,destX-sourceX);
If it doesn't, switch the GetX and coordinate in both arguments.
Seriously people. Danmakufu is CASE SENSETIVEYou spelled sensitive wrong :V
People should read first instead of hitting the "reply" button rapidly.
You spelled sensitive wrong :V
Do keep in mind that Helepolis is not a native English speaker.He knows.
@MainLoop (You capitalized the L in mainloop, you're not supposed to do that :V
CreateShot01(GetAngleToPlayer;
if(2 = 1){
apple = 23
- Extremely large polygons, larger than about 3000 pixels in either dimension, will break it. This is common with the polygons people use for floors and such that are supposed to stretch out forever. They need to be trimmed and the stage needs to loop rather quickly to get around this.
task shoot{
let x = 0;
let dir = 0;
while(x < 15){
CreateShot(Blah,blah,blah)
x++;
dir += 360/15;
}
}
function shoot(density){
let x = 0;
let dir = 0;
while(x < density){
CreateShot(Blah,blah,blah)
x++;
dir += 360/density;
}
}
Actually the difference between task and function is that function takes in an input. For example if you have a shooting task like this:Code: [Select]task shoot{
let x = 0;
let dir = 0;
while(x < 15){
CreateShot(Blah,blah,blah)
x++;
dir += 360/15;
}
}
It will always shoot 15 evenly spread bullets in a circle. But changing "task shoot" to "function shoot(density)" let's you shoot any amount you want without having to rewrite the numbers you want to change. You have to change the code to this:Code: [Select]function shoot(density){
let x = 0;
let dir = 0;
while(x < density){
CreateShot(Blah,blah,blah)
x++;
dir += 360/density;
}
}
Then call shoot with shoot(#) and insert any number you want to shoot any amount of bullet you want and they will still be evenly spread out. There are other things you can do with functions but this is the simplest thing next to wait(w). So if you call shoot(25) then shoot(50) it will first shoot 25 bullets in a circle then 50 by using the same code.
Wrong.
Subroutines take no inputs, while functions and tasks both do. Functions are always run in a single frame, while tasks can use yield; to stall for a frame, then continue running.
About the subroutines, functions, and tasks question:
http://www.shrinemaiden.org/forum/index.php?topic=3218.msg162097#msg162097
Question specific for the 3D stage crafters.
Is it me or there seem to be a weird way that Danmakufu places 3D objects in stages. ( not effect objects, just 3D drawing in @BackGround ).
Look at this:
makemuur(GetCenterX-768,0,f,90);
makemuur(GetCenterX+768,0,f,90);
The above are functions to save endless blocks of scripting. First parameter places the wall on the X-axis, second on on the Y-axis, the third one on the Z-axis (aka scrolling technique) and the last parameter is something I added to flip/tilt the wall flexible. Basically I am creating two walls exactly on the opposite side ( minus and plus 768. ) However, this is how it looks ingame.
(http://i46.tinypic.com/15qx8br.png)
This is a reversed view ( I am flying backwards ). As you can see, the walls don't even allign proper with eachother. Why is this happening?
now you say that I'll need to store the id somewhere where @MainLoop can access it...would right before @Initialize in the script_player_main be an acceptable location...?
& I'd have to use SetVertexUV to define the coordinates/Vertexes of the graphic on the sheet(file) I want Danmakufu to display, right...?
Oh, I forgot to mention one last fundamental difference between subroutines, functions, and tasks. Functions are the ONLY ones that can return values. For example:
function GetDistance(x1, y1, x2, y2){
return ((x1-x2)^2+(y1-y2)^2)^0.5;
}
Then, you can do let distanceToPlayer = GetDistance(GetX, GetY, GetPlayerX, GetPlayerY); and the variable will now hold the value that was returned. Of course you can also do stuff like this:
function ObjShot_Create(x, y, speed, angle, graphic, delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, speed);
Obj_SetAngle(obj, angle);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
return obj;
}
And then you can go let obj = ObjShot_Create(GetX, GetY, 3, GetAngleToPlayer, RED01, 10); so that you don't have to type out the individual Obj_SetStuff functions every time.
Question specific for the 3D stage crafters.
Is it me or there seem to be a weird way that Danmakufu places 3D objects in stages. ( not effect objects, just 3D drawing in @BackGround ).
Look at this:
makemuur(GetCenterX-768,0,f,90);
makemuur(GetCenterX+768,0,f,90);
The above are functions to save endless blocks of scripting. First parameter places the wall on the X-axis, second on on the Y-axis, the third one on the Z-axis (aka scrolling technique) and the last parameter is something I added to flip/tilt the wall flexible. Basically I am creating two walls exactly on the opposite side ( minus and plus 768. ) However, this is how it looks ingame.
(http://i46.tinypic.com/15qx8br.png)
This is a reversed view ( I am flying backwards ). As you can see, the walls don't even allign proper with eachother. Why is this happening?
GetCenterX is the x-center of the 2D playing field, not the x-center of the 3D space.
There... is no function to fade out music...Eh, wut? It works with my scripts.
Eh, wut? It works with my scripts.
Actually that function does exist, but it never worked any time I tried to use it.
For Lawence Codye: You'll need to store the id of the object effect that is displaying the options where it can be accessed in the @MainLoop. Then, somewhere in the player script's @MainLoop, you can do
okay...umm how do I do this?...& I'm not asking where as I already know that...
script_player_main{
//declare stuff
//declare options
let optiona=Obj_Create(OBJ_EFFECT);
//etc
task Option(position){
//things about your option
}
task optionmove(whatever)
{
//do whatever
}
@Initialize{
//load stuff
}
@MainLoop{
yield;
//everything else you need
if((GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)){
//optiona do whatever...
//OR
//what do you want the option to do or task that makes the option do something, etc.
//optionmove(whatever)
}
@Missed{
//put anything you may want to put here
}
@SpellCard{
//put spell cards
}
@DrawLoop{
//draw stuff
}
@Finalize{
//delete stuff
}
}
I can use SetShotKillTime to delete ShotA bullets, but... they just kinda disappear. What do I use to make them show a deletion animation? You know, like when they kinda have a little "poof" out and whatnot, rather than simply vanish.
Well, I definitely confirmed that it's Danmakufu itself that won't run, because I went to the site and downloaded version 0.12m or whatever the latest version is, ran it with applocale and it brought up the same crash scenario. :(I've probably said this too many times already but try running the game with config.exe
Wait, it worked. o_O For some reason.heh
Unfortunately, now I can't get Concealed the Conclusion to run because of two indecipherable error messages. I think one of them mentioned FLAN. Should I get screenshots of them?
Unfortunately, there's no good way to do a nice effect for a randomly disappearing ShotA bullet. With object shots, you can do fade deleting, but for ShotA, the best thing you can do is to AddShot a delayed bullet in one frame before the one that's deleting is getting deleted. This second bullet can have SetShotKillTime on it for 0 frames so that as soon as the delay effect is gone, the bullet disappears. In this way, the bullet you want to delete will seem to sort of fade/shrink away.
*insert example scripting stuffs*
You don't have the proper dll file in the folder~
There should be a th_dnh.dll or something there.
Vsynch? What exactly does that do? I find Danmakufu to be the most input lag-free of any touhou-esque program, be it actually touhou or otherwise, so far.
let LeafProperties = [];
// If your camera is moving instead of your
// background, you'll need to change these
// according to your camera's movement
let LeafMinDeleteX = -500;
let LeafMaxDeleteX = 500;
let LeafMinDeleteY = -50;
let LeafMinDeleteY = 1000;
let LeafMinDeleteZ = -1000;
let LeafMaxDeleteZ = 400;
//These are optional but help with organization.
//They're mostly to help you remember which array
//element refers to what property of each leaf.
//So LeafProperties[2][XVEL] will refer to
//the 3rd leaf's x velocity.
let XPOS = 1;
let YPOS = 2;
let ZPOS = 3;
let XVEL = 4;
let YVEL = 5;
let ZPOS = 6;
let XANGLE = 7;
let YANGLE = 8;
let ZANGLE = 9;
let XANGLEVEL = 10;
let YANGLEVEL = 11;
let ZANGLEVEL = 12;
task MakeBackgroundLeaf (xPos, yPos, zPos, xVel, yVel, zVel, xAngleVel, yAngleVel, zAngleVel){
// I ignored the starting graphic angles since
// no one's gonna notice if they spawn off screen.
LeafProperties = LeafProperties ~ [xPos, yPos, zPos, xVel, yVel, zVel, 0, 0, 0, xAngleVel, yAngleVel, zAngleVel];
let indx = length(LeafProperties) - 1; // Don't name it "index" 'cause Danmakufu sucks. :V
while( // while the position is not off-camera
LeafProperties[indx][XPOS]>LeafMinDeleteX &&
LeafProperties[indx][XPOS]<LeafMaxDeleteX &&
LeafProperties[indx][YPOS]>LeafMinDeleteY &&
LeafProperties[indx][YPOS]<LeafMaxDeleteY &&
LeafProperties[indx][ZPOS]>LeafMinDeleteZ &&
LeafProperties[indx][ZPOS]<LeafMaxDeleteZ
){
// update the information for drawing
// Danmakufu can't change values two dimensions deep so remake the whole array.
LeafProperties[indx] = [
LeafProperties[indx][XPOS] + LeafProperties[indx][XVEL], // First element is XPOS
LeafProperties[indx][YPOS] + LeafProperties[indx][YVEL], // Second element is YPOS
LeafProperties[indx][ZPOS] + LeafProperties[indx][ZVEL], // Third element is ZPOS
LeafProperties[indx][XVEL], // Fourth element is XVEL which doesn't change
LeafProperties[indx][YVEL], // Fifth element is YVEL which doesn't change
LeafProperties[indx][ZVEL], // Sixth element is ZVEL which doesn't change
LeafProperties[indx][XANGLE] + LeafProperties[indx][XANGLEVEL], // Seventh element is XANGLE
LeafProperties[indx][YANGLE] + LeafProperties[indx][YANGLEVEL], // Eighth element is YANGLE
LeafProperties[indx][ZANGLE] + LeafProperties[indx][ZANGLEVEL], // Ninth element is ZANGLE
LeafProperties[indx][XANGLEVEL], // Tenth element is XANGLEVEL which doesn't change
LeafProperties[indx][YANGLEVEL], // Eleventh element is YANGLEVEL which doesn't change
LeafProperties[indx][ZANGLEVEL] // Twelfth element is ZANGLEVEL which doesn't change
];
// store the values temporarily in case the indx
// number changes due to deletion of previous leaves
// in other tasks.
let tempInfo = LeafProperties[indx];
yield;
// find the corresponding leaf again in the array.
while(tempInfo != LeafProperties[indx]){
indx--;
}
}
LeafProperties = erase(LeafProperties, indx);
}
SetTexture(imgLeaf); // or whatever
SetGraphicRect(0, 0, 32, 32); // or whatever :V
SetGraphicScale(1, 1); // or whatever :V :V
SetAlpha(255); // or whatever :V :V :V
ascent(i in 0..length(LeafProperties)){
SetGraphicAngle(LeafProperties[i][XANGLE], LeafProperties[i][YANGLE], LeafProperties[i][ZANGLE]);
DrawGraphic3D(LeafProperties[i][XPOS], LeafProperties[i][YPOS], LeafProperties[i][ZPOS]);
}
loop(20){ // has 20 starting leaves when the stage starts
MakeBackgroundLeaf(
rand(-500, 500),
rand(0, 1000),
rand(-1000, 400),
rand(-1, 1),
rand(-1, 1),
rand(-1, 1),
rand(-3, 3),
rand(-3, 3),
rand(-3, 3)
);
}
let rotxarr=[rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359)];
let rotyarr=[rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359)];
let rotzarr=[rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359), rand(0, 359)];
let rotxbarr=[rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3)];
let rotybarr=[rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3)];
let rotzbarr=[rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3), rand(1, 3)];
let typearr=[rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8), rand_int(1, 8)];
let xarr=[-rand(210, 1000), -rand(300, 700), -rand(100, 500), -rand(210, 600), -rand(150, 800), -rand(500, 890), -rand(40, 100), -rand(50, 300), -rand(60, 300)];
let yarr=[rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220), rand(150, 220)];
let zarr=[rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600), rand(0, 600)];
let xmovarr=[-rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2)];
let ymovarr=[-rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2), -rand(0.5, 2)];
let zmovarr=[-rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2), -rand(1, 2)];
sub snowflake
{
ascent(i in 0..9)
{
let rotx=rotxarr[i]; //setting variables for each individual snowflake
let roty=rotxarr[i];
let rotz=rotxarr[i];
let rotxb=rotxbarr[i];
let rotyb=rotybarr[i];
let rotzb=rotzbarr[i];
let type=typearr[i];
let x=xarr[i];
let y=yarr[i];
let z=zarr[i];
let xmov=xmovarr[i];
let ymov=ymovarr[i];
let zmov=zmovarr[i];
SetTexture(a_img_snow);
if(type<=3) //I had different snowflakes so I randomized them instead of just using one flake design
{
SetGraphicRect(type*89-89, 0, type*89, 86);
}else if(type<=6){
SetGraphicRect((type-4)*89, 86, (type-3)*89, 172);
}else{
SetGraphicRect((type-7)*89, 172, (type-6)*89, 259);
}
SetGraphicScale(1, 1);
SetGraphicAngle(rotx, roty, rotz);
DrawGraphic3D(x, y, z);
rotxarr[i]=rotx+rotxb;
rotyarr[i]=roty+rotyb;
rotzarr[i]=rotz+rotzb;
xarr[i]=x+xmov;
yarr[i]=y+ymov;
zarr[i]=z+zmov;
if(y<4) //if the flake has reached underground, return it to a random position at the top
{
yarr[i]=rand(150, 220);
xarr[i]=-rand(100, 1000);
zarr[i]=rand(0, 1000);
}
}
}
And that lag should be fixed by the vsynch patch, but I can't get it to work because supposedly I need a dll which according to you doesn't exist. :\Except that the .dll should be included with the Vsync patch, not Danmakufu. So, it should be in the zip with all the other dll files.
Kyle's version is easier to use and will work for most similar applications to falling 2D images in a 3D background like leaves and snowflakes. However, one thing I wanna nitpick about is the handling of logic in @DrawLoop. Try going to config.exe and selecting that 1/3 option in the left side of the first tab and seeing what happens to your snowflakes. :VEDIT: Also, my code is longer and therefore manlier.
Thank you. That was indeed the problem. Being able to control my movements instantly makes this game more likable. Now there's just the issue of it spawning bullets on top of me way more often than any game should, the ludicrously short death invulnerability times, the fact that I have no idea what determines when you can gather Hakurei... :VYou also need 1cc the game while doing a full twist back layout aka no one really knows. Although you could poke around in the code to unlock it I guess...
BTW, when does extra open? Do I need to 1cc with all shot types? I thought I read once you only needed to do it with three.
Is it possible to make a boss use a kind of recovery effect on themselves (i.e. restoring part of their health in the middle of a spell card)? I tried doing something such as
SetLife(GetLife+5);
But this causes Danmakufu to crash.
So is it actually possible for an enemy/boss to recover their health? If so, how is it performed?
okay...umm, what's the purpose of...or what exacly does MULTIPLY: multiplicative blend in Object Effects?
when I tried doing multiply in drawing (drawloop, not object effects, but I think the same principle applies), it's like a mix between subtract and add... so basically... it's both Dark and bright/shiny... it's just weird and hard to explain... it's like a dark shadow-like version of the basic Alpha... (hope this helps)umm...it helped me...not enough, thanks though...
Quick explanation of render modes:...meh...no matter...I have this...
(bg color + object color = result)
MULTIPLY (starting to understand ?) : Multiply the overlaying hex values
no math example because I am lazy
http://en.wikipedia.org/wiki/Blend_modeswow, wikipedia, really...no, no, this helped me figure it out...
edit: f u blargellol...wow...well thank you guys...& I will never need to know what ALPHA blend is, ever...!
It only slows the time it takes danmakufu to archive those scripts (load them in a menu). Doesnt affect anything else. Not unloading images/music in your scripts may affect things over time, if you keep danmakufu open for a while, but I think that's the only thing that could.Yeah that's what I suspected. But the thing is I can't seem to run my Nitori GET DOWN script at 60 fps anymore and the only thing that I can see is different is I have more scripts.
Also, 149 pages of scripts when I try to load up the single manu. Takes ages to load (this is what lead me to my previous conclusion). I only use directory nowadays...
#TouhouDanmakufu
#Title[China's Punch "Time To Revive The Color"]
#Text[Test script]
#BackGround[User(.\black.png, 1, 1)]
#BGM[script/st6boss2.wav]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let ImgBoss = "script\img\ExRumia.png";
let count = -120;
let SMT = 0;
let fire = 0;
@Initialize {
SetLife(400);
SetDamageRate(10, 20);
SetTimer(256);
SetInvincibility( 200 );
LoadGraphic(ImgBoss);
SetMovePosition02(GetCenterX, GetCenterY-120, 120);
CutIn(YOUMU, "Non-Spell 2"\", "", 0, 0, 0, 0);
LoadUserShotData("\lib\SHOT_REPLACE\shot_All.dnh");
SetGraphicRect(0, 0, 64, 64);
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if ((count == 0)){
particle;
}
if ((count == 150)){
count = 0;
}
count++;
SMT++;
yield;
}
@DrawLoop {
SetTexture(ImgBoss);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(ImgBoss);
}
task particle{
let b = 180;
let bup = 13.3;
let reverse = 0;
let lrar = 0;
let kput = 1;
let krar = 360/kput;
let Length = 30;
yield;
let x = 2.3;
let n = 0;
let q = 0;
let RollerX;
let RollerY;
let random;
loop{
PlaySE(GetCurrentScriptDirectory~"SE\se_tan01.wav");
ascent(a in 1..kput+1){
RollerX = GetClipMinX - 10 + (GetClipMaxX-GetClipMinX) / 150 * count;
RollerY = GetY - 0 + sin(SMT*11.3) * 80;
CreateLaserA(1, RollerX, RollerY, 400, 8, 41, 20);
SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);
SetShotKillTime(2, 120);
FireShot(1);
TheshotUp(RollerX, RollerY, 0, (a*krar+b)+120, 42, 20);
TheshotUp(RollerX, RollerY, 0, (a*krar+b)-120, 43, 20);
}
if (reverse == 0){
if (bup > -0.7){
bup += 0;
}
else{
reverse++;
}
}
else{
if (bup > 120){
bup -= 0;
}
else{
reverse--;
}
}
b += bup;
if (Length > -200){
Length -= 0;
}
loop(1){
yield;
}
}
}
task TheshotUp(x, y, v, angle, graphic, delay){
let obj = Obj_Create(OBJ_SHOT);
let a = 0;
let b = 0;
let dir = angle;
Obj_SetX(obj, x);
Obj_SetY(obj, y);
Obj_SetSpeed(obj, v);
Obj_SetAngle(obj, angle);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
Obj_SetAutoDelete(obj, false);
while (!Obj_BeDeleted(obj)){
if (count == 150){
Obj_SetAutoDelete(obj, true);
Obj_SetSpeed(obj, 2);
}
a++;
b++;
yield;
}
}
task TheshotCircle(x, y, v, angle, graphic, delay){
let obj = Obj_Create(OBJ_SHOT);
let a = 0;
let b = 0;
let dir = angle;
Obj_SetX(obj, x);
Obj_SetY(obj, y);
Obj_SetSpeed(obj, v);
Obj_SetAngle(obj, angle);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
ObjShot_SetBombResist(obj, true);
while (!Obj_BeDeleted(obj)){
if (a == 120){
Obj_SetSpeed(obj, v*8);
}
a++;
b++;
yield;
}
}
}
How can I make the lasers stop flickering around?
SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);
I want the lasers to point in different directions. If you have played the script, you should see why.Code: [Select]SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);
The angular velocity of your lasers is (a*krar+b).
(a*krar+b) = (1..n)*360 + 180
So yeah, an angular velocity of a high value is going to raep your eyes anywhere, anytime. I am not shure what you tried to accomplish with this, but whatever it may be, in this statement lies the error. ;)
SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);
for SetLaserDataA(1, 0, (a*krar+b), 0, 0, 0, 0);
?In that case, why not give each laser a different starting angle, then? For exampe, what if you exchangeCode: [Select]SetLaserDataA(1, 0, 0, (a*krar+b), 0, 0, 0);
forCode: [Select]SetLaserDataA(1, 0, (a*krar+b), 0, 0, 0, 0);
?
Also, you should make the SetShotKillTime refer to the laser, which means replacing the argument 2 with 1. Otherwise you will eventuall have 95% of the screen covered with lasers.
#TouhouDanmakufu
#Title[China's Punch "Time To Revive The Color"]
#Text[Test script]
#BackGround[User(.\black.png, 1, 1)]
#BGM[script/st6boss2.wav]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let ImgBoss = "script\img\ExRumia.png";
let count = -120;
let SMT = 0;
let fire = 0;
@Initialize {
SetLife(400);
SetDamageRate(10, 20);
SetTimer(256);
SetInvincibility( 200 );
LoadGraphic(ImgBoss);
SetMovePosition02(GetCenterX, GetCenterY-120, 120);
CutIn(YOUMU, "Non-Spell 2"\", "", 0, 0, 0, 0);
LoadUserShotData("\lib\SHOT_REPLACE\shot_All.dnh");
SetGraphicRect(0, 0, 64, 64);
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if ((count == 0)){
particle;
}
if ((count == 90)){
count = 0;
}
count++;
SMT++;
yield;
}
@DrawLoop {
SetTexture(ImgBoss);
DrawGraphic(GetX, GetY);
}
@Finalize {
DeleteGraphic(ImgBoss);
}
task particle{
let b = 180;
let bup = 13.3;
let reverse = 0;
let lrar = 0;
let kput = 1;
let krar = 360/kput;
let Length = 30;
yield;
let x = 2.3;
let n = 0;
let q = 0;
let RollerX;
let RollerY;
let random;
loop{
PlaySE(GetCurrentScriptDirectory~"SE\se_tan01.wav");
ascent(a in 1..kput+1){
RollerX = GetClipMinX - 10 + (GetClipMaxX-GetClipMinX) / 90 * count;
RollerY = GetY - 0 + sin(SMT*6.3) * 80;
CreateLaserA(1, RollerX, RollerY, 800, 8, 41, 40);
SetLaserDataA(1, 0, (a*krar+b), 0, 0, 0, 0);
SetShotKillTime(1, 90);
FireShot(1);
CreateLaserA(1, RollerX, RollerY, 800, 8, 42, 40);
SetLaserDataA(1, 0, (a*krar+b)+120, 0, 0, 0, 0);
SetShotKillTime(1, 90);
FireShot(1);
CreateLaserA(1, RollerX, RollerY, 800, 8, 43, 40);
SetLaserDataA(1, 0, (a*krar+b)-120, 0, 0, 0, 0);
SetShotKillTime(1, 90);
FireShot(1);
TheshotUp(RollerX, RollerY, 0, (a*krar+b)+60, 41, 20);
TheshotUp(RollerX, RollerY, 0, (a*krar+b)+180, 42, 20);
TheshotUp(RollerX, RollerY, 0, (a*krar+b)-60, 43, 20);
}
if (reverse == 0){
if (bup > -0.7){
bup += 0;
}
else{
reverse++;
}
}
else{
if (bup > 120){
bup -= 0;
}
else{
reverse--;
}
}
b += bup;
if (Length > -200){
Length -= 0;
}
loop(3){
yield;
}
}
}
task TheshotUp(x, y, v, angle, graphic, delay){
let obj = Obj_Create(OBJ_SHOT);
let a = 0;
let b = 0;
let dir = angle;
Obj_SetX(obj, x);
Obj_SetY(obj, y);
Obj_SetSpeed(obj, v);
Obj_SetAngle(obj, angle);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
Obj_SetAutoDelete(obj, false);
while (!Obj_BeDeleted(obj)){
if (count == 90){
Obj_SetAutoDelete(obj, true);
Obj_SetSpeed(obj, 2);
}
a++;
b++;
yield;
}
}
task TheshotCircle(x, y, v, angle, graphic, delay){
let obj = Obj_Create(OBJ_SHOT);
let a = 0;
let b = 0;
let dir = angle;
Obj_SetX(obj, x);
Obj_SetY(obj, y);
Obj_SetSpeed(obj, v);
Obj_SetAngle(obj, angle);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
ObjShot_SetBombResist(obj, true);
while (!Obj_BeDeleted(obj)){
if (a == 120){
Obj_SetSpeed(obj, v*8);
}
a++;
b++;
yield;
}
}
}
Does having a lot of scripts in your script folder slow danmakufu down? It seems to for me although I don't really have any concrete evidence for it...Holy shit I am a moron. I just realized I had my power settings on "power saver" mode. I switched it to "high performance" and BAM, 60 glorious fps.
task mainTask{
loop{
if(Season==1){FireSign("First");}
else if(Season==2){WaterSign("Fifth");}
if(Season2==1){FireSign("Second");}
else if(Season2==2){WaterSign("Sixth");}
if(Season3==1){FireSign("Third");}
else if(Season3==2){WaterSign("Seventh");}
if(Season4==1){FireSign("Fourth");}
else if(Season4==2){WaterSign("Eighth");}
yield;
}
}
task FireSign(position){
let hfire = Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(hfire, 200);
ObjEffect_SetTexture(hfire, imgSprite);
ObjEffect_SetRenderState(hfire, ALPHA);
ObjEffect_SetLayer(hfire, 1);
ObjEffect_SetPrimitiveType(hfire, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(hfire, 4);
ObjEffect_SetVertexUV(hfire, 0, 106, 152);
ObjEffect_SetVertexUV(hfire, 1, 119, 152);
ObjEffect_SetVertexUV(hfire, 2, 119, 165);
ObjEffect_SetVertexUV(hfire, 3, 106, 165);
if(position=="First"){
while(!Obj_BeDeleted(hfire)){
ObjEffect_SetVertexXY(hfire,0,GetPlayerX-oxp2-
7,GetPlayerY+oyp3-7);
ObjEffect_SetVertexXY(hfire,1,GetPlayerX-
oxp2+7,GetPlayerY+oyp3-7);
ObjEffect_SetVertexXY(hfire,2,GetPlayerX-
oxp2+7,GetPlayerY+oyp3+7);
ObjEffect_SetVertexXY(hfire,3,GetPlayerX-oxp2-
7,GetPlayerY+oyp3+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||
GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3-7, 20, 275, 4.0, 1, 1);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3-7, 20, 275, 4.0, 1, 1);
i++;
}
}
}
yield;
}
}if(position=="Second"){
while(!Obj_BeDeleted(hfire)){
ObjEffect_SetVertexXY(hfire,0,GetPlayerX+oxp2-
7,GetPlayerY+oyp3-7);
ObjEffect_SetVertexXY
(hfire,1,GetPlayerX+oxp2+7,GetPlayerY+oyp3-7);
ObjEffect_SetVertexXY
(hfire,2,GetPlayerX+oxp2+7,GetPlayerY+oyp3+7);
ObjEffect_SetVertexXY(hfire,3,GetPlayerX+oxp2-
7,GetPlayerY+oyp3+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||
GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()
+oxp2, GetPlayerY()+oyp3-7, 20, 265, 4.0, 1, 1);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()
+oxp2, GetPlayerY()+oyp3-7, 20, 265, 4.0, 1, 1);
i++;
}
}
}
yield;
}
}if(position=="Third"){
while(!Obj_BeDeleted(hfire)){
ObjEffect_SetVertexXY(hfire,0,GetPlayerX-oxp-
7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY(hfire,1,GetPlayerX-
oxp+7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY(hfire,2,GetPlayerX-
oxp+7,GetPlayerY+oyp2+7);
ObjEffect_SetVertexXY(hfire,3,GetPlayerX-oxp-
7,GetPlayerY+oyp2+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||
GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2-7, 20, 276, 4.0, 1, 1);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2-7, 20, 276, 4.0, 1, 1);
i++;
}
}
}
yield;
}
}if(position=="Fourth"){
while(!Obj_BeDeleted(hfire)){
ObjEffect_SetVertexXY(hfire,0,GetPlayerX+oxp-
7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY
(hfire,1,GetPlayerX+oxp+7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY
(hfire,2,GetPlayerX+oxp+7,GetPlayerY+oyp2+7);
ObjEffect_SetVertexXY(hfire,3,GetPlayerX+oxp-
7,GetPlayerY+oyp2+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||
GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()
+oxp, GetPlayerY()+oyp2-7, 20, 264, 4.0, 1, 1);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()
+oxp, GetPlayerY()+oyp2-7, 20, 264, 4.0, 1, 1);
i++;
}
}
}
yield;
}
}
}
task WaterSign(position){
let hwater = Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(hwater, 200);
ObjEffect_SetTexture(hwater, imgSprite);
ObjEffect_SetRenderState(hwater, ALPHA);
ObjEffect_SetLayer(hwater, 1);
ObjEffect_SetPrimitiveType(hwater, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(hwater, 4);
ObjEffect_SetVertexUV(hwater, 0, 106, 168);
ObjEffect_SetVertexUV(hwater, 1, 119, 168);
ObjEffect_SetVertexUV(hwater, 2, 119, 181);
ObjEffect_SetVertexUV(hwater, 3, 106, 181);
if(position=="Fifth"){
while(!Obj_BeDeleted(hwater)){
ObjEffect_SetVertexXY(hwater,0,GetPlayerX-oxp2-
7,GetPlayerY+oyp3-7);
ObjEffect_SetVertexXY(hwater,1,GetPlayerX-
oxp2+7,GetPlayerY+oyp3-7);
ObjEffect_SetVertexXY(hwater,2,GetPlayerX-
oxp2+7,GetPlayerY+oyp3+7);
ObjEffect_SetVertexXY(hwater,3,GetPlayerX-oxp2-
7,GetPlayerY+oyp3+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||
GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3, 20, 275, 3.0, 1, 2);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3, 20, 275, 3.0, 1, 2);
i++;
}
}
}
yield;
}
}if(position=="Sixth"){
while(!Obj_BeDeleted(hwater)){
ObjEffect_SetVertexXY(hwater,0,GetPlayerX+oxp2-
7,GetPlayerY+oyp3-7);
ObjEffect_SetVertexXY
(hwater,1,GetPlayerX+oxp2+7,GetPlayerY+oyp3-7);
ObjEffect_SetVertexXY
(hwater,2,GetPlayerX+oxp2+7,GetPlayerY+oyp3+7);
ObjEffect_SetVertexXY(hwater,3,GetPlayerX+oxp2-
7,GetPlayerY+oyp3+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||
GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3, 20, 275, 3.0, 1, 2);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-
oxp2, GetPlayerY()+oyp3, 20, 275, 3.0, 1, 2);
i++;
}
}
}
yield;
}
}if(position=="Seventh"){
while(!Obj_BeDeleted(hwater)){
ObjEffect_SetVertexXY(hwater,0,GetPlayerX-oxp-
7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY(hwater,1,GetPlayerX-
oxp+7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY(hwater,2,GetPlayerX-
oxp+7,GetPlayerY+oyp2+7);
ObjEffect_SetVertexXY(hwater,3,GetPlayerX-oxp-
7,GetPlayerY+oyp2+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||
GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2, 20, 275, 3.0, 1, 2);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2, 20, 275, 3.0, 1, 2);
i++;
}
}
}
yield;
}
}if(position=="Eighth"){
while(!Obj_BeDeleted(hwater)){
ObjEffect_SetVertexXY(hwater,0,GetPlayerX+oxp-
7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY
(hwater,1,GetPlayerX+oxp+7,GetPlayerY+oyp2-7);
ObjEffect_SetVertexXY
(hwater,2,GetPlayerX+oxp+7,GetPlayerY+oyp2+7);
ObjEffect_SetVertexXY(hwater,3,GetPlayerX+oxp-
7,GetPlayerY+oyp2+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH ||
GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2, 20, 275, 3.0, 1, 2);
i++
}
}
}else{
if(count%8 == 4){
i=2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2, 20, 265, 3.0, 1, 2);
CreatePlayerShot01(GetPlayerX()-
oxp, GetPlayerY()+oyp2, 20, 275, 3.0, 1, 2);
i++;
}
}
}
yield;
}
}
}
function wait(w){
loop(w){yield;}
}
}
yeah...but when I start a script problems occur in the following order...I cannot give you any further information because... ohgodsomuchcode...
Oh, wait, another thing:
The fps get so low because of a common mistake: You have a task that runs every frame and that activates all the other tasks. Each of the other tasks also runs once per frame. Thus the number of tasks increases exponentially. My tip to fix it: Get rid of the task that activates all the other tasks and make it so that the code inside it is run once every time a season is changed.
Oh boy, it seems people are messing up often with the microthreading method. Even though it is clearly explained how to do it step by step. I guess it is still something which is annoying to understand but eventually more powerful to use.
It totally depends on style and preferences. Hence I advice people not to think of that style being the best. There is no such thing as best style, it is whatever makes you happy.
Um, you could always put stuff in the regular @MainLoop{}, I guess. Did you learn how to code by watching the Helepolis' videao tutorials, by any chance? :P...actually, yes...this is a bit different though don't you agree...but no, thanks that fixed the hell out of the fps problem...&...you can go get your criticism now... ;)
On an unrelated note, I am still waiting for the comment on my rough player script. :V
if(Season=!1){ Obj_Delete(hfire); }
oh &...this;Oh. Umm, well, yeah, sorry. :V
!=
is what you meant right...cause the other thing spawned me at omfgerrors&errors...thanks...
&...you can go get your criticism now... ;)Thanks. Wheeee!
I managed to view your post before you edited it...
...and what I thought was "HOLY SHIT NAUT KNOWS HOW TO COMMENT :V"
However, your array-fu is lacking still.
#TouhouDanmakufu
#Title[TrialBoss]
#Text[just a tutorial to present it]
#Player[FREE]
#ScriptVersion[2]
#BGM[.\bgm\Fate.mp3"]
#PlayerLevel[Normal]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let ShotData = CSD ~ "system\supershot2.txt";
let imgBoss = CSD ~ "system\boss21.png";
let cut = CSD ~ "system\slpl13.png";
let bg = CSD ~ "system\judgment.png";
let lay = CSD ~ "system\cdbg21b.png";
let f = 0;
let f2 = 0;
let attack = 0;
let b = 0;
@Initialize{
SetLife(1000);
SetTimer(60);
SetScore(100000);
SetMovePosition01(GetX,120,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
LoadUserShotData(ShotData);
CutIn(YOUMU,"Judgement: "\""Final Verdict""\",cut,0,0,256,512);
mainTask;
}
@MainLoop{
//SetCollisionA(GetX,GetY,32);
//SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1.2,1.2);
SetGraphicAngle(0,0,0);
if(int(GetSpeedX())==0){
if(attack==0){
if(f<10){SetGraphicRect(0,0,64,80);}
if(f>=10 && f<20){SetGraphicRect(64,0,128,80);}
if(f>=20 && f<30){SetGraphicRect(128,0,192,80);}
if(f>=30 && f<40){SetGraphicRect(192,0,256,80);}
}
if(attack==1){
SetGraphicRect(0,160,64,240);
}
f2 = 0;
}
if(GetSpeedX()>0){
if(attack==0){
if(f2<5){SetGraphicRect(0,80,64,160);}
if(f2>=5 && f<10){SetGraphicRect(64,80,128,160);}
if(f2>=10 && f<15){SetGraphicRect(128,80,192,160);}
if(f2>=15){SetGraphicRect(192,80,256,160);}
} f2++;
if(attack==1){
SetSpeed(0);
SetGraphicRect(0,160,64,240);
}
}
if(GetSpeedX()<0){
if(attack==0){
SetGraphicAngle(180,0,0);
if(f2<5){SetGraphicRect(0,80,64,160);}
if(f2>=5 && f<10){SetGraphicRect(64,80,128,160);}
if(f2>=10 && f<15){SetGraphicRect(128,80,192,160);}
if(f2>=15){SetGraphicRect(192,80,256,160);}
f2++;
}
if(attack==1){
SetSpeed(0);
SetGraphicRect(0,160,64,240);
}
}
DrawGraphic(GetX,GetY);
f++;
if(f==40){f = 0; }
DrawText("Shikieiki Yamaxanadu",35,30,12,255);
}
@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
SetTexture(lay);
SetGraphicRect(0,0,24000,24000);
SetRenderState(ALPHA);
SetAlpha(35);
SetGraphicScale(1,1);
DrawGraphic(GetCenterX + b, GetCenterY + b);
b++;
if(b>=9000){b=0;}
}
@Finalize{
if(GotSpellCardBonus){
PlaySE(CSD ~ "SFX\se_cardget.wav");
}
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
// main task, activates stuff.
task mainTask{
yield;
wait(75);
fire;
fire2;
}
task fire{
loop{
if(GetTimer<31){
PlaySE(CSD~"sfx\se_power0.wav");
Concentration01(120);
wait(50);
attack = 1;
wait(10);
//CreateLaser01(GetX, GetY, 2, GetAngleToPlayer, 200, 16, RED01, 20);
CreateLaserA(1, GetEnemyX, GetEnemyY, 700, 80, PURPLE03, 60);
SetLaserDataA(1, 0, GetAngleToPlayer, 0, 0, 0, 0);
CreateLaserA(2, GetEnemyX, GetEnemyY, 600, 20, BLUE01, 60);
SetLaserDataA(2, 0, GetAngleToPlayer-60, 0, 0, 0, 0);
CreateLaserA(3, GetEnemyX, GetEnemyY, 600, 20, BLUE01, 60);
SetLaserDataA(3, 0, GetAngleToPlayer-90, 0, 0, 0, 0);
CreateLaserA(4, GetEnemyX, GetEnemyY, 600, 20, BLUE01, 60);
SetLaserDataA(4, 0, GetAngleToPlayer-120, 0, 0, 0, 0);
CreateLaserA(5, GetEnemyX, GetEnemyY, 600, 20, BLUE01, 60);
SetLaserDataA(5, 0, GetAngleToPlayer-145, 0, 0, 0, 0);
CreateLaserA(6, GetEnemyX, GetEnemyY, 600, 20, RED01, 60);
SetLaserDataA(6, 0, GetAngleToPlayer+145, 0, 0, 0, 0);
CreateLaserA(7, GetEnemyX, GetEnemyY, 600, 20, RED01, 60);
SetLaserDataA(7, 0, GetAngleToPlayer+120, 0, 0, 0, 0);
CreateLaserA(8, GetEnemyX, GetEnemyY, 600, 20, RED01, 60);
SetLaserDataA(8, 0, GetAngleToPlayer+90, 0, 0, 0, 0);
CreateLaserA(9, GetEnemyX, GetEnemyY, 600, 20, RED01, 60);
SetLaserDataA(9, 0, GetAngleToPlayer+60, 0, 0, 0, 0);
SetShotKillTime(1,120);
SetShotKillTime(2,120);
SetShotKillTime(3,120);
SetShotKillTime(4,120);
SetShotKillTime(5,120);
SetShotKillTime(6,120);
SetShotKillTime(7,120);
SetShotKillTime(8,120);
SetShotKillTime(9,120);
PlaySE(CSD~"sfx\se_lazer00.wav");
FireShot(1);
FireShot(2);
FireShot(3);
FireShot(4);
FireShot(5);
FireShot(6);
FireShot(7);
FireShot(8);
FireShot(9);
wait(120);
attack = 0;
wait(60);
yield;
} else {
yield;
}
}
yield;
}
task fire2{
attack = 1;
wait(30);
loop{
if(GetTimer==51){
PlaySE(CSD~"sfx\se_power1.wav");
Concentration01(120);
wait(10);
}
if(GetTimer==31){
PlaySE(CSD~"sfx\se_power1.wav");
Concentration01(120);
wait(10);
}
if(GetTimer==21){
PlaySE(CSD~"sfx\se_power1.wav");
Concentration01(120);
wait(10);
}
if(GetTimer==11){
PlaySE(CSD~"sfx\se_power1.wav");
Concentration01(120);
wait(10);
}
if(GetTimer>50){
PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,2,90,255,50);
CreateShot01(rand(40,65),5,2,90,255,50);
CreateShot01(rand(70,95),20,2,90,255,50);
CreateShot01(rand(100,125),5,2,90,255,50);
CreateShot01(rand(130,155),20,2,90,255,50);
CreateShot01(rand(160,185),5,2,90,255,50);
CreateShot01(rand(190,215),20,2,90,255,50);
CreateShot01(rand(220,245),5,2,90,255,50);
CreateShot01(rand(250,275),20,2,90,255,50);
CreateShot01(rand(280,305),5,2,90,255,50);
CreateShot01(rand(310,335),20,2,90,255,50);
CreateShot01(rand(340,365),5,2,90,255,50);
CreateShot01(rand(370,395),20,2,90,255,50);
CreateShot01(rand(400,425),5,2,90,255,50);
wait(60);
} else if (GetTimer>40){
PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,3,90,255,50);
CreateShot01(rand(40,65),5,3,90,255,50);
CreateShot01(rand(70,95),20,3,90,255,50);
CreateShot01(rand(100,125),5,3,90,255,50);
CreateShot01(rand(130,155),20,3,90,255,50);
CreateShot01(rand(160,185),5,3,90,255,50);
CreateShot01(rand(190,215),20,3,90,255,50);
CreateShot01(rand(220,245),5,3,90,255,50);
CreateShot01(rand(250,275),20,3,90,255,50);
CreateShot01(rand(280,305),5,3,90,255,50);
CreateShot01(rand(310,335),20,3,90,255,50);
CreateShot01(rand(340,365),5,3,90,255,50);
CreateShot01(rand(370,395),20,3,90,255,50);
CreateShot01(rand(400,425),5,3,90,255,50);
wait(50);
} else if (GetTimer>30){
PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,3,90,255,50);
CreateShot01(rand(40,65),5,3,90,255,50);
CreateShot01(rand(70,95),20,3,90,255,50);
CreateShot01(rand(100,125),5,3,90,255,50);
CreateShot01(rand(130,155),20,3,90,255,50);
CreateShot01(rand(160,185),5,3,90,255,50);
CreateShot01(rand(190,215),20,3,90,255,50);
CreateShot01(rand(220,245),5,3,90,255,50);
CreateShot01(rand(250,275),20,3,90,255,50);
CreateShot01(rand(280,305),5,3,90,255,50);
CreateShot01(rand(310,335),20,3,90,255,50);
CreateShot01(rand(340,365),5,3,90,255,50);
CreateShot01(rand(370,395),20,3,90,255,50);
CreateShot01(rand(400,425),5,3,90,255,50);
wait(40);
} else if (GetTimer>20){
PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,4,90,255,50);
CreateShot01(rand(40,65),5,4,90,255,50);
CreateShot01(rand(70,95),20,4,90,255,50);
CreateShot01(rand(100,125),5,4,90,255,50);
CreateShot01(rand(130,155),20,4,90,255,50);
CreateShot01(rand(160,185),5,4,90,255,50);
CreateShot01(rand(190,215),20,4,90,255,50);
CreateShot01(rand(220,245),5,4,90,255,50);
CreateShot01(rand(250,275),20,4,90,255,50);
CreateShot01(rand(280,305),5,4,90,255,50);
CreateShot01(rand(310,335),20,4,90,255,50);
CreateShot01(rand(340,365),5,4,90,255,50);
CreateShot01(rand(370,395),20,4,90,255,50);
CreateShot01(rand(400,425),5,4,90,255,50);
wait(30);
} else if (GetTimer>10){
PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,4,90,255,50);
CreateShot01(rand(40,65),5,4,90,255,50);
CreateShot01(rand(70,95),20,4,90,255,50);
CreateShot01(rand(100,125),5,4,90,255,50);
CreateShot01(rand(130,155),20,4,90,255,50);
CreateShot01(rand(160,185),5,4,90,255,50);
CreateShot01(rand(190,215),20,4,90,255,50);
CreateShot01(rand(220,245),5,4,90,255,50);
CreateShot01(rand(250,275),20,4,90,255,50);
CreateShot01(rand(280,305),5,4,90,255,50);
CreateShot01(rand(310,335),20,4,90,255,50);
CreateShot01(rand(340,365),5,4,90,255,50);
CreateShot01(rand(370,395),20,4,90,255,50);
CreateShot01(rand(400,425),5,4,90,255,50);
wait(20);
} else {
PlaySE(CSD~"sfx\thump.wav");
CreateShot01(rand(5,35),20,5,90,255,50);
CreateShot01(rand(40,65),5,5,90,255,50);
CreateShot01(rand(70,95),20,5,90,255,50);
CreateShot01(rand(100,125),5,5,90,255,50);
CreateShot01(rand(130,155),20,5,90,255,50);
CreateShot01(rand(160,185),5,5,90,255,50);
CreateShot01(rand(190,215),20,5,90,255,50);
CreateShot01(rand(220,245),5,5,90,255,50);
CreateShot01(rand(250,275),20,5,90,255,50);
CreateShot01(rand(280,305),5,5,90,255,50);
CreateShot01(rand(310,335),20,5,90,255,50);
CreateShot01(rand(340,365),5,5,90,255,50);
CreateShot01(rand(370,395),20,5,90,255,50);
CreateShot01(rand(400,425),5,5,90,255,50);
wait(15);
}
}
wait = 60;
attack = 0;
yield;
}
// wait function
function wait(w){
loop(w){yield;}
}
}
@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
SetTexture(lay);
SetGraphicRect(0,0 + b,448, 480 + b);
SetRenderState(ALPHA);
SetAlpha(135);
SetGraphicScale(1,1);
DrawGraphic(224, 240);
b++;
}
I do have an unrelated question as well though. Theoretically speaking, is there anything stopping one from having fairies/regular enemies around during a spellcard attack? I haven't started dabbling with creating such enemies yet but I think that a rad idea for a Shikieiki script would be to have entire formations of dark-clad fairies assaulting you under the Judge's all-seeing gaze. ;D
Damnit
Double damnit
My arrays weren't even the problem, t'was my silly modulus misplacement. Works perfectly now :3
I'm sure I'll be happy with simply having them fixed in place for the duration of the sequence. I've only been programming things since 3 months back (and that's only been newbie things with JavaScript in school) and I started my Danmakufu-ing two weeks ago, I'm down with realizing my own limitations. At the moment. ;)
Edit: Might there still be a way to have Shikieiki visually deploy them at the beginning of the sequence, instead of having them drawn to the background instantly?
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
into this:#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(80);
SetDamageRate(25,25);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
}
@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(50);
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}
task fire{
let n = 0;
let dxl = 0;
let dxr = 0;
let xa = (448/4)+dxl;
let xb = (448*3/4)+dxr;
//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+dxl,12*n,0,0,YELLOW01,n);
lightning(xb+dxr,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dxl,12*n,0,180,YELLOW01,n);
lightning(xb+dxr,12*n,0,180,YELLOW01,n);
}
wait(1);
dxl=rand_int(-8,8);
dxr=rand_int(-8,8);
xa+=dxl;
xb+=dxr;
n++;
}
n = 0;
dxl = 0;
dxr = 0;
xa = (448/4);
xb = (448*3/4);
}
task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
//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);
}
}
one of the following happens:#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(80);
SetDamageRate(25,25);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
SoundTask;
}
@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(50);
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}
task fire{
let n = 0;
let dxl = 0;
let dxr = 0;
let xa = (448/4)+dxl;
let xb = (448*3/4)+dxr;
//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+dxl,12*n,0,0,YELLOW01,n);
lightning(xb+dxr,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dxl,12*n,0,180,YELLOW01,n);
lightning(xb+dxr,12*n,0,180,YELLOW01,n);
}
wait(1);
dxl=rand_int(-8,8);
dxr=rand_int(-8,8);
xa+=dxl;
xb+=dxr;
n++;
}
n = 0;
dxl = 0;
dxr = 0;
xa = (448/4);
xb = (448*3/4);
}
task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
//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);
}
task SoundTask{
loop{if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;}
}
}
Try this. Your problem was that you were calling 'wait' in the Mainloop, and yield; has substantially different effects depending on whether it's called in the Mainloop or outside it. I don't have the sound files, so I can't tell, but get back to me on this if this doesn't work (I relegated your snippet to a task, SoundTask, and called it separately from Maintask)No matter where I try to stick this benign bit of code:Code: [Select]if(GetTimer <= 10 && GetTimer > 3){
into this:
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;Code: [Select]#TouhouDanmakufu
one of the following happens:
#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(80);
SetDamageRate(25,25);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
}
@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(50);
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}
task fire{
let n = 0;
let dxl = 0;
let dxr = 0;
let xa = (448/4)+dxl;
let xb = (448*3/4)+dxr;
//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+dxl,12*n,0,0,YELLOW01,n);
lightning(xb+dxr,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dxl,12*n,0,180,YELLOW01,n);
lightning(xb+dxr,12*n,0,180,YELLOW01,n);
}
wait(1);
dxl=rand_int(-8,8);
dxr=rand_int(-8,8);
xa+=dxl;
xb+=dxr;
n++;
}
n = 0;
dxl = 0;
dxr = 0;
xa = (448/4);
xb = (448*3/4);
}
task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
//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);
}
}
1) Danmakufu freezes when the timer hits 10.
2) The pattern goes berserk when the timer hits 10.
3) The entire card is rendered inert.
Where should I put the timer function?
I'm trying to add an event to a plural, but when i put it right in to one of the spells, it plays over the action. How do i make it so it goes Event starts > Event Finishes > Spell Starts as opposed to them starting at the same time.
if((GetKeyState(VK_SLOWMOVE)==KEY_PUSH||GetKeyState(VK_SLOWMOVE)==KEY_HOLD)&&focusdot<255){ focusdot+=15; }
if((GetKeyState(VK_SLOWMOVE)==KEY_PULL||GetKeyState(VK_SLOWMOVE)==KEY_FREE)&&focusdot>0){ focusdot-=15; }
SetTexture(img_dot);
SetGraphicRect(0, 0, 7, 7);
SetAlpha(focusdot);
DrawGraphic(GetPlayerX, GetPlayerY);
I have a problem with my player script.
When I focus, the dot around the hitbox is supposed to fade in quickly once you push the button and to fade away just as fast when you release it. The relevant code is:Code: [Select]if((GetKeyState(VK_SLOWMOVE)==KEY_PUSH||GetKeyState(VK_SLOWMOVE)==KEY_HOLD)&&focusdot<255){ focusdot+=15; }
if((GetKeyState(VK_SLOWMOVE)==KEY_PULL||GetKeyState(VK_SLOWMOVE)==KEY_FREE)&&focusdot>0){ focusdot-=15; }
SetTexture(img_dot);
SetGraphicRect(0, 0, 7, 7);
SetAlpha(focusdot);
DrawGraphic(GetPlayerX, GetPlayerY);
Now, the problem is: When I focus, the dot fades in as planned, but when the maximum is reached, the white center becomes transparent again. I have no idea why this is happening.
Anyone got an idea?
if((GetKeyState(VK_SLOWMOVE)==KEY_PUSH||GetKeyState(VK_SLOWMOVE)==KEY_HOLD)&&focusdot<255){ focusdot+=15; focusdot=255;}
if((GetKeyState(VK_SLOWMOVE)==KEY_PULL||GetKeyState(VK_SLOWMOVE)==KEY_FREE)&&focusdot>0){ focusdot-=15; focusdot=0;}
like that? since x (where x is the starting focusdot) isn't divisible by 15 and you add 15 when it's under 255... it probably reached something like... 255+x
task Hitbox{
let alph = 0;
let spin = rand_int(0, 359);
let spinner = 103;
let hitbox = Obj_Create(OBJ_SHOT);
Obj_SetSpeed(hitbox,0);
Obj_SetCollisionToPlayer(hitbox, false);
ObjShot_SetBombResist(hitbox, true);
ObjShot_SetGraphic(hitbox, 5);
while(!Obj_BeDeleted(hitbox)){//128, 223, 192, 287
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){
if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY+1);
}else if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY-2);
}else{
Obj_SetPosition(hitbox, GetPlayerX+1, GetPlayerY);}
}else if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){
if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY+1);
}else if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY-2);
}else{
Obj_SetPosition(hitbox, GetPlayerX-2, GetPlayerY);
}
}else if(GetKeyState(VK_DOWN)==KEY_PUSH || GetKeyState(VK_DOWN)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY+1);
}else if(GetKeyState(VK_UP)==KEY_PUSH || GetKeyState(VK_UP)==KEY_HOLD){
Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY-2);
}else{
Obj_SetPosition(hitbox, GetPlayerX, GetPlayerY);
}
}else{
Obj_Delete(hitbox);
}
if(alph<255){
alph+=15;}
spin+=spinner;
if(spinner>3){
spinner-=5;
}
if(spin>=360){
spin-=360;
}
Obj_SetAngle(hitbox, spin);
Obj_SetAlpha(hitbox, alph);
yield;
}
Obj_Delete(hitbox);
}
Oh hi, I'm your friendly neighborhood array-whore. :V
If you really want to do what Iryan was suggesting with two arrays of objects interacting with each other, I can help with that, but I can't guarantee that you'll be able to figure out what my code is doing, so I don't think that'll be so helpful for you.
Since you're deciding to do the static approach, if you want Sikieiki to look like she's deploying the at the beginning of a sequence, you can make a task that handles a sprite (or effect object if you're ambitious) at the position of Siki and changes its position every frame towards the set location till it reaches there.
task mainmenu
{
let obja=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obja, menupic);
ObjEffect_SetPrimitiveType(obja, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetLayer(obja, 8);
ObjEffect_CreateVertex(obja, 4);
ObjEffect_SetVertexUV(obja, 0, 1, 1);
ObjEffect_SetVertexUV(obja, 1, 145, 1);
ObjEffect_SetVertexUV(obja, 2, 1, 24);
ObjEffect_SetVertexUV(obja, 3, 145, 24);
ObjEffect_SetVertexXY(obja, 0, GetCenterX-150, GetCenterY+75);
ObjEffect_SetVertexXY(obja, 1, GetCenterX-4, GetCenterY+100);
ObjEffect_SetVertexXY(obja, 2, GetCenterX-150, GetCenterY+75);
ObjEffect_SetVertexXY(obja, 3, GetCenterX-4, GetCenterY+100);
let objb=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(objb, menupic);
ObjEffect_SetPrimitiveType(objb, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetLayer(objb, 8);
ObjEffect_CreateVertex(objb, 4);
ObjEffect_SetVertexUV(objb, 0, 1, 28);
ObjEffect_SetVertexUV(objb, 1, 145, 28);
ObjEffect_SetVertexUV(objb, 2, 1, 52);
ObjEffect_SetVertexUV(objb, 3, 145, 52);
ObjEffect_SetVertexXY(objb, 0, GetCenterX-150, GetCenterY+105);
ObjEffect_SetVertexXY(objb, 1, GetCenterX-4, GetCenterY+130);
ObjEffect_SetVertexXY(objb, 2, GetCenterX-150, GetCenterY+105);
ObjEffect_SetVertexXY(objb, 3, GetCenterX-4, GetCenterY+130);
let objc=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(objc, menupic);
ObjEffect_SetPrimitiveType(objc, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetLayer(objc, 8);
ObjEffect_CreateVertex(objc, 4);
ObjEffect_SetVertexUV(objc, 0, 1, 56);
ObjEffect_SetVertexUV(objc, 1, 145, 56);
ObjEffect_SetVertexUV(objc, 2, 1, 76);
ObjEffect_SetVertexUV(objc, 3, 145, 76);
ObjEffect_SetVertexXY(objc, 0, GetCenterX+4, GetCenterY+75);
ObjEffect_SetVertexXY(objc, 1, GetCenterX+150, GetCenterY+100);
ObjEffect_SetVertexXY(objc, 2, GetCenterX+4, GetCenterY+75);
ObjEffect_SetVertexXY(objc, 3, GetCenterX+150, GetCenterY+100);
let objd=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(objd, menupic);
ObjEffect_SetPrimitiveType(objd, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_SetLayer(objd, 8);
ObjEffect_CreateVertex(objd, 4);
ObjEffect_SetVertexUV(objd, 0, 1, 94);
ObjEffect_SetVertexUV(objd, 1, 145, 94);
ObjEffect_SetVertexUV(objd, 2, 1, 100);
ObjEffect_SetVertexUV(objd, 3, 145, 100);
ObjEffect_SetVertexXY(objd, 0, GetCenterX+4, GetCenterY+105);
ObjEffect_SetVertexXY(objd, 1, GetCenterX+150, GetCenterY+130);
ObjEffect_SetVertexXY(objd, 2, GetCenterX+4, GetCenterY+105);
ObjEffect_SetVertexXY(objd, 3, GetCenterX+150, GetCenterY+130);
while(Obj_BeDeleted(obja)==false)
{
yield;
}
}
ObjEffect_SetVertexXY(objb, 0, GetCenterX-150, GetCenterY+105);
ObjEffect_SetVertexXY(objb, 1, GetCenterX-4, GetCenterY+130);
ObjEffect_SetVertexXY(objb, 2, GetCenterX-150, GetCenterY+105);
ObjEffect_SetVertexXY(objb, 3, GetCenterX-4, GetCenterY+130);
That's where your problem is. You're putting vertex 0 and vertex 2 in the same place. Vertex 1 and vertex 3 are also in the same place so the image has 0 width or length.
i've got serious problems with music.
i always need to make the music i got louder so you can hear it while playing
but the programs i use to amplify the songs make certain parts sound very ugly
what can i do?
I got similar problems. I have to amplify my songs, but the new versions never play on Danmakufu. WTF?
.WAV
.WAV
[size=8].WAV[/size]
#TouhouDanmakufu
#Title[XXX]
#Text[XXX]
#BackGround[User(.\img\BG.png,0,0)]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let frame2 = 0;
let obj=Obj_Create(OBJ_SHOT);
let obj2=Obj_Create(OBJ_SHOT);
#include_function ".\Rena Draw2.txt"
@Initialize{
initalize;
SetLife(3000);
SetTimer(100);
SetMovePosition02(GetCenterX, GetCenterY, 30);
}
@MainLoop{
frame++;
yield;
if(frame>120){SetCollisionA(GetX, GetY, 32);}
if(frame>120 && frame==180 || frame==360 || frame==540){
Explode01;
Explode02;}
}@DrawLoop{renadraw;
if(frame<120){
DrawText("XXX", GetClipMinX, GetClipMinY+15, 18, 255);}
DrawText("XXX", GetClipMinX, GetClipMaxY-40, 20, 255);
}
@Finialize{
DeleteGraphic(BossImage);}
task Explode01{
let bullets = [GREEN01, PURPLE01, WHITE01, GREEN02, PURPLE02, WHITE02, GREEN05, PURPLE05, WHITE05, GREEN31, PURPLE31, WHITE31];
Obj_SetPosition(obj, GetClipMinX, GetY-60);
Obj_SetAngle(obj, 0);
Obj_SetSpeed(obj, 8);
ObjShot_SetGraphic(obj, YELLOW02);
ObjShot_SetDelay (obj, 60);
ObjShot_SetBombResist (obj, true);
while(Obj_BeDeleted(obj)==false) {
if(Obj_GetY(obj)==Obj_GetY(obj2) && Obj_GetX(obj)==Obj_GetX(obj2)){
loop(1000){
CreateShot01(Obj_GetX(obj), Obj_GetY(obj), rand(0.1,5), rand(0,360), bullets[rand_int(0,11)], 0);}
Obj_SetSpeed(obj, rand(0.1,5));
Obj_SetAngle(obj, rand(0,360));
ObjShot_SetGraphic(obj, bullets[rand_int(0,11)]);}
yield;
}//End BeDeleted
}//End Task
task Explode02{
let bullets = [GREEN01, PURPLE01, WHITE01, GREEN02, PURPLE02, WHITE02, GREEN05, PURPLE05, WHITE05, GREEN31, PURPLE31, WHITE31];
Obj_SetPosition(obj2, GetClipMaxX, GetY-60);
Obj_SetAngle(obj2, 180);
Obj_SetSpeed(obj2, 8);
ObjShot_SetGraphic(obj2, YELLOW02);
ObjShot_SetDelay (obj2, 60);
ObjShot_SetBombResist (obj2, true);
while(Obj_BeDeleted(obj2)==false) {
if(Obj_GetY(obj)==Obj_GetY(obj2) && Obj_GetX(obj)==Obj_GetX(obj2)){
Obj_SetSpeed(obj2, rand(0.1,5));
Obj_SetAngle(obj2, rand(0,360));
ObjShot_SetGraphic(obj2, bullets[rand_int(0,11)]);}
yield;
}//End BeDeleted
}//End Task
}
#include_function ".Rena Draw2.txt"
initalize;
renadraw;
...you should probably include "Rena Draw.txt"Yes, even though it won't help the shooting problem.
then there's the include_function ".\Rena Draw2.txt" line which is suppose to probably have a ; at the end...Nope
else{DrawText("XXX", GetClipMinX, GetClipMaxY-40, 20, 255);}Not if he wants the latter to always be drawn.
instead of just... DrawText("XXX", GetClipMinX, GetClipMaxY-40, 20, 255);
last thing...task are written like this... task Mytask{} ...see?That is how he wrote it.
That is how he wrote it.
One thing I did notice was that you wrote Finalize{} "Finialize{}".
I would stick that in a separate task and call it once and only once somewhere when the spellcard starts. @Initialize would be fine. Before the wait(50); in your mainTask would work too.
EDIT: Oh... I should read down farther before I answer a question. <_<
In you are using purely tasks like Helepolis's video tutorials teach you to, putting if(OnEvent){yield;} in the very beginning of you mainTask should solve your problem. If you are putting everything in the @MainLoop, put everything in your @MainLoop inside if(!OnEvent){//stuff} so that it only runs when there is no event going on.
function IntString(number){
let str = ToString(number);
let str2 = "";
let i = 0;
while (str[i] != '.')
{
str2 = str2 ~ [str[i]];
i++;
}
return(str2);
}
I've got a couple questions. What are dnh files, what can I put in them, how can I make them, and how can I properly load them into danmakufu? I've seen it done before, but now I want to get more in-depth.
...None of those worked. Ack.
I've got a couple questions. What are dnh files, what can I put in them, how can I make them, and how can I properly load them into danmakufu? I've seen it done before, but now I want to get more in-depth.
Exactly the same as .txt files. You can put whatever you want in them. You make them by saving them with ".dnh" after the name. Danmakufu will load any file that begins with #TouhouDanmakufu, they don't have to be .txt or .dnh.
They are useless, and a really poor way of preventing people from looking at your scripts, considering you open them the same way as well. I had somebody argue that they are used for "identifying Danmakufu scripts, instead of regular .txt files", but really, I don't think it matters.
Besides, if people want to hide their scripts, just use the Danmakufu archiver.
#UserShotData
ShotImage = ".\shot.png"
// Laser bases
ShotData {id = 1 rect = (0,0,16,16) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 2 rect = (16,0,32,16) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 3 rect = (32,0,48,16) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 4 rect = (48,0,64,16) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 5 rect = (64,0,80,16) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 6 rect = (80,0,96,16) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 7 rect = (96,0,112,16) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 8 rect = (112,0,128,16) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 9 rect = (128,0,144,16) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 10 rect = (144,0,160,16) render = ALPHA delay_color = (127,127,127)}
// 21
ShotData {id = 11 rect = (0,16,16,32) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 12 rect = (16,16,32,32) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 13 rect = (32,16,48,32) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 14 rect = (48,16,64,32) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 15 rect = (64,16,80,32) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 16 rect = (80,16,96,32) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 17 rect = (96,16,112,32) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 18 rect = (112,16,128,32) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 19 rect = (128,16,144,32) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 20 rect = (144,16,160,32) render = ALPHA delay_color = (127,127,127)}
// 04
ShotData {id = 21 rect = (0,32,16,48) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 22 rect = (16,32,32,48) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 23 rect = (32,32,48,48) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 24 rect = (48,32,64,48) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 25 rect = (64,32,80,48) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 26 rect = (80,32,96,48) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 27 rect = (96,32,112,48) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 28 rect = (112,32,128,48) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 29 rect = (128,32,144,48) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 30 rect = (144,32,160,48) render = ALPHA delay_color = (127,127,127)}
// 01
ShotData {id = 31 rect = (0,48,16,64) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 32 rect = (16,48,32,64) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 33 rect = (32,48,48,64) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 34 rect = (48,48,64,64) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 35 rect = (64,48,80,64) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 36 rect = (80,48,96,64) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 37 rect = (96,48,112,64) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 38 rect = (112,48,128,64) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 39 rect = (128,48,144,64) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 40 rect = (144,48,160,64) render = ALPHA delay_color = (127,127,127)}
// 12
ShotData {id = 41 rect = (3,64,13,80) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 42 rect = (19,64,29,80) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 43 rect = (35,64,45,80) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 44 rect = (51,64,61,80) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 45 rect = (67,64,77,80) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 46 rect = (83,64,93,80) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 47 rect = (99,64,109,80) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 48 rect = (115,64,125,80) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 49 rect = (131,64,141,80) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 50 rect = (147,64,157,80) render = ALPHA delay_color = (127,127,127)}
// 31
ShotData {id = 51 rect = (3,80,13,96) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 52 rect = (19,80,29,96) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 53 rect = (35,80,45,96) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 54 rect = (51,80,61,96) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 55 rect = (67,80,77,96) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 56 rect = (83,80,93,96) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 57 rect = (99,80,109,96) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 58 rect = (115,80,125,96) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 59 rect = (131,80,141,96) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 60 rect = (147,80,157,96) render = ALPHA delay_color = (127,127,127)}
// 23
ShotData {id = 61 rect = (3,96,13,112) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 62 rect = (19,96,29,112) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 63 rect = (35,96,45,112) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 64 rect = (51,96,61,112) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 65 rect = (67,96,77,112) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 66 rect = (83,96,93,112) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 67 rect = (99,96,109,112) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 68 rect = (115,96,125,112) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 69 rect = (131,96,141,112) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 70 rect = (147,96,157,112) render = ALPHA delay_color = (127,127,127)}
// Amulets
ShotData {id = 71 rect = (1,112,15,128) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 72 rect = (17,112,31,128) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 73 rect = (33,112,47,128) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 74 rect = (49,112,63,128) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 75 rect = (65,112,79,128) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 76 rect = (81,112,95,128) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 77 rect = (97,112,111,128) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 78 rect = (113,112,127,128) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 79 rect = (129,112,143,128) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 80 rect = (145,112,159,128) render = ALPHA delay_color = (127,127,127)}
// Suppositories
ShotData {id = 81 rect = (3,128,13,144) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 82 rect = (19,128,29,144) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 83 rect = (35,128,45,144) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 84 rect = (51,128,61,144) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 85 rect = (67,128,77,144) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 86 rect = (83,128,93,144) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 87 rect = (99,128,109,144) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 88 rect = (115,128,125,144) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 89 rect = (131,128,141,144) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 90 rect = (147,128,157,144) render = ALPHA delay_color = (127,127,127)}
// 12i
ShotData {id = 91 rect = (3,144,13,160) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 92 rect = (19,144,29,160) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 93 rect = (35,144,45,160) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 94 rect = (51,144,61,160) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 95 rect = (67,144,77,160) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 96 rect = (83,144,93,160) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 97 rect = (99,144,109,160) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 98 rect = (115,144,125,160) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 99 rect = (131,144,141,160) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 100 rect = (147,144,157,160) render = ALPHA delay_color = (127,127,127)}
// Marisa's small stars
ShotData {id = 101 rect = (0,160,16,176) render = ALPHA delay_color = (255,127,127) angular_velocity = 2}
ShotData {id = 102 rect = (16,160,32,176) render = ALPHA delay_color = (127,127,255) angular_velocity = 2}
ShotData {id = 103 rect = (32,160,48,176) render = ALPHA delay_color = (255,127,255) angular_velocity = 2}
ShotData {id = 104 rect = (48,160,64,176) render = ALPHA delay_color = (127,255,255) angular_velocity = 2}
ShotData {id = 105 rect = (64,160,80,176) render = ALPHA delay_color = (127,255,127) angular_velocity = 2}
ShotData {id = 106 rect = (80,160,96,176) render = ALPHA delay_color = (191,255,127) angular_velocity = 2}
ShotData {id = 107 rect = (96,160,112,176) render = ALPHA delay_color = (255,255,127) angular_velocity = 2}
ShotData {id = 108 rect = (112,160,128,176) render = ALPHA delay_color = (255,191,127) angular_velocity = 2}
ShotData {id = 109 rect = (128,160,144,176) render = ALPHA delay_color = (255,255,255) angular_velocity = 2}
ShotData {id = 110 rect = (144,160,160,176) render = ALPHA delay_color = (127,127,127) angular_velocity = 2}
// MURASA's dorplets
ShotData {id = 111 rect = (3,176,13,192) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 112 rect = (19,176,29,192) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 113 rect = (35,176,45,192) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 114 rect = (51,176,61,192) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 115 rect = (67,176,77,192) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 116 rect = (83,176,93,192) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 117 rect = (99,176,109,192) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 118 rect = (115,176,125,192) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 119 rect = (131,176,141,192) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 120 rect = (147,176,157,192) render = ALPHA delay_color = (127,127,127)}
// MoF dots
ShotData {id = 121 rect = (0,192,8,200) render = ALPHA delay_color = (255,127,127) angular_velocity = 2}
ShotData {id = 122 rect = (16,192,24,200) render = ALPHA delay_color = (127,127,255) angular_velocity = 2}
ShotData {id = 123 rect = (32,192,40,200) render = ALPHA delay_color = (255,127,255) angular_velocity = 2}
ShotData {id = 124 rect = (48,192,56,200) render = ALPHA delay_color = (127,255,255) angular_velocity = 2}
ShotData {id = 125 rect = (64,192,72,200) render = ALPHA delay_color = (127,255,127) angular_velocity = 2}
ShotData {id = 126 rect = (80,192,88,200) render = ALPHA delay_color = (191,255,127) angular_velocity = 2}
ShotData {id = 127 rect = (96,192,104,200) render = ALPHA delay_color = (255,255,127) angular_velocity = 2}
ShotData {id = 128 rect = (112,192,120,200) render = ALPHA delay_color = (255,191,127) angular_velocity = 2}
ShotData {id = 129 rect = (128,192,136,200) render = ALPHA delay_color = (255,255,255) angular_velocity = 2}
ShotData {id = 130 rect = (144,192,152,200) render = ALPHA delay_color = (127,127,127) angular_velocity = 2}
// 05
ShotData {id = 131 rect = (8,192,16,200) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 132 rect = (24,192,32,200) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 133 rect = (40,192,48,200) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 134 rect = (56,192,64,200) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 135 rect = (72,192,80,200) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 136 rect = (88,192,96,200) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 137 rect = (104,192,112,200) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 138 rect = (120,192,128,200) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 139 rect = (136,192,144,200) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 140 rect = (152,192,160,200) render = ALPHA delay_color = (127,127,127)}
// Sinuate laser bases (UFO)
ShotData {id = 141 rect = (352,256,368,512) render = ADD delay_color = (255,127,127)}
ShotData {id = 142 rect = (368,256,384,512) render = ADD delay_color = (127,127,255)}
ShotData {id = 143 rect = (384,256,400,512) render = ADD delay_color = (255,127,255)}
ShotData {id = 144 rect = (400,256,416,512) render = ADD delay_color = (127,255,255)}
ShotData {id = 145 rect = (416,256,432,512) render = ADD delay_color = (127,255,127)}
ShotData {id = 146 rect = (432,256,448,512) render = ADD delay_color = (191,255,127)}
ShotData {id = 147 rect = (448,256,464,512) render = ADD delay_color = (255,255,127)}
ShotData {id = 148 rect = (464,256,480,512) render = ADD delay_color = (255,191,127)}
ShotData {id = 149 rect = (480,256,496,512) render = ADD delay_color = (255,255,255)}
ShotData {id = 150 rect = (496,256,512,512) render = ADD delay_color = (127,127,127)}
/*------------------------*\
| Medium and large bullets |
\*------------------------*/
// Koishi's penormaku
ShotData {id = 151 rect = (0,256,32,288) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 152 rect = (32,256,64,288) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 153 rect = (64,256,96,288) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 154 rect = (96,256,128,288) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 155 rect = (128,256,160,288) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 156 rect = (160,256,192,288) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 157 rect = (192,256,224,288) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 158 rect = (224,256,256,288) render = ALPHA delay_color = (127,127,127)}
// Marisa's large stars
ShotData {id = 159 rect = (256,0,288,32) render = ALPHA delay_color = (255,127,127) angular_velocity = 2}
ShotData {id = 160 rect = (288,0,320,32) render = ALPHA delay_color = (255,127,255) angular_velocity = 2}
ShotData {id = 161 rect = (320,0,352,32) render = ALPHA delay_color = (127,127,255) angular_velocity = 2}
ShotData {id = 162 rect = (352,0,384,32) render = ALPHA delay_color = (127,255,255) angular_velocity = 2}
ShotData {id = 163 rect = (384,0,416,32) render = ALPHA delay_color = (127,255,127) angular_velocity = 2}
ShotData {id = 164 rect = (416,0,448,32) render = ALPHA delay_color = (255,255,127) angular_velocity = 2}
ShotData {id = 165 rect = (448,0,480,32) render = ALPHA delay_color = (255,255,255) angular_velocity = 2}
ShotData {id = 166 rect = (480,0,512,32) render = ALPHA delay_color = (127,127,127) angular_velocity = 2}
// 02
ShotData {id = 167 rect = (256,32,288,64) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 168 rect = (288,32,320,64) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 169 rect = (320,32,352,64) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 170 rect = (352,32,384,64) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 171 rect = (384,32,416,64) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 172 rect = (416,32,448,64) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 173 rect = (448,32,480,64) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 174 rect = (480,32,512,64) render = ALPHA delay_color = (127,127,127)}
// Yuyuko's butterflies
ShotData {id = 175 rect = (256,64,288,96) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 176 rect = (288,64,320,96) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 177 rect = (320,64,352,96) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 178 rect = (352,64,384,96) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 179 rect = (384,64,416,96) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 180 rect = (416,64,448,96) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 181 rect = (448,64,480,96) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 182 rect = (480,64,512,96) render = ALPHA delay_color = (127,127,127)}
// Sakuya's knives
ShotData {id = 183 rect = (256,96,288,128) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 184 rect = (288,96,320,128) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 185 rect = (320,96,352,128) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 186 rect = (352,96,384,128) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 187 rect = (384,96,416,128) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 188 rect = (416,96,448,128) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 189 rect = (448,96,480,128) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 190 rect = (480,96,512,128) render = ALPHA delay_color = (127,127,127)}
// Oval bullets
ShotData {id = 191 rect = (264,128,280,160) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 192 rect = (296,128,312,160) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 193 rect = (328,128,346,160) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 194 rect = (360,128,376,160) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 195 rect = (392,128,408,160) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 196 rect = (424,128,440,160) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 197 rect = (456,128,472,160) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 198 rect = (488,128,504,160) render = ALPHA delay_color = (127,127,127) }
// Flashes
ShotData {id = 199 rect = (256,160,288,192) render = ADD delay_color = (255,127,127) angular_velocity = 20}
ShotData {id = 200 rect = (288,160,320,199) render = ADD delay_color = (255,127,255) angular_velocity = 20}
ShotData {id = 201 rect = (320,160,352,192) render = ADD delay_color = (127,127,255) angular_velocity = 20}
ShotData {id = 202 rect = (352,160,384,192) render = ADD delay_color = (127,255,255) angular_velocity = 20}
ShotData {id = 203 rect = (384,160,416,192) render = ADD delay_color = (127,255,127) angular_velocity = 20}
ShotData {id = 204 rect = (416,160,448,192) render = ADD delay_color = (255,255,127) angular_velocity = 20}
ShotData {id = 205 rect = (448,160,480,192) render = ADD delay_color = (255,255,255) angular_velocity = 20}
ShotData {id = 206 rect = (480,160,512,192) render = ADD delay_color = (127,127,127) angular_velocity = 20}
// 03
ShotData {id = 207 rect = (256,192,320,256) render = ADD delay_color = (255,127,127) angular_velocity = 20}
ShotData {id = 208 rect = (320,192,384,256) render = ADD delay_color = (127,127,255) angular_velocity = 20}
ShotData {id = 209 rect = (384,192,448,256) render = ADD delay_color = (127,255,127) angular_velocity = 20}
ShotData {id = 210 rect = (448,192,512,256) render = ADD delay_color = (255,255,127) angular_velocity = 20}
/*-----------------*\
| Animating bullets |
\*------------------/
ShotData {
id = 211
render = ADD
delay_color = (255,127,127)
AnimationData {
animation_data = (4,256,256,288,288)
animation_data = (4,256,288,288,320)
animation_data = (4,256,320,288,352)
animation_data = (4,256,352,288,384)
}
}
ShotData {
id = 212
render = ADD
delay_color = (127,127,255)
AnimationData {
animation_data = (4,288,256,320,288)
animation_data = (4,288,288,320,320)
animation_data = (4,288,320,320,352)
animation_data = (4,288,352,320,384)
}
}
ShotData {
id = 213
render = ADD
delay_color = (255,127,255)
AnimationData {
animation_data = (4,320,256,352,288)
animation_data = (4,320,288,352,320)
animation_data = (4,320,320,352,352)
animation_data = (4,320,352,352,384)
}
}
ShotData {
id = 214
render = ADD
delay_color = (127,255,255)
AnimationData {
animation_data = (4,256,384,288,416)
animation_data = (4,256,416,288,48)
animation_data = (4,256,448,288,480)
animation_data = (4,256,480,288,512)
}
}
ShotData {
id = 215
render = ADD
delay_color = (255,255,127)
AnimationData {
animation_data = (4,288,384,320,416)
animation_data = (4,288,416,320,448)
animation_data = (4,288,448,320,480)
animation_data = (4,288,480,320,512)
}
}
ShotData {
id = 216
render = ADD
delay_color = (127,255,127)
AnimationData {
animation_data = (4,320,384,352,416)
animation_data = (4,320,416,352,448)
animation_data = (4,320,448,352,480)
animation_data = (4,320,480,352,512)
}
}
Might wanna post up your whole script then. It's pretty hard to solve a problem when we don't have all the details and the best way to give those details is to just tell us what you're trying to accomplish and giving us the script.
#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(80);
SetDamageRate(25,25);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
}
@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(50);
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}
task fire{
let n = 0;
let dxl = 0;
let dxr = 0;
let xa = (448/4)+dxl;
let xb = (448*3/4)+dxr;
//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+dxl,12*n,0,0,YELLOW01,n);
lightning(xb+dxr,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dxl,12*n,0,180,YELLOW01,n);
lightning(xb+dxr,12*n,0,180,YELLOW01,n);
}
wait(1);
dxl=rand_int(-8,8);
dxr=rand_int(-8,8);
xa+=dxl;
xb+=dxr;
n++;
}
n = 0;
dxl = 0;
dxr = 0;
xa = (448/4);
xb = (448*3/4);
}
task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
//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);
}
task timecheck{
loop{
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
}
}
}
task timecheck is the bit that just won't work properly. Its only purpose is to play sound effects when the timer runs down from 10. The rest of the script is actual danmaku.
...Code: [Select]#TouhouDanmakufu
task timecheck is the bit that just won't work properly. Its only purpose is to play sound effects when the timer runs down from 10. The rest of the script is actual danmaku.
#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(80);
SetDamageRate(25,25);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
}
@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(50);
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}
task fire{
let n = 0;
let dxl = 0;
let dxr = 0;
let xa = (448/4)+dxl;
let xb = (448*3/4)+dxr;
//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+dxl,12*n,0,0,YELLOW01,n);
lightning(xb+dxr,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dxl,12*n,0,180,YELLOW01,n);
lightning(xb+dxr,12*n,0,180,YELLOW01,n);
}
wait(1);
dxl=rand_int(-8,8);
dxr=rand_int(-8,8);
xa+=dxl;
xb+=dxr;
n++;
}
n = 0;
dxl = 0;
dxr = 0;
xa = (448/4);
xb = (448*3/4);
}
task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
//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);
}
task timecheck{
loop{
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
}
}
}
Problem has been magically solved by doing I-don't-know-what in the shot dataCode: [Select]#UserShotData
ShotImage = ".\shot.png"
// Laser bases
ShotData {id = 1 rect = (0,0,16,16) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 2 rect = (16,0,32,16) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 3 rect = (32,0,48,16) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 4 rect = (48,0,64,16) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 5 rect = (64,0,80,16) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 6 rect = (80,0,96,16) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 7 rect = (96,0,112,16) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 8 rect = (112,0,128,16) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 9 rect = (128,0,144,16) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 10 rect = (144,0,160,16) render = ALPHA delay_color = (127,127,127)}
// 21
ShotData {id = 11 rect = (0,16,16,32) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 12 rect = (16,16,32,32) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 13 rect = (32,16,48,32) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 14 rect = (48,16,64,32) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 15 rect = (64,16,80,32) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 16 rect = (80,16,96,32) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 17 rect = (96,16,112,32) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 18 rect = (112,16,128,32) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 19 rect = (128,16,144,32) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 20 rect = (144,16,160,32) render = ALPHA delay_color = (127,127,127)}
// 04
ShotData {id = 21 rect = (0,32,16,48) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 22 rect = (16,32,32,48) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 23 rect = (32,32,48,48) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 24 rect = (48,32,64,48) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 25 rect = (64,32,80,48) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 26 rect = (80,32,96,48) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 27 rect = (96,32,112,48) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 28 rect = (112,32,128,48) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 29 rect = (128,32,144,48) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 30 rect = (144,32,160,48) render = ALPHA delay_color = (127,127,127)}
// 01
ShotData {id = 31 rect = (0,48,16,64) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 32 rect = (16,48,32,64) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 33 rect = (32,48,48,64) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 34 rect = (48,48,64,64) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 35 rect = (64,48,80,64) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 36 rect = (80,48,96,64) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 37 rect = (96,48,112,64) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 38 rect = (112,48,128,64) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 39 rect = (128,48,144,64) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 40 rect = (144,48,160,64) render = ALPHA delay_color = (127,127,127)}
// 12
ShotData {id = 41 rect = (3,64,13,80) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 42 rect = (19,64,29,80) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 43 rect = (35,64,45,80) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 44 rect = (51,64,61,80) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 45 rect = (67,64,77,80) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 46 rect = (83,64,93,80) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 47 rect = (99,64,109,80) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 48 rect = (115,64,125,80) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 49 rect = (131,64,141,80) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 50 rect = (147,64,157,80) render = ALPHA delay_color = (127,127,127)}
// 31
ShotData {id = 51 rect = (3,80,13,96) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 52 rect = (19,80,29,96) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 53 rect = (35,80,45,96) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 54 rect = (51,80,61,96) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 55 rect = (67,80,77,96) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 56 rect = (83,80,93,96) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 57 rect = (99,80,109,96) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 58 rect = (115,80,125,96) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 59 rect = (131,80,141,96) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 60 rect = (147,80,157,96) render = ALPHA delay_color = (127,127,127)}
// 23
ShotData {id = 61 rect = (3,96,13,112) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 62 rect = (19,96,29,112) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 63 rect = (35,96,45,112) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 64 rect = (51,96,61,112) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 65 rect = (67,96,77,112) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 66 rect = (83,96,93,112) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 67 rect = (99,96,109,112) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 68 rect = (115,96,125,112) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 69 rect = (131,96,141,112) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 70 rect = (147,96,157,112) render = ALPHA delay_color = (127,127,127)}
// Amulets
ShotData {id = 71 rect = (1,112,15,128) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 72 rect = (17,112,31,128) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 73 rect = (33,112,47,128) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 74 rect = (49,112,63,128) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 75 rect = (65,112,79,128) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 76 rect = (81,112,95,128) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 77 rect = (97,112,111,128) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 78 rect = (113,112,127,128) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 79 rect = (129,112,143,128) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 80 rect = (145,112,159,128) render = ALPHA delay_color = (127,127,127)}
// Suppositories
ShotData {id = 81 rect = (3,128,13,144) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 82 rect = (19,128,29,144) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 83 rect = (35,128,45,144) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 84 rect = (51,128,61,144) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 85 rect = (67,128,77,144) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 86 rect = (83,128,93,144) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 87 rect = (99,128,109,144) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 88 rect = (115,128,125,144) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 89 rect = (131,128,141,144) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 90 rect = (147,128,157,144) render = ALPHA delay_color = (127,127,127)}
// 12i
ShotData {id = 91 rect = (3,144,13,160) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 92 rect = (19,144,29,160) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 93 rect = (35,144,45,160) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 94 rect = (51,144,61,160) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 95 rect = (67,144,77,160) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 96 rect = (83,144,93,160) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 97 rect = (99,144,109,160) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 98 rect = (115,144,125,160) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 99 rect = (131,144,141,160) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 100 rect = (147,144,157,160) render = ALPHA delay_color = (127,127,127)}
// Marisa's small stars
ShotData {id = 101 rect = (0,160,16,176) render = ALPHA delay_color = (255,127,127) angular_velocity = 2}
ShotData {id = 102 rect = (16,160,32,176) render = ALPHA delay_color = (127,127,255) angular_velocity = 2}
ShotData {id = 103 rect = (32,160,48,176) render = ALPHA delay_color = (255,127,255) angular_velocity = 2}
ShotData {id = 104 rect = (48,160,64,176) render = ALPHA delay_color = (127,255,255) angular_velocity = 2}
ShotData {id = 105 rect = (64,160,80,176) render = ALPHA delay_color = (127,255,127) angular_velocity = 2}
ShotData {id = 106 rect = (80,160,96,176) render = ALPHA delay_color = (191,255,127) angular_velocity = 2}
ShotData {id = 107 rect = (96,160,112,176) render = ALPHA delay_color = (255,255,127) angular_velocity = 2}
ShotData {id = 108 rect = (112,160,128,176) render = ALPHA delay_color = (255,191,127) angular_velocity = 2}
ShotData {id = 109 rect = (128,160,144,176) render = ALPHA delay_color = (255,255,255) angular_velocity = 2}
ShotData {id = 110 rect = (144,160,160,176) render = ALPHA delay_color = (127,127,127) angular_velocity = 2}
// MURASA's dorplets
ShotData {id = 111 rect = (3,176,13,192) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 112 rect = (19,176,29,192) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 113 rect = (35,176,45,192) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 114 rect = (51,176,61,192) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 115 rect = (67,176,77,192) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 116 rect = (83,176,93,192) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 117 rect = (99,176,109,192) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 118 rect = (115,176,125,192) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 119 rect = (131,176,141,192) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 120 rect = (147,176,157,192) render = ALPHA delay_color = (127,127,127)}
// MoF dots
ShotData {id = 121 rect = (0,192,8,200) render = ALPHA delay_color = (255,127,127) angular_velocity = 2}
ShotData {id = 122 rect = (16,192,24,200) render = ALPHA delay_color = (127,127,255) angular_velocity = 2}
ShotData {id = 123 rect = (32,192,40,200) render = ALPHA delay_color = (255,127,255) angular_velocity = 2}
ShotData {id = 124 rect = (48,192,56,200) render = ALPHA delay_color = (127,255,255) angular_velocity = 2}
ShotData {id = 125 rect = (64,192,72,200) render = ALPHA delay_color = (127,255,127) angular_velocity = 2}
ShotData {id = 126 rect = (80,192,88,200) render = ALPHA delay_color = (191,255,127) angular_velocity = 2}
ShotData {id = 127 rect = (96,192,104,200) render = ALPHA delay_color = (255,255,127) angular_velocity = 2}
ShotData {id = 128 rect = (112,192,120,200) render = ALPHA delay_color = (255,191,127) angular_velocity = 2}
ShotData {id = 129 rect = (128,192,136,200) render = ALPHA delay_color = (255,255,255) angular_velocity = 2}
ShotData {id = 130 rect = (144,192,152,200) render = ALPHA delay_color = (127,127,127) angular_velocity = 2}
// 05
ShotData {id = 131 rect = (8,192,16,200) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 132 rect = (24,192,32,200) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 133 rect = (40,192,48,200) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 134 rect = (56,192,64,200) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 135 rect = (72,192,80,200) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 136 rect = (88,192,96,200) render = ALPHA delay_color = (191,255,127)}
ShotData {id = 137 rect = (104,192,112,200) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 138 rect = (120,192,128,200) render = ALPHA delay_color = (255,191,127)}
ShotData {id = 139 rect = (136,192,144,200) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 140 rect = (152,192,160,200) render = ALPHA delay_color = (127,127,127)}
// Sinuate laser bases (UFO)
ShotData {id = 141 rect = (352,256,368,512) render = ADD delay_color = (255,127,127)}
ShotData {id = 142 rect = (368,256,384,512) render = ADD delay_color = (127,127,255)}
ShotData {id = 143 rect = (384,256,400,512) render = ADD delay_color = (255,127,255)}
ShotData {id = 144 rect = (400,256,416,512) render = ADD delay_color = (127,255,255)}
ShotData {id = 145 rect = (416,256,432,512) render = ADD delay_color = (127,255,127)}
ShotData {id = 146 rect = (432,256,448,512) render = ADD delay_color = (191,255,127)}
ShotData {id = 147 rect = (448,256,464,512) render = ADD delay_color = (255,255,127)}
ShotData {id = 148 rect = (464,256,480,512) render = ADD delay_color = (255,191,127)}
ShotData {id = 149 rect = (480,256,496,512) render = ADD delay_color = (255,255,255)}
ShotData {id = 150 rect = (496,256,512,512) render = ADD delay_color = (127,127,127)}
/*------------------------*\
| Medium and large bullets |
\*------------------------*/
// Koishi's penormaku
ShotData {id = 151 rect = (0,256,32,288) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 152 rect = (32,256,64,288) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 153 rect = (64,256,96,288) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 154 rect = (96,256,128,288) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 155 rect = (128,256,160,288) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 156 rect = (160,256,192,288) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 157 rect = (192,256,224,288) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 158 rect = (224,256,256,288) render = ALPHA delay_color = (127,127,127)}
// Marisa's large stars
ShotData {id = 159 rect = (256,0,288,32) render = ALPHA delay_color = (255,127,127) angular_velocity = 2}
ShotData {id = 160 rect = (288,0,320,32) render = ALPHA delay_color = (255,127,255) angular_velocity = 2}
ShotData {id = 161 rect = (320,0,352,32) render = ALPHA delay_color = (127,127,255) angular_velocity = 2}
ShotData {id = 162 rect = (352,0,384,32) render = ALPHA delay_color = (127,255,255) angular_velocity = 2}
ShotData {id = 163 rect = (384,0,416,32) render = ALPHA delay_color = (127,255,127) angular_velocity = 2}
ShotData {id = 164 rect = (416,0,448,32) render = ALPHA delay_color = (255,255,127) angular_velocity = 2}
ShotData {id = 165 rect = (448,0,480,32) render = ALPHA delay_color = (255,255,255) angular_velocity = 2}
ShotData {id = 166 rect = (480,0,512,32) render = ALPHA delay_color = (127,127,127) angular_velocity = 2}
// 02
ShotData {id = 167 rect = (256,32,288,64) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 168 rect = (288,32,320,64) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 169 rect = (320,32,352,64) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 170 rect = (352,32,384,64) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 171 rect = (384,32,416,64) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 172 rect = (416,32,448,64) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 173 rect = (448,32,480,64) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 174 rect = (480,32,512,64) render = ALPHA delay_color = (127,127,127)}
// Yuyuko's butterflies
ShotData {id = 175 rect = (256,64,288,96) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 176 rect = (288,64,320,96) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 177 rect = (320,64,352,96) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 178 rect = (352,64,384,96) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 179 rect = (384,64,416,96) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 180 rect = (416,64,448,96) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 181 rect = (448,64,480,96) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 182 rect = (480,64,512,96) render = ALPHA delay_color = (127,127,127)}
// Sakuya's knives
ShotData {id = 183 rect = (256,96,288,128) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 184 rect = (288,96,320,128) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 185 rect = (320,96,352,128) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 186 rect = (352,96,384,128) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 187 rect = (384,96,416,128) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 188 rect = (416,96,448,128) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 189 rect = (448,96,480,128) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 190 rect = (480,96,512,128) render = ALPHA delay_color = (127,127,127)}
// Oval bullets
ShotData {id = 191 rect = (264,128,280,160) render = ALPHA delay_color = (255,127,127)}
ShotData {id = 192 rect = (296,128,312,160) render = ALPHA delay_color = (255,127,255)}
ShotData {id = 193 rect = (328,128,346,160) render = ALPHA delay_color = (127,127,255)}
ShotData {id = 194 rect = (360,128,376,160) render = ALPHA delay_color = (127,255,255)}
ShotData {id = 195 rect = (392,128,408,160) render = ALPHA delay_color = (127,255,127)}
ShotData {id = 196 rect = (424,128,440,160) render = ALPHA delay_color = (255,255,127)}
ShotData {id = 197 rect = (456,128,472,160) render = ALPHA delay_color = (255,255,255)}
ShotData {id = 198 rect = (488,128,504,160) render = ALPHA delay_color = (127,127,127) }
// Flashes
ShotData {id = 199 rect = (256,160,288,192) render = ADD delay_color = (255,127,127) angular_velocity = 20}
ShotData {id = 200 rect = (288,160,320,199) render = ADD delay_color = (255,127,255) angular_velocity = 20}
ShotData {id = 201 rect = (320,160,352,192) render = ADD delay_color = (127,127,255) angular_velocity = 20}
ShotData {id = 202 rect = (352,160,384,192) render = ADD delay_color = (127,255,255) angular_velocity = 20}
ShotData {id = 203 rect = (384,160,416,192) render = ADD delay_color = (127,255,127) angular_velocity = 20}
ShotData {id = 204 rect = (416,160,448,192) render = ADD delay_color = (255,255,127) angular_velocity = 20}
ShotData {id = 205 rect = (448,160,480,192) render = ADD delay_color = (255,255,255) angular_velocity = 20}
ShotData {id = 206 rect = (480,160,512,192) render = ADD delay_color = (127,127,127) angular_velocity = 20}
// 03
ShotData {id = 207 rect = (256,192,320,256) render = ADD delay_color = (255,127,127) angular_velocity = 20}
ShotData {id = 208 rect = (320,192,384,256) render = ADD delay_color = (127,127,255) angular_velocity = 20}
ShotData {id = 209 rect = (384,192,448,256) render = ADD delay_color = (127,255,127) angular_velocity = 20}
ShotData {id = 210 rect = (448,192,512,256) render = ADD delay_color = (255,255,127) angular_velocity = 20}
/*-----------------*\
| Animating bullets |
\*------------------/
ShotData {
id = 211
render = ADD
delay_color = (255,127,127)
AnimationData {
animation_data = (4,256,256,288,288)
animation_data = (4,256,288,288,320)
animation_data = (4,256,320,288,352)
animation_data = (4,256,352,288,384)
}
}
ShotData {
id = 212
render = ADD
delay_color = (127,127,255)
AnimationData {
animation_data = (4,288,256,320,288)
animation_data = (4,288,288,320,320)
animation_data = (4,288,320,320,352)
animation_data = (4,288,352,320,384)
}
}
ShotData {
id = 213
render = ADD
delay_color = (255,127,255)
AnimationData {
animation_data = (4,320,256,352,288)
animation_data = (4,320,288,352,320)
animation_data = (4,320,320,352,352)
animation_data = (4,320,352,352,384)
}
}
ShotData {
id = 214
render = ADD
delay_color = (127,255,255)
AnimationData {
animation_data = (4,256,384,288,416)
animation_data = (4,256,416,288,48)
animation_data = (4,256,448,288,480)
animation_data = (4,256,480,288,512)
}
}
ShotData {
id = 215
render = ADD
delay_color = (255,255,127)
AnimationData {
animation_data = (4,288,384,320,416)
animation_data = (4,288,416,320,448)
animation_data = (4,288,448,320,480)
animation_data = (4,288,480,320,512)
}
}
ShotData {
id = 216
render = ADD
delay_color = (127,255,127)
AnimationData {
animation_data = (4,320,384,352,416)
animation_data = (4,320,416,352,448)
animation_data = (4,320,448,352,480)
animation_data = (4,320,480,352,512)
}
}
Gives me :
(http://dl.dropbox.com/u/3185156/Danmakufu%20errors/shoterror1.png)
...Code: [Select]#TouhouDanmakufu
task timecheck is the bit that just won't work properly. Its only purpose is to play sound effects when the timer runs down from 10. The rest of the script is actual danmaku.
#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(80);
SetDamageRate(25,25);
LoadGraphic(imgBoss);
shotinit;
CutIn(KOUMA,"Danmaku Upgrade "\""Alpha Shock"\","",0,0,0,0);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
}
@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(50);
loop{
fire;
wait(100);
centerbolt;
wait(100);
}
}
task fire{
let n = 0;
let dxl = 0;
let dxr = 0;
let xa = (448/4)+dxl;
let xb = (448*3/4)+dxr;
//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+dxl,12*n,0,0,YELLOW01,n);
lightning(xb+dxr,12*n,0,0,YELLOW01,n);
}else{
lightning(xa+dxl,12*n,0,180,YELLOW01,n);
lightning(xb+dxr,12*n,0,180,YELLOW01,n);
}
wait(1);
dxl=rand_int(-8,8);
dxr=rand_int(-8,8);
xa+=dxl;
xb+=dxr;
n++;
}
n = 0;
dxl = 0;
dxr = 0;
xa = (448/4);
xb = (448*3/4);
}
task centerbolt{
let n = 0;
let dx = 0;
let xc = (448/2)+dx;
//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);
}
task timecheck{
loop{
if(GetTimer <= 10 && GetTimer > 3){
PlaySE(CSD ~ "Materials/timer1.wav");
wait(60);
}
if(GetTimer <= 3){
PlaySE(CSD ~ "Materials/timer2.wav");
wait(60);
}
yield;
}
}
}
How to do CreateLaserC with Obj_Laser ? I have tried ObjSinuateLaser and AHGAHGAHGAHGAHGAHGAHGAGAHAGCreate an object bullet that creates another object bullet of the same bullet graphic and the same angle but without movement speed on top of itself every frame which fade out after a certain amount of time. Should be a close enough simulation, depending on what kinds of bullets you use. If none of the bullets have the right dimensions for what you are planning to do, let everything be object lasers instead so that you can define them yourself.
How to do CreateLaserC with Obj_Laser ? I have tried ObjSinuateLaser and AHGAHGAHGAHGAHGAHGAHGAGAHAG
task SomeSortOfCurvyLaser {
let obj = Obj_Create(OBJ_SINUATE_LASER);
Obj_SetPosition(obj, GetX, GetY);
Obj_SetAngle(obj, 0);
Obj_SetSpeed(obj, 3);
ObjShot_SetGraphic(obj, RED02);
ObjSinuateLaser_SetWidth(obj, 16);
ObjSinuateLaser_SetLength(obj, 200);
loop(60){
Obj_SetAngle(obj, Obj_GetAngle(obj)+2);
}
}
what is the danmakufu archiver, where can i get it?
Alright, new question. I'd like to know where to get this archiver, and if I can compress my scripts and everything within the folder into a single DAT file similar to the ones you find in Touhou games, with the music, sound effects, scripts, everything.
Is there a tool I could use to do it?
Yes. (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh.html)
東方弾幕風用アーカイバ v0.01c(約50kB)
Make sure you use GetCurrentScriptDirectory~ and .\ to reference all your files, the archiver randomly chooses a new base folder for no apparent reason, so absolute pathnames will brake.
what is the danmakufu archiver, where can i get it?
Right here (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh_archiver.zip), found here (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh.html).
It looks like a file compresser that can put all your scripts, images, sound effects into a single DAT file similar to the one you find in the Touhou Games.
Here's my question, how do I properly use it? Once I compress the stuff, should I just treat the parameters for the files in the DAT archive like a folder, and put the pathway as GetCurrentScriptDirectory~"datfile/mystuff.wav.png"; , or what?
Oh, and how do I uncompress it?
I personally use .dnh because it looks nice and it prevents Danmakufu from loading those scripts.
Compress everything, Danmakufu will read it all as if it was uncompressed. Don't reference things from outside the .dat file (I haven't messed with it personally, but it sounds like a bad idea. Though, the defaults like seSuperNaturalBorder2.wav or whatever should be fine). Again, just make sure you use GetCurrentScriptDirectory and .\ instead of absolute pathnames.
...I don't even see it being called
sub timer
{
if (timerframe == 0)
{
if (GetTimer > 4 && GetTimer <= 10)
{PlaySE(timeo1);}
if (GetTimer <= 4)
{PlaySE(timeo2);}
timerframe = -60;
}
timerframe++;
Actually, now that I think of it, Onthenet used a similar method in his Chen boss, let me rummage through my Danmakufu files, and.....if you don't mind Onthenet, he does this:
This is the timer code, he uses it as a sub, but a function works as well (I think):Code: [Select]sub timer
{
if (timerframe == 0)
{
if (GetTimer > 4 && GetTimer <= 10)
{PlaySE(timeo1);}
if (GetTimer <= 4)
{PlaySE(timeo2);}
timerframe = -60;
}
timerframe++;
and he calls it in his MainLoop.
After reading Blargel's beginner tutorial and watching a few videos, I still have a few unanswered questions.
1. Can I make multiple spellcards in one file?
2. Do ALL pictures in Danmakufu need to be png/bmp? (I know I can just save them as png in Photoshop, but still just wondering.)
3. Is there a specific library for all the bullets I can use? (I looked in DMKFU wiki, but I recall more bullet types. ;_;)
Sorry for the stupid questions, I've just started to get into programming (ie. Java [DON'T JUDGE ME]).
This is my first spellcard (still working on it), so it isn't very good.
http://www.shrinemaiden.org/forum/index.php?topic=30.msg202#msg202
Thanks for the help!
2. Do ALL pictures in Danmakufu need to be png/bmp? (I know I can just save them as png in Photoshop, but still just wondering.)
2) My memory slips here but I would stick to PNG and not BPM as PNG is smaller filesize. And I think JPG is ignored by dnh ( could be wrong )
Sub? What?
Merged into the Q&A thread. I don't want to delete things, others might have your same questions.
As far as I remember, Danmakufu takes most common image types including JPGs and GIFs. PNGs are preferred, however, as they aren't prone to artifacting and support semi-transparency. BMPs are a big no-no as they are huge in file size and create large downloads if you want to share the script. Although JPGs tend to have artifacts, they could be used if you don't need transparency and the quality of the texture doesn't matter for the purpose you are using it for. I haven't tried GIFs in Danmakufu, but judging from how it treats the other formats, I'd assume that you could use them instead of PNGs if you don't need partial transparency.
In short, PNGs are superior. Just use them.
Btw, CreateLaserA acts really weird(spawning all over the place and rotating like crazy)...Is it really much better to use than CreateLaser01?With CreateLaser01 everything is predetermined, fire here, at this width/length, etc.
Btw, CreateLaserA acts really weird(spawning all over the place and rotating like crazy)...Is it really much better to use than CreateLaser01?
Could someone explain object intersections?
Well, that is, assuming that I already have the right idea for it.
Like, what would I do if I wanted to have a bullet change colors when it passes a laser, for instance?
How do I cut the last place off of an array? For example, to turn [0, 1, 2, 3] into [0, 1, 2]?
Ok, when experimenting with players, I stumbled upon a problem,My bomb wont show up, http://pastebin.com/m7013265a (http://pastebin.com/m7013265a) This is the player code, The bomb doesnt want to show up.... help!
ObjEffect_SetVertexXY(obj,0,GetPlayerX-40,GetPlayerY+40);
ObjEffect_SetVertexXY(obj,1,GetPlayerX+40,GetPlayerY+40);
ObjEffect_SetVertexXY(obj,2,GetPlayerX-40,GetPlayerY-40);
ObjEffect_SetVertexXY(obj,3,GetPlayerX+40,GetPlayerY-40);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,0,256);
ObjEffect_SetVertexUV(obj,2,256,256);
ObjEffect_SetVertexUV(obj,3,256,0);
ObjSpell_SetIntersecrionLine(obj,GetPlayerX+40,GetCenterY+40,GetPlayerX-40,GetPlayerY-40,200,0,true);}
Also, muchas gracias Naut. The wiki truly is a mess. :V
script_event name{
let reimu = GetCurrentScriptDirectory ~ "img\cutins\reimu.png";
let chen2 = GetCurrentScriptDirectory ~ "img\cutins\chen.png";
@Initialize{
LoadGraphic(reimu);
LoadGraphic(chen2);
}
@MainLoop{
SetChar(LEFT, reimu); //Set the player's character on the left side, with the graphic you've told it to display.
SetGraphicRect(LEFT, 0, 0, 500, 590); //The region you're displaying of the graphic for the player character, just like SetGraphicRect.
MoveChar(LEFT, BACK); //Move the player's character into the background, to show she is not speaking.
SetChar(RIGHT, chen2); //Set the boss' picture on the right side of the screen.
SetGraphicRect(RIGHT, 0, 0, 125, 512); //Set the boundry of the picture you want displayed.
MoveChar(RIGHT, FRONT); //Move the boss' image to the front to show that she is speaking.
TextOutA("The text you want the character to speak goes here"); //Self explanatory. Danmakufu will not pass this function until a certain amount of time has passed, or the player clicks the shot button.
MoveChar(RIGHT, BACK); //Move the boss to the background, then...
MoveChar(LEFT, FRONT); //Move the player forward, to show that she will now speak.
TextOutA("More words here"); //What the player will be speaking.
End; //This ends the event.
}
@Finalize{
}
}
I want my object to have a kind of life, similar to the SetLife function for enemy scripts, that when hits zero, disappears. I also want a collision circle similar to SetCollisionA and SetCollisionB, that dissappears a player's shot it you shoot at it.
Can anyone help me with this?
script_enemy_main{
#include_function "script\script_enemy\enemymisc\EnemyControl.txt"
let r = rand(0, 100);
let a = rand(0, 360);
task Attack(Difficulty){
loop(10){yield;}
if(Difficulty==1){
loop(10){
CreateEnemyFromScript("swarm", GetX, GetY, 0, r, Difficulty);
loop(10){yield;}
}
}
if(Difficulty==2){
loop(15){
CreateEnemyFromScript("swarm", GetX, GetY, 0, r, Difficulty);
loop(7){yield;}
}
}
if(Difficulty==3){
loop(20){
CreateEnemyFromScript("swarm", GetX, GetY, 0, r, Difficulty);
loop(5){yield;}
}
}
if(Difficulty==4){
loop(20){
CreateEnemyFromScript("swarm", GetX, GetY, 0, r, Difficulty);
loop(5){yield;}
}
}
loop(150){yield;}
if(GetX<224){
SetMovePosition02(500, GetY, 240);
}
if(GetX>=224){
SetMovePosition02(-50, GetY, 240);
}
}
task Attack2(Difficulty){
if(Difficulty==1){
}
if(Difficulty==2){
loop(50){
CreateShotA(0, GetX + 50*cos(a) + rand(-5, 5), GetY + 50*sin(a) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 1.8, BLUE12);
FireShot(0);
CreateShotA(0, GetX + 50*cos(a + 2) + rand(-5, 5), GetY + 50*sin(a + 2) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 1.8, BLUE12);
FireShot(0);
a+=12;
loop(5){yield;}
}
}
if(Difficulty==3){
loop(70){
CreateShotA(0, GetX + 50*cos(a) + rand(-5, 5), GetY + 50*sin(a) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 2, BLUE12);
FireShot(0);
CreateShotA(0, GetX + 50*cos(a + 2) + rand(-5, 5), GetY + 50*sin(a + 2) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 2, BLUE12);
FireShot(0);
a+=10;
loop(4){yield;}
}
}
if(Difficulty==4){
loop(140){
CreateShotA(0, GetX + 50*cos(a) + rand(-5, 5), GetY + 50*sin(a) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 2.5, BLUE12);
FireShot(0);
CreateShotA(0, GetX + 50*cos(a + 2) + rand(-5, 5), GetY + 50*sin(a + 2) + rand(-5, 5), 10);
SetShotDataA(0, 0, 7, a + rand_int(-20, 20), 0, -0.5, 2.5, BLUE12);
FireShot(0);
a+=5;
loop(2){yield;}
}
}
}
@Initialize{
SetInvincibility(10);
SetMovePosition03(GetX, 150, 10, 3);
SetLife(130);
Attack(GetArgument);
Attack2(GetArgument);
}
@MainLoop{
DeathCheck;
SetCommonData(ToString(r), [GetX, GetY]); //Set coordinates for the familiar to get.
SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 4);
yield;
}
@DrawLoop{
DrawBigEnemy;
}
@Finalize{
DeadEnemy(GetX, GetY, 5, 0, 5, 50); //x, y, points, power, IE, dispersion radius.
}
}
script_enemy swarm{
#include_function "script\script_enemy\enemymisc\EnemyControl.txt"
let a = rand(0, 360);
let radius = 0;
let xvar = rand(0, 90);
let yvar = rand(0, 90);
let maxrad = rand_int(50, 100);
let Difficulty = GetArgument;
let frames = rand_int(2, 30);
let gg = GetAngle;
task Attack{
if(Difficulty==1){
loop(frames){yield;}
loop{
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran + 1, RED12, 0);
loop(80){yield;}
}
}
if(Difficulty==2){
loop(frames){yield;}
loop{
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran + 1, RED12, 0);
loop(60){yield;}
}
}
if(Difficulty==3){
loop(frames){yield;}
loop{
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran + 1, RED12, 0);
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2, GetAngleToPlayer + ran + 1, RED12, 0);
loop(50){yield;}
}
}
if(Difficulty==4){
loop(frames){yield;}
loop{
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran + 1, RED12, 0);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran - 1, RED12, 0);
let ran = rand(-90, 90);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran, RED12, 0);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran + 1, RED12, 0);
CreateShot01(GetX, GetY, 2.2, GetAngleToPlayer + ran - 1, RED12, 0);
loop(40){yield;}
}
}
}
@Initialize{
SetLife(10);
SetDamageRateEx(100, 100, 10, 10);
Attack;
}
@MainLoop{
SetCollisionA(GetX, GetY, 16);
SetCollisionB(GetX, GetY, 4);
DeathCheck;
SetX(GetCommonDataDefault(ToString(gg), [-2000, -2000])[0] + radius*cos(a + xvar));
SetY(GetCommonDataDefault(ToString(gg), [-2000, -2000])[1] + radius*sin(a + yvar));
if(radius<maxrad){
radius++;
}
a+=3;
yield;
}
@DrawLoop{
DrawSmallGreenEnemy;
}
@Finalize{
DeadEnemy(GetX, GetY, 1, 0, 0, 10); //x, y, points, power, IE, dispersion radius.
}
}
Ahh, you were close.
DrawText("History: " ~ caprate ~ "/" ~ seerate, GetClipMinX+10, GetClipMinY+100, 12, 255);
Use tilde to combine strings.
You need to make arrays of all your objects, and test if they are colliding every frame. Once they are colliding, use a counter to make sure that the next frame the action isn't performed again (for example, if you were reflecting bullets, sometimes the bullet will collide two frames in a row, and screw up the reflection).
Something like this, where you put every object bullet or laser inside an array (array = array ~ [obj]; )...
*code*
#TouhouDanmakufu
#Title[Spell Template]
#Text[Description]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
///
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
///
let sprite = "script\img\ExRumia.png";
let Cutin = "";
let fr1 = 0;
let fr2 = 0;
let ang = 0;
let array = [];
//////////
@Initialize{
shotinit;
LoadGraphic(sprite);
SetLife(5000);
SetDamageRate(100, 100);
SetTimer(50);
SetInvincibility(30);
CutIn(YOUMU, "X Sign "\""X"\", Cutin, 0, 0, 0, 0);
SetScore(500000);
SetEnemyMarker(true);
Concentration01(60);
MagicCircle(true);
SetEffectForZeroLife(180, 100, 1);
SetMovePosition02(GetCenterX, GetCenterY - 100, 30);
}
//////////
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
fr1++;
fr2++;
if(fr1==30){
laser;
}
if(fr2==30){
shot;
fr2 = 0;
}
yield;
}
//////////
@DrawLoop{
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(sprite);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(sprite);
}
//////////
task shot{
let counter = 0;
let o1 = Obj_Create(OBJ_SHOT);
Obj_SetPosition (o1, GetX, GetY);
Obj_SetAngle (o1, GetAngleToPlayer);
Obj_SetSpeed (o1, 1);
ObjShot_SetGraphic (o1, RED01);
ObjShot_SetDelay (o1, 5);
ObjShot_SetBombResist (o1, false);
Obj_SetCollisionToObject (o1, true);
while(!Obj_BeDeleted(o1) ){
ascent(j in 0..(length (array) -1) ){
if(Collision_Obj_Obj (o1, array[j])==true && counter==0){
ObjShot_SetGraphic(o1, BLUE01);
counter++;
}
}
yield;
}
array = array ~ [o1];
}
/////
task laser{
let o2 = Obj_Create(OBJ_LASER);
Obj_SetPosition (o2, GetClipMinX, GetCenterY);
Obj_SetAngle (o2, 0);
Obj_SetSpeed (o2, 3);
ObjShot_SetGraphic (o2, RED01);
ObjShot_SetDelay (o2, 10);
ObjLaser_SetLength (o2, 400);
ObjLaser_SetWidth (o2, 30);
Obj_SetCollisionToObject (o2, true);
array = array ~ [o2];
}
/////
}
let r = rand(0, 100);
Took a quick look, but didn't copypaste and test the script. I spotted a few errors that might be causing the delay before the color changing happens:
1.) ascent(j in 0..(length (array) -1) ){ should really just be ascent(j in 0..length(array)){
Remember that ascents stop one number before the defined upper bound, which is just perfect for array handling.
2.) You shouldn't really be adding the shot ids to the array at the very end. It doesn't serve any purpose that I can see and it just eats up memory (although very slowly).
3.) You actually don't need an array at all if you're only going to have one laser. As you may have noticed if you followed what I said in the #2, you'll only be storing one value, a laser object id, in the array. Arrays are for storing multiple values so it's fairly redundant in this case. Instead, you can declare let o2; at the very top and put o2 = Obj_Create(blahblah); in the laser creation task. Then, when you check for collision in the shot task, you can just compare if o1 is colliding with o2. Of course, if you later plan to add more lasers, go ahead and leave the array in there.
rand(0, 100); has a one in one hundred million chance of producing the same number twice in a row.
You're probably thinking of rand_int(0, 100);
But yes, your idea would've guaranteed no duplicates. Honestly, I was just tired of dealing with CommonData so I settled on random numbers without thinking about it... Making a full game is so CommonData heavy that I'm sick of it now. And I've barely skimmed the surface. </minor rant>
Yeah, you're right, I was thinging rand_int.
Sounds like you're really using the hell out of Common Data ...
Config.exe is pissing me off. No matter what type of compatiblity I use or any setting in Applocal, it refuses to show up. Though it is visible inside taskmanager as a running task.
What the hell, I want to adjust options so dnh runs smoother on my laptop. Currently the fps is like 30-40 =.=
#TouhouDanmakufu
#Title[Tomoko Familiar 1]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let shot1=0;
let bullet1=[];
let angle=0;
let bounce=0;
let radius=0;
let speed=1;
let bullets=15;
let rotatespeed=0;
let random=rand_int(0,1);
if(random==0){ rotatespeed=0.3; }
if(random==1){ rotatespeed=-0.3; }
let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;
@Initialize{
SetLife(1);
MagicCircle(false);
SetAngle(rand(0,360));
SetSpeed(speed);
}
@MainLoop{
if(time==0){
let color=rand_int(61,70);
loop(bullets){
shot1=(Obj_Create(OBJ_SHOT));
Obj_SetPosition(shot1,GetX+radius*cos(angle),GetY+radius*sin(angle));
Obj_SetAngle(shot1,angle+360/20);
Obj_SetAutoDelete(shot1,false);
ObjShot_SetBombResist(shot1,true);
ObjShot_SetGraphic(shot1,color);
angle+=360/bullets;
bullet1=bullet1~[shot1];
}
}
let i=0;
while (i<length(bullet1)){
Obj_SetPosition(bullet1[i],GetX+radius*cos(angle),GetY+radius*sin(angle));
Obj_SetAngle(bullet1[i],angle+360/bullets);
angle+=360/bullets;
i++;
}
angle+=rotatespeed;
if(bounce<3){
if(GetX<=minx){ SetAngle(180-GetAngle); SetX(GetX+1); SetSpeed(speed); bounce+=1; }
if(GetX>=maxx){ SetAngle(180-GetAngle); SetX(GetX-1); SetSpeed(speed); bounce+=1; }
if(GetY<=miny){ SetAngle(-GetAngle); SetY(GetY+1); SetSpeed(speed); bounce+=1; }
if(GetY>=maxy){ SetAngle(-GetAngle); SetY(GetY-1); SetSpeed(speed); bounce+=1; }
}
if(GetX<=minx-300 || GetX>=maxx+300 || GetY<=miny-300 || GetY>=maxy+300){
let i=0;
while (i<length(bullet1)){
Obj_Delete(bullet1[i]);
i++
}
VanishEnemy;
}
if(radius<150){ radius+=0.2; }
time++;
frame++;
}
@DrawLoop{
}
@Finalize{
}
}
Guys, I'm trying to make some stuff with object bullets:
It goes like this: The enemy shoots familiars that have all sorts of shapes on them. The shapes rotate and grow over time and bounce with their core around the screen a few times before vanishing offscreen.
So far I managed to make this with a circle. But making anything else I want (triangles, squares, stars, two triangles on top of each other, etc), is breaking my mind!
I couldn't get further than making a framework with a bullet for each edge, but the lining in between those points is giving me a headache.
I tried using Pythagoras' nice equation, but combining that with the motion and rotation of the shapes just won't work.
Can you help me with this? I'm probably doing it completely wrong if I get two pages of text just to make 1 star... >_>;
let number_of_bullets = 9; // Number of bullets on the line
// First point
let x1 = first_x_position;
let y1 = first_y_position;
// Second point
let x2 = second_x_position;
let y2 = second_y_position;
// Loop counter from 0 to number_of_bullets (count up by 1 each time)
for (counter = 0 to number_of_bullets)
{
let position_fraction = counter / number_of_bullets;
// calculate next bullet's position
let x = (x1 * position_fraction) + (x2 * (1 - position_fraction));
let y = (y1 * position_fraction) + (y2 * (1 - position_fraction));
// create the next bullet
Create_Bullet(x, y, ...);
}
Yeah, no tasks. 8)
#TouhouDanmakufu[Stage]
#Title[I don't know why it's crashing.]
#Text[It just crashes.]
//Background[IceMountain]
#PlayLevel[Wut]
#BGM[]
#Player[FREE]
#ScriptVersion[2]
script_stage_main{
let GCSD = GetCurrentScriptDirectory;
function Wait(let frames){
loop(frames){yield;}
}
function WaitForZeroEnemy{
while(GetEnemyNum != 0){yield;}
}
function WaitForNoEvent {
while(OnEvent) { yield; }
}
task stage6 {
Wait(1);
CreateEnemyBossFromFile(GCSD~"theattack.txt", GetCenterX, GetClipMinY-50, 0, 0, 0);
Wait(360);
Clear;
}
@Initialize{
stage6;
LoadGraphic(EFamiliar);
}
@MainLoop{
yield;
}
let EFamiliar = GCSD~"img\enemy_option.png";
let rotateoptioncircle = 0; let rotateoptioncirclea = 0;
@Background{
rotateoptioncircle -= rotateoptioncirclea; rotateoptioncirclea+=1/4;
if(rotateoptioncircle >= 360) { rotateoptioncircle -= 360; } if(rotateoptioncirclea >= 360) { rotateoptioncirclea -= 360; }
SetTexture(EFamiliar);
SetGraphicRect(0,0,75,75);
SetGraphicAngle(0, 0, rotateoptioncircle);
SetGraphicScale(5, 5);
SetRenderState(ALPHA);
SetAlpha(255);
SetColor(255, 255, 255);
DrawGraphic(GetCenterX, GetCenterY);
}
@Finalize{
LoadGraphic(EFamiliar);
}
}
#TouhouDanmakufu
#Title[Works here, though.]
#Text[]
#Image[]
#BackGround[IceMountain]
#Player[FREE]
#ScriptVersion[2]
//Don't worry about having the images.
script_enemy_main {
let BossImage = "script\img\ExRumia.png";
let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
let CutInGraphic = GetCurrentScriptDirectory~"img\cut.png";
let bossname = "????????? ?? ?????";
let Spell = 1;
let SpellName = "「???」";
@Initialize {
SetLife(500000); SetDamageRate(0, 0); SetTimer(68);
SetEnemyMarker(true); MagicCircle(true); SetInvincibility(180);
LoadGraphic(BossImage); LoadGraphic(EFamiliar);
TMain;
SetInvincibility(480);
SetEffectForZeroLife(60, 55, 3); //LastSpell;
SetShotAutoDeleteClip(10, 10, 10, 10);
}
@MainLoop {
if(GetTimer > 0) { SetLife(630); }
SetCommonData("StuffLife", GetEnemyLife);
SetCommonData("StuffTime", GetTimer);
if(Spell <= 1) {
if(show) { ascent(i in 0..7) { SetCollisionA(GetPlayerX+50*cos(i*360/7), GetPlayerY+50*sin(i*360/7), 10); } }
}
yield;
}
let animation = 0;
let rotate = 0; let rotatea = 0;
let alpha = 0;
let x = 0;
let count = 0;
let show = 0;
@DrawLoop {
if(!show){
if(count<270) {
count++;
if(x<=20) { x+=1/6; }
if(alpha < 255) { alpha+=255/120; }
if(count==210) { alpha=255; } if(count>210) { x+=1/4; alpha-=255/60; }
SetFontColor(255, 255, 255, 0, 0, 155);
DrawText("Blue text! THIS IS A COPY", GetCenterX-100+x, GetCenterY+150-10, 15, alpha);
SetFontColor(255, 255, 255, 155, 0, 155);
DrawText("Purple text! OF YUYUKO", GetCenterX-100-x, GetCenterY+150+10, 10, alpha);
}
}
SetFontColor(255, 255, 255, 0, 0, 155);
DrawText(bossname, 40, 36, 12, 255);
}
@Finalize {
PlaySE("se\se_enep01.wav");
DeleteCommonData("StuffLife");
DeleteCommonData("StuffTime");
SetShotAutoDeleteClip(200, 200, 200, 200);
SetShotColor(255, 255, 255);
DeleteGraphic(BossImage); DeleteGraphic(EFamiliar);
}
task TMain {
suika;
SetMovePosition02(GetCenterX, GetCenterY, 1);
loop(120){yield;}
loop(4) { Concentration02(45); PlaySE("se\se_ch00.wav"); loop(30){yield;} } Concentration02(90); PlaySE("se\se_ch00.wav"); loop(45){yield;}
show = 1;
SetText(SpellName); SetScore(10000000); //SetDurableSpellCard;
loop(30) { yield; }
loop(150) { yield; }
PlaySE("se\se_option.wav"); ascent(i in 0..6) { CreateEnemyFromScript("one", GetX, GetY, 0, 0, i*360/6); }
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>50) { yield; } attack1;
while(GetCommonData("StuffLife")>300 && GetCommonData("StuffTime")>40) { yield; } SetDamageRate(9, 3); attack2;
}
task suika {
task CreateShotR(x, y, delay) {
let obj = Obj_Create(OBJ_SHOT); let c = -delay;
Obj_SetPosition(obj, x, y);
ObjShot_SetGraphic(obj, BLUE05);
ObjShot_SetDelay(obj, delay);
ObjShot_SetBombResist(obj, 1);
Obj_SetCollisionToPlayer(obj, 0);
while(!Obj_BeDeleted(obj)) {
Obj_SetY(obj, Obj_GetY(obj)-2);
c++; if(c==0) { Obj_Delete(obj); }
yield;
}
}
loop {
loop(10) { CreateShotR(GetX+rand(-15, 15), GetY+rand(-10, 30), rand_int(15, 25)); }
loop(5) { yield; }
}
}
task attack1 {
let graphic = [BLUE03, BLUE02, BLUE01, BLUE04, BLUE05];
let num = 3; let a = GetAngleToPlayer;
loop {
a = GetAngleToPlayer;
ascent(i in 0..num) {
PlaySE("se\se_lazer01.wav");
CreateShot01(GetX, GetY, 5, a+i*360/num, graphic[0], 10);
loop(30) { CreateShot01(GetX, GetY, rand(4, 5), a+i*360/num+rand(-2, 2), graphic[1], 10); }
loop(60) { CreateShot01(GetX, GetY, rand(3, 5), a+i*360/num+rand(-3, 3), graphic[2], 10); }
loop(25) { CreateShot01(GetX, GetY, rand(1, 5), a+i*360/num+rand(-3, 3), graphic[3], 10); }
loop(70) { CreateShot01(GetX, GetY, rand(1, 5), a+i*360/num+rand(-7, 7), graphic[4], 10); }
}
loop(60) { yield; }
}
}
task attack2 {
loop {
ascent(i in -17..18) { ascent(j in 0..6) { CreateShot01(GetX, GetY, 1/3, GetAngleToPlayer+i*1+j*360/6, RED02, 0); PlaySE("se\se_tan02.wav"); } }
loop(180) { yield; }
}
}
}
script_enemy one {
let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
@Initialize {
SetLife(9999);
TMain;
//LoadGraphic(EFamiliar);
}
@MainLoop {
SetLife(9999);
SetMovePosition02(GetCenterX+radius*cos(a), GetCenterY+radius*sin(a), 1);
yield;
}
let rotate = 0;
@DrawLoop {
rotate += 7; if(rotate >= 360) { rotate -= 360; }
SetTexture(EFamiliar);
SetGraphicRect(0,0,75,75);
SetGraphicAngle(0, 0, rotate);
SetGraphicScale(1, 1);
SetRenderState(ADD);
SetAlpha(255);
SetColor(255, 255, 255);
DrawGraphic(GetX, GetY);
}
@Finalize {
SetShotColor(255, 255, 255);
//DeleteGraphic(EFamiliar);
}
let radius = 0; let a = GetArgumentDefault(0); let delay = 3;
task TMain {
radiusinc;
ainc;
unr;
atak1;
while(GetCommonData("StuffLife")>100 && GetCommonData("StuffTime")>10) { yield; }
PlaySE("se\se_option.wav"); CreateEnemyFromScript("two", GetPlayerX, GetPlayerY, 0, 0, GetArgument);
}
task radiusinc {
while(radius<225) {
radius+=2;
yield;
}
loop {
CreateShot01(GetX, GetY, 4, a, BLUE22, 0); PlaySE("se\se_kira01.wav");
loop(delay) { yield; }
}
}
let spin = 0.75;
task ainc {
loop {
a+=spin; if(a>=360) { a-=360; }
yield;
}
}
task unr {
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>30) { yield; }
while(radius > 150) { radius-=1/4; yield; }
spin = 5.5; delay = 1;
}
task atak1 {
while(GetCommonData("StuffLife")>200 && GetCommonData("StuffTime")>20) { yield; }
loop {
CreateShot01(GetX, GetY, 2, GetAngleToPlayer, RED03, 0); PlaySE("se\se_tan02.wav");
loop(240) { yield; }
}
}
}
script_enemy two {
let EFamiliar = GetCurrentScriptDirectory~"img\enemy_option.png";
@Initialize {
SetLife(9999);
TMain;
//LoadGraphic(EFamiliar);
}
@MainLoop {
SetLife(9999);
SetMovePosition02(GetPlayerX+radius*cos(a), GetPlayerY+radius*sin(a), 1);
yield;
}
let rotate = 0;
@DrawLoop {
rotate += 7; if(rotate >= 360) { rotate -= 360; }
SetTexture(EFamiliar);
SetGraphicRect(0,0,75,75);
SetGraphicAngle(0, 0, rotate);
SetGraphicScale(1, 1);
SetRenderState(SUBTRACT);
SetAlpha(255);
SetColor(255, 255, 255);
DrawGraphic(GetX, GetY);
}
@Finalize {
SetShotColor(255, 255, 255);
//DeleteGraphic(EFamiliar);
}
let radius = 0; let a = GetArgumentDefault(0);
task TMain {
ainc;
unr;
}
let spin = 5.5;
task ainc {
loop {
a-=spin; if(a>=360) { a-=360; }
yield;
}
}
task unr {
while(GetCommonData("StuffLife")>400 && GetCommonData("StuffTime")>20) { yield; }
while(radius < 100) { radius+=1; yield; }
atak1;
}
task atak1 {
while(GetCommonData("StuffLife")>100 && GetCommonData("StuffTime")>20) { yield; }
loop {
ascent(i in -5..6) { CreateShot01(GetX, GetY, 3/4, a+i*30, RED22, 0); } PlaySE("se\se_tan02.wav");
loop(240) { yield; }
}
}
}
Does it have to do with the familiars spawning familiars?
Ahh, you were close.DrawText("Seconds:" ~ frame/60 ~ "frame" ~ time, GetClipMinX,GetClipMinY+60,20,255);
DrawText("History: " ~ caprate ~ "/" ~ seerate, GetClipMinX+10, GetClipMinY+100, 12, 255);
Use tilde to combine strings.
DrawText("Seconds:" ~ frame/60 ~ "frame" ~ time, GetClipMinX,GetClipMinY+60,20,255);
I do not see what I am doing wrong...
I get an error at this message, its in my post at the Error Message Thread
So...i guess my question is: can someone explain to me how to get the CtC bullets? (lolnubquestion) i don't even know if people are allowed to ask for them, so sorry if it is >.<
Also, thanks in advance~
CreateShotA(1,GetEnemyX,GetEnemyY,10);
SetShotDataA_XY(1,0,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01); <--- fountain
SetShotDataA(1,60,0,NULL,0,0,0,RED01); <--- halt + maintain angle
SetShotDataA_XY(1,90,5*cos(rand(240,270)),5*sin(rand(240,270)),0,0.1,0,rand_int(2,3),RED01); <---- FFF cannot maintain angles here cause you cannot store it. Also this makes bullets 'rejump' making it look bad.
Thus Naut adviced me to use Object Bullets because you can get angle to perform calculation. Though yea, he he he--- How? Can someone explain me a bit step by step how create an arching Object Bullet:
(http://i49.tinypic.com/jaucjm.png)
task whatever
{
let ac = *y-acceleration*;
let xv = 5*cos(rand(240,270));
let yv = 5*sin(rand(240,270)); //x,y velocity
let obj=Obj_Create(OBJ_SHOT);
//set you object angle/speed/graphic to whatever
loop(*frames you want the bullet to move for before halting*)
{
//The first thing to do is to relocate the bullet according to its velocity
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
//Then you change the y-velocity according to the acceleration
yv += ac;
yield;
}
loop(*Length of frames the bullet halts*)
{yield;}
//Then just let the bullet fall until it is deleted
while(!Obj_BeDeleted(obj))
{
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
yv += ac;
yield;
}
Iryan once helped me out with a code to create a fountain effect effect for my afro boss.Hi there. :V
Code: [Select]task whatever{
let flyangle=rand(240,270);
let ac = *y-acceleration*;
let xv = 5*cos(flyangle);
let yv = 5*sin(flyangle); //x,y velocity
let obj=Obj_Create(OBJ_SHOT);
//set you object angle/graphic to whatever, but the speed to zero
loop(*frames you want the bullet to move for before halting*) {
//The first thing to do is to relocate the bullet according to its velocity
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
//Then you change the y-velocity according to the acceleration
yv += ac;
yield;
}
loop(*Length of frames the bullet halts*) {yield;}
//Then just let the bullet fall until it is deleted
while(!Obj_BeDeleted(obj)){
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
yv += ac;
yield;
}
Ok, so i"ve made this spellcard and stuff.Does it crash upon loading the stage or whenever you try to spawn the boss?
So when I tried it out this, it crashes.Code: (Bleh. it just crashes, no script error or anything.) [Select]#TouhouDanmakufu[Stage]
<snip>
@Finalize{
LoadGraphic(EFamiliar);
}Code: (theattack.txt) [Select]#TouhouDanmakufu
#Title[Works here, though.]
#Text[]
#Image[]
#BackGround[IceMountain]
#Player[FREE]
#ScriptVersion[2]
<snip>
task sproeibullet(x,y,kleur,delay){
let obj=Obj_Create(OBJ_SHOT);
let flyangle=rand(240,270);
let ac = 0.1;
let xv = 5*cos(flyangle);
let yv = 5*sin(flyangle); //x,y velocity
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,0);
ObjShot_SetGraphic(obj,kleur);
ObjShot_SetDelay(obj,delay);
loop(60){
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
yv += ac;
yield;
}
loop(60){yield;}
while(!Obj_BeDeleted(obj)){
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
Obj_SetAngle(obj,flyangle);
yv += ac;
yield;
}
}
Obj_SetAngle() and to the rescue!
However, the bullets are like falling sideways ( if I use pellets or ovals ). How can I make the bullet angle cooperate as well ?
task sproeibullet(x,y,kleur,delay){
let obj=Obj_Create(OBJ_SHOT);
let flyangle=rand(240,270);
let ac = 0.1;
let xv = 5*cos(flyangle);
let yv = 5*sin(flyangle); //x,y velocity
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,0);
ObjShot_SetGraphic(obj,kleur);
ObjShot_SetDelay(obj,delay);
loop(60){
yv += ac;
Obj_SetAngle(obj, 180+ atan(yv/xv)); //This one line here!
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
yield;
}
loop(60){yield;}
while(!Obj_BeDeleted(obj)){
Obj_SetPosition(obj, Obj_GetX(obj)+xv, Obj_GetY(obj)+yv);
Obj_SetAngle(obj, 180+ atan(yv/xv)); //This same line here!
yv += ac;
yield;
}
}
I tested this very code using RED32s, and it looked fine to me.
whenever you try to spawn the boss
?? Did I understood it all correctly, teacher ??Correct! 8)
This.I can assume you did test the #Background issue, yes? Other than that, I cannot spot anything that might be causing the crashes right now. Nothing I understand, at least. :V
the #Background issueThanks! I can't believe #BackGround was causing all this... ~_~
This question has probably been asked and answered before but i cnat seem to find anything on it. Im running windows vista and i have applocale and i jsut downloaded danmakufu. now i had it a relaly long time ago on this computer and it worked fine with applocale but now since i've just downloaded it again, i had deleted the previous version a while ago, when it opens up i jsut get the application window open then it says th_dnh.exe (the program) has stopped working. My options are clsoe the program, or check online for a solution and clsoe the program. Is there any way to fix this?For some reason, the program refuses to run on Windows 7 unless you right-click the link to Danmakufu and select "Run as Administrator". I'm positive this will work for you, too.
let shotCount = -1;
let bNextShot = false;
let optionx = 0;
let optiony = 0;
let optionx2 = 0;
let optiony2 = 0;
let optionx3 = 0;
let optiony3 = 0;
let optionx4 = 0;
let optiony4 = 0;
let oang = 115;
let oang2 = 65;
let oang3 = 155;
let oang4 = 25;
let ooffset = 39;
let angle = 270;
let rot = 0;
let IsShooting = false;
task Laser(x, y, angle, power, l, w, g, a, s, loc)
{
let maxTraverse = 5;
let rev = false;
let Time = 0;
let Fall = Obj_Create(OBJ_SINUATE_LASER);
ObjShot_SetDamage(Fall, power);
Obj_SetPosition(Fall, x, y);
ObjShot_SetPenetration(Fall, 1000000);
ObjShot_SetGraphic(Fall, g);
Obj_SetSpeed(Fall, s);
Obj_SetAngle(Fall, angle);
Obj_SetAlpha(Fall, a);
ObjSinuateLaser_SetWidth(Fall, w);
ObjSinuateLaser_SetLength(Fall, l);
while(!Obj_BeDeleted(Fall))
{
ObjSinuateLaser_SetLength(Fall, l);
if(Time >= 5)
{
Obj_SetAngle(Fall, angle);
let dir;
dir = atan2(GetEnemyY - Obj_GetY(Fall), GetEnemyX - Obj_GetX(Fall));
// difference between 'dir' and 'angle'
let diff = dir - angle;
while(diff >= 180) { diff -= 360; } // adjust the range
while(diff < -180) { diff += 360; }
let diffAbs = (|diff|);
if(diffAbs < maxTraverse)
{
// if the difference is small,
// the bullet turns to the enemy
angle = dir;
}
else
{
// otherwise, the bullet turns 'maxTraverse' degrees
if(loc == "left")
{
angle += (|maxTraverse * diff / diffAbs|);
}
else
{
angle -= (|maxTraverse * diff / diffAbs|);
}
}
if(Time >= 10 && maxTraverse < 25)
{
maxTraverse++;
}
}
if(GetKeyState(VK_SHOT) == KEY_HOLD)
{
l+=10;
}
if((Obj_GetX(Fall) >= GetEnemyX-10 && Obj_GetX(Fall) <= GetEnemyX+10 && Obj_GetY(Fall) >= GetEnemyY-10 && Obj_GetY(Fall) <= GetEnemyY+10) && GetEnemyNum >= 1)
{
l-=10;
Obj_SetSpeed(Fall, 0);
}
else
{
Obj_SetSpeed(Fall, s);
}
Time++;
yield;
}
}
@MainLoop
{
rot += 5;
optionx = GetPlayerX+ooffset*cos(oang);
optiony = GetPlayerY+ooffset*sin(oang);
optionx2 = GetPlayerX+ooffset*cos(oang2);
optiony2 = GetPlayerY+ooffset*sin(oang2);
optionx3 = GetPlayerX+ooffset*cos(oang3);
optiony3 = GetPlayerY+ooffset*sin(oang3);
optionx4 = GetPlayerX+ooffset*cos(oang4);
optiony4 = GetPlayerY+ooffset*sin(oang4);
if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD) && shotCount==-1)
{
shotCount = 0;
bNextShot = false;
}
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
{
if(ooffset > 21)
{
ooffset-=3;
}
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && !IsShooting)
{
Laser(optionx, optiony, 90, 4.0, 10, 15, 12, 190, 8, "left");
Laser(optionx2, optiony2, 90, 4.0, 10, 15, 12, 190, 8, "right");
Laser(optionx3, optiony3, 105, 4.0, 10, 15, 12, 190, 8, "left");
Laser(optionx4, optiony4, 75, 4.0, 10, 15, 12, 190, 8, "right");
IsShooting = true;
}
}
else
{
if(ooffset < 39)
{
ooffset+=3;
}
if((GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD) && !IsShooting)
{
Laser(optionx, optiony, 90, 2.0, 10, 15, 12, 190, 8, "left");
Laser(optionx2, optiony2, 90, 2.0, 10, 15, 12, 190, 8, "right");
Laser(optionx3, optiony3, 90, 2.0, 10, 15, 12, 190, 8, "left");
Laser(optionx4, optiony4, 90, 2.0, 10, 15, 12, 190, 8, "right");
IsShooting = true;
}
}
if(shotCount%2 == 0)
{
//CreatePlayerShot01(GetPlayerX-8, GetPlayerY, 20, 270, 2.4, 1, 1);
//CreatePlayerShot01(GetPlayerX+8, GetPlayerY, 20, 270, 2.4, 1, 1);
}
if(shotCount >= 0)
{
shotCount++;
}
if(shotCount == 30)
{
shotCount=-1;
}
if(GetKeyState(VK_SHOT) != KEY_PUSH && GetKeyState(VK_SHOT) != KEY_HOLD)
{
IsShooting = false;
}
SetIntersectionCircle(GetPlayerX, GetPlayerY, 0);
yield;
}
task ellipse{
let dir=270;
let rx=150;
let ry=75;
loop{
dir++;
SetX(x+rx*cos(dir));
Sety(y+ry*sin(dir));
yield;
}
}
That function is way too difficult for mortals to understand.
Dohohohoho.
/me spawns a spear the gungnir
But seriously, what does it exactly do. Or what can it do.
7 arguments:
1) X-coordinate //x-coordinate where the enemy will go to
2) Y-coordinate //y-coordinate where the enemy will go to
3) distance to curve from beginning point //until how far from the starting place the starting curve will last
4) angle at beginning point //at what angle the boss starts to move from the starting place
5) distance to curve to ending point //how far from the ending spot the enemy will start to curve
6) angle at ending point //from what angle the enemy will arrive at the ending point
7) frames //how long it'll take
Sounds more like a function for stage enemies.
task tentacle
{
let obj=Obj_Create(OBJ_SINUATE_LASER);
Obj_SetPosition(obj, GetX+50*cos(Obj_GetAngle(obj)), GetY+50*sin(Obj_GetAngle(obj)));
Obj_SetSpeed(obj, 10);
Obj_SetAngle(obj, 0);
ObjShot_SetGraphic(obj, BLUE01);
ObjSinuateLaser_SetLength(obj, 100);
ObjSinuateLaser_SetWidth(obj, 20);
while(Obj_BeDeleted(obj)==false)
{
yield;
Obj_SetAngle(obj, Obj_GetAngle(obj)+1);
Obj_SetPosition(obj, GetX+50*cos(Obj_GetAngle(obj)), GetY+50*sin(Obj_GetAngle(obj)));
}
}
to make a laser that spins around the boss, the laser appears much thiner than what you declared at ObjSinuateLaser_SetWidth, but the hitbox is a bit larger than the graphic (although still of course smaller than what you declared)... should it really be like this? I have a feeling that this is a stupid question with a really basic explanation to why the laser's like that... (that bit of code actually makes a laser that spins around the boss 50 pixels away, but with a width of about 1 pixel...)#TouhouDanmakufu
#Title[FUCK]
#Text[ASSBALLS]
#Player[FREE]
#ScriptVersion[2]
#BGM[]
script_enemy_main {
#include_function "lib\ExtendedShotDatav4\shot_replace.dnh"
let ImgBoss = "script\img\ExRumia.png";
let pos_draw_a = GetX;
let f = -120;
task derf{
let angle = rand(0, 360);
ascent(a in 0..30){
CreateShot01(GetX, GetY, 3, angle + a*(360/30), ORANGE12, 10);
}
}
task bamf(let i){
let angle = rand_int(0, 18);
loop(10){
ascent(x in 0..20){
yams(i, angle+x*18);
}
loop(3){yield;}
}
}
task yams(let i, let a){
let a_i = [[GetCenterX-175 , GetCenterY-150],[GetCenterX+175 , GetCenterY-150]];
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, a_i[i][0], a_i[i][1]);
Obj_SetSpeed(obj, 10);
Obj_SetAngle(obj, a);
ObjShot_SetGraphic(obj, RED43);
ascent(b in 0..33){Obj_SetSpeed(obj, 10-b*0.3); yield;}
Obj_SetSpeed(obj, 0);
loop(30){yield;}
Obj_SetSpeed(obj, 2);
loop(60){
let anglep = atan2(GetPlayerY-Obj_GetY(obj), -Obj_GetX(obj)+GetPlayerX);
let angleb = Obj_GetAngle(obj);
if(angleb >= 0){
if(anglep > angleb + 1 || anglep <= angleb - 180){Obj_SetAngle(obj, angleb + 1);}
if(anglep < angleb - 1 && anglep > angleb - 180){Obj_SetAngle(obj, angleb - 1);}
} else if(angleb < 0){
if(anglep < angleb - 1 || anglep > angleb + 180){Obj_SetAngle(obj, angleb - 1);}
if(anglep > angleb + 1 && anglep <= angleb + 180){Obj_SetAngle(obj, angleb + 1);}
} else if(angleb == 0){angleb+=0.1;}
while(angleb > 180){angleb -= 360;}
while(angleb < -180){angleb += 360;}
if(anglep <= angleb+1 && anglep >= angleb-1){Obj_SetAngle(obj, anglep);}
yield;
}
}
@Initialize {
SetLife(2000);
SetInvincibility(60);
SetTimer(99);
SetScore(1000000);
SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
CutIn(YOUMU, "Yam Sign "\""Attack of the fucking yams"\", "", 0, 0, 0, 0);
LoadGraphic(ImgBoss);
SetTexture(ImgBoss);
ShotInit;
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if(f%20==0 && f>=0){derf;}
if(f%80==0 && f>=0){bamf(0);}
if(f%85==0 && f>=0){bamf(1);}
f++;
yield;
}
@DrawLoop {
if(GetX==pos_draw_a){
SetGraphicRect(0, 0, 64, 64);
DrawGraphic(GetX, GetY);
}
if(GetX<pos_draw_a){
SetGraphicRect(128, 0, 192, 64);
DrawGraphic(GetX, GetY);
}
if(GetX>pos_draw_a){
SetGraphicRect(192, 0, 256, 64);
DrawGraphic(GetX, GetY);
}
pos_draw_a = GetX;
}
@Finalize {
DeleteGraphic(ImgBoss);
}
}
INCOMING HEADACHE
<snip>
task bamf(let i){
let angle = rand_int(0, 18);
loop(10){
loop(3){yield;}
ascent(x in 0..20){
yams(i, angle+x*18);
}
}
}
task lolshot(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);
while(!Obj_BeDeleted(obj)){
if(Obj_GetY(obj) < GetClipMinY){
CreateShot01(Obj_GetX(obj),Obj_GetY(obj),3,atan2(-sin(Obj_GetAngle(obj)),cos(Obj_GetAngle(obj))),AQUA23,0);
Obj_Delete(obj);
}
if(Obj_GetY(obj) > GetClipMaxY){
CreateShot01(Obj_GetX(obj),Obj_GetY(obj),3,atan2(-sin(Obj_GetAngle(obj)),cos(Obj_GetAngle(obj))),AQUA23,0);
Obj_Delete(obj);
}
if(Obj_GetX(obj) < GetClipMinX){
CreateShot01(Obj_GetX(obj),Obj_GetY(obj),3,atan2(sin(Obj_GetAngle(obj)),-cos(Obj_GetAngle(obj))),AQUA23,0);
Obj_Delete(obj);
}
if(Obj_GetX(obj) > GetClipMaxX){
CreateShot01(Obj_GetX(obj),Obj_GetY(obj),3,atan2(sin(Obj_GetAngle(obj)),-cos(Obj_GetAngle(obj))),AQUA23,0);
Obj_Delete(obj);
}
yield;
}
}
task lolshot(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);
while(!Obj_BeDeleted(obj)){
if(Obj_GetY(obj) < GetClipMinY){
Obj_SetAngle(obj,atan2(-sin(Obj_GetAngle(obj)),cos(Obj_GetAngle(obj))));
}
if(Obj_GetY(obj) > GetClipMaxY){
Obj_SetAngle(obj,atan2(-sin(Obj_GetAngle(obj)),cos(Obj_GetAngle(obj))));
}
if(Obj_GetX(obj) < GetClipMinX){
Obj_SetAngle(obj,atan2(sin(Obj_GetAngle(obj)),-cos(Obj_GetAngle(obj))));
}
if(Obj_GetX(obj) > GetClipMaxX){
Obj_SetAngle(obj,atan2(sin(Obj_GetAngle(obj)),-cos(Obj_GetAngle(obj))));
}
yield;
}
}
task lolshot(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
let counter = 0;
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);
while(!Obj_BeDeleted(obj)){
if(counter<4){
if(Obj_GetY(obj) < GetClipMinY){
let position = GetClipMinY - Obj_GetY(obj);
Obj_SetY(obj, GetClipMinY + position);
Obj_SetAngle(obj, 0 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetY(obj) > GetClipMaxY){
let position = Obj_GetY(obj) - GetClipMaxY;
Obj_SetY(obj, GetClipMaxY - position);
Obj_SetAngle(obj, 0 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetX(obj) < GetClipMinX){
let position = GetClipMinX - Obj_GetX(obj);
Obj_SetY(obj, GetClipMinX + position);
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetX(obj) > GetClipMaxX){
let position = Obj_GetX(obj) - GetClipMaxX;
Obj_SetY(obj, GetClipMaxX - position);
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
counter++;
}
yield;
}
}
}
lol
task lolshot(x,y,v,dir,graphic,delay){
let obj = Obj_Create(OBJ_SHOT);
let counter = 0;
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
ObjShot_SetBombResist(obj,true);
while(!Obj_BeDeleted(obj)){
if(counter<4){
if(Obj_GetY(obj) < GetClipMinY){
let position = GetClipMinY - Obj_GetY(obj);
Obj_SetY(obj, GetClipMinY + position);
Obj_SetAngle(obj, 0 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetY(obj) > GetClipMaxY){
let position = Obj_GetY(obj) - GetClipMaxY;
Obj_SetY(obj, GetClipMaxY - position);
Obj_SetAngle(obj, 0 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetX(obj) < GetClipMinX){
let position = GetClipMinX - Obj_GetX(obj);
Obj_SetX(obj, GetClipMinX + position);
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
counter++;
}
if(Obj_GetX(obj) > GetClipMaxX){
let position = Obj_GetX(obj) - GetClipMaxX;
Obj_SetX(obj, GetClipMaxX - position);
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
counter++;
}
}
yield;
}
}
What's your computer's specs? Sometimes it haet older computer models.Windows Vista Home Premium.
Also, try using Applocale. It saves headaches in the long run. Google it, it's a microsoft thing.
My advice is to change your computer's language back to English (or whatever language you usually use) and follow the advice in the AppLocale Tutorial (http://www.shrinemaiden.org/forum/index.php?topic=4138.0).Okay, I'll try it out.
Windows Vista Home Premium.
... Um, I'm not sure what else to write down.
Try right-clicking the .exe and selecting Run as Administrator, if the option appears on Vista. It does for 7, where the game also crashes if you try to run it normally, but running as Administrator seems to always fix it. But of course, I've never truly used Vista, so I don't know if that option is there...
Does anyone know what Danmakufu returns when you divide a number by 0? ???
But does it say 1.#INF00 or 1.#INFOO, or possibly even 1.#INFO0? This is important.
Kind of odd that some things are defined as numbers, whereas others get weird text gibberish?
[/self-promotion]:V
In a stage script, is there a way to keep the child enemies from dying when the boss enemy dies?This is just a guess but try ending the boss with VanishEnemy
I'm not talking about child enemies the boss spawns or from the boss's script, but the ones spawned in the stage script, separate from the boss. They somehow automatically die if the enemy boss dies, and I want to get rid of that.
In a stage script, is there a way to keep the child enemies from dying when the boss enemy dies?
I'm not talking about child enemies the boss spawns or from the boss's script, but the ones spawned in the stage script, separate from the boss. They somehow automatically die if the enemy boss dies, and I want to get rid of that.
There is no way around this, lol.
Couldn't you just have the supposed boss enemy be a regular non-boss enemy? I mean, a special sprite and a magic circle ought to be enough to distinguish it from the regular enemies, and you can call CutIn in non-boss enemies.
I was thinking about doing that. By the way, I make my own cutins, I don't like Danmakufu's system. The magic circle and the scores, too. I make them all myself. The bonus score would be extremely easy....thought so. :V
The only thing I have left to find out is if enemies die when the child enemy declares a spellcard and then dies. If they don't, then this might be the answer I'm looking for. If they do die, well... it's impossible without reprogramming Danmakufu.Well, to test this, I made a script that spawns the same non-boss enemy two times, which has a CutIn and a SetScore, with two seconds in between each spawn. Neither of them dies when I kill the other one, so... :V
This isnt so much a question dealing with Danmaku in Danmakufu but, when I run Danmakufu, it opens up twice, and then one closes and I use the window not closed, why is this?
Maybe you're clicking too much?Yeah, probably that. Except sometimes I click just once.
I think I'm having a problem with the Shot Replace V4.#include_function |lib\ExpandedShotDatav4\shot_replace.dnh" before @Initialize
Every time I attempt to call it, something amiss happens.
I have it saved in lib\ExpandedShotDatav4\.
Some bullet questions again.Either with object bullets or with ShotA bullets.
(http://images.torrentmove.com/iw/183untitled.jpg)
How can I create spiral bullet stream like this?
task TBullet(x, y, v, ang, delta, phi, ampli, graph){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, 0);
ObjShot_SetGraphic(obj, graph);
ObjShot_SetDelay (obj, 0);
while(Obj_BeDeleted(obj)==false) {
delta+=phi;
Obj_SetX(obj, Obj_GetX(obj) + v*cos(ang) + ampli*sin(delta)*cos(ang+90) );
Obj_SetY(obj, Obj_GetY(obj) + v*sin(ang) + ampli*sin(delta)*sin(ang+90) );
Obj_SetAngle(obj, ang+90-atan( v/(ampli*sin(delta)) ) );
yield;
}
}
Some bullet questions again.
(http://images.torrentmove.com/iw/183untitled.jpg)
How can I create spiral bullet stream like this?
And how can I create bullet that bounch on each side?
From Naut's Tutorial I can make them bounch in X but when I try in Y, the bullet act very odd.
(I want them to bounching around permanently until spell brake.)
For your second question, use 180-Obj_GetAngle(obj) for when the bullets bounce off the left and right, and use 360-Obj_GetAngle(obj) for when the bullets bounce off the top and bottom.
EDIT: Lol, extraneous calculations for SetX and SetY that are completely unnecessary. :VD'OH!
#include_function |lib\ExpandedShotDatav4\shot_replace.dnh" before @Initialize:V Oh, I just had it capitalized incorrectly.
then ShotInit; in @Initialize ?
(I should really get to making that readme...)
task redshot{
let red = Obj_Create(OBJ_SHOT);
Obj_SetPosition(red,GetX,GetY);
Obj_SetSpeed(red,0);
Obj_SetAngle(red,0);
ObjShot_SetGraphic(red,RED01);
wait(120);
Obj_SetAngle(red,atan2(GetPlayerY-Obj_GetY(red),GetPlayerX-Obj_GetX(red)));
Obj_SetSpeed(red,1);
}
The intended effect is to have the bullets pause for 2 seconds and then move directly towards the player. Instead, they just hang there (but it added so much stress, I'm making it part of the card. Who says mistakes are all bad?)Your wait function is probably oddly defined, or you're missing yield; in your @MainLoop. Switch wait(120); with loop(120){yield;}, if both of those checks didnt do anything.
#TouhouDanmakufu
#Title[Assault Wall "Geisterwand"]
#Text[Boxed in by bullets!]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "system\PlaceholderBoss.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
@Initialize{
SetLife(1000);
SetDamageRate(0,0);
SetTimer(90);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY-90,5);
LoadGraphic(imgBoss);
ShotInit;
CutIn(KOUMA,"Assault Wall "\""Geisterwand"\","",0,0,0,0);
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{
//randomly choose a type of wall at the start
let walltype = rand_int(1,4);
wait(120);
yield;
//Cast Geisterwand Defense
Ghost;
loop{
alternative(walltype)
case(1){
blue;
}
case(2){
red;
}
case(3){
yellow;
}
case(4){
green;
}
others{yield}
wait(90);
walltype = rand_int(1,4);
yield;
}
}
task blue{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("BlueWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("BlueWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("BlueWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}
task red{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("RedWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("RedWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("RedWall",448,rand_int(0,480),0,0,3);
}
others{}
yield;
}
task yellow{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("YlwWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("YlwWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("YlwWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}
task green{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("GreenWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("GreenWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("GreenWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}
sub Ghost{
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,0);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,60);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,120);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,180);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,240);
CreateEnemyFromScript("maceFam",GetEnemyX,GetEnemyY,0,0,300);
}
function wait(w){
loop(w){yield;}
}
}
//Travels in a straight line and lays down a wall of bullets
//After 2 seconds, bullets will fly at whatever the player's position was when the bullet was planted
script_enemy BlueWall{
let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;
@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(8,8,39,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFam);
}
function wait(n){
loop(n){yield}
}
task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(90);
VanishEnemy;
}
task wall{
loop{
CreateShotA(1,GetX,GetY,0);
SetShotDataA(1,0,0,GetAngleToPlayer,0,0,0,BLUE01);
SetShotDataA(1,120,1,NULL,0,0,0,BLUE01);
FireShot(1);
wait(5);
yield;
}
}
}
//Travels in a straight line and lays down a wall of bullets
//After 2 seconds, bullets will fly directly at the player
script_enemy RedWall{
let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;
@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(56,8,87,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFam);
}
function wait(n){
loop(n){yield;}
}
task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(90);
VanishEnemy;
}
task wall{
loop{
redshot;
wait(5);
yield;
}
}
task redshot{
let red = Obj_Create(OBJ_SHOT);
Obj_SetPosition(red,GetX,GetY);
Obj_SetSpeed(red,0);
Obj_SetAngle(red,0);
ObjShot_SetGraphic(red,RED01);
while(!Obj_BeDeleted(red)){
wait(120);
Obj_SetAngle(red,atan2(GetPlayerY-Obj_GetY(red),GetPlayerX-Obj_GetX(red)));
Obj_SetSpeed(red,1);
yield;
}
}
}
//Moves in a straight line and leaves a wall of bullets
//Bullets left by YlwWall do not move, ever
script_enemy YlwWall{
let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;
@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(152,8,183,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFam);
}
function wait(n){
loop(n){yield}
}
task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(90);
VanishEnemy;
}
task wall{
loop{
ylwshot;
wait(5);
yield;
}
}
task ylwshot{
let ylw = Obj_Create(OBJ_SHOT);
Obj_SetPosition(ylw,GetX,GetY);
Obj_SetSpeed(ylw,0);
Obj_SetAngle(ylw,0);
ObjShot_SetGraphic(ylw,YELLOW01);
wait(120);
yield;
}
}
//Travels in a straight line and leaves a wall of bullets
//After 2 seconds, bullets explode into randomly angled lasers
script_enemy GreenWall{
let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;
@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(104,8,135,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFam);
}
function wait(n){
loop(n){yield;}
}
task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(90);
VanishEnemy;
}
task wall{
loop{
greenshot;
wait(5);
yield;
}
}
task greenshot{
let lasangle = rand_int(0,359);
let green = Obj_Create(OBJ_SHOT);
Obj_SetPosition(green,GetX,GetY);
Obj_SetAngle(green,0);
ObjShot_SetGraphic(green,GREEN01);
ObjShot_SetDelay(green,0);
while(!Obj_BeDeleted(green)){
wait(120);
loop(5){
CreateLaser01(Obj_GetX(green),Obj_GetY(green),2,lasangle,20,5,GREEN21,0);
lasangle = rand_int(0,359);
}
ObjShot_FadeDelete(green);
}
}
}
//Geisterwand Mace Shield
script_enemy maceFam{
let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\GeisterwandSprite.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let dir = GetArgument;
let r = 50;
let spin = GetArgument+87;
let frame = 0;
@Initialize{
SetLife(1);
SetDamageRate(0,0);
LoadGraphic(imgFam);
ShotInit;
maintask;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,spin);
SetGraphicRect(0,0,30,31);
DrawGraphic(GetX,GetY);
spin+=5;
}
@Finalize{
DeleteGraphic(imgFam);
}
task maintask{
yield;
move;
}
task move{
loop{
//shoot direction of movement and 30 degrees off every 15 frames
if(frame == 7){
CreateShot01(GetX,GetY,3,dir+90,WHITE12I,0);
frame = 0;
}
SetMovePosition03(GetEnemyX+3*r*cos(dir),GetEnemyY+3*r*sin(dir),20,10);
dir+=5;
frame++;
yield;
}
}
function wait(n){
loop(n){yield;}
}
}
Here's the whole thing. EDIT: Forgot the .png at the end of the filename.task red{You define a variable that has the same name as a defined task. Defining two different things under the same name usually causes problems. I suggest to change every instance of red inside your redshot task to something else, like obj or gooseberry or something, maybe this will fix the problem, maybe it won't, but it is defeinitely worth a try. ;)
<snip>
}
I'm trying to make lasers spawn lasers. So I'd create two different ones using CreateLaserblah(1,blah) twice and then use AddShot, right?Answer 1: To make the Laser spawn from the "master laser" just put 0,0 for X and YAnswer 2: I would actually ascent the id and frames after creation for that...ascent(i in 1..how many you want){CreateLaserA(1,blah) AddShot(10*i,1,i,0);CreateLaserA(i,blah)l
Question 1: The first one would be fired from a specific point, so the x and y are covered, but what about the second? What would I put in there?
Question 2: I'm what I'm actually attempting involves having the lasers that come from the first lasers do the same (make more lasers) over and over again, and when they do so, they disappear. Would I just have to create as many CreateLasers it takes to reach the end of the screen, or could I make a loop for that?
If you don't add SetScore, danmakufu doesn't register it as a spell card, and it skips @BackGround.
I don't know if this is the source of the problem, but it very well could be:
In your task, you create a variable to refer to the object id.
The name of this variable is red. Why is this a problem?You define a variable that has the same name as a defined task. Defining two different things under the same name usually causes problems. I suggest to change every instance of red inside your redshot task to something else, like obj or gooseberry or something, maybe this will fix the problem, maybe it won't, but it is defeinitely worth a try. ;)
The way I would see how you would do that would make a variable = true; then, in MainLoop, if the player dies, set it to false, and in the finalize, if(variable = true){AddScore(bonus);}I mean the really crappy text that pops up. It isn't a graphic either so you can't just black it.
I mean the really crappy text that pops up. It isn't a graphic either so you can't just black it.
//Travels in a straight line and lays down a wall of bullets
//WhiteWall fires lasers perpendicular to the path
script_enemy WhiteWall{
let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\DMF_faml.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;
@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFam);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(8,8,39,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFam);
}
function wait(n){
loop(n){yield}
}
task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}
task wall{
loop(18){
white;
wait(5);
yield;
}
}
task white{
let angle = GetAngle;
let wht = Obj_Create(OBJ_SHOT);
Obj_SetPosition(wht,GetX,GetY);
Obj_SetSpeed(wht,0);
ObjShot_SetGraphic(WHITE01);
Obj_SetAngle(wht,0);
ObjShot_SetDelay(wht,0);
while(!Obj_BeDeleted(wht)){
wait(120);
CreateLaserA(1,Obj_GetX(wht),Obj_GetY(wht),500,8,WHITE47,10);
SetLaserDataA(1,0,angle+90,0,0,0,0);
CreateLaserA(2,Obj_GetX(wht),Obj_GetY(wht),500,8,WHITE47,10);
SetLaserDataA(2,0,angle-90,0,0,0,0);
SetLaserDataA(1,20,angle+90,0,0,500,angle+90);
SetLaserDataA(2,20,angle+90,0,0,500,angle-90);
FireShot(1);
FireShot(2);
Obj_Delete(wht);
}
}
}
How can you get Danmakufu to work on windows 7?There's a separate thread for this.
oh, where?
There's a weakness though; if you're firing more than one bullet at the same time and they're supposed to be different colors, they'll all come out the one set with SetShotColor.*cough* Here's an old snippet of code from some time back...
//...
task attack1 {
let a = 0; let b = 0;
loop {
loop(15) {
PlaySE("se\se_kira01.wav");
SetShotColor(255, 255, 255);
ascent(i in 0..6) { CreateShot01(GetX, GetY, 3, GetAngleToPlayer+a+i*360/6, PURPLE02, 0); }
SetShotColor(55, 55, 55);
ascent(i in 0..9) { CreateShot01(GetX, GetY, 2, GetAngleToPlayer+b+i*360/9, WHITE01, 0); }
a-=17; b-=9;
loop(2) { yield; }
}
SetMovePosition02(GetPlayerX, GetClipMinY+100+rand(-50, 50), 10);
}
}
//...
There's a weakness though; if you're firing more than one bullet at the same time and they're supposed to be different colors, they'll all come out the one set with SetShotColor.
SetShotColor(100, 100, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, 1, 30);
SetShotColor(100, 255, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer+10, 1, 30);
it works...
*cough* Here's an old snippet of code from some time back...Code: (...Unless I'm doing something totally different from what you're trying to do...) [Select]//...
task attack1 {
let a = 0; let b = 0;
loop {
loop(15) {
PlaySE("se\se_kira01.wav");
SetShotColor(255, 255, 255);
ascent(i in 0..6) { CreateShot01(GetX, GetY, 3, GetAngleToPlayer+a+i*360/6, PURPLE02, 0); }
SetShotColor(55, 55, 55);
ascent(i in 0..9) { CreateShot01(GetX, GetY, 2, GetAngleToPlayer+b+i*360/9, WHITE01, 0); }
a-=17; b-=9;
loop(2) { yield; }
}
SetMovePosition02(GetPlayerX, GetClipMinY+100+rand(-50, 50), 10);
}
}
//...
well not really...Oh. Right. More than once per frame. Gotcha.Code: [Select]SetShotColor(100, 100, 255);
it works...
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, 1, 30);
SetShotColor(100, 255, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer+10, 1, 30);
Make sure you aren't trying to create the object effects in @Initialize. If you're calling the task that makes them in @Initialize, you can just put a yield at the very beginning of the task and it should work.BWAHAHAHAHA it still crashes...
#東方弾幕風[Player] #ScriptVersion[2] #Menu[PPL 1] #Text[PPL 1] #Image[.imgossimg.png] #ReplayName[PPL 1]
script_player_main{
let CSD = GetCurrentScriptDirectory();let PPL = CSD~"imgossimg.png";let PPLCut = CSD~"imgossimgCut.png";let frame = 0;let speed = 5;let MeterBox = CSD~"imgMeter Box.png";let Meter = CSD~"imgBar.png";let slow = false;
task Lagger(x,y){yield;
let obj=Obj_Create(OBJ_SHOT); let speedd=0; let frame1=0;
Obj_SetPosition(obj,x,y); ObjShot_SetGraphic(obj,3); ObjShot_SetDamage(obj,0.1); ObjShot_SetPenetration(obj,10); Obj_SetAngle(obj,0); Obj_SetSpeed(obj,speedd); Obj_SetAlpha(obj,75);
while(Obj_BeDeleted(obj)==false){frame1++; if(frame1>120){speedd+=0.2; Obj_SetSpeed(obj,speedd); Obj_SetAngle(obj,atan2(GetEnemyY-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj)));}
yield;} Obj_Delete(obj);}
task Da(angle){yield;let obj=Obj_Create(OBJ_SHOT); let speedd=-3; let frame1=0;
Obj_SetPosition(obj,GetPlayerX,GetPlayerY); ObjShot_SetGraphic(obj,2); ObjShot_SetDamage(obj,0.5); ObjShot_SetPenetration(obj,3); Obj_SetAngle(obj,angle); Obj_SetSpeed(obj,speedd); Obj_SetAlpha(obj,75);
while(Obj_BeDeleted(obj)==false){frame1++; if(frame1>60){speedd+=0.2; Obj_SetSpeed(obj,speedd);} yield;}}
task SlowMeter{yield;let meter=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(meter, MeterBox); ObjEffect_SetPrimitiveType(meter, PRIMITIVE_TRIANGLEFAN); ObjEffect_CreateVertex(meter, 4);
ObjEffect_SetVertexXY(meter, 0, GetClipMaxX, GetClipMaxY-150); ObjEffect_SetVertexUV(meter, 0, 0, 0); ObjEffect_SetVertexXY(meter, 1, GetClipMaxX+200, GetClipMaxY-150); ObjEffect_SetVertexUV(meter, 1, 150, 0);
ObjEffect_SetVertexXY(meter, 2, GetClipMaxX+200, GetClipMaxY); ObjEffect_SetVertexUV(meter, 2, 150,100);
ObjEffect_SetVertexXY(meter, 3, GetClipMaxX, GetClipMaxY); ObjEffect_SetVertexUV(meter, 3, 0, 100); ObjEffect_SetLayer(meter,8);
}
task Bar{yield;let meter=Obj_Create(OBJ_EFFECT);let SlowMeter = 0;let deframe=false;let dframe=120;
ObjEffect_SetTexture(meter, Meter); ObjEffect_SetPrimitiveType(meter, PRIMITIVE_TRIANGLEFAN); ObjEffect_CreateVertex(meter, 4);while(!Obj_BeDeleted(meter)){SlowMeter+=1; if(SlowMeter==190){SlowMeter=190; slow=true;} if(GetKeyState(VK_USER)==KEY_PUSH || GetKeyState(VK_USER)==KEY_HOLD){deframe=true;} if(deframe==true){dframe--;} if(dframe==0){dframe=0; deframe=false;}
ObjEffect_SetVertexXY(meter, 0, GetClipMaxX+5, GetClipMaxY-65); ObjEffect_SetVertexUV(meter, 0, 0, 0); ObjEffect_SetVertexXY(meter, 1, GetClipMaxX+5+SlowMeter, GetClipMaxY-65); ObjEffect_SetVertexUV(meter, 1, 150, 0);
ObjEffect_SetVertexXY(meter, 2, GetClipMaxX+5+SlowMeter, GetClipMaxY-6); ObjEffect_SetVertexUV(meter, 2, 150,100);
ObjEffect_SetVertexXY(meter, 3, GetClipMaxX+5, GetClipMaxY-6); ObjEffect_SetVertexUV(meter, 3, 0, 100); ObjEffect_SetLayer(meter,8);}}
@Initialize{ yield;
SetPlayerLifeImage(PPL, 0, 0, 33, 63); LoadGraphic(PPL); LoadGraphic(PPLCut); LoadGraphic(MeterBox); LoadGraphic(Meter); SetSpeed(speed, 2); LoadPlayerShotData(CSD~"shotdata.txt"); SetItemCollectLine(128);
}@MainLoop{ yield; if(frame==20){} if(GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD){frame++; if(frame>300 && frame<400 && frame%2==0){Lagger(GetPlayerX,GetPlayerY);} if(frame<100 && frame%3==0){ascent(i in 1..11){Da(270-5*i); Da(270+5*i);}} if(GetKeyState(VK_USER)==KEY_PUSH && slow==true){Slow(1);}else{Slow(0);} if(frame==500){frame=0;}CreatePlayerShot01(GetPlayerX, GetPlayerY, 18, 270, 0.5, 200, 1);} SetIntersectionCircle(GetPlayerX, GetPlayerY, 1);
}@Missed{}@SpellCard{yield;
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){UseSpellCard("rawr", true);}else{UseSpellCard("rawr", true);}
CutIn(KOUMA, "Genjutsu -Sakura-", PPLCut); }@DrawLoop{yield;SetTexture(PPL);SetRenderState(ALPHA);SetGraphicAngle(0,0,0);SetGraphicScale(1.35,1.35);if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){SetGraphicRect(32,0,69,62);}else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){SetGraphicAngle(180,0,0); SetGraphicRect(32,0,69,62);}else{SetGraphicRect(0,0,33,63);}
DrawGraphic(GetPlayerX, GetPlayerY);SlowMeter; Bar; }@Finalize{DeleteGraphic(PPL);}
}
script_spell rawr{let Tree = GetCurrentScriptDirectory~"img.png";let petals = GetCurrentScriptDirectory~"ingpetals.png";let obj=Obj_Create(OBJ_SPELL);let obj2=Obj_Create(OBJ_SPELL);let spin = 4; @Initialize{yield; LoadGraphic(Tree); LoadGraphic(petals); run(); } @MainLoop{spin++; yield; } @Finalize{DeleteGraphic(Tree);} task run(){yield; SetPlayerInvincibility(150); loop(10){yield;} Fire; loop(140){yield;} End;} task Fire{ let posx = GetEnemyX;let posy = GetEnemyY;let fwa = 0; ObjEffect_SetTexture(obj,Tree); ObjEffect_SetScale(obj,1,1); ObjEffect_SetRenderState(obj,255); ObjEffect_CreateVertex(obj,4); ObjEffect_SetLayer(obj,1); ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
while(Obj_BeDeleted(obj)==false){yield; posx=GetCenterX; posy=GetCenterY;
ObjEffect_SetVertexXY(obj,0,posx-60*2-fwa,posy-60*2-fwa); ObjEffect_SetVertexUV(obj,0,0,0); ObjEffect_SetVertexXY(obj,1,posx+60*2+fwa,posy-60*2-fwa); ObjEffect_SetVertexUV(obj,1,0,512); ObjEffect_SetVertexXY(obj,2,posx+60*2+fwa,posy+60*2+fwa); ObjEffect_SetVertexUV(obj,2,512,512); ObjEffect_SetVertexXY(obj,3,posx-60*2-fwa,posy+60*2+fwa); ObjEffect_SetVertexUV(obj,3,512,0);ObjSpell_SetIntersecrionCircle(obj,posx,posy,120,20,true); yield;}}}
#Image[.imgossimg.png]
#Image[.\imgossimg.png]
...you have a yield in @Initialize? That could screw things up, I suppose...Still Freezes, here, let me put up the graphics and such for you guys,EDIT: Here it is: http://www.mediafire.com/?wannttdyytd
task SlowMeter{ ... }
let SlowMeter = 0;Defining two different things under the same name is not a good idea, either, although that probably isn't what causes your crashing...
Defining two different things under the same name is not a good idea, either, although that probably isn't what causes your crashing...
Will tinker a little more after dinner. Unless someone finds the error before I'm done, that is.
#TouhouDanmakufu
#Title[-VOID-]
#Text[It can't be resisted!]
#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);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
CutIn(KOUMA,"VOID",0,0,0,0);
ShotInit;
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{
wait(5);
fire(GetX,GetY,GetAngleToPlayer,BLUE02);
SetMovePositionRandom01(150,50,7,0,0,GetCenterX*2,GetCenterY+50);
wait(30);
fire(GetX,GetY,270,BLUE02);
}
task fire(x,y,dir,graphic){
let expand = 0;
let lsr = Obj_Create(OBJ_LASER);
ObjShot_SetBombResist(lsr,true);
ObjShot_SetGraphic(lsr,graphic);
ObjLaser_SetWidth(lsr,5);
ObjLaser_SetLength(lsr,5);
ObjLaser_SetSource(lsr,false);
Obj_SetAngle(lsr,dir);
Obj_SetPosition(lsr,x,y);
Obj_SetSpeed(lsr,0);
while(Obj_BeDeleted(lsr)==false){
if(expand<120){
ObjLaser_SetWidth(lsr,5+expand);
ObjLaser_SetLength(lsr,5+expand);
expand+=2;
wait(1);
}else{
Obj_SetSpeed(lsr,5);
Obj_SetAngle(lsr,dir);
}
if(Obj_GetX(lsr)<0||Obj_GetX(lsr)>GetCenterX*2){
burst(Obj_GetX(lsr),Obj_GetY(lsr));
Obj_Delete(lsr);
}
if(Obj_GetY(lsr)>GetCenterY*2||Obj_GetY(lsr)<0){
burst(Obj_GetX(lsr),Obj_GetY(lsr));
Obj_Delete(lsr);
}
wait(1);
}
}
task burst(x,y){
let pentblast = rand_int(0,359);
ascent(a in 1..60){
ascent(v in 1..4){
CreateShot01(x,y,3*v,360/a,SP02,0);
}
}
}
function wait(w){
loop(w){yield;}
}
}
The laser will expand to the right size, but not move. And since the whole spellcard relies on them moving...
shut up blargel i'm doing mathD:
Yep. You can get the distance between the character and the line made by the two corners. Tbh I was never actually taught this, I just used it to shortcut through some questions in grade 12 >_>
The three points make a triangle. First you find the area of the triangle (Yes it's a weird formula):
triarea = abs(0.5*((x1*y2 + x2*y3 + x3*y1) - (y1*x2 + y2*x3 + y3*x1)));
Then you get the base of the triangle with the wall coordinates:
tribase = ((x2-x1)^2 + (y2-y1)^2)^0.5;
Now you can find the height of the triangle, or the distance between the character and the wall:
triheight = 2*triarea/tribase;
If you wanna be really pro you can put it in a single formula lol:
function GetDistToWall(x1,y1,x2,y2,x3,y3){
return 2 * abs(0.5*((x1*y2+x2*y3+x3*y1)-(y1*x2+y2*x3+y3*x1))) / (((x2-x1)^2 + (y1-y2)^2)^0.5);
}
So if( GetDistToWall(enter, points, here) < 5){ back the fuck up; } and there you go.
let anorm;
let n1;
let n2;
let dist;
function GetDist(ox, oy, p1x, p1y, p2x, p2y){
anorm=atan2(p1y-p2y, p1x-p2x)-90;
n1=cos(anorm);
n2=sin(anorm);
// ->n = [cos(anorm), sin(anorm)] = [n1, n2]
// g: [ox-p1x, oy-p1y]*[n1, n2]=0;
dist= ( (ox-p1x)*cos(anorm)+(oy-p1y)*sin(anorm) )/(( (n1)^2 + (n2)^2 )^0.5) ;
return dist;
}
Hooray for vectors!
Obj_Lasers cannot move with SetSpeed. You have to manually move them with SetPosition every frame:Seems like a pain, but it's nice to know.
Obj_SetPosition(obj, Obj_GetX(obj)+cos(Obj_GetAngle(obj))*Obj_GetSpeed(obj), Obj_GetY(obj)+sin(Obj_GetAngle(obj))*Obj_GetSpeed(obj))
let obj_x=[Obj_Create(OBJ_EFFECT)];
Obj_Delete(obj_x[0]);
let magnet=[];
task bomber(x, y){
let obj=Obj_Create(OBJ_EFFECT);
obj_x=[obj];
magnet=magnet ~ obj_x;
Obj_SetPosition(obj_x[0], x, y);
//insert the drawing stuff you want here
while(Obj_BeDeleted(obj){ etc }
}
}
If you want every object to do something once it enters a square- or rectangle-formed space arounde the object, than that is not a problem at all as long as the square stays aligned to the regular x and y axes. If it spins, it gets more difficult, but then we could pretty much reuse the code(s) for Naut's problem.
If you want the bullets to be attracted towards the object no matter where they are, I am not shure what the difference between a circular and a rectangular attraction would be, aside maybe from the fact that the horizontal pull may be stronger or weaker than the vertical pull, but that would still be a piece of cake.
So...
Do you want the bullets to form a rectangular shape while being attracted? Because for that to happen you would have to spawn all bullets at the same time or the shape will be royally messed up anyways...
let att=false;
let attx=0;
let atty=0;
if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}
if(attx!=0&&atty!=0){
Obj_SetSpeed(obj, 0);
att=true;
if(attx<50&&attx>0){attx=50; }
if(attx>-50&&attx<0){attx=-50; }
if(atty<30&&atty>0){atty=30; }
if(atty>-30&&atty<0){atty=-30; }
}
if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}
script_enemy_main{
let magnet=Obj_Create(OBJ_SHOT);
Obj_SetPosition(magnet, GetCenterX, GetCenterY-64);
Obj_SetAngle(magnet, 80);
task bullet(x, y, v1, v, ang){
let att=false;
let attx=0;
let atty=0;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, v1);
ObjShot_SetGraphic(obj, RED01);
ObjShot_SetDelay (obj, 0);
let tangle=0;
while(Obj_BeDeleted(obj)==false){
if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}
if(attx!=0&&atty!=0){
Obj_SetSpeed(obj, 0);
att=true;
if(attx<50&&attx>0){attx=50; }
if(attx>-50&&attx<0){attx=-50; }
if(atty<30&&atty>0){atty=30; }
if(atty>-30&&atty<0){atty=-30; }
}
if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}
yield;
}
}
@MainLoop { }
//etc.
if(attx<50&&attx>0){attx=50; }
if(attx>-50&&attx<0){attx=-50; }
if(atty<30&&atty>0){atty=30; }
if(atty>-30&&atty<0){atty=-30; }
part from the code I posted, and it should work. It just won't work perfectly. I don't like it if somethng doesn't work perfectly. :-XAlright, finishing up my stage...Spawn them all at the beginning of the script maybe? (and then immediately kill them or something)
Is there a way to load boss enemies, child enemies, and all of their sound effects/images/other files before spawning them within a stage script?
I noticed there's a slight pause just before a boss or child enemy spawns. After they spawn once, though, that pause is gone and you can re-load them hundreds of times without that split-second delay between each one. I want to know if there's a way to load them all without actually spawning them, similar to how ZUN does it in before each Touhou stage. Is there a way to do it in Danmakufu?
As a side note, I don't believe bosses can be compiled beforehand.
let magnet=Obj_Create(OBJ_SHOT);
Obj_SetPosition(magnet, GetCenterX, GetCenterY-64);
Obj_SetAngle(magnet, 80);
let mdx=50; //half the width of the magnet, change value as you please
let mdy=30; //half the width of the magnet, change value as you please
task bullet(x, y, v1, v, ang){
let att=false;
let attx=0;
let atty=0;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, v1);
ObjShot_SetGraphic(obj, RED01);
ObjShot_SetDelay (obj, 0);
let tangle=0;
while(Obj_BeDeleted(obj)==false){
tangle=atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj));
if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(tangle) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(tangle) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}
if(attx!=0&&atty!=0){
Obj_SetSpeed(obj, 0);
att=true;
if(tangle<atan2(-mdy, -mdx)&&tangle>atan2(-mdy, mdx)){ atty=-mdy;}
if(tangle<atan2(-mdy, mdx)&&tangle>atan2(mdy, mdx)){ attx=mdx;}
if(tangle<atan2(mdy, mdx)&&tangle>atan2(mdy, -mdx)){ atty=mdy;}
if(tangle<atan2(mdy, -mdx)&&tangle>180){ attx=-mdx;}
if(tangle<(-180)&&tangle>atan2(-mdy, -mdx)){ attx=-mdx;}
}
if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}
yield;
}
}
CompileEnemyFromFile(enemyFilePath);It's not working too well for me. Maybe I'm not doing it right? Can you give me an example with a stage script and enemy? Something that loads a large sound or image file, to have noticable pause when it spawns without the compileenemyfromfile function.
Do it for every enemy you plan to use for that stage.
It's not working too well for me. Maybe I'm not doing it right? Can you give me an example with a stage script and enemy? Something that loads a large sound or image file, to have noticable pause when it spawns without the compileenemyfromfile function.
It doesn't have to do anything. I just want to see what I'm doing wrong.
Load all your sounds and graphics that you'll use for the regular enemies at the beginning of the stage and delete them at the end of the stage.
let ImgBoss = ".\img\stg3enm.png";
let BossCutIn = ".\img\face_03_00.png";
@Initialize {
SetScore(1000000);
SetLife(1);
SetTimer(60);
Concentration01(80);
SetDurableSpellCard;
LoadGraphic(ImgBoss);
LoadGraphic(BossCutIn);
CutIn(YOUMU, "card name here", BossCutIn, 0, 0, 128, 512);
SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
}
@MainLoop {
//SetCollisionA(GetX, GetY, 32);
//SetCollisionB(GetX, GetY, 16);
}
@DrawLoop {
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 48, 64);
DrawGraphic(GetX, GetY);
}
BossCutIn appears as a large white rectangle, while the boss's sprite doesn't show up at all. I checked the images themselves, as well as Iryan's Parallax Sign script from the last contest that called a large moon as the cutin, and they seem to work fine.
How will I be doing that? If I put in let image=whatever.png; LoadGraphic(image);/etc in the stage script, will the child enemies correspond with that? Or am I missing some secret here?
My guess is to somehow make the sound and image files common data files in the stage script and then calling them in the child enemies. But I don't know how to properly approach this.
Actually, I have already did it (http://www.mediafire.com/?yz3itumc2my).
Put the power of the player is a bit...not balanced...ze.
You can still put let image = whatever.png; in your enemy scripts. And then you just use SetTexture(image); and all that stuff like usual. The only difference is, you also put let image = whatever.png; inside the stage script too and let the stage do all the loading and deleting.
let BossImg = GetCurrentScriptDirectory~ "BossSprite.png";
let sfx_shot = GetCurrentScriptDirectory~ "Shotsound.wav";
That kind of stuff. That way, you can reference the files in both scripts easily.LoadGraphic(BossImg);
LoadSE(sfx_shot);
DeleteGraphic(BossImg);
DeleteSE(sfx_shot);
That way you will load all the files at the beginning of the stage and not during the initialization of the boss. I don't see how you can do that. Can you give an example?
Remember, what I'm trying to do is take away that loading time when the enemy spawns. If defining and loading sounds/images in stage scripts make it all happen before the stage starts, I'm fine with it. But if it loads again when the enemies themselves spawn, this is useless for me. I need the stage to run fluently.
script_enemy_main {
let enemySprite = GetCurrentScriptDirection ~ "whatever.png";
@Initialize{
// No LoadGraphic here.
SetLife(200);
// Whatever else you wanna do.
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 32);
// Whatever else.
}
@DrawLoop{
// Use DrawLoop as normal.
SetTexture(enemySprite);
SetGraphicRect(0, 0, 64, 64);
DrawGraphic(GetX, GetY);
}
@Finalize{
// No DeleteGraphic here.
// Everthing else is normal.
}
}
script_stage_main{
let enemy1 = GetCurrentScriptDirectory ~ "enemy1.txt";
let enemy1Sprite = GetCurrentScriptDirectory ~ "whatever.png"; // same whatever.png that the enemy used for its variable enemySprite
@Initialize{
LoadGraphic(enemy1Sprite);
CompileEnemyFromFile(enemy1);
StageTask;
}
@MainLoop{
yield;
}
@BackGround{
}
@Finalize{
DeleteGraphic(enemy1Sprite);
ClearByteCodeCash;
}
task StageTask{
Wait(60);
CreateEnemyFromFile(enemy1, GetCenterX, GetClipMinY, 1, 90, 0);
Wait(60);
ascent(i in 0..5){
CreateEnemyFromFile(enemy1, GetCenterX-100+i*50, GetClipMinY, 1, 90, 0);
}
}
function Wait(t){
loop(t){yield;}
}
}
let GCSD = GetCurrentScriptDirectory;
let Graphics = [
GCSD ~ "graphic1.png",
GCSD ~ "graphic2.png",
GCSD ~ "graphic3.png",
GCSD ~ "graphic4.png",
GCSD ~ "graphic5.png",
GCSD ~ "graphic6.png",
GCSD ~ "graphic7.png",
GCSD ~ "graphic8.png",
GCSD ~ "graphic9.png"
];
@Initialize{
ascent(i in 0..length(Graphics)){
LoadGraphic(Graphics[i]);
}
}
explanation
LoadUserShotData should be called in every enemy. That's the only thing you can't load in a stage script, which actually makes sense if you think about it. This let's you use different shot data for different enemies so that the 255 id limit isn't AS annoying (but it still is annoying :'()
It just couldn't be that easy.... Of course there'd be a catch. There's always, ALWAYS a catch.
Maybe I could get rid of it by loading the png for the shot data, hopefully that will be enough.
On a side note, when I use the debug window, the loaded scripts are on the very right bar, right? Why doesn't compileenemyfromfile function load them into it?
I have never used the debug window before. Am I a disappointment?...there's a debug window?
I have never used the debug window before. Am I a disappointment?There's a debug window?
lol. Texture, Sound and Script tabs are like the most important as they show what is currently being inside the memory of dnh. How the hell you never looked into these.
I AM DISAPPOINTED IN YOU BLARGEL =|
I have never used the debug window before. Am I a disappointment?
...there's a debug window?
There's a debug window?Yes. Use it. It's helpful.
Or what Sonic Zero said
Looks like that did the trick.
Thanks for the help, it's running so smoothly now, there's absolutely no pause whatsoever.
I shall save everyone the pain of my "god teir" and MSPaintastic pictures by ripping sprites to use in my picture!I have no idea what the hell that image is supposed to be depicting.
I want to recreate this sort of effect(http://i600.photobucket.com/albums/tt84/Happyhobo810/Plan.jpg)[font='times new roman']I would post the script to this but unfortunalty I got mad at it and Deleted it off the face of the Universe...[/font]
I have no idea what the hell that image is supposed to be depicting.Looks like splitting bullets.
CreateShotA(0,GetX,GetY,10); SetShotDataA(0,0,3,angle,0,-0.05,0,WHITE56); ascent(l in 1..5){ AddShot(80,0,1+l,0); CreateShotA(1+l,0,0,0); SetShotDataA(1+l,0,3,rand(0,360)*l,0,-0.1,-2,WHITE56); ascent(o in 1..11){ AddShot(80,1+l,6+o,0); CreateShotA(6+o,0,0,0); SetShotDataA(6+o,0,5,angle-50+10*o,0,-0.25,-2,RED56);
Its pretty much one fires, three more fire at the opposite angle, and then a mess come out, I decided to put the code back together and this is it, but for some reason Only 1 bullet comes from the first card but the mess of them come out the last!Code: [Select]CreateShotA(0,GetX,GetY,10); SetShotDataA(0,0,3,angle,0,-0.05,0,WHITE56); ascent(l in 1..5){ AddShot(80,0,1+l,0); CreateShotA(1+l,0,0,0); SetShotDataA(1+l,0,3,rand(0,360)*l,0,-0.1,-2,WHITE56); ascent(o in 1..11){ AddShot(80,1+l,6+o,0); CreateShotA(6+o,0,0,0); SetShotDataA(6+o,0,5,angle-50+10*o,0,-0.25,-2,RED56);
Well, the code box is something... at least it didnt totally butcher the code...
The only possible explanations for me would be that
a) #include_script doesn't work in child enemies, or that
b) you cannot call #include_script in the same file more than once, even if it is in separate script_enemy parts.
script_enemy_main {
#include_function "script\DanceContest\functions\systemloader.txt"
}
script_enemy shaker{
#include_function "script\DanceContest\functions\superfams.txt"
}
(systemloader is basically including 5 scripts at once, which superfams is one of those scripts. So technically I am calling the same file twice here and no errors. So there is something that Danmakufu does not like when you are calling it twice.)
#TouhouDanmakufu
#Title[New Test L New 3]
#Text[Test]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
#include_script ".\add\Filename.txt";
<snip>
}
//---------------
script_enemy CLONE{
#include_script ".\add\Filename.txt";
<snip>
}
The boss enemy then creates one child enemy in the @MainLoop when the ever-increasing timer variable frame reaches the value of -120.
let img_trail= GetCurrentScriptDirectory ~"add\Trail.png";
let img_sword= GetCurrentScriptDirectory ~"add\SwordTest.png";
let animate=0;
let animate_sword=0;
let animate_attack=0;
function rush(distance, time, bleft, btop, bright, bbottom){
let doit=0;
let angle=0;
while(doit==0){
angle=rand(0, 360);
if( GetX+distance*cos(angle)>bleft
&& GetY+distance*sin(angle)>btop
&& GetX+distance*cos(angle)<bright
&& GetY+distance*sin(angle)<bbottom ){ doit=1; }
}
SetMovePosition02(GetX+distance*cos(angle), GetY+distance*sin(angle), time);
}
task GhostWisp{
let visibility=128;
let size=0.5;
let obj=Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(obj, visibility);
Obj_SetPosition(obj, GetX+rand(-10,10), GetY+rand(10,25));
ObjEffect_SetTexture(obj,img_trail);
ObjEffect_SetRenderState(obj, ADD);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetLayer(obj, 1);
while(Obj_BeDeleted(obj)==false){
Obj_SetY(obj, Obj_GetY(obj)+1);
size=size*0.98;
visibility-=2;
if(visibility==0){ Obj_Delete(obj); }
ascent(i in 0..5){
ObjEffect_SetVertexColor(obj,i,visibility,255,255,255);
}
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,21,0);
ObjEffect_SetVertexUV(obj,2,21,29);
ObjEffect_SetVertexUV(obj,3,0,29);
ObjEffect_SetVertexXY(obj,0,-11.5*size,-14.5*size);
ObjEffect_SetVertexXY(obj,1,11.5*size,-14.5*size);
ObjEffect_SetVertexXY(obj,2,11.5*size,14.5*size);
ObjEffect_SetVertexXY(obj,3,-11.5*size,14.5*size);
yield;
}
}
task GhostTrail{
LoadGraphic(img_trail);
LoadGraphic(img_sword);
loop{
yield;
GhostWisp;
}
}
task TSwAnim(t1, t2, t3){
loop(t1){ animate_sword+=164/t1; yield; }
loop(t2){ yield; }
loop(t3){ animate_sword-=164/t3; yield; }
}
GhostTrail is usually run in the @Intialize. In my child script I ran GhostWisp manually in the @MainLoop once the @Initialize has passed, so I neither load the graphics mulitple times, nor am I creating an EffectObject in @Initialize. I copypasted the exact same line I used in the main script where it works just fine, and if the filename was invalid danmakufu would spit out an error about this, which it doesn't. The script's existence is acknowledged, yet the script is not included.
However, if I delete the #include_script and every reference to its data from the main enemy, the #include_script works just fine.
If I make a text file that has no other line but the #include_script, then include THAT script, it still tells me the stuff is not defined.
If I copy the script and call #include_script on the copy, which is identical except for the file name, everything works.
Conclusion:
Danmakufu doesn't recognize a repeated #include_script command, even if it is repeated in an entirely different section of the script.
*facepalm*
But hey, the script works now, so screw this nonsensical limitation. Now to tinker with that spell card...
#TouhouDanmakufu
#Title[Flower sp]
#Text[Description]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
///
#include_function "lib\SHOT_REPLACE\shot_replace.dnh"
function wait(let frames){ loop(frames){yield;} }
///
let sprite = "script\img\ExRumia.png";
let Cutin = "";
let fr = 0;
//////////
@Initialize{
shotinit;
LoadGraphic(sprite);
SetLife(5000);
SetDamageRate(100, 100);
SetTimer(50);
SetInvincibility(30);
CutIn(YOUMU, "X Sign "\""X"\", Cutin, 0, 0, 0, 0);
SetScore(500000);
SetEnemyMarker(true);
Concentration01(60);
MagicCircle(true);
SetEffectForZeroLife(180, 100, 1);
SetMovePosition02(GetCenterX, GetCenterY - 100, 30);
SetShotAutoDeleteClip(100,100,100,100);
Flowers;
}
//////////
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
fr++;
yield;
}
//////////
@DrawLoop{
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(sprite);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(sprite);
}
//////////
task Flowers{
let tr_ang = GetAngleToPlayer+15;
let ang = 0;
wait(60);
loop{
tr_ang = GetAngleToPlayer-20;
loop(10){
loop(6){
Petal(tr_ang, ang, 20, 1, YELLOW02);
FlowerCenter(tr_ang, ang, 20, 1, GREEN05);
ang += 360/6;
}
tr_ang += 360/10;
}
wait(120);
tr_ang = GetAngleToPlayer+20;
loop(10){
loop(6){
Petal(tr_ang, ang, 20, -1, RED02);
FlowerCenter(tr_ang, ang, 20, -1, YELLOW05);
ang += 360/6;
}
tr_ang += 360/10;
}
wait(120);
}
yield;
}
//////////
task Petal (tr_ang, ang, radius, spin, graphic){
let obj = Obj_Create(OBJ_LASER);
let speed = 1;
Obj_SetPosition (obj, GetX+radius*cos(tr_ang), GetY+radius*sin(tr_ang) );
Obj_SetSpeed (obj, 0);
Obj_SetAngle (obj, ang);
ObjShot_SetGraphic (obj, graphic);
ObjShot_SetDelay (obj, 10);
ObjShot_SetBombResist (obj, true);
ObjLaser_SetLength (obj, 0);
ObjLaser_SetWidth (obj, 40);
ObjLaser_SetSource (obj, false);
while(!Obj_BeDeleted(obj) ){
if(ObjLaser_GetLength(obj) < 80){
ObjLaser_SetLength (obj, ObjLaser_GetLength(obj) +2);
}
if(speed<3){
speed += 0.01;
}
Obj_SetPosition (obj, GetX + radius*cos(tr_ang), GetY + radius*sin(tr_ang) ); //movement
radius += speed;
tr_ang += 0.2 * spin;
Obj_SetAngle (obj, Obj_GetAngle(obj) + (1*spin) ); //flower rotation
yield;
}
}
//////////
task FlowerCenter (tr_ang, add_ang, radius, spin, add_graphic){
let o2 = Obj_Create(OBJ_SHOT);
let speed = 1;
let count = 0;
Obj_SetPosition (o2, GetX+radius*cos(tr_ang), GetY+radius*sin(tr_ang) );
Obj_SetSpeed (o2, 0);
Obj_SetAngle (o2, 0);
ObjShot_SetGraphic (o2, YELLOW02);
ObjShot_SetDelay (o2, 10);
ObjShot_SetBombResist (o2, true);
while(!Obj_BeDeleted(o2) ){
count++;
if(count==50){ //spores.
CreateShot01(Obj_GetX(o2), Obj_GetY(o2), 0.5, rand_int(0,359), add_graphic, 2);
}
if(speed<3){ //acceleration
speed += 0.01;
}
Obj_SetPosition (o2, GetX + radius*cos(tr_ang), GetY + radius*sin(tr_ang) ); //movement
radius += speed;
tr_ang += 0.2 * spin;
if(Obj_GetX(o2) < GetClipMinX-20){ //out-of-screen deletion
Obj_Delete(o2);
}
if(Obj_GetX(o2) > GetClipMaxX+20){
Obj_Delete(o2);
}
if(Obj_GetY(o2) < GetClipMinY-20){
Obj_Delete(o2);
}
if(Obj_GetY(o2) > GetClipMaxY+20){
Obj_Delete(o2);
}
yield;
}
}
//////////
}
loop(6){
Petal(tr_ang, ang, 20, 1, YELLOW02);
FlowerCenter(tr_ang, ang, 20, 1, GREEN05);
ang += 360/6;
}
EDIT: Demonbman: I can't figure out the problem in your script from what you posted on IRC, sorry. :-\
The reason I don't want you to use absolute path names (relative to th_dnh) is because people will extract files differently, and thus have different path names than what is on your computer. The script will error if you have used them, and it pisses me the fuck off when I have to dick through your scripts to find every absolute path name you've declared and change it to something that works on my computer. If you use relative path names, then it will always work no matter how anybody extracts your files.Also this. So much this.
so how do i set the player's bombs, from a stage script?
i have only found a way to set lives, but nothing for bombs >:|
When I use FadeOutMusic, the song wont start playing after I do PlayMusic again...
How do I solve this problem?!
An absolute file path means that it is relative to your root directory (in this case, th_dnh).
scriptossesholyshit.txt is an absolute file path, it is relative to th_dnh.exe.
A relative file path means that it gets the file path relative to the file you're calling it in. For example, if you have a text file in the folder scriptosses called dicks.txt, and you want to communicate to holyshit.txt for whatever reason, you can call it in an #include_function by saying:
.holyshit.txt
The . gets the current directory of the file it's called in (just like GetCurrentScriptDirectory), and then follows the rest of the path name to the file you've specified. So in this case, it will find the directory that dicks.txt is in, and then find holyshit.txt in the same directory.
The reason I don't want you to use absolute path names (relative to th_dnh) is because people will extract files differently, and thus have different path names than what is on your computer. The script will error if you have used them, and it pisses me the fuck off when I have to dick through your scripts to find every absolute path name you've declared and change it to something that works on my computer. If you use relative path names, then it will always work no matter how anybody extracts your files.
Not necessarily. You can put the Data.txt file in the Prisimrivers folder outside of any of the specific sisters' folders. Then in any script you want to include the Data.txt into, you can put
#include_function "...Data.txt"
The . as Naut already explained behaves like GetCurrentScriptDirectory. The .. on the other hand basically means "go back one folder". Now I haven't actually used this technique myself, but I've seen it used by other people before.
Also, do you realize that you're spelling their last name wrong? It's Prismriver last time I checked. :V
I keep forgetting the dimensions of the field, which is important for the next spellcard I'm making.384x448
384x448
(GetCenterX*2,GetCenterY*2)
task LayoutSet{
HoriWall(GetCenterX*2/5,GetCenterX*2/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*6/5,GetCenterX*2/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*2/5,GetCenterY*2-GetCenterX*2/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*6/5,GetCenterY*2-GetCenterX*2/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*4/5,GetCenterY+GetCenterX/5,GetCenterX*2/5,WHITE47);
HoriWall(GetCenterX*4/5,GetCenterY-GetCenterX/5,GetCenterX*2/5,WHITE47);
VertWall(GetCenterX*2/5,GetCenterX*2/5,GetCenterY*2-GetCenterX*4/5,WHITE47);
VertWall(GetCenterX*6/5,GetCenterX*2/5,GetCenterY*2-GetCenterX*4/5,WHITE47);
VertWall(GetCenterX*4/5,GetCenterY+GetCenterX/5,GetCenterX*2/5,WHITE47);
VertWall(GetCenterX*4/5,GetCenterY-GetCenterX/5,GetCenterX*2/5,WHITE47);
}
task HoriWall(x,y,length,graphic){
let hwall = Obj_Create(OBJ_LASER);
Obj_SetPosition(hwall,x,y);
Obj_SetAngle(hwall,0);
ObjShot_SetGraphic(hwall,graphic);
ObjLaser_SetLength(hwall,length);
ObjLaser_SetWidth(hwall,10);
ObjLaser_SetSource(hwall,false);
ObjShot_SetBombResist(hwall,true);
ObjShot_SetDelay(hwall,60);
}
task VertWall(x,y,length,graphic){
let vwall = Obj_Create(OBJ_LASER);
Obj_SetPosition(vwall,x,y);
Obj_SetAngle(vwall,90)
ObjShot_SetGraphic(vwall,graphic);
ObjLaser_SetLength(vwall,length);
ObjLaser_SetWidth(vwall,10);
ObjLaser_SetSource(vwall,false);
ObjShot_SetBombResist(vwall,true);
ObjShot_SetDelay(vwall,60);
}
task ReflectPod(angle){
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(Collision_Obj_Obj(reflect,hwall)==true{
Obj_SetAngle(reflect,-angle);
}
if(Collision_Obj_Obj(reflect,vwall)==true{
Obj_SetAngle(reflect,180-angle);
}
if(Obj_GetX(reflect)<=0||Obj_GetX(reflect)>=GetCenterX*2){
Obj_SetAngle(reflect,180-angle);
}
if(Obj_GetY(reflect)<=0||Obj_GetY(reflect)>=GetCenterY*2){
Obj_SetAngle(reflect,-angle);
}
if(reflecttime==2700){
explosion(Obj_GetX(reflect),Obj_GetY(reflect));
Obj_Delete(reflect);
}
reflecttime++;
wait(1);
}
}
Also I am pretty sure it is impossible to avoid the freeze on @finalize if it's part of the boss.
is it possible to just put
if(GetEnemyLife<1){Obj_Delete(whatever);}
???
it's extremely rare that you're able to get the enemy's life to 0.___ anyway... I'm just not that sure if that'll be able to delete it before the enemy dies...
is it possible to just put
if(GetLife<1){Obj_Delete(whatever);}
???
it's extremely rare that you're able to get the enemy's life to 0.___ anyway... I'm just not that sure if that'll be able to delete it before the enemy dies...
(Also, a small note regarding something this reminded me of. The @Missed loop in player scripts runs once per frame while the player is dead, not just once. So if you have problems with the hitbox freezing, homing shots going straight, etc. during the death animation, just stick yield; in @Missed.)
So rare that it's not possible. When the life of an enemy is less than 1, it proceeds to @Finalize and then deletes the enemy. I know people think "when the enemy has 0 or less than 0 life", but it's actually when the enemy has anything less than 1.