Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // header
- #東方弾幕風[Single]
- #ScriptVersion[3]
- #Title["テスト「ダークネス」"]
- #Text["azaka`crossのはじめのスペカー"]
- // include files
- #include"script/default_system/Default_ShotConst.txt"
- #include"script/default_system/Default_Effect.txt"
- // globs
- let objEnemy;
- let inMotion = false;
- @Initialize
- {
- objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS); // generates boss obj
- ObjEnemy_Regist(objEnemy); // Sets objEnemy to active
- ObjEnemy_SetDamageRate(objEnemy, 50, 75); // 50% dmg from bullets, 75% dmg from bomb
- // Load important tasks here
- // Tasks are "microthreads" which perform independently of one another
- // Using the yield; command in a task suspends it, when placed in loop(n) { }
- // It will suspend for n frames.
- TWork;
- TEnemDraw;
- TFinish;
- }
- @MainLoop
- {
- let enemyX = ObjMove_GetX(objEnemy);
- let enemyY = ObjMove_GetY(objEnemy);
- // Enemy collision to bullets
- ObjEnemy_SetIntersectionCircleToShot(objEnemy, enemyX, enemyY, 32);
- // Enemy collision to player chara
- ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, enemyX, enemyY, 24);
- yield; // Allows all tasks to perform their job before repeating @MainLoop
- }
- @Event
- {
- alternative(GetEventType())
- case(EV_REQUEST_LIFE)
- {
- SetScriptResult(250) // Set eHP to 500
- }
- case(EV_REQUEST_TIMER)
- {
- SetScriptResult(120) // Set timer to 120s
- }
- case(EV_REQUEST_SPELL_SCORE)
- {
- SetScriptResult(50000) // Set score get to 50k
- }
- }
- /*******
- * Tasks
- ********/
- // Power task, performing the bulk
- task TWork
- {
- let stgX = GetStgFrameWidth() / 2; // Obtains the X coordinate of the center of the stage
- /*******
- * Parameters:
- * real: object id ,
- * real: X-coordinate (in this example, X coord of the center) ,
- * real: Y-coordinate (in this example, 60 pixels below (stgX,0)) ,
- * real: the frame the object should be placed in (stgX, 60)
- ********/
- ObjMove_SetDestAtFrame(objEnemy, stgX, 60, 60);
- loop(60) { yield; } // Suspend this task for 60 frames or 1 second
- // Performs spell card activation
- let objScene = GetEnemyBossSceneObjectID();
- ObjEnemyBossScene_StartSpell(objScene);
- // Perform this while the enemy isn't dead yet
- while(!Obj_IsDeleted(objEnemy))
- {
- // Danmaku processing goes here.
- }
- }
- // Drawing task
- task TEnemDraw
- {
- let imgExRumia = GetCurrentScriptDirectory ~ "ExRumia.png";
- ObjPrim_SetTexture(objEnemy, imgExRumia); // Set exrumia.png as texture to objEnemy
- while(!Obj_IsDeleted(objEnemy)) // perform this while the enemy isn't dead yet
- {
- let angle = ObjMove_GetAngle(objEnemy);
- let speed = ObjMove_GetSpeed(objEnemy);
- if(speed == 0) // Only perform this entire block if Rumia's speed was 0
- {
- if(inMotion) // Perform this block if Rumia was in motion
- {
- /**************************
- * Parameters - Takes only ONE texture image:
- * real: object's id ,
- * real: lower-left point ,
- * real: upper-left point ,
- * real: upper-right point ,
- * real: lower-right point
- **************************/
- ObjSprite2D_SetSourceRect(objEnemy, 64, 1, 127, 64);
- }
- else // Otherwise, make her appear stationary.
- {
- ObjSprite2D_SetSourceRect(objEnemy, 1, 1, 64, 64);
- }
- }
- // positive value = move right, so make Rumia's body go right
- else if (cos(angle) > 0) { ObjSprite2D_SetSourceRect(objEnemy, 192, 1, 255, 64); }
- // negative value = move left, so make Rumia's body go left
- else if (cos(angle) < 0) { ObjSprite2D_SetSourceRect(objEnemy, 128, 1, 191, 64); }
- ObjSprite2D_SetDestCenter(objEnemy);
- yield; // This loop performed once per frame
- }
- }
- // Bullet routines
- // Post-fight processing
- task TFinish
- {
- // Suspend this task indefinitely as long as enemy is still alive
- while(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0)
- {
- yield;
- }
- let enemyX = ObjMove_GetX(objEnemy);
- let enemyY = ObjMove_GetY(objEnemy);
- /******
- * TExplosionA is found in "script/default_system/..."
- * Parameters:
- * real: X coordinate of the explosion ,
- * real: Y coordinate of the explosion ,
- * real: "dAlpha" - reduce the brightness of the explosion by this amount
- * real: "dScale" - adjust the size of the explosion by this multiplier
- ******/
- TExplosionA = (enemyX, enemyY, 45, 0.7);
- DeleteShotAll(TYPE_ALL, TYPE_ITEM); // Get rid of everything
- Obj_Delete(objEnemy); // Delete the enemy to kill the loops
- loop(30) { yield; } // suspend this task for half a second
- // Don't forget to close the script when it ends!
- CloseScript(GetOwnScriptID());
- }
Advertisement
Add Comment
Please, Sign In to add comment