Advertisement
Guest User

Coding attempt

a guest
Mar 26th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1.  
  2. #TouhouDanmakufu[Single]
  3. #ScriptVersion[3]
  4. #Title["My First Danmakufu Script!"]
  5. #Text["Code by Ender[r]My First Bullet!"]
  6. #BGM["./necrofantasia.ogg"]
  7. #include "script/default_system/Default_ShotConst.txt"
  8. let objBoss;
  9. let objScene=GetEnemyBossSceneObjectID();
  10. @Event{
  11. alternative(GetEventType())
  12. case(EV_REQUEST_LIFE){
  13. SetScriptResult(500);
  14. }
  15. case(EV_REQUEST_TIMER){
  16. SetScriptResult(60);
  17. }
  18. case(EV_REQUEST_SPELL_SCORE){
  19. SetScriptResult(1000000);
  20. }
  21. }
  22. @Initialize{
  23. objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  24. ObjEnemy_Regist(objBoss);
  25. ObjMove_SetDestAtFrame(objBoss, GetCenterX, 60, 60);
  26. ObjEnemyBossScene_StartSpell(objScene);
  27. TDrawLoop;
  28. TFinalize;
  29. MainTask;
  30. }
  31. @MainLoop{
  32. ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32);
  33. ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 24);
  34. yield;
  35. }
  36.  
  37. task MainTask{
  38. ObjMove_SetDestAtFrame(objBoss, GetCenterX(), 60, 60)
  39. wait(120);
  40. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
  41. CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), rand(3, 6), rand(0, 360), DS_BALL_S_BLUE, 20);
  42. yield;
  43. }
  44. }
  45. task movement{
  46. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
  47. ObjMove_SetDestAtFrame(objBoss, rand(GetCenterX + 90, GetCenterX - 90), rand(GetCenterY - 60, GetCenterY - 120), 60);
  48. wait(240);
  49. }
  50. }
  51. task fireA{
  52. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
  53. let angleT = GetAngleToPlayer(objBoss);
  54. ascent(i in -1..2){
  55. ascent(j in 0..3){
  56. CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 3 - j/6, angleT + i*15, DS_RICE_M_SKY, 5);
  57. }
  58. }
  59. wait(120);
  60. }
  61. }
  62. task fireB{
  63. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
  64. let angleT = GetAngleToPlayer(objBoss);
  65. loop(13){
  66. ascent(i in 0..3){
  67. CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2.5 - i/3, angleT, DS_BALL_S_RED + i, 5);
  68. }
  69. angleT += 360/13;
  70. }
  71. wait(30);
  72. }
  73. }
  74. task TDrawLoop {
  75. let imgExRumia = GetCurrentScriptDirectory() ~ "ExRumia.png";
  76. ObjPrim_SetTexture(objBoss, imgExRumia);
  77. ObjSprite2D_SetSourceRect(objBoss, 64, 1, 127, 64);
  78. ObjSprite2D_SetDestCenter(objBoss);
  79. }
  80. task TFinalize {
  81. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
  82. if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT)
  83. +ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0){
  84. AddScore(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE));
  85. }
  86. Obj_Delete(objBoss);
  87. DeleteShotAll(TYPE_ALL,TYPE_IMMEDIATE);
  88. SetAutoDeleteObject(true);
  89. CloseScript(GetOwnScriptID());
  90. return;
  91. }
  92.  
  93. function rand_int(min, max){
  94. return round(rand(min, max))
  95.  
  96. function GetCenterX() {
  97. return GetStgFrameWidth() / 2;
  98. }
  99. function GetCenterU(){
  100. return GetStgFrameHeighr() / 2;
  101. }
  102.  
  103. function wait (n){
  104. loop(n){yield;}
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement