Guest User

partially working script

a guest
May 8th, 2020
6
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #TouhouDanmakufu[Single]
  2. #ScriptVersion[3]
  3. #Title["002 pastebin edit"]
  4. #Text[""]
  5. //#Image[]
  6. //#BGM["./whatever.mp3"]
  7.  
  8. #include "script/default_system/Default_ShotConst.txt"
  9.  
  10. let objBoss;
  11. let objScene = GetEnemyBossSceneObjectID();
  12. let frame = 0;
  13. let angleT = 22.5;
  14.  
  15. @Event {
  16. alternative(GetEventType())
  17. case(EV_REQUEST_LIFE) {
  18. SetScriptResult(500);
  19. }
  20. case(EV_REQUEST_TIMER) {
  21. SetScriptResult(90);
  22. }
  23. case(EV_REQUEST_SPELL_SCORE) {
  24. SetScriptResult(150000);
  25. }
  26. }
  27.  
  28. @Initialize {
  29. objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  30. ObjEnemy_Regist(objBoss);
  31. ObjMove_SetDestAtFrame(objBoss, GetCenterX(), 90, 30);
  32.  
  33. ObjEnemyBossScene_StartSpell(objScene);
  34.  
  35. TDrawLoop;
  36. TFinalize;
  37. TDrawDifficulty;
  38. }
  39.  
  40. @MainLoop {
  41. ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32);
  42. ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 24);
  43.  
  44. frame++;
  45. if (frame % 60 == 0) {
  46. fire;
  47. }
  48. }
  49.  
  50. //-----------------------------------------------------------------------------------------------------------------------
  51.  
  52. task fire {
  53. if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0) {
  54. return;
  55. }
  56. //Default kill to prevent (0,0) spawning
  57. loop(7) {
  58. CreateStraightLaserA1(ObjMove_GetX(objBoss) + 50 * cos(angleT), ObjMove_GetY(objBoss) + 50 * sin(angleT), angleT, 400, 15, 20, DS_BALL_S_RED, 40);
  59. CreateShotA1(ObjMove_GetX(objBoss) + 60 * cos(angleT), ObjMove_GetY(objBoss) + 60 * sin(angleT), 0.9, angleT, DS_BALL_S_RED, 70);
  60. CreateShotA1(ObjMove_GetX(objBoss) + 60 * cos(angleT), ObjMove_GetY(objBoss) + 60 * sin(angleT), 0.9, angleT + 10, DS_BALL_S_RED, 70);
  61. CreateShotA1(ObjMove_GetX(objBoss) + 60 * cos(angleT), ObjMove_GetY(objBoss) + 60 * sin(angleT), 0.9, angleT - 10, DS_BALL_S_RED, 70);
  62. CreateShotA1(ObjMove_GetX(objBoss) + 60 * cos(angleT), ObjMove_GetY(objBoss) + 60 * sin(angleT), 1.1, angleT + 5, DS_BALL_S_RED, 70);
  63. CreateShotA1(ObjMove_GetX(objBoss) + 60 * cos(angleT), ObjMove_GetY(objBoss) + 60 * sin(angleT), 1.1, angleT - 5, DS_BALL_S_RED, 70);
  64. CreateShotA1(ObjMove_GetX(objBoss) + 60 * cos(angleT), ObjMove_GetY(objBoss) + 60 * sin(angleT), 1.3, angleT, DS_BALL_S_RED, 70);
  65. angleT += 360/7;
  66. }
  67. angleT += 14.1;
  68. }
  69.  
  70. task TDrawLoop {
  71. let imgExRumia = GetCurrentScriptDirectory() ~ "ExRumia.png";
  72. ObjPrim_SetTexture(objBoss, imgExRumia);
  73.  
  74. ObjSprite2D_SetSourceRect(objBoss, 64, 1, 127, 64);
  75. ObjSprite2D_SetDestCenter(objBoss);
  76. }
  77.  
  78. task TDrawDifficulty {
  79. let objText = ObjText_Create();
  80. ObjText_SetText(objText, "Testing");
  81. ObjText_SetFontSize(objText, 24);
  82. ObjText_SetFontType(objText, "Revue");
  83. ObjText_SetFontBold(objText, true);
  84. ObjText_SetFontColorTop(objText, 255, 255, 255);
  85. ObjText_SetFontColorBottom(objText, 255, 255, 255);
  86. ObjText_SetFontBorderType(objText, BORDER_FULL);
  87. ObjText_SetFontBorderColor(objText, 226, 176, 7);
  88. ObjText_SetFontBorderWidth(objText, 2);
  89. Obj_SetRenderPriority(objText, 0.01);
  90. ObjRender_SetX(objText, 428);
  91. ObjRender_SetY(objText, 12);
  92. }
  93.  
  94. // funclib copied so it works
  95.  
  96. function GetCenterX() {
  97. return GetStgFrameWidth() / 2;
  98. }
  99.  
  100. function GetCenterY() {
  101. return GetStgFrameHeight() / 2;
  102. }
  103.  
  104. function wait(n) {
  105. loop(n) {
  106. yield;
  107. }
  108. }
  109.  
  110. function rand_int(min, max) {
  111. return round(rand(min, max));
  112. }
  113.  
  114. task TFinalize {
  115. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0) {
  116. yield;
  117. }
  118.  
  119. if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT) + ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0) { // this IF and anything in it will cause the spell to actually award score
  120. AddScore(truncate(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE) / 10) * 10);
  121. }
  122.  
  123. Obj_Delete(objBoss);
  124. DeleteShotAll(TYPE_ALL, TYPE_IMMEDIATE);
  125. SetAutoDeleteObject(true);
  126. CloseScript(GetOwnScriptID());
  127. return;
  128. }
RAW Paste Data