Guest User

h

a guest
Feb 25th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.93 KB | None | 0 0
  1. #TouhouDanmakufu[Player]
  2. #Menu[Marisa ZE type]
  3. #Text[Danmakufu is all about power!
  4. Bomb:"Magic Cannon - Star Explosion" (Doesn´t work)]
  5. #ReplayName[MarisaZE]
  6. #Image[.\system\sl_pl01.png]
  7. #ScriptVersion[2]
  8.  
  9. script_player_main {
  10.     let CSD = GetCurrentScriptDirectory;
  11.     let maritex = CSD ~ "system\MariPlayer.png";
  12.     let f = 0;
  13.     let f2 = 0;
  14.     let count = -1;
  15.    
  16.     @Initialize {
  17.     SetSpeed(5,2);
  18.     SetPlayerLifeImage(maritex,0,0,32,48);
  19.     LoadGraphic(maritex);
  20.     LoadPlayerShotData(CSD ~ "ZEshot.txt");
  21.     }
  22.     @DrawLoop {
  23.         SetTexture(maritex);
  24.     SetRenderState(ALPHA);
  25.     SetAlpha(255);
  26.     SetGraphicScale(1,1);
  27.  
  28.     if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){
  29.         SetGraphicAngle(0,0,0);
  30.         if(f2<5){SetGraphicRect(0,48,32,96);}
  31.         if(f2>=5 && f2<10){SetGraphicRect(32,48,64,96);}
  32.         if(f2>=10 && f2<15){SetGraphicRect(64,48,96,96);}
  33.         if(f2>=15 && f2<20){SetGraphicRect(96,48,128,96);}
  34.         f2++;
  35.         }
  36.     else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){
  37.         SetGraphicAngle(180,0,0);
  38.         if(f2<5){SetGraphicRect(0,48,32,96);}
  39.         if(f2>=5 && f2<10){SetGraphicRect(32,48,64,96);}
  40.         if(f2>=10 && f2<15){SetGraphicRect(64,48,96,96);}
  41.         if(f2>=15 && f2<20){SetGraphicRect(96,48,128,96);}
  42.         f2++;
  43.         }
  44.     else{
  45.         if(f<15){SetGraphicRect(0,0,32,48);}
  46.         if(f>=15 && f<30){SetGraphicRect(32,0,64,48);}
  47.         if(f>=30 && f<45){SetGraphicRect(64,0,96,48);}
  48.         if(f>=45 && f<60){SetGraphicRect(96,0,128,48);}
  49.         f2 = 0;
  50.     }
  51.     DrawGraphic(GetPlayerX(), GetPlayerY());
  52.  
  53.     f+=3;
  54.     f2+=3;
  55.     if(f==60){f=0;}
  56.  
  57.     }
  58.     @Missed{
  59.         yield;
  60.     }
  61.     @Spellcard{
  62.         UseSpellCard("bombSC",NULL);
  63.     }
  64.     @Finalize {
  65.  
  66.     }
  67.     @MainLoop{
  68.     // when Z is pressed, set count to 0.
  69.     if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD) && count == -1){
  70.         count = 0;
  71.     }
  72.     // when focussing
  73.     if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
  74.         if(count == 5){
  75.             marishot(GetPlayerX,GetPlayerY-20,20,270,1,4);
  76.             marishot(GetPlayerX,GetPlayerY-20,20,250,1,4);
  77.             marishot(GetPlayerX,GetPlayerY-20,20,290,1,4);
  78.             PlaySE(CSD ~ "system\SFX\PlayerShot.wav");
  79.             count = -1;
  80.         }
  81.     }
  82.     // when regular
  83.     else {
  84.             if(count == 5){
  85.                 marishot(GetPlayerX,GetPlayerY-20,20,270,1,4);
  86.                 PlaySE(CSD ~ "system\SFX\PlayerShot.wav");
  87.                 count = -1;
  88.         }
  89.     }
  90.     // if count is 0 or greater, start counting for each frame.
  91.     if(count >=0){count++;}
  92.     SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
  93.     yield;
  94.     }
  95.    
  96.     // ZE bullet
  97.     task marishot(x,y,speed,dir,graphic,dmg){
  98.             let obj = Obj_Create(OBJ_SHOT);
  99.         Obj_SetPosition(obj,x,y);
  100.         Obj_SetSpeed(obj,speed);
  101.         Obj_SetAngle(obj,dir);
  102.         Obj_SetAlpha(obj,155);
  103.         ObjShot_SetGraphic(obj,graphic);
  104.         ObjShot_SetDamage(obj,dmg);
  105.         ObjShot_SetPenetration(obj,1);
  106.         yield;
  107.         }
  108.  
  109.         function wait(w){loop(w){yield;}}
  110. }
  111.  
  112.  
  113.  
  114.  
  115.  
  116. // spell card code.
  117. script_spell bombSC{
  118.     let CSD = GetCurrentScriptDirectory;
  119.     let startex = CSD ~"system\startex.png";
  120.     let cut = CSD ~ "mariCut.png";
  121.  
  122.     @Initialize{
  123.         SetSpeed(2,2);
  124.         LoadGraphic(startex);
  125.         LoadGraphic(cut);
  126.         CutIn(KOUMA,"Magic Cannon - Star Explosion",cut);
  127.         SetPlayerInvincibility(240);
  128.         // main task for our SC.
  129.         spellTask;
  130. }
  131.     @MainLoop{
  132.         yield;
  133.         collectItems;
  134. }
  135.     @Finalize{
  136. }
  137.     task spellTask{
  138.         PlaySE(CSD ~ "system\SFX\SPELLCARD.wav");
  139.         wait(60);
  140.         // sometask.
  141.         starBomb(GetPlayerX,GetPlayerY);
  142.         wait(180);
  143.         End;
  144. }
  145.  
  146.     // bomb projectile, spinning star.
  147.     task starBomb(x,y){
  148.     let obj = Obj_Create(OBJ_SPELL);
  149.  
  150.     let starspin = 0;
  151.     let c = 0;
  152.     let scale = 1.0;
  153.  
  154.     Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
  155.     Obj_SetAngle(obj,0);
  156.  
  157.     ObjEffect_SetTexture(obj,startex);
  158.     ObjEffect_SetRenderState(obj,ADD);
  159.     ObjEffect_SetLayer(obj,3);
  160.  
  161.     ObjEffect_SetPrimitiveType(Obj, PRIMITIVE_TRIANGLESTRIP);
  162.     ObjEffect_CreateVertex(obj,4);
  163.  
  164.     ObjEffect_SetVertexXY(obj,0,-32,-32);
  165.     ObjEffect_SetVertexUV(obj,0,0,0);
  166.  
  167.     ObjEffect_SetVertexXY(obj,1,32,-32);
  168.     ObjEffect_SetVertexUV(obj,1,64,0);
  169.  
  170.     ObjEffect_SetVertexXY(obj,2,-32,32);
  171.     ObjEffect_SetVertexUV(obj,2,0,64);
  172.  
  173.     ObjEffect_SetVertexXY(obj,3,32,32);
  174.     ObjEffect_SetVertexUV(obj,3,64,64);
  175.    
  176.     while(!Obj_BeDeleted(obj)){
  177.         // animation effect.
  178.         ObjEffect_SetAngle(obj,0,0,starspin);
  179.         ObjEffect_SetScale(obj,scale,scale);
  180.         Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
  181.    
  182.         // set the colour ObjEffect_SetVertexColor([var],vertex,alpha,red,green,blue);
  183.         ascent(x in 0..4){ObjEffect_SetVertexColor(obj,x,255,255,255,255);}
  184.         ObjSpell_SetIntersecrionCircle(obj,obj_GetX(obj),obj_GetY(obj),scale*16,2,true);
  185.         // if c > 120.
  186.     if(c>120){
  187.         PlaySE(CSD ~ "system\SFX\DEFEATED.wav");
  188.         // do massive damage and disappear. ObjSpell_SetIntersecrionCircle([objvar],x,y,radius,damage,true/false remove bullets on screen);
  189.         ObjSpell_SetIntersecrionCircle(obj,Obj_GetX(obj),Obj_GetY(obj),512,700,true);
  190.         Obj_Delete(obj);
  191.     }
  192.     starspin+=10;
  193.     scale+=0.05;
  194.     c++;
  195.     yield;
  196.         }
  197.  
  198.     }
  199.     Function wait(w){loop(w){yield;}}
  200. }
Advertisement
Add Comment
Please, Sign In to add comment