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 {
- Time_Sign_Imaginary_Vertical_Time;
- /*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;
- }
- }
- }
- //Ultima Created this
- task Time_Sign_Imaginary_Vertical_Time{
- let shot_array = []; //Prepare an array for usage later.
- loop(200){yield;} //Yielding 200 times going by your original code
- //Create a ring of bullets that spawn other bullets
- ascent(i in 0..13){
- CreateBulletSpecial(ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),3,360/13*i,150,15,-0.7);
- CreateBulletSpecial(ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),3,360/13*i,150,15,0.7);
- }
- loop(320){yield;} //Wait 3 secs
- //fill the array we created earlier with the object id of every bullet on the screen
- //within the radius of 999px
- shot_array = GetShotIdInCircleA2(384/2,448/2,999,TARGET_ENEMY);
- //Give all of the bullets acceleration and a speed cap and change the color to purple
- ascent(i in 0..length(shot_array)){
- ObjMove_SetAcceleration(shot_array[i],0.01);
- ObjMove_SetMaxSpeed(shot_array[i],3);
- ObjShot_SetGraphic(shot_array[i],151);
- }
- //End of task
- }
- function CreateBulletSpecial(X,Y,SPEED,ANGLE,GRAPHIC,DELAY,VELOCITY){
- //Create a bullet and assign it's object id inside of a variable.
- let obj = CreateShotA1(X,Y,SPEED,ANGLE,GRAPHIC,DELAY);
- //Increases the bullet's angle by a value (be careful or you may have looping bullets that never leave the screen)
- ObjMove_SetAngularVelocity(obj,VELOCITY);
- //Apply special actions to the bullet when it is spawned.
- BulletActions;
- task BulletActions{
- while(!Obj_IsDeleted(obj)){ //As long as the bullet exists do the following below
- //Create another bullet at the main's position with the same angle.
- CreateShotA1(ObjMove_GetX(obj),ObjMove_GetY(obj),0,ObjMove_GetAngle(obj),152,15);
- //Yield 20 times before creating the next bullet.
- loop(20){yield;}
- }
- //End of task
- }
- return obj
- //End of Function
- }
- 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