Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TouhouDanmakufu[Single]
- #ScriptVersion[3]
- #Title["Script #3"]
- #Text["Exploding Ring Random"]
- #BGM["./BLD.mp3"]
- #include "script/AllStarShot/AllStarShot_Const_Andi.txt"
- let objBoss;
- let objScene = GetEnemyBossSceneObjectID();
- @Event{
- alternative(GetEventType())
- case(EV_REQUEST_LIFE){
- SetScriptResult(3500);
- }
- case(EV_REQUEST_TIMER){
- SetScriptResult(60);
- }
- case(EV_REQUEST_SPELL_SCORE){
- SetScriptResult(1000000);
- }
- }
- @Initialize{
- objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
- ObjEnemy_Regist(objBoss);
- ObjMove_SetDestAtFrame(objBoss, GetCenterX, 120, 60);
- ObjEnemyBossScene_StartSpell(objScene);
- TDrawLoop; // Defined OUTSIDE
- TFinalize;
- MainTask;
- }
- @MainLoop{
- ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32);
- ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 24);
- yield;
- }
- task MainTask{
- wait(60);
- movement;
- fireA;
- }
- task fireA{
- while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
- let angle = rand(0, 360);
- let obj = CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2.5, angle, 99, 5);
- Explode(obj);
- yield;
- }
- }
- task Explode(obj){
- wait(45);
- ObjMove_SetSpeed(obj, rand_int(0, 30));
- let speed = ObjMove_GetSpeed(obj);
- if(speed > 1){
- ObjMove_SetSpeed(obj, 2.5); // Set speed back to normal if obj's speed > 1
- }
- else{ // Execute if obj's speed < 1. Probability: 3.33%.
- let angle = rand(0, 360);
- ObjMove_SetSpeed(obj, 0);
- ObjMove_AddPatternA3(obj, 0, NO_CHANGE, NO_CHANGE, 0, 0, 2.5, 103); // Change graphic if the object's going to explode
- wait(100);
- loop(8){
- let obj2 = CreateShotA1(ObjMove_GetX(obj), ObjMove_GetY(obj), 2, angle, 3, 15); // Create ring of bullet (Exploding effect)
- angle += 360/8;
- ObjMove_AddPatternA1(obj2, 60, 2.7, rand(80, 100)); // Redirect the bullet
- }
- Obj_Delete(obj); // Delete the original object
- }
- }
- task movement{
- while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
- ObjMove_SetDestAtFrame(objBoss, rand(GetCenterX + 90, GetCenterX - 90), rand(GetCenterY - 60, GetCenterY - 120), 60);
- wait(60);
- }
- }
- task TDrawLoop{
- let imgBoss = GetCurrentScriptDirectory() ~ "texture/cirno.png"; // Declare variable imgBoss
- ObjPrim_SetTexture(objBoss, imgBoss); // Set Enemy's image as imgBoss
- ObjSprite2D_SetSourceRect(objBoss, 64, 1, 127, 64); // Set Enemy's sprite
- ObjSprite2D_SetDestCenter(objBoss); // Center the sprite with the Enemy
- }
- task TFinalize{
- while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
- if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT)
- + ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0){
- AddScore(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE));
- }
- Obj_Delete(objBoss);
- DeleteShotAll(TYPE_ALL, TYPE_IMMEDIATE);
- SetAutoDeleteObject(true);
- CloseScript(GetOwnScriptID());
- return;
- }
- function GetCenterX(){
- return GetStgFrameWidth() / 2;
- }
- function GetCenterY(){
- return GetStgFrameHeight() / 2;
- }
- function wait(n){
- loop(n){yield;}
- }
- function rand_int(min, max){
- return truncate(rand(min, max + 1));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement