Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TouhouDanmakufu[Player]
- #ScriptVersion[3]
- #Title["Zino"]
- #Text[""]
- #ID["Zino"]
- #ReplayName["Zino"]
- #include"./lib/includes.txt"
- let playerSprite = GetCurrentScriptDirectory ~ "./marisasprite.png";
- let playerID = GetPlayerObjectID;
- let playerObj = ObjPrim_Create(OBJ_SPRITE_2D);
- let hitboxObj = ObjPrim_Create(OBJ_SPRITE_2D);
- let count = -1;
- let isFocus = false;//focus
- let ShotPress = false;//shot press
- let Shooting = false;// is shooting
- let objBoss = -1;
- let ObjOption;
- let ObjOption1;
- @Initialize{
- SetPlayerSpeed(4,2);
- ObjPlayer_AddIntersectionCircleA1(playerID,0,0,3,16);
- SetPlayerClip(0+5,0+5,384-5,448-5);
- SetPlayerDownStateFrame(60);
- SetPlayerRebirthFrame(30);
- SetPlayerAutoItemCollectLine(90);
- OptionSpin;
- ShotU1;//shot
- renderPlayer;
- renderHitbox(GetPlayerX,GetPlayerY);
- }
- @Event{
- alternative(GetEventType)
- case(EV_REQUEST_SPELL){
- if(GetPlayerSpell > 0){
- SetScriptResult(true);
- SetPlayerInvincibilityFrame(120);// a little bomb to make the character not useless
- }else{
- SetScriptResult(false);
- }
- }
- case(EV_PLAYER_SHOOTDOWN){//if the player have been hit
- SetForbidPlayerShot(true);
- SetForbidPlayerSpell(true);
- ObjRender_SetAlpha(playerObj,0);
- }
- case(EV_PLAYER_REBIRTH){//if the player revives
- SetForbidPlayerShot(false);
- SetForbidPlayerSpell(false);
- SetPlayerInvincibilityFrame(120);
- SetPlayerSpell(3);
- ObjRender_SetAlpha(playerObj,255);
- }
- }
- @MainLoop{
- if(GetVirtualKeyState(VK_SLOWMOVE) == KEY_PUSH || GetVirtualKeyState(VK_SLOWMOVE) == KEY_HOLD){
- isFocus = true;//checks if the player is in focus mode
- }
- if(GetVirtualKeyState(VK_SLOWMOVE) == KEY_PULL){
- isFocus = false;//checks if the player is in focus mode
- }
- if(GetVirtualKeyState(VK_SHOT) == KEY_PUSH || GetVirtualKeyState(VK_SHOT) == KEY_HOLD){
- ShotPress = true;//checks if the player is pressing the shot button
- }else{
- ShotPress = false;//checks if the player is pressing the shot button
- }
- if(IsPermitPlayerShot && ShotPress){
- Shooting = true;//checks if the player is shooting
- }else{
- Shooting = false;//checks if the player is shooting
- }
- yield;
- }
- task ShotU1{
- while(true){
- let las = -1;
- let las1 = -1;
- if(Shooting){
- ascent(i in 0..1){
- las = ObjShot_Create(OBJ_STRAIGHT_LASER);//default laser
- ObjShot_Regist(las);
- ObjShot_SetAutoDelete(las, false);
- ObjShot_SetGraphic(las, 1016);
- ObjShot_SetDamage(las, 1);
- ObjShot_SetPenetration(las, 3);
- ObjLaser_SetLength(las, 512);
- ObjLaser_SetRenderWidth(las,20);
- ObjLaser_SetIntersectionWidth(las,20);
- ObjStLaser_SetAngle(las,270);
- KeepAtObj(las,playerID);
- deleteinloop(las);
- ObjStLaser_SetSource(las,false);
- Obj_SetRenderPriorityI(las,79);
- ObjRender_SetAlpha(las,255);
- /*if(Shooting&&isFocus){
- ObjRender_SetColor(las1,255,255,0);
- }
- if(Shooting&&!isFocus){
- ObjRender_SetColor(las1,255,255,255);
- }code don't work*/
- }
- while(Shooting&&!isFocus){
- let angleT= 270-(360/72)*3;
- ascent(i in 0..72/9){
- let obj = CreatePlayerShotA1(ObjRender_GetX(ObjOption),ObjRender_GetY(ObjOption),5,angleT,5,1,879);// create the shot
- let obj1 = CreatePlayerShotA1(ObjRender_GetX(ObjOption1),ObjRender_GetY(ObjOption1),5,angleT,5,1,879);// create the shot
- angleT+=360/72;//set the angle
- ObjRender_SetColor(obj,0,0,0);//set the color
- ObjRender_SetColor(obj1,0,0,0);
- ObjRender_SetAlpha(obj1,128);//set the opacity
- ObjRender_SetAlpha(obj,128);
- }
- wait(5);//so that the script don't crash and to make it not too powerful
- }
- if(Shooting&&isFocus){
- ascent(i in 0..1){
- las = ObjShot_Create(OBJ_STRAIGHT_LASER);
- ObjShot_Regist(las);
- ObjShot_SetAutoDelete(las, false);
- ObjShot_SetGraphic(las, 1016);//graphic
- ObjShot_SetDamage(las, 1);//damage
- ObjShot_SetPenetration(las, 3);//penetration
- ObjLaser_SetLength(las, 512+256);//length
- ObjLaser_SetRenderWidth(las,20);//width
- ObjLaser_SetIntersectionWidth(las,20);
- KeepAtObj(las,ObjOption);//keep the location at the familiar
- deleteinloop(las);//delete when stop firing
- ObjStLaser_SetSource(las,false);// to not draw the base light
- Obj_SetRenderPriorityI(las,79);//to be above all things
- ObjRender_SetAlpha(las,255);//to make it 100% observable
- ObjRender_SetColor(las,255,128,0);//set the color to complete orange
- las1 = ObjShot_Create(OBJ_STRAIGHT_LASER);//same thing as above
- ObjShot_Regist(las1);
- ObjShot_SetAutoDelete(las1, false);
- ObjShot_SetGraphic(las1, 1016);
- ObjShot_SetDamage(las1, 1);
- ObjShot_SetPenetration(las1, 3);
- ObjLaser_SetLength(las1, 512+256);
- ObjLaser_SetRenderWidth(las1,20);
- ObjLaser_SetIntersectionWidth(las1,20);
- KeepAtObj(las1,ObjOption1);
- deleteinloop(las1);
- ObjStLaser_SetSource(las1,false);
- Obj_SetRenderPriorityI(las1,79);
- ObjRender_SetAlpha(las1,255);
- ObjRender_SetColor(las1,255,128,0);
- while(!Obj_IsDeleted(las)&&!Obj_IsDeleted(las1)){
- /*let enemy = [0] ~ GetAllEnemyID;
- let dist = [0];
- let nearestID = 0;
- let distA2 = [0];
- ascent(i in 0..length(enemy)){
- let distV = [GetDistance(ObjMove_GetX(enemy[i]),ObjMove_GetY(enemy[i]),GetPlayerX,GetPlayerY)];
- dist = dist ~ distV;
- }
- ascent(i in 0..length(dist)){
- let distnrst = min(dist[i],dist[max(i-1,0)]);
- let distnrstA = [distnrst];
- distA2 = distA2 ~ distnrstA;
- if(distA2[i] == distnrst){nearestID++;}
- }code don't work*/
- yield;
- }
- }
- }
- while(Shooting){yield;}
- }
- yield;
- }
- }
- task OptionSpin{//create the familiar
- let ang = 180;//set the initial angle
- let rad = 32;//the radius
- let angbonus = 1;//the number that the ang will increase
- let radminus = 16;//to decrease radius y
- ObjOption = ObjPrim_Create(OBJ_SPRITE_2D);
- ObjPrim_SetTexture(ObjOption,playerSprite);//texture
- Obj_SetRenderPriorityI(ObjOption,31);//layer
- ObjRender_SetAngleXYZ(ObjOption,0,0,0);//reset angle
- ObjRender_SetScaleXYZ(ObjOption,1,1,1);// normal scale
- ObjRender_SetAlpha(ObjOption,255);//completely visible
- ObjSprite2D_SetSourceRect(ObjOption,87,16,102,30);//the source
- ObjSprite2D_SetDestCenter(ObjOption);//to make render obj move functions usable
- ObjOption1 = ObjPrim_Create(OBJ_SPRITE_2D);//same thing
- ObjPrim_SetTexture(ObjOption1,playerSprite);
- Obj_SetRenderPriorityI(ObjOption1,31);
- ObjRender_SetAngleXYZ(ObjOption1,0,0,0);
- ObjRender_SetScaleXYZ(ObjOption1,1,1,1);
- ObjRender_SetAlpha(ObjOption1,255);
- ObjSprite2D_SetSourceRect(ObjOption1,87,16,102,30);
- ObjSprite2D_SetDestCenter(ObjOption1);
- while(!Obj_IsDeleted(ObjOption) || !Obj_IsDeleted(ObjOption1)){
- ObjRender_SetPosition(ObjOption,GetPlayerX+rad*cos(ang),GetPlayerY+(rad-radminus)*sin(ang),0);//change the position to a angle in a circle
- ObjRender_SetPosition(ObjOption1,GetPlayerX+rad*cos(ang-180),GetPlayerY+(rad-radminus)*sin(ang-180),0);
- ang+=angbonus;// add the angle
- if(isFocus){
- rad = 16;//set the radius
- radminus = 8;//take 8 form the y radius
- }else{
- rad = 32;//same thing as above
- angbonus = 1;
- radminus = 16;
- }
- yield;
- }
- }
- task deleteinloop(las){
- while(!Obj_IsDeleted(las)){//check if the player is shooting, if not, deletes the laser
- if(!Shooting){
- Obj_Delete(las);
- }yield;
- }
- }
- task KeepAtObj(obj,obj1){// keep the location at the position of a obj
- while(!Obj_IsDeleted(obj)){
- ObjMove_SetPosition(obj,ObjRender_GetX(obj1),ObjRender_GetY(obj1));
- yield;
- }
- }
- task renderPlayer{
- ObjPrim_SetTexture(playerObj,playerSprite);
- Obj_SetRenderPriorityI(playerObj,31);
- ObjRender_SetBlendType(playerObj,BLEND_ALPHA);
- ObjRender_SetAngleXYZ(playerObj,0,0,0);
- ObjRender_SetScaleXYZ(playerObj,1,1,1);
- ObjRender_SetAlpha(playerObj,255);
- ObjSprite2D_SetSourceRect(playerObj,0,0,32,48);
- ObjSprite2D_SetDestCenter(playerObj);
- ObjRender_SetPosition(playerObj,GetPlayerX,GetPlayerY,0);
- while(!Obj_IsDeleted(playerObj)){
- ObjRender_SetPosition(playerObj,GetPlayerX,GetPlayerY,0);
- yield;
- if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || GetVirtualKeyState(VK_LEFT) == KEY_HOLD){
- ObjRender_SetAngleY(playerObj,0);
- ObjSprite2D_SetSourceRect(playerObj,32,0,64,48);
- }else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || GetVirtualKeyState(VK_RIGHT) == KEY_HOLD){
- ObjRender_SetAngleY(playerObj,180);
- ObjSprite2D_SetSourceRect(playerObj,32,0,64,48);
- }else{
- ObjSprite2D_SetSourceRect(playerObj,0,0,32,48);
- }
- }
- }
- task renderHitbox(x,y){
- let alpha = 0;
- let spin = 0;
- ObjPrim_SetTexture(hitboxObj,playerSprite);
- ObjRender_SetBlendType(hitboxObj,BLEND_ALPHA);
- Obj_SetRenderPriorityI(hitboxObj,50);
- ObjRender_SetAlpha(hitboxObj,0);
- ObjRender_SetScaleXYZ(hitboxObj,1,1,0);
- ObjSprite2D_SetSourceRect(hitboxObj,0,64,64,128);
- ObjSprite2D_SetDestCenter(hitboxObj);
- while(!Obj_IsDeleted(hitboxObj)){
- ObjRender_SetPosition(hitboxObj,GetPlayerX,GetPlayerY,0);
- ObjRender_SetAngleZ(hitboxObj,spin);
- ObjRender_SetAlpha(hitboxObj,alpha);
- spin+=1;
- if(isFocus){
- alpha = 255;
- }else{
- alpha = 0;
- }
- yield;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment