Advertisement
Guest User

text

a guest
Jan 7th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. #TouhouDanmakufu[Single]
  2. #ScriptVersion[3] //This is required for ph3 scripts
  3. #Title["Border of cliche and beginner"]
  4. #Text["SampleA01:Shooting Bullets Straight Down"]
  5. #BGM ["./LLS - Alice Maestra.mp3"]
  6.  
  7. //Danmakufu basic has dimensions 384 x 448
  8. //Load the default shotsheet
  9. #include"script/default_system/Default_ShotConst.txt"
  10. #incluce"script/default_system/Extra_ShotConst.txt"
  11.  
  12.  
  13. let objBoss; //Enemy object
  14. let objScene = GetEnemyBossSceneObjectID();
  15. //----------------------------------------------------
  16. //Enemy movement
  17. //----------------------------------------------------
  18. @Event
  19. {
  20. alternative(GetEventType())
  21. case(EV_REQUEST_LIFE){
  22. SetScriptResult(500); //Setting the enemy's life to 500
  23. }
  24. case(EV_REQUEST_TIMER){
  25. SetScriptResult(60); //Setting script timer to 60 seconds
  26. }
  27. case(EV_REQUEST_SPELL_SCORE){
  28. SetScriptResult(1000000); //Set spellcard score value
  29. }
  30. }
  31.  
  32. @Initialize
  33. {
  34. //Creating and registering enemy objects
  35. objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  36. ObjEnemy_Regist(objBoss);
  37.  
  38. //Moving to the coordinate (centre of X axis, 60) in 60 frames
  39.  
  40. ObjMove_SetDestAtFrame(objBoss, GetCenterX(), 60, 60);
  41.  
  42. //Designate the beginning of a spellcard
  43. ObjEnemyBossScene_StartSpell(objScene);
  44.  
  45. //Calling TCutIn to draw a cut in when the spell starts
  46. //TCutIn;
  47.  
  48. //Calling TDrawLoop which draws enemy graphics
  49. TDrawLoop;
  50.  
  51. //Calling TFinalize task which will end the spellcard
  52. TFinalize;
  53.  
  54. //Calling MainTask task which will create bullets
  55. MainTask;
  56. }
  57.  
  58. @MainLoop{
  59. //retrieving enemy coordinates
  60. let ex = ObjMove_GetX(objBoss);
  61. let ey = ObjMove_GetY(objBoss);
  62.  
  63. //Setting the enemy hit box
  64. ObjEnemy_SetIntersectionCircleToShot(objBoss, ex, ey, 32); //hitbox against player bullets. 32 is the radius.
  65. ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ex, ey, 0); //hitbox against the player. 24 is the radius.
  66.  
  67. //Needed for task to work
  68. yield;
  69. }
  70.  
  71. function GetCenterX(){
  72. return GetStgFrameWidth() / 2;
  73. }
  74.  
  75. function GetCenterY(){
  76. return GetStgFrameHeight() / 2;
  77. }
  78.  
  79. function wait(n) {
  80. loop(n) {yield;}
  81. }
  82.  
  83. function rand_int(min, max){
  84. return truncate(rand(min, max+1))
  85. }
  86.  
  87. task TFinalize {
  88. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0) {yield;}
  89. Obj_Delete(objBoss);
  90. DeleteShotAll(TYPE_ALL, TYPE_ITEM);
  91. SetAutoDeleteObject(true);
  92. wait(30);
  93. CloseScript(GetOwnScriptID());
  94.  
  95. if (ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT)
  96. + ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0) {
  97. AddScore(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE));
  98. }
  99. return;
  100. }
  101.  
  102. //Creating MainTask. Will run and fire bullet if enemy life is > 0.
  103.  
  104. task MainTask{
  105. BoWaP
  106. }
  107.  
  108. task BoWaP{
  109. let angleT = rand(0, 360);
  110. let objcount = 0;
  111. while (ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
  112. CreateShotA1(102, 134, 3, angleT, 1, 5);
  113. CreateShotA1(282, 134, 3, angleT, 601, 5);
  114. angleT += sin(objcount) * 12; //BOWAP
  115. objcount += 1;
  116. yield;
  117. }
  118. }
  119.  
  120. task TDrawLoop {
  121. let imgExRumia = GetCurrentScriptDirectory() ~ "/art/ExRumia.png"; //file path to enemy image
  122. ObjPrim_SetTexture(objBoss, imgExRumia);
  123. while(!Obj_IsDeleted(objBoss))
  124. {
  125. let angle = ObjMove_GetAngle(objBoss);
  126. let speed = ObjMove_GetSpeed(objBoss);
  127. if(speed == 0){ObjSprite2D_SetSourceRect(objBoss, 64, 1, 127, 64);}
  128. else if(cos(angle) > 0){ObjSprite2D_SetSourceRect(objBoss, 192, 1, 255, 64);}
  129. else if(cos(angle) < 0){ObjSprite2D_SetSourceRect(objBoss, 128 ,1, 191, 64);}
  130. ObjSprite2D_SetDestCenter(objBoss);
  131. yield;
  132. }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement