Advertisement
Gamer251

Danmakufu Code Trial 01

May 27th, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.17 KB | None | 0 0
  1. #TouhouDanmakufu[Single]
  2. #ScriptVersion[3]
  3. #Title["Spellcard 01"]
  4. #Text["First Spellcard"]
  5.  
  6. #include"script/default_system/Default_ShotConst.txt"
  7.  
  8. let objBoss;
  9. let GetX = 0;
  10. let GetY = 0;
  11. let objScene = GetEnemyBossSceneObjectID();
  12.  
  13. @Event{
  14.     alternative(GetEventType())
  15.     case(EV_REQUEST_LIFE){
  16.         SetScriptResult(1000);
  17.         }
  18.     case(EV_REQUEST_TIMER){
  19.         SetScriptResult(60);
  20.         }
  21.     case(EV_REQUEST_SPELL_SCORE) {
  22.         SetScriptResult(100000);
  23.         }
  24. }
  25.  
  26. @Initialize{
  27.     objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  28.     ObjEnemy_Regist(objBoss);
  29.     ObjMove_SetDestAtFrame(objBoss, GetCenterX, 60, 60);
  30.    
  31.     ObjEnemyBossScene_StartSpell(objScene);
  32.    
  33.     TDrawLoop;
  34.     TFinalize;
  35.     MainTask;
  36. }
  37.  
  38. @MainLoop{
  39.     GetX = ObjMove_GetX(objBoss);
  40.     GetY = ObjMove_GetY(objBoss);
  41.    
  42.     ObjEnemy_SetIntersectionCircleToShot(objBoss, GetX, GetY, 32);
  43.     ObjEnemy_SetIntersectionCircleToPlayer(objBoss, GetX, GetY, 24);
  44.     yield;
  45. }
  46.  
  47. task MainTask {
  48.     movement;
  49.     while(ObjEnemy_GetInfo(objBoss, INFO_LIFE)>0){
  50.     let angleT = GetAngleToPlayer(objBoss);
  51.     loop(13){
  52.         ascent(i in 0..3){
  53.             CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2.5-i/3, angleT, DS_FIRE_RED+1, 5);
  54.         }
  55.         angleT+=360/13;
  56.         }
  57.     }
  58. }
  59.  
  60. task movement{
  61.     while(ObjEnemy_GetInfo(objBoss, INFO_LIFE)>0){
  62.         ObjMove_SetDestAtFrame(objBoss, rand(GetCenterX+90,GetCenterX-90), rand(GetCenterY-60,GetCenterY-120), 60);
  63.         wait(120);
  64.     }
  65. }
  66.  
  67. task TDrawLoop{
  68.     let imgFlan = GetCurrentScriptDirectory ~ "img/boss_flandre.png";
  69.     ObjPrim_SetTexture(objBoss, imgFlan);
  70.     ObjSprite2D_SetSourceRect(objBoss, 0, 0, 128, 128);
  71.     ObjSprite2D_SetDestCenter(objBoss);
  72. }
  73.  
  74.    
  75. task TFinalize {
  76.     while(ObjEnemy_GetInfo(objBoss, INFO_LIFE)>0){yield;}
  77.     if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT)
  78.             +ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0){
  79.         AddScore(ObjEnemyBossScene_GetInfo(objScene,INFO_SPELL_SCORE));
  80.     }
  81.     Obj_Delete(objBoss);
  82.     DeleteShotAll(TYPE_ALL, TYPE_IMMEDIATE);
  83.     SetAutoDeleteObject(true);
  84.     CloseScript(GetOwnScriptID());
  85.     return;
  86. }
  87.    
  88. function GetCenterX{
  89.     return GetStgFrameWidth/2;
  90. }
  91. function GetCenterY{
  92.     return GetStgFrameHeight/2;
  93. }
  94. function wait(n){
  95.     loop(n){yield;}
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement