Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TouhouDanmakufu[Player]
- #Menu[Rainbow Dash]
- #Text[Dashtest]
- #ReplayName[RD]
- #ScriptVersion[2]
- script_player_main
- {
- #include_function ".\drawchar.dnh";
- let CSD = GetCurrentScriptDirectory;
- let imgpplayer = CSD ~"rdb.png";
- let plshot = CSD ~"rdshot.png";
- let eff = CSD ~ "rdashani.png";
- let scount = -1;
- let shotcount = -1;
- let f = 0;
- task Option(position,id)
- {
- yield;
- let count = 0;
- let dir1 = 270;
- let dir2 = 270;
- let destinationx = GetPlayerX+position[0];
- let destinationy = GetPlayerY+position[1];
- let optioneffect = Obj_Create(OBJ_EFFECT);
- Obj_SetPosition(optioneffect,GetPlayerX,GetPlayerY);
- ObjEffect_SetTexture(optioneffect,eff);
- ObjEffect_SetRenderState(optioneffect,ADD);
- ObjEffect_SetPrimitiveType(optioneffect,PRIMITIVE_TRIANGLEFAN);
- ObjEffect_SetLayer(optioneffect,3);
- ObjEffect_CreateVertex(optioneffect,4);
- ObjEffect_SetVertexUV(optioneffect,0,828,1);
- ObjEffect_SetVertexUV(optioneffect,1,843,1);
- ObjEffect_SetVertexUV(optioneffect,2,843,16);
- ObjEffect_SetVertexUV(optioneffect,3,828,16);
- let option = Obj_Create(OBJ_EFFECT);
- Obj_SetPosition(option,GetPlayerX,GetPlayerY);
- ObjEffect_SetTexture(option,eff);
- ObjEffect_SetRenderState(option,ALPHA);
- ObjEffect_SetPrimitiveType(option,PRIMITIVE_TRIANGLEFAN);
- ObjEffect_SetLayer(option,3);
- ObjEffect_CreateVertex(option,4);
- ObjEffect_SetVertexUV(option,0,828,1);
- ObjEffect_SetVertexUV(option,1,843,1);
- ObjEffect_SetVertexUV(option,2,843,16);
- ObjEffect_SetVertexUV(option,3,828,16);
- let distancetopoint = ((destinationx-Obj_GetX(option))^2+(destinationy-Obj_GetY(option))^2)^0.5;
- let directiontopoint = atan2(destinationy-Obj_GetY(option),destinationx-Obj_GetX(option));
- if (id == 0){
- dir1 = 267;
- dir2 = 270;
- }
- else{
- dir1 = 270;
- dir2 = 273;
- }
- while(!Obj_BeDeleted(option)){
- distancetopoint = ((destinationx-Obj_GetX(option))^2+(destinationy-Obj_GetY(option))^2)^0.5;
- directiontopoint = atan2(destinationy-Obj_GetY(option),destinationx-Obj_GetX(option));
- if (distancetopoint >= 1){
- Obj_SetPosition(option,Obj_GetX(optioneffect)+cos(directiontopoint)*distancetopoint*0.4,Obj_GetY(optioneffect)+ sin(directiontopoint)*distancetopoint*0.4);
- Obj_SetPosition(optioneffect,Obj_GetX(optioneffect)+cos(directiontopoint)*distancetopoint*0.4,Obj_GetY(optioneffect)+ sin(directiontopoint)*distancetopoint*0.4);
- }
- else{
- Obj_SetPosition(option,destinationx,destinationy);
- Obj_SetPosition(optioneffect,destinationx,destinationy);
- }
- if (GetKeyState(VK_SLOWMOVE) == KEY_PUSH || GetKeyState(VK_SLOWMOVE) == KEY_HOLD){
- destinationx = GetPlayerX+position[2];
- destinationy = GetPlayerY+position[3];
- if (shotcount == 6){
- rarshot(Obj_GetX(option),Obj_GetY(option),-0.8,270,2,1.25);
- }
- }
- else{
- destinationx = GetPlayerX+position[0];
- destinationy = GetPlayerY+position[1];
- if (shotcount == 6){
- rarshot(Obj_GetX(option),Obj_GetY(option),-0.8,270,2,1.25);
- }
- }
- ObjEffect_SetVertexXY(option,0,(10.6*cos((count*5)+225)),(10.6*sin((count*5)+225)));
- ObjEffect_SetVertexXY(option,1,(10.6*cos((count*5)+315)),(10.6*sin((count*5)+315)));
- ObjEffect_SetVertexXY(option,2,(10.6*cos((count*5)+45)),(10.6*sin((count*5)+45)));
- ObjEffect_SetVertexXY(option,3,(10.6*cos((count*5)+135)),(10.6*sin((count*5)+135)));
- ObjEffect_SetVertexXY(optioneffect,0,(16*cos((count*-5)+225)),(16*sin((count*-5)+225)));
- ObjEffect_SetVertexXY(optioneffect,1,(16*cos((count*-5)+315)),(16*sin((count*-5)+315)));
- ObjEffect_SetVertexXY(optioneffect,2,(16*cos((count*-5)+45)),(16*sin((count*-5)+45)));
- ObjEffect_SetVertexXY(optioneffect,3,(16*cos((count*-5)+135)),(16*sin((count*-5)+135)));
- ObjEffect_SetVertexColor(optioneffect,0,128,255,255,255);
- ObjEffect_SetVertexColor(optioneffect,1,128,255,255,255);
- ObjEffect_SetVertexColor(optioneffect,2,128,255,255,255);
- ObjEffect_SetVertexColor(optioneffect,3,128,255,255,255);
- count ++;
- yield;
- }
- }
- @Initialize
- {
- SetCommonData("CHAR","RDR");
- Hitbox;
- Hitbox2;
- Option([-30,10,-20,10],0);
- Option([30,10,20,10],1);
- Option([-15,32,-10,25],1);
- Option([15,32,10,25],0);
- SetSpeed(5.5,2.5);
- SetPlayerLifeImage(imgpplayer,0,0,31,47);
- LoadGraphic(imgpplayer);
- LoadPlayerShotData(CSD ~ "regshot.dnh");
- }
- @DrawLoop
- {
- drawchar;
- DrawHitbox;
- DrawHitbox2;
- }
- @Missed
- {
- yield;
- }
- @SpellCard
- {
- UseSpellCard("bombSC",NULL);
- PlaySE(CSD ~ "spark.wav");
- PlaySE(CSD ~ "shot4.wav");
- }
- @Finalize
- {
- }
- @MainLoop
- {
- if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD) && scount == -1)
- {
- scount = 0;
- }
- //when focused
- if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
- {
- if(scount == 2)
- {
- rdregshot(GetPlayerX-10,GetPlayerY+13,30,270,1,1.5);
- rdregshot(GetPlayerX+10,GetPlayerY+13,30,270,1,1.5);
- //rdregshot(GetPlayerX-18,GetPlayerY+15,28,270,1,1.5);
- //rdregshot(GetPlayerX+18,GetPlayerY+15,28,270,1,1.5);
- //rdregshot(GetPlayerX,GetPlayerY+15,28,276,1,1.5);
- //rdregshot(GetPlayerX,GetPlayerY+15,28,264,1,1.5);
- PlaySE(CSD ~ "se_plshot.wav");
- scount = -1;
- }
- }
- //when not focused
- else
- {
- if(scount == 2)
- {
- rdregshot(GetPlayerX-10,GetPlayerY+15,28,270,1,1.5);
- rdregshot(GetPlayerX+10,GetPlayerY+15,28,270,1,1.5);
- //rdregshot(GetPlayerX-18,GetPlayerY+15,28,270,1,1.5);
- //rdregshot(GetPlayerX+18,GetPlayerY+15,28,270,1,1.5);
- //rdregshot(GetPlayerX,GetPlayerY+15,28,276,1,1.5);
- //rdregshot(GetPlayerX,GetPlayerY+15,28,264,1,1.5);
- PlaySE(CSD ~ "se_plshot.wav");
- scount = -1;
- }
- }
- if(scount >= 0)
- {
- scount++;
- }
- SetIntersectionCircle(GetPlayerX,GetPlayerY,0);
- if (GetKeyState(VK_SHOT) == KEY_PUSH || GetKeyState(VK_SHOT) == KEY_HOLD && shotcount == -1){
- shotcount = 0;
- }
- if (shotcount >= 0){
- shotcount ++;
- }
- if (shotcount >= 7){
- shotcount = -1;
- }
- yield;
- }
- task rdregshot(x,y,speed,dir,graphic,dmg)
- {
- let obj = Obj_Create(OBJ_SHOT);
- Obj_SetPosition(obj,x,y);
- Obj_SetSpeed(obj,speed);
- Obj_SetAngle(obj,dir);
- Obj_SetAlpha(obj,200);
- ObjShot_SetGraphic(obj,graphic);
- ObjShot_SetDamage(obj,dmg);
- ObjShot_SetPenetration(obj,1);
- Obj_SetAutoDelete(obj,true);
- task ShotFade(x,y,dir)
- {
- let fcount = 0;
- let obj_shotfade = Obj_Create(OBJ_EFFECT);
- Obj_SetPosition(obj_shotfade,x,y);
- Obj_SetSpeed(obj_shotfade,5);
- Obj_SetAngle(obj_shotfade,dir);
- ObjEffect_SetRenderState(obj_shotfade,ALPHA);
- Obj_SetAlpha(obj_shotfade,10);
- ObjEffect_SetTexture(obj_shotfade,plshot);
- ObjEffect_SetPrimitiveType(obj_shotfade,PRIMITIVE_TRIANGLEFAN);
- ObjEffect_CreateVertex(obj_shotfade,4);
- ObjEffect_SetVertexUV(obj_shotfade,0,0,113);
- ObjEffect_SetVertexUV(obj_shotfade,1,18,113);
- ObjEffect_SetVertexUV(obj_shotfade,2,18,171);
- ObjEffect_SetVertexUV(obj_shotfade,3,0,171);
- ObjEffect_SetVertexXY(obj_shotfade,0,-8,-16);
- ObjEffect_SetVertexXY(obj_shotfade,1,8,-16);
- ObjEffect_SetVertexXY(obj_shotfade,2,8,16);
- ObjEffect_SetVertexXY(obj_shotfade,3,-8,16);
- while(!Obj_BeDeleted(obj_shotfade))
- {
- if (fcount >= 0 && fcount < 5)
- {
- ObjEffect_SetVertexUV(obj_shotfade,0,0,113);
- ObjEffect_SetVertexUV(obj_shotfade,1,18,113);
- ObjEffect_SetVertexUV(obj_shotfade,2,18,171);
- ObjEffect_SetVertexUV(obj_shotfade,3,0,171);
- }
- if (fcount >= 5 && fcount < 10)
- {
- ObjEffect_SetVertexUV(obj_shotfade,0,0,50);
- ObjEffect_SetVertexUV(obj_shotfade,1,18,50);
- ObjEffect_SetVertexUV(obj_shotfade,2,18,108);
- ObjEffect_SetVertexUV(obj_shotfade,3,0,108);
- }
- if (fcount >= 10 && fcount < 15)
- {
- ObjEffect_SetVertexUV(obj_shotfade,0,0,0);
- ObjEffect_SetVertexUV(obj_shotfade,1,18,0);
- ObjEffect_SetVertexUV(obj_shotfade,2,18,51);
- ObjEffect_SetVertexUV(obj_shotfade,3,0,51);
- }
- if (fcount >= 15)
- {
- Obj_Delete(obj_shotfade);
- return;
- }
- fcount ++;
- yield;
- }
- }
- while(!Obj_BeDeleted(obj))
- {
- x = Obj_GetX(obj);
- y = Obj_GetY(obj);
- dir = Obj_GetAngle(obj);
- yield;
- }
- ShotFade(x,y,dir);
- }
- task rarshot(x,y,speed,dir,graphic,dmg)
- {
- let obj = Obj_Create(OBJ_SHOT);
- let timer = 0;
- let boost = 5;
- Obj_SetPosition(obj,x,y);
- Obj_SetSpeed(obj,speed);
- Obj_SetAngle(obj,dir);
- Obj_SetAlpha(obj,200);
- ObjShot_SetGraphic(obj,graphic);
- ObjShot_SetDamage(obj,dmg);
- ObjShot_SetPenetration(obj,1);
- Obj_SetAutoDelete(obj,true);
- task ShotFade(x,y,dir)
- {
- let fcount = 0;
- let obj_shotfade = Obj_Create(OBJ_EFFECT);
- Obj_SetAutoDelete(obj_shotfade,true);
- Obj_SetPosition(obj_shotfade,x,y);
- Obj_SetSpeed(obj_shotfade,5);
- Obj_SetAngle(obj_shotfade,dir);
- ObjEffect_SetRenderState(obj_shotfade,ALPHA);
- Obj_SetAlpha(obj_shotfade,10);
- ObjEffect_SetTexture(obj_shotfade,plshot);
- ObjEffect_SetPrimitiveType(obj_shotfade,PRIMITIVE_TRIANGLEFAN);
- ObjEffect_CreateVertex(obj_shotfade,4);
- ObjEffect_SetVertexUV(obj_shotfade,0,0,113);
- ObjEffect_SetVertexUV(obj_shotfade,1,18,113);
- ObjEffect_SetVertexUV(obj_shotfade,2,18,171);
- ObjEffect_SetVertexUV(obj_shotfade,3,0,171);
- ObjEffect_SetVertexXY(obj_shotfade,0,-8,-16);
- ObjEffect_SetVertexXY(obj_shotfade,1,8,-16);
- ObjEffect_SetVertexXY(obj_shotfade,2,8,16);
- ObjEffect_SetVertexXY(obj_shotfade,3,-8,16);
- while(!Obj_BeDeleted(obj_shotfade))
- {
- if (fcount >= 0 && fcount < 5)
- {
- ObjEffect_SetVertexUV(obj_shotfade,0,0,113);
- ObjEffect_SetVertexUV(obj_shotfade,1,18,113);
- ObjEffect_SetVertexUV(obj_shotfade,2,18,171);
- ObjEffect_SetVertexUV(obj_shotfade,3,0,171);
- }
- if (fcount >= 5 && fcount < 10)
- {
- ObjEffect_SetVertexUV(obj_shotfade,0,0,50);
- ObjEffect_SetVertexUV(obj_shotfade,1,18,50);
- ObjEffect_SetVertexUV(obj_shotfade,2,18,108);
- ObjEffect_SetVertexUV(obj_shotfade,3,0,108);
- }
- if (fcount >= 10 && fcount < 15)
- {
- ObjEffect_SetVertexUV(obj_shotfade,0,0,0);
- ObjEffect_SetVertexUV(obj_shotfade,1,18,0);
- ObjEffect_SetVertexUV(obj_shotfade,2,18,51);
- ObjEffect_SetVertexUV(obj_shotfade,3,0,51);
- }
- if (fcount >= 15)
- {
- Obj_Delete(obj_shotfade);
- return;
- }
- fcount ++;
- yield;
- }
- }
- task Trail(x,y,dir)
- {
- let fcount = 0;
- let obj_trail = Obj_Create(OBJ_EFFECT);
- Obj_SetAutoDelete (obj_trail,true);
- Obj_SetPosition(obj_trail,x,y);
- Obj_SetSpeed(obj_trail,0);
- Obj_SetAngle(obj_trail,dir);
- ObjEffect_SetRenderState(obj_trail,ADD);
- Obj_SetAlpha(obj_trail,10);
- ObjEffect_SetTexture(obj_trail,plshot);
- ObjEffect_SetPrimitiveType(obj_trail,PRIMITIVE_TRIANGLEFAN);
- ObjEffect_CreateVertex(obj_trail,4);
- ObjEffect_SetVertexUV(obj_trail,0,1,177);
- ObjEffect_SetVertexUV(obj_trail,1,15,177);
- ObjEffect_SetVertexUV(obj_trail,2,15,203);
- ObjEffect_SetVertexUV(obj_trail,3,1,203);
- ObjEffect_SetVertexXY(obj_trail,0,-8,-16);
- ObjEffect_SetVertexXY(obj_trail,1,8,-16);
- ObjEffect_SetVertexXY(obj_trail,2,8,16);
- ObjEffect_SetVertexXY(obj_trail,3,-8,16);
- loop(5)
- {
- if (fcount >= 0 && fcount < 3)
- {
- ObjEffect_SetVertexUV(obj_trail,0,1,177);
- ObjEffect_SetVertexUV(obj_trail,1,15,177);
- ObjEffect_SetVertexUV(obj_trail,2,15,203);
- ObjEffect_SetVertexUV(obj_trail,3,1,203);
- fcount ++;
- }
- if (fcount >= 3 && fcount < 6)
- {
- ObjEffect_SetVertexUV(obj_trail,0,1,150);
- ObjEffect_SetVertexUV(obj_trail,1,15,150);
- ObjEffect_SetVertexUV(obj_trail,2,15,176);
- ObjEffect_SetVertexUV(obj_trail,3,1,176);
- fcount ++;
- }
- if (fcount >= 6 && fcount < 9)
- {
- ObjEffect_SetVertexUV(obj_trail,0,1,123);
- ObjEffect_SetVertexUV(obj_trail,1,15,123);
- ObjEffect_SetVertexUV(obj_trail,2,15,149);
- ObjEffect_SetVertexUV(obj_trail,3,1,149);
- fcount ++;
- }
- if (fcount >= 9)
- {
- Obj_Delete(obj_trail);
- return;
- }
- yield;
- }
- }
- while(!Obj_BeDeleted(obj))
- {
- x = Obj_GetX(obj);
- y = Obj_GetY(obj);
- dir = Obj_GetAngle(obj);
- loop
- {
- Obj_SetSpeed(obj,speed);
- speed+=0.5;
- Trail(Obj_GetX(obj),Obj_GetY(obj),dir);
- yield;
- }
- yield;
- }
- ShotFade(x,y,dir);
- }
- function wait(w){loop(w){yield;}}
- }
- //spellcard
- script_spell bombSC
- {
- let CSD = GetCurrentScriptDirectory;
- let back = CSD ~ "icefield.png";
- let cut = CSD ~ "cut.png";
- @Initialize
- {
- SetPlayerInvincibility(360);
- LoadGraphic(back);
- LoadGraphic(cut);
- SpellTask;
- }
- @MainLoop
- {
- CollectItems;
- yield;
- }
- @Finalize
- {
- }
- task SpellTask
- {
- ice;
- wait(180);
- End;
- }
- task ice
- {
- let objj = Obj_Create(OBJ_EFFECT);
- let obj = Obj_Create(OBJ_SPELL);
- let scroll = 10;
- let scroll2 = 13;
- let xc = 2;
- let counter = 0;
- let alph = 5;
- ObjEffect_SetTexture(objj,back);
- ObjEffect_SetRenderState(objj, ALPHA);
- Obj_SetAlpha(objj, 210);
- ObjEffect_SetLayer(objj, 1);
- ObjEffect_CreateVertex(objj, 4);
- ObjEffect_SetPrimitiveType(objj, PRIMITIVE_TRIANGLEFAN);
- ObjEffect_SetVertexUV(objj, 0, 0, 0);
- ObjEffect_SetVertexUV(objj, 1, 255, 0);
- ObjEffect_SetVertexUV(objj, 2, 255, 255);
- ObjEffect_SetVertexUV(objj, 3, 0, 255);
- while(! Obj_BeDeleted(objj))
- {
- ObjEffect_SetVertexUV(objj, 0, 0 - scroll2, 0 - scroll);
- ObjEffect_SetVertexUV(objj, 1, 255 - scroll2, 0 - scroll);
- ObjEffect_SetVertexUV(objj, 2, 255 - scroll2, 255 - scroll);
- ObjEffect_SetVertexUV(objj, 3, 0 - scroll2, 255 - scroll);
- ObjEffect_SetVertexXY(objj, 0, 0, 0);
- ObjEffect_SetVertexXY(objj, 1, 448, 0);
- ObjEffect_SetVertexXY(objj, 2, 448, 480);
- ObjEffect_SetVertexXY(objj, 3, 0, 480);
- scroll-=xc;
- scroll2-=xc;
- xc = 2;
- while(scroll>=255)
- {
- scroll-=255;
- }
- while(scroll2>=255)
- {
- scroll2-=255;
- }
- if(counter<50)
- {
- alph+=10;
- }
- if(counter>180)
- {
- alph-=40;
- }
- ObjEffect_SetVertexColor(objj, 0, alph, 255, 255, 255);
- ObjEffect_SetVertexColor(objj, 1, alph, 255, 255, 255);
- ObjEffect_SetVertexColor(objj, 2, alph, 255, 255, 255);
- ObjEffect_SetVertexColor(objj, 3, alph, 255, 255, 255);
- if(counter==180)
- {
- ObjSpell_SetIntersecrionCircle(obj,GetCenterY,GetCenterX,400,8,true);
- yield;
- Obj_Delete(objj);
- Obj_Delete(obj);
- }
- yield;
- counter++;
- }
- }
- function wait(w){loop(w){yield;}}
- }
Advertisement
Add Comment
Please, Sign In to add comment