Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #東方弾幕風[Stage]
- #ScriptVersion[3]
- #Title["HRtP Stage 1"]
- #Text["HRtP Stage 1"]
- let bgm;
- function wait(n)
- {
- loop(n)
- {
- yield;
- }
- }
- function randInt(min, max)
- {
- return trunc(rand(min, max + 1));
- }
- function spawnOrb(x, y, a)
- {
- let enemy = ObjEnemy_Create(OBJ_ENEMY);
- ObjMove_SetPosition(enemy, x, y);
- ObjMove_SetSpeed(enemy, 1);
- ObjMove_SetAngle(enemy, a);
- ObjEnemy_SetLife(enemy, 1);
- ObjPrim_SetTexture(enemy, "script/JayRS/resource/img/orb.png");
- ObjSprite2D_SetSourceRect(enemy, 4, 5, 28, 27);
- ObjEnemy_Regist(enemy);
- TSpawnOrb(enemy);
- }
- function manageBGM(obj, ID)
- {
- ObjSound_SetSoundDivision(obj, SOUND_BGM);
- ObjSound_SetRestartEnable(obj, true);
- ObjSound_SetLoopEnable(obj, true);
- ObjSound_SetLoopTime(obj, 0, 61.714);
- return obj;
- }
- @Initialize
- {
- TStage;
- }
- @Event
- {
- alternative(GetEventType())
- case(EV_PAUSE_ENTER)
- {
- ObjSound_Stop(bgm);
- }
- case(EV_PAUSE_LEAVE)
- {
- ObjSound_Play(bgm);
- }
- }
- @MainLoop
- {
- yield;
- }
- task TStage
- {
- wait(40);
- bgm = ObjSound_Create();
- ObjSound_Load(bgm, "script/JayRS/resource/bgm/hrtpstage1.ogg");
- manageBGM(bgm, 1);
- ObjSound_Play(bgm);
- loop(10)
- {
- spawnOrb(0, 20, 0);
- spawnOrb(GetStgFrameWidth(), 20, 180);
- wait(20);
- }
- loop(10)
- {
- let randX = randInt(1, GetStgFrameWidth());
- loop(10)
- {
- spawnOrb(randX, 0, 90);
- wait(20)
- }
- wait(80);
- }
- let pluralScript = LoadScriptInThread("script/JayRS/HRtP/HRtP-stage1midboss.txt");
- wait(60);
- StartScript(pluralScript);
- while(!IsCloseScript(pluralScript) && GetPlayerState() != STATE_END)
- {
- yield;
- }
- wait(240);
- CloseStgScene();
- }
- task TSpawnOrb(e)
- {
- let x = 0;
- let y = 0;
- while(ObjEnemy_GetInfo(e, INFO_LIFE) > 0 && !Obj_IsDeleted(e))
- {
- x = ObjMove_GetX(e);
- y = ObjMove_GetY(e);
- ObjEnemy_SetIntersectionCircleToShot(e, x, y, 24);
- ObjEnemy_SetIntersectionCircleToPlayer(e, x, y, 20);
- ObjSprite2D_SetDestCenter(e);
- if((x < -100) || (x > GetStgFrameWidth() + 100) || (y < -100) || (y > GetStgFrameWidth() + 100))
- {
- Obj_Delete(e);
- return;
- }
- yield;
- }
- Obj_Delete(e);
- let soundEnemyDie = ObjSound_Create();
- ObjSound_Load(soundEnemyDie, "script/JayRS/resource/se/enemydeath.wav");
- ObjSound_SetSoundDivision(soundEnemyDie, SOUND_SE);
- ObjSound_Play(soundEnemyDie);
- let randResult = randInt(1, 10);
- if(randResult <= 4)
- {
- CreateItemA1(ITEM_POWER, x, y, 10);
- }
- else
- {
- CreateItemA1(ITEM_POINT, x, y, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement