Guest User

Danmakufu Single

a guest
Nov 7th, 2014
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. #TouhouDanmakufu[Single]
  2. #ScriptVersion[3]
  3. #Title["Lilly 1"]
  4. #Text["Lilly's First Nonspell"]
  5.  
  6. let bossObj;
  7. let bossX = 0;
  8. let bossY = 0;
  9. let imgBoss = GetCurrentScriptDirectory ~ "/img/Placeholder.png";
  10.  
  11. #include "script/default_system/Default_ShotConst.txt"
  12.  
  13. //My bffl <3
  14. function wait(w) {
  15. loop(w) {yield;}
  16. }
  17. @Initialize {
  18. //define a boss in bossObj and register
  19. bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  20. ObjEnemy_Regist(bossObj);
  21. ObjMove_SetPosition(bossObj, 192, -100);
  22.  
  23. ObjMove_SetDestAtSpeed(bossObj, 192, 170, 5);
  24. mainTask;
  25. die;
  26. }
  27.  
  28. @Event {
  29. //setting boss hp and shenanigans
  30.  
  31. alternative(GetEventType())
  32. case(EV_REQUEST_LIFE) {
  33. SetScriptResult(1500);
  34. }
  35. case(EV_REQUEST_TIMER) {
  36. SetScriptResult(40);
  37. }
  38.  
  39.  
  40. }
  41.  
  42. @MainLoop {
  43. bossX = ObjMove_GetX(bossObj);
  44. bossY =ObjMove_GetY(bossObj);
  45.  
  46. //collision
  47.  
  48. ObjEnemy_SetIntersectionCircleToShot(bossObj, bossX, bossY, 18);
  49. ObjEnemy_SetIntersectionCircleToPlayer(bossObj, bossX, bossY, 25);
  50.  
  51.  
  52. yield;
  53. }
  54.  
  55.  
  56. @Finalize {
  57.  
  58. }
  59. task mainTask {
  60. renderBoss;
  61. movement;
  62. }
  63. task renderBoss {
  64. let dir;
  65. let speed;
  66.  
  67. ObjPrim_SetTexture(bossObj, imgBoss);
  68. ObjSprite2D_SetSourceRect(bossObj, 0, 0, 63, 116);
  69. ObjSprite2D_SetDestCenter(bossObj);
  70. ObjRender_SetScaleXYZ(bossObj, 1, 1, 0);
  71.  
  72. while(!Obj_IsDeleted(bossObj)) {
  73. //update speed and direction
  74. dir = ObjMove_GetAngle(bossObj);
  75. speed = ObjMove_GetSpeed(bossObj);
  76.  
  77. yield;
  78. }
  79. }
  80. //i feel like cirno right now ;~;
  81. task movement {
  82. wait(60);
  83. loop{
  84. ObjMove_SetDestAtSpeed(bossObj, 100, 120, 4);
  85. fire;
  86. wait(90);
  87. ObjMove_SetDestAtSpeed(bossObj, 280, 120, 4);
  88. fire;
  89. wait(90);
  90. }
  91.  
  92. }
  93. task fire {
  94. loop(round(rand(10, 30))) {
  95. CreateShotA1(bossX, bossY, 3, GetAngleToPlayer(bossObj) - 20, 54, 0);
  96. CreateShotA1(bossX, bossY, 3, GetAngleToPlayer(bossObj), 54, 0);
  97. CreateShotA1(bossX, bossY, 3, GetAngleToPlayer(bossObj) + 20, 54, 0);
  98. wait(3);
  99. }
  100.  
  101. }
  102.  
  103. task die{
  104. loop{
  105. if(ObjEnemy_GetInfo(bossObj, INFO_LIFE) <= 0)
  106. {
  107. //The enemy is killed immediately when life is 0
  108. //As this is a beginner sample script,
  109. //the script is ended immediately without waiting for an explosion effect.
  110. ObjMove_SetDestAtSpeed(bossObj, 200, 200, 4);
  111. DeleteShotAll(TYPE_ALL, TYPE_ITEM);
  112. Obj_Delete(bossObj);
  113. DeleteShotAll(TYPE_ALL, TYPE_ITEM);
  114. CloseScript(GetOwnScriptID());
  115. return;
  116. }
  117. yield;
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment