#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.
Updated. GreenWall is supposed to shoot lasers in 5 random directions after 2 seconds.