Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TouhouDanmakufu(Single)
- #ScriptVersion [3]
- #Title ["Test5"]
- #Text ["Prove prove prove!"]
- let bossObj;
- let bossX = 0;
- let bossY = 0;
- let imgBoss = GetCurrentScriptDirectory ~ "Sprite.png";
- let imgBossMove = GetCurrentScriptDirectory ~ "SpriteMove.png";
- # include "script\default_system\Default_ShotConst.txt"
- @Initialize {
- // Definisce bossObj come un boss e lo registra
- bossObj = ObjEnemy_Create (OBJ_ENEMY_BOSS);
- ObjEnemy_Regist(bossObj);
- // teletrasporta il boss alle coordinate
- ObjMove_SetPosition(bossObj,192,-100);
- // Muove il boss alle coordinate X e Y desiderate alla velocità scelta
- ObjMove_SetDestAtSpeed(bossObj,192,120,3);
- LoadSound(GetCurrentScriptDirectory ~ "tan00.wav");
- LoadSound(GetCurrentScriptDirectory ~ "tan01.wav");
- LoadSound(GetCurrentScriptDirectory ~ "tan02.wav");
- LoadSound(GetCurrentScriptDirectory ~ "FloweringNight.mp3");
- PlaySE(GetCurrentScriptDirectory ~ "FloweringNight.mp3");
- mainTask; // Esegue il task
- }
- @Event {
- // Settare la vita e il timer del boss
- alternative(GetEventType())
- case(EV_REQUEST_LIFE) {
- SetScriptResult(10000);
- }
- case(EV_REQUEST_TIMER) {
- SetScriptResult(80);
- }
- }
- @MainLoop {
- bossX = ObjMove_GetX(bossObj);
- bossY = ObjMove_GetY(bossObj);
- // collisioni per i colpi e il player
- ObjEnemy_SetIntersectionCircleToShot(bossObj,bossX,bossY,24);
- ObjEnemy_SetIntersectionCircleToPlayer(bossObj,bossX,bossY,32);
- yield;
- }
- @Finalize {
- }
- // Best friend
- function wait(w) { loop(w) { yield; } }
- task mainTask {
- renderBoss;
- movement;
- fire;
- end;
- }
- task renderBoss {
- let dir;
- let speed;
- // Attribuisce una texture, o immagine, al boss e ne centra il punto di movimento
- ObjPrim_SetTexture(bossObj,imgBoss);
- ObjSprite2D_SetSourceRect(bossObj,0,0,65,83);
- ObjSprite2D_SetDestCenter(bossObj);
- // ObjRender_SetScaleXYZ(bossObj,1,1,0);
- while(!Obj_IsDeleted(bossObj)) {
- // Aggiorna la velocità e direzione del boss localmente
- dir = ObjMove_GetAngle(bossObj);
- speed = ObjMove_GetSpeed(bossObj);
- // Mostra immagine in base al movimento del boss
- if(speed == 0) {ObjPrim_SetTexture(bossObj,imgBoss); ObjSprite2D_SetSourceRect(bossObj,0,0,65,83); ObjSprite2D_SetDestCenter(bossObj); ObjRender_SetAngleXYZ(bossObj,0,0,0); } // Boss fermo
- else if(cos(dir) < 0) {ObjPrim_SetTexture(bossObj,imgBossMove); ObjSprite2D_SetSourceRect(bossObj,0,0,50,76); ObjSprite2D_SetDestCenter(bossObj); ObjRender_SetAngleXYZ(bossObj,0,180,0); } // Boss verso sinistra
- else if(cos(dir) > 0) {ObjPrim_SetTexture(bossObj,imgBossMove); ObjSprite2D_SetSourceRect(bossObj,0,0,50,76); ObjSprite2D_SetDestCenter(bossObj); ObjRender_SetAngleXYZ(bossObj,0,0,0); } // Boss verso destra
- yield;
- }
- }
- task movement {
- wait(400);
- loop {
- ObjMove_SetDestAtSpeed(bossObj,100,60,2); // muove il boss a sinistra
- wait(400);
- ObjMove_SetDestAtSpeed(bossObj,280,150,2); // muove il boss a destra
- wait(400);
- ObjMove_SetDestAtSpeed(bossObj,350,80,2);
- wait(400);
- ObjMove_SetDestAtSpeed(bossObj,192,120,2);
- wait(400);
- ObjMove_SetDestAtSpeed(bossObj,60,170,2);
- wait(400);
- }
- }
- task fire {
- eruptKnives;
- /*loop {
- wait(100);
- //purpleRicochet;
- //knivesFlower;
- }*/
- }
- function angleToPlayer {
- let dir = atan2(GetPlayerY-bossY,GetPlayerX-bossX);
- return dir;
- }
- task knivesFlower{
- let angle = GetAngleToPlayer(bossObj);
- let angle2 = GetAngleToPlayer(bossObj);
- ascent(i in 0..24){
- loop(20){
- CreateShotA1(ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 1.5+i/12, angle,145 , 5);
- CreateShotA1(ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 1.5+i/12, angle2,150, 5);
- angle+=360/6; angle2+=360/6;
- }
- angle+=12;
- angle2-=12;
- wait(5);
- }
- }
- task purpleRicochet {
- if (ObjEnemy_GetInfo(bossObj,INFO_LIFE) < 10000) {
- let minx = 0;
- let maxx = 384;
- let maxy = 440;
- let miny = 0;
- let purpleObj1;
- PlaySE(GetCurrentScriptDirectory ~ "tan01.wav");
- purpleObj1 = CreateShotA1(bossX,bossY,2,GetAngleToPlayer(bossObj),151,20);
- loop {
- if (ObjMove_GetX(purpleObj1) < minx || ObjMove_GetX(purpleObj1) > maxx) {ObjMove_SetAngle(purpleObj1,180-ObjMove_GetAngle(purpleObj1)); ObjMove_SetSpeed(purpleObj1,0.25+ObjMove_GetSpeed(purpleObj1))}
- if (ObjMove_GetY(purpleObj1) < miny || ObjMove_GetY(purpleObj1) > maxy) {ObjMove_SetAngle(purpleObj1,360-ObjMove_GetAngle(purpleObj1)); ObjMove_SetSpeed(purpleObj1,0.25+ObjMove_GetSpeed(purpleObj1))}
- yield;
- }
- }
- }
- task eruptKnives{
- let dir = angleToPlayer;
- let shotCount = 0;
- let greyObj1;
- let greyObj2;
- let greyObj3;
- let greyObj4;
- let greyObj5;
- let greyObj6;
- let greyObj7;
- let greyObj8;
- let greyObj9;
- let greyObj10;
- let greyObj11;
- let greyObj12;
- let greyObj13;
- wait(200);
- loop {
- if (shotCount < 3) {
- let blueObj1 = CreateShotA1(bossX, bossY, 3, angleToPlayer+5, 150, 0);
- let blueObj2 = CreateShotA1(bossX, bossY, 3, angleToPlayer+10, 150, 0);
- let blueObj3 = CreateShotA1(bossX, bossY, 3, angleToPlayer+15, 150, 0);
- let blueObj4 = CreateShotA1(bossX, bossY, 3, angleToPlayer-5, 150, 0);
- let blueObj5 = CreateShotA1(bossX, bossY, 3, angleToPlayer-10, 150, 0);
- let blueObj6 = CreateShotA1(bossX, bossY, 3, angleToPlayer-15, 150, 0);
- let blueObj7 = CreateShotA1(bossX, bossY, 3, angleToPlayer, 150, 0);
- let blueObj8 = CreateShotA1(bossX, bossY, 3, angleToPlayer+80, 150, 0);
- let blueObj9 = CreateShotA1(bossX, bossY, 3, angleToPlayer+70, 150, 0);
- let blueObj10 = CreateShotA1(bossX, bossY, 3, angleToPlayer+60, 150, 0);
- let blueObj11 = CreateShotA1(bossX, bossY, 3, angleToPlayer-80, 150, 0);
- let blueObj12 = CreateShotA1(bossX, bossY, 3, angleToPlayer-70, 150, 0);
- let blueObj13 = CreateShotA1(bossX, bossY, 3, angleToPlayer-60, 150, 0);
- ObjMove_SetAngularVelocity(blueObj1, 0.003*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj2, 0.006*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj3, 0.009*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj4, -0.003*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj5, -0.006*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj6, -0.009*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj7, 0.000*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj8, -0.002*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj9, -0.004*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj10, -0.006*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj11, 0.002*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj12, 0.004*angleToPlayer);
- ObjMove_SetAngularVelocity(blueObj13, 0.006*angleToPlayer);
- let objangle1 = ObjMove_GetAngle(blueObj1);
- let objangle2 = ObjMove_GetAngle(blueObj2);
- let objangle3 = ObjMove_GetAngle(blueObj3);
- let objangle4 = ObjMove_GetAngle(blueObj4);
- let objangle5 = ObjMove_GetAngle(blueObj5);
- let objangle6 = ObjMove_GetAngle(blueObj6);
- let objangle7 = ObjMove_GetAngle(blueObj7);
- let objangle8 = ObjMove_GetAngle(blueObj8);
- let objangle9 = ObjMove_GetAngle(blueObj9);
- let objangle10 = ObjMove_GetAngle(blueObj10);
- let objangle11 = ObjMove_GetAngle(blueObj11);
- let objangle12 = ObjMove_GetAngle(blueObj12);
- let objangle13 = ObjMove_GetAngle(blueObj13);
- shotCount = shotCount+1;
- loop(10){
- wait(20);
- greyObj1 = CreateShotOA1(blueObj1, 0, ObjMove_GetAngle(blueObj1), 152, 30);
- greyObj2 = CreateShotOA1(blueObj2, 0, ObjMove_GetAngle(blueObj2), 152, 30);
- greyObj3 = CreateShotOA1(blueObj3, 0, ObjMove_GetAngle(blueObj3), 152, 30);
- greyObj4 = CreateShotOA1(blueObj4, 0, ObjMove_GetAngle(blueObj4), 152, 30);
- greyObj5 = CreateShotOA1(blueObj5, 0, ObjMove_GetAngle(blueObj5), 152, 30);
- greyObj6 = CreateShotOA1(blueObj6, 0, ObjMove_GetAngle(blueObj6), 152, 30);
- greyObj7 = CreateShotOA1(blueObj7, 0, ObjMove_GetAngle(blueObj7), 152, 30);
- greyObj8 = CreateShotOA1(blueObj8, 0, ObjMove_GetAngle(blueObj8), 152, 30);
- greyObj9 = CreateShotOA1(blueObj9, 0, ObjMove_GetAngle(blueObj9), 152, 30);
- greyObj10 = CreateShotOA1(blueObj10, 0, ObjMove_GetAngle(blueObj10), 152, 30);
- greyObj11 = CreateShotOA1(blueObj11, 0, ObjMove_GetAngle(blueObj11), 152, 30);
- greyObj12 = CreateShotOA1(blueObj12, 0, ObjMove_GetAngle(blueObj12), 152, 30);
- greyObj13 = CreateShotOA1(blueObj13, 0, ObjMove_GetAngle(blueObj13), 152, 30);
- //objangle+=360/8;
- }
- if (shotCount == 3) {
- ObjMove_AddPatternA2(greyObj1,200,1,NO_CHANGE,0.5,NO_CHANGE,10);
- ObjMove_SetMaxSpeed(greyObj2,0.1);
- ObjMove_SetAcceleration(greyObj1,0.5);
- ObjMove_SetSpeed(greyObj2,0.1);
- ObjMove_SetAcceleration(greyObj2,0.005);
- ObjMove_SetSpeed(greyObj3,0.1);
- ObjMove_SetAcceleration(greyObj3,0.005);
- ObjMove_SetSpeed(greyObj4,0.1);
- ObjMove_SetAcceleration(greyObj4,0.005);
- ObjMove_SetSpeed(greyObj5,0.1);
- ObjMove_SetAcceleration(greyObj5,0.005);
- ObjMove_SetSpeed(greyObj6,0.1);
- ObjMove_SetAcceleration(greyObj6,0.005);
- ObjMove_SetSpeed(greyObj7,0.1);
- ObjMove_SetAcceleration(greyObj7,0.005);
- ObjMove_SetSpeed(greyObj8,0.1);
- ObjMove_SetAcceleration(greyObj8,0.005);
- ObjMove_SetSpeed(greyObj9,0.1);
- ObjMove_SetAcceleration(greyObj9,0.005);
- ObjMove_SetSpeed(greyObj10,0.1);
- ObjMove_SetAcceleration(greyObj10,0.005);
- ObjMove_SetSpeed(greyObj11,0.1);
- ObjMove_SetAcceleration(greyObj11,0.005);
- ObjMove_SetSpeed(greyObj12,0.1);
- ObjMove_SetAcceleration(greyObj12,0.005);
- ObjMove_SetSpeed(greyObj13,0.1);
- ObjMove_SetAcceleration(greyObj13,0.005);
- shotCount = 0;
- wait(500);
- }
- }
- }
- }
- task end {
- loop {
- if (ObjEnemy_GetInfo(bossObj, INFO_LIFE) == 0) {
- DeleteShotAll(TYPE_ALL,TYPE_IMMEDIATE);
- RemoveSound(GetCurrentScriptDirectory ~ "tan00.wav");
- RemoveSound(GetCurrentScriptDirectory ~ "tan01.wav");
- RemoveSound(GetCurrentScriptDirectory ~ "tan02.wav");
- Obj_Delete(bossObj);
- }
- yield;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement