BananaCupcake

Untitled

Oct 7th, 2017
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #TouhouDanmakufu[Single]
  2. #ScriptVersion[3]
  3. #Title["Test System Contest or not SPELL 4"]
  4. #Text["???"]
  5.  
  6. // Example, definitely required for cut-in.
  7. let Cutin = GetCurrentScriptDirectory ~ "img/flan_cutin.png";
  8. let objBoss;
  9. let objScene=GetEnemyBossSceneObjectID();
  10. let size = 0.8;
  11. let type = true;
  12. let obj = 1;
  13. let bSpell = false;
  14. let l = 1024;
  15. let w = 40;
  16. let dt = 1000;
  17. let graph = 41;
  18. let delay = 10;
  19.  
  20. #include "./System !/Default_Effect.txt"
  21. #include "./System !/Shot/AllStarShot_Const.txt"
  22. #include "./Cutin.txt"
  23. #include "./SoundFunctions.txt"
  24.  
  25. @Initialize{
  26. objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  27. ObjEnemy_Regist(objBoss);
  28. ObjMove_SetDestAtFrame(objBoss, GetCenterX, 100, 50);
  29. ObjEnemyBossScene_StartSpell(objScene);
  30. ObjCutin_SetSpellcardS4("Forbidden Danmaku 'Bloody Ruby Rings'", Cutin, YABUSAME, 6000, 10, 7000);
  31. ObjCutin_LaunchS3(KANAKO, Cutin, "Focuser");
  32. PlaySound("cardcall",100,0);
  33. TDrawLoop;
  34. TFinalize;
  35. MainTask;
  36. RenderBG;
  37. DrawName;
  38. Move;
  39. }
  40.  
  41. @Event {
  42. alternative(GetEventType())
  43. case(EV_REQUEST_LIFE){
  44. SetScriptResult(4000);
  45. }
  46. case(EV_REQUEST_TIMER){
  47. SetScriptResult(60);
  48. }
  49. case(EV_REQUEST_SPELL_SCORE){
  50. SetScriptResult(900000);
  51. }
  52. case(EV_REQUEST_IS_DURABLE_SPELL){
  53. SetScriptResult(true);
  54. }
  55. }
  56.  
  57. @MainLoop {
  58. let objScene = GetEnemyBossSceneObjectID();
  59. if(objScene != ID_INVALID && ObjEnemyBossScene_GetInfo(objScene, INFO_IS_SPELL))
  60. {
  61. bSpell = true;
  62. }
  63. else
  64. {
  65. bSpell = false;
  66. }
  67. yield;
  68. }
  69.  
  70. task MainTask{
  71. wait(120);
  72. ObjMove_SetDestAtFrame(objBoss, GetCenterX, 150, 30);
  73. magiccircle(objBoss,size,type);
  74. wait(180);
  75. PlaySound("Charge2",100,0);
  76. fireA;
  77.  
  78. }
  79.  
  80. task fireA{
  81. let angleT1 = 0;
  82. let angleT2 = 0;
  83. let a1 = 180;
  84. let a2 = 180;
  85. let dir = 1.09;
  86. let count = 0;
  87.  
  88. while(!Obj_IsDeleted(objBoss)){
  89. angleT2 = rand(0,360);
  90. PlaySound("Shot2",100,0);
  91. circle(16,2,12,25,1.6,19,angleT2,-dir,480,0);
  92. dir *= -1;
  93. wait(36);
  94. ObjMove_SetDestAtWeight(objBoss,rand(GetPlayerX()-12,GetPlayerX()+12),rand(100,130),9,8);
  95. wait(360);
  96. }
  97. task circle(num1,num2,num3,dist,speed,shotID,angle1,dir,area,intv){
  98. let angle2 = GetAngleToPlayer(objBoss);;
  99. loop(num3){
  100. loop(num2){
  101. loop(num1){
  102. PlaySound("Shot2",100,0);
  103. let obj = CreateShotA1(ObjMove_GetX(objBoss)+dist*cos(angle1),ObjMove_GetY(objBoss)+dist*sin(angle1),speed,angle2,shotID,12);
  104. angle1 += 360/num1;
  105.  
  106. BOINGceiling(obj,angle2);
  107.  
  108. }
  109. angle2 += 360/num2;
  110. }
  111. //dist += dist/24*dir;
  112. angle2 += area/num1*dir;
  113. wait(intv);
  114. }
  115. }
  116. }
  117.  
  118.  
  119.  
  120. task BOINGceiling(obj,angle2){
  121. while(ObjMove_GetX(obj)>0&&ObjMove_GetX(obj)<GetStgFrameWidth&&ObjMove_GetY(obj)>0){yield;}
  122. if(ObjMove_GetX(obj)<=0){
  123. //ObjMoveSetX(obj,0)
  124. ObjMove_SetAngle(obj,180-ObjMove_GetAngle(obj));
  125. }else if(ObjMove_GetX(obj)>=GetStgFrameWidth){
  126. //ObjMoveSetX(obj),GetStgFrameWidth);
  127. ObjMove_SetAngle(obj,180-ObjMove_GetAngle(obj));
  128. }else if(ObjMove_GetY(obj)<=0){
  129. //ObjMoveSetY(obj,0);
  130. ObjMove_SetAngle(obj,-1*ObjMove_GetAngle(obj));
  131. }
  132. }
  133.  
  134. task BOINGside(obj,angle2){
  135. while(ObjMove_GetX(obj)>0&&ObjMove_GetX(obj)<GetStgFrameWidth){yield;}
  136. if(ObjMove_GetX(obj)<=0){
  137. //ObjMoveSetX(obj,0)
  138. ObjMove_SetAngle(obj,180-ObjMove_GetAngle(obj));
  139. }
  140. if(ObjMove_GetX(obj)>=GetStgFrameWidth){
  141. //ObjMoveSetX(obj),GetStgFrameWidth);
  142. ObjMove_SetAngle(obj,180-ObjMove_GetAngle(obj));
  143. }
  144. }
  145.  
  146. task Move{
  147. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
  148. ObjMove_SetDestAtFrame(objBoss, GetCenterX, 120, 30);
  149. wait(300);
  150. }
  151. }
  152.  
  153. task DrawName{
  154. let objText = ObjText_Create();
  155. let alpha = 255;
  156. ObjText_SetText(objText, "Eiki Shiki");
  157. ObjText_SetFontSize(objText, 12);
  158. ObjText_SetFontColorTop(objText, 255, 255, 255);
  159. ObjText_SetFontColorBottom(objText, 0, 255, 128);
  160. ObjText_SetFontBorderType(objText, BORDER_SHADOW);
  161. ObjText_SetFontBorderColor(objText,0, 128, 128);
  162. ObjText_SetFontBorderWidth(objText, 2);
  163. ObjRender_SetPosition(objText,0,12,0);
  164. while(!Obj_IsDeleted(objText)){
  165. if(GetPlayerY>80 && alpha<255){alpha+=10;}
  166. if(GetPlayerY<=80 && alpha>100){alpha-=10;}
  167. ObjRender_SetAlpha(objText,alpha);
  168. yield;
  169. }
  170. }
  171.  
  172. task RenderBG{
  173. let path1 = GetCurrentScriptDirectory() ~ "img/RedMoon.png";
  174. let obj1 = ObjPrim_Create(OBJ_SPRITE_2D);
  175. ObjRender_SetBlendType(obj1, BLEND_ALPHA);
  176. Obj_SetRenderPriority(obj1, 0.20);
  177. ObjPrim_SetTexture(obj1, path1);
  178. ObjSprite2D_SetSourceRect(obj1, 0, 0, 512, 512);
  179. ObjSprite2D_SetDestRect(obj1, -256, -256, 256, 256);
  180. ObjRender_SetPosition(obj1, 384/2, 448/2, 1);
  181. let frame = 0;
  182. let alpha = 0;
  183. loop {
  184. if (bSpell) { //Transition from stage background
  185. alpha = 255;
  186. } else {
  187. alpha = 0; //If no longer spell
  188. }
  189. Obj_SetVisible(obj1, alpha > 0);
  190. frame++;
  191. yield;
  192. }
  193. }
  194.  
  195. task magiccircle(objBoss,size,type){
  196. let obj=ObjPrim_Create(OBJ_SPRITE_2D);
  197. let GCSD = GetCurrentScriptDirectory;
  198. let img=GCSD~"img/MG (3).png";
  199. let spin = 0;
  200. let s = 0;
  201. LoadTexture(img);
  202. ObjPrim_SetTexture(obj,img);
  203. ObjSprite2D_SetSourceRect(obj,0,0,256,256);
  204. ObjSprite2D_SetDestCenter(obj);
  205. ObjRender_SetScaleXYZ(obj,size,size,size);
  206. ObjRender_SetAlpha(obj,230);
  207. Obj_SetRenderPriority(obj,0.35);
  208. while(!Obj_IsDeleted(objBoss)){
  209. spin += 3;
  210. ObjRender_SetAngleXYZ(obj,0,0,-spin*1.5);
  211. ObjRender_SetPosition(obj,ObjMove_GetX(objBoss),ObjMove_GetY(objBoss),0);
  212. if(type==true){
  213. ObjRender_SetScaleXYZ(obj,size+0.08*sin(spin),size+0.08*sin(spin),0);
  214. }
  215. ObjMove_SetPosition(obj,ObjMove_GetX(objBoss), ObjMove_GetY(objBoss));
  216. yield;
  217. }
  218. Obj_Delete(obj);
  219. }
  220.  
  221. task TDrawLoop {
  222. let timer_anim = 0;
  223. let anim = 0;
  224. let imgBoss = GetCurrentScriptDirectory ~ "img/Flandre.png"; //file path to enemy image
  225. let bossAngle = ObjMove_GetAngle(objBoss);
  226. let bossSpeed = ObjMove_GetSpeed(objBoss);
  227. ObjPrim_SetTexture(objBoss, imgBoss); //Setting the above image file as a texture to the enemy object(objEnemy)
  228. ObjRender_SetScaleXYZ(objBoss, 1, 1, 1);
  229. ObjSprite2D_SetSourceRect(objBoss, 1, 1, 64, 64);
  230. ObjSprite2D_SetDestCenter(objBoss);
  231. while(!Obj_IsDeleted(objBoss)){
  232. timer_anim++;
  233. if(timer_anim == 0) {anim = 0;}
  234. if(timer_anim == 10) {anim = 1;}
  235. if(timer_anim == 2*10) {anim = 2;}
  236. if(timer_anim == 3*10) {
  237. anim = 3;
  238. timer_anim = -1;
  239. }
  240. bossAngle = ObjMove_GetAngle(objBoss);
  241. bossSpeed = ObjMove_GetSpeed(objBoss);
  242. if(bossSpeed < -1) {
  243. ObjSprite2D_SetSourceRect(objBoss, 1, 64, 64, 128); //Moving on left fast
  244. } else if(bossSpeed > 1) {
  245. ObjSprite2D_SetSourceRect(objBoss, 192, 64, 256, 128); //Moving on right fast
  246. } else if(bossSpeed < 0 && bossSpeed > -1) {
  247. ObjSprite2D_SetSourceRect(objBoss, 128, 64, 192, 128); //Moving on left slow
  248. } else if(bossSpeed > 0 && bossSpeed < 1) {
  249. ObjSprite2D_SetSourceRect(objBoss, 64, 64, 127, 128); //Moving on right slow
  250. } else if(bossSpeed == 0) {
  251. ObjSprite2D_SetSourceRect(objBoss, 1+anim*64, 1, 64+anim*64, 64); //Setting the rectangle coordinates in the enemy image to use(Left, Top, Right, Bottom).
  252. }
  253. yield;
  254. }
  255. }
  256.  
  257. task TFinalize{
  258. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
  259. if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT)
  260. +ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0){
  261. AddScore(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE));
  262. PlaySound("capture",100,0);
  263. } else {PlaySound("failed",100,0);}
  264. Obj_Delete(objBoss);
  265. DeleteShotAll(TYPE_ALL,TYPE_IMMEDIATE);
  266. loop(120) {
  267. yield;
  268. }
  269. SetAutoDeleteObject(true);
  270. CloseScript(GetOwnScriptID());
  271. return;
  272. }
  273.  
  274. function GetCenterX(){
  275. return GetStgFrameWidth() / 2;
  276. }
  277.  
  278. function GetCenterY(){
  279. return GetStgFrameWidth() / 2;
  280. }
  281.  
  282. function wait(n){
  283. loop(n){yield;}
  284. }
RAW Paste Data