A quick question: If... wait, no, I just figured out a workaround.
Anyway, different question. Back to the object laser business. Do I have to define them all in an array, or can I do it some other way?
Oh, and another thing: So I've been tweaking Assault Wall, and now I have this...
#TouhouDanmakufu
#Title[Assault Wall "Geisterwand"]
#Text[Boxed in by bullets!]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "Materials\Graphics\PlaceholderBoss.png";
let spellback = CSD ~ "Materials\Graphics\SpellBack.png";
#include_function CSD ~ "lib\ExpandedShotDatav4\shot_replace.dnh";
let slider = 0;
@Initialize{
SetLife(1000);
SetDamageRate(0,0);
SetTimer(90);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY-90,5);
LoadGraphic(imgBoss);
LoadGraphic(spellback);
ShotInit;
CutIn(KOUMA,"Assault Wall "\""Geisterwand"\","",0,0,0,0);
mainTask;
PlayMusic(CSD ~ "Materials\Music\33.mp3");
}
@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{
SetTexture(spellback);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,448,768+slider);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
slider+=2;
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(spellback);
}
task mainTask{
drop;
//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){
red;
}
case(2){
yellow;
}
case(3){
blue;
}
case(4){
green;
}
case(5){
white;
}
case(6){
aqua;
}
case(7){
orange;
}
case(8){
purple;
}
others{yield;}
wait(30);
if(GetTimer<=30){yield;
}else{
if(GetTimer<=60){
wait(30);
}else{
wait(60);
}
}
walltype = rand_int(1,4);
if(GetTimer<=4*90/5){
walltype = rand_int(1,5);
}
if(GetTimer<=3*90/5){
walltype = rand_int(1,6);
}
if(GetTimer<=2*90/5){
walltype = rand_int(1,7);
}
if(GetTimer<=90/5){
walltype = rand_int(1,8);
}
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;
}
task white{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("WhiteWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("WhiteWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("WhiteWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}
task aqua{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("AquaWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("AquaWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("AquaWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}
task purple{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("PrplWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("PrplWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("PrplWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}
task orange{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("OrangeWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("OrangeWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("OrangeWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}
sub Ghost{
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(0),GetEnemyY+50*sin(0),0,0,0);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(60),GetEnemyY+50*sin(60),0,0,60);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(120),GetEnemyY+50*sin(120),0,0,120);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(180),GetEnemyY+50*sin(180),0,0,180);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(240),GetEnemyY+50*sin(240),0,0,240);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(360),GetEnemyY+50*sin(0),0,0,300);
}
task drop{
yield;
}
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 imgFamB = 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(imgFamB);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFamB);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(8,8,39,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFamB);
}
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{
while(GetSpeed>0){
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 imgFamR = 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(imgFamR);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFamR);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(56,8,87,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFamR);
}
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{
while(GetSpeed>0){
redshot;
wait(5);
yield;
}
}
task redshot{
let redb = Obj_Create(OBJ_SHOT);
Obj_SetPosition(redb,GetX,GetY);
Obj_SetSpeed(redb,0);
Obj_SetAngle(redb,0);
ObjShot_SetGraphic(redb,RED01);
while(!Obj_BeDeleted(redb)){
wait(120);
Obj_SetAngle(redb,atan2(GetPlayerY-Obj_GetY(redb),GetPlayerX-Obj_GetX(redb)));
Obj_SetSpeed(redb,1);
yield;
}
}
}
//Moves in a straight line and leaves a wall of bullets
//Bullets left by YlwWall split and fly at an angle
script_enemy YlwWall{
let CSD = GetCurrentScriptDirectory;
let imgFamY = 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(imgFamY);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFamY);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(152,8,183,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFamY);
}
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{
while(GetSpeed>0){
ylwshot;
wait(5);
yield;
}
}
task ylwshot{
let angle = GetAngle;
PlaySE(CSD ~ "Materials\SoundEffects\shot.wav");
let ylsplit = Obj_Create(OBJ_SHOT);
ObjShot_SetGraphic(ylsplit,YELLOW01);
Obj_SetSpeed(ylsplit,0);
Obj_SetAngle(ylsplit,angle+25);
Obj_SetPosition(ylsplit,GetX,GetY);
while(!Obj_BeDeleted(ylsplit)){
wait(120);
CreateShot01(Obj_GetX(ylsplit),Obj_GetY(ylsplit),1.3,angle-25,YELLOW01,0);
Obj_SetSpeed(ylsplit,1.3);
}
}
}
//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 imgFamG = 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(imgFamG);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFamG);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(104,8,135,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFamG);
}
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{
while(GetSpeed>0){
greenshot;
wait(5);
yield;
}
}
task greenshot{
let lasangle = rand_int(0,359);
let grn = Obj_Create(OBJ_SHOT);
Obj_SetPosition(grn,GetX,GetY);
Obj_SetAngle(grn,0);
ObjShot_SetGraphic(grn,GREEN01);
ObjShot_SetDelay(grn,0);
while(!Obj_BeDeleted(grn)){
wait(120);
PlaySE(CSD ~ "Materials\SoundEffects\shot.wav");
loop(5){
CreateLaser01(Obj_GetX(grn),Obj_GetY(grn),2,lasangle,20,5,GREEN21,0);
lasangle = rand_int(0,359);
}
Obj_Delete(grn);
}
}
}
//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 imgFamW = 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(imgFamW);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFamW);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(8,8,39,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFamW);
}
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{
while(GetSpeed>0){
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(wht,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);
PlaySE(CSD ~ "Materials\SoundEffects\laser.wav");
SetShotKillTime(1,40);
SetShotKillTime(2,40);
FireShot(1);
FireShot(2);
Obj_Delete(wht);
}
}
}
//Travels in a straight line and lays down a wall of bullets
//AquaWall bullets fire in a curved line
script_enemy AquaWall{
let CSD = GetCurrentScriptDirectory;
let imgFamA = 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(imgFamA);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFamA);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(56,8,87,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFamA);
}
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{
let curvature = 0.1;
while(GetSpeed>0){
aquashot(curvature);
wait(5);
curvature+=0.1;
yield;
}
}
task aquashot(curvature){
CreateShotA(1,GetX,GetY,0);
SetShotDataA(1,0,0,GetAngle,0,0,0,AQUA01);
SetShotDataA(1,120,1,NULL,curvature,0,0,AQUA01);
FireShot(1);
wait(120);
PlaySE(CSD ~ "Materials\SoundEffects\effect.wav");
}
}
//Moves in a straight line and leaves a wall of bullets
//I don't yet know what this will do.
script_enemy PrplWall{
let CSD = GetCurrentScriptDirectory;
let imgFamP = 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(imgFamP);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFamP);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(152,8,183,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFamP);
}
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{
let baseangle = 45;
while(GetSpeed>0){
prplshot(baseangle);
wait(5);
baseangle-=3;
yield;
}
}
task prplshot(baseangle){
CreateShotA(1,GetX,GetY,0);
SetShotDataA(1,0,0,GetAngle,0,0,0,PURPLE01);
SetShotKillTime(1,240);
CreateLaserA(2,GetX,GetY,30,8,PURPLE41,5);
SetLaserDataA(2,0,baseangle,0.2,0,0,0);
FireShot(1);
AddShot(115,1,2,0);
wait(120);
PlaySE(CSD ~ "Materials\SoundEffects\laser.wav");
}
}
//Travels in a straight line and leaves a wall of bullets
//Bullets fire a laser that blocks the wall temporarily
script_enemy OrangeWall{
let CSD = GetCurrentScriptDirectory;
let imgFamO = 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(imgFamO);
ShotInit;
maintask;
}
@MainLoop{
yield;
}
@DrawLoop{
SetTexture(imgFamO);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(104,8,135,39);
DrawGraphic(GetX,GetY);
}
@Finalize{
DeleteGraphic(imgFamO);
}
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{
while(GetSpeed>0){
oranshot;
wait(5);
yield;
}
}
task oranshot{
let lasangle = GetAngle;
let oran = Obj_Create(OBJ_SHOT);
Obj_SetPosition(oran,GetX,GetY);
Obj_SetAngle(oran,GetAngle);
ObjShot_SetGraphic(oran,ORANGE01);
ObjShot_SetDelay(oran,0);
while(!Obj_BeDeleted(oran)){
wait(120);
PlaySE(CSD ~ "Materials\SoundEffects\laser.wav");
CreateLaserA(1,Obj_GetX(oran),Obj_GetY(oran),500,8,ORANGE47,10);
SetLaserDataA(1,0,lasangle,0,0,0,0);
SetShotKillTime(1,40);
FireShot(1);
CreateLaserA(2,Obj_GetX(oran),Obj_GetY(oran),500,8,ORANGE47,10);
SetLaserDataA(2,0,lasangle+180,0,0,0,0);
SetShotKillTime(2,40);
FireShot(2);
wait(20);
Obj_Delete(oran);
}
}
}
//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+90;
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){
PlaySE(CSD ~ "Materials\SoundEffects\shot.wav");
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++;
r=50+10*sin(frame);
yield;
}
}
function wait(n){
loop(n){yield;}
}
}
There are a couple of problems with this script as it is...
First and foremost: Except for the black bullets from the mace... things (no one seems to agree on just what those are), no bullets show up. Ever. Is GetSpeed incompatible with SetMovePosition02 or something?