Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TouhouDanmakufu[Single]
- #ScriptVersion[3]
- #Title["Stardust Claw"]
- #Text["SINGLE SERIES CARD[r] stardust claw[r] by kawamura-reo (1st)"]
- // include files
- #include"script/default_system/Default_ShotConst.txt"
- #include"script/default_system/Default_Effect.txt"
- // globs
- let objPlayer;
- let objEnemy;
- let inMotion = false;
- let stgX = GetStgFrameWidth() / 2; // Obtains the X coordinate of the center of the stage
- @Initialize
- {
- objPlayer = GetPlayerObjectID();
- objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS); // generates boss obj
- ObjEnemy_Regist(objEnemy); // Sets objEnemy to active
- ObjEnemy_SetDamageRate(objEnemy, 1, 50); // 1% dmg from bullets, 50% dmg from bomb
- // Load important tasks here
- // Tasks are "microthreads" which perform independently of one another
- // Using the yield; command in a task suspends it, when placed in loop(n) { }
- // It will suspend for n frames.
- TWork;
- TEnemDraw;
- TFinish;
- }
- @MainLoop
- {
- let enemyX = ObjMove_GetX(objEnemy);
- let enemyY = ObjMove_GetY(objEnemy);
- // Enemy collision to bullets
- ObjEnemy_SetIntersectionCircleToShot(objEnemy, enemyX, enemyY, 32);
- // Enemy collision to player chara
- ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, enemyX, enemyY, 24);
- yield; // Allows all tasks to perform their job before repeating @MainLoop
- }
- @Event
- {
- alternative(GetEventType())
- case(EV_REQUEST_LIFE)
- {
- SetScriptResult(200) // Set eHP
- }
- case(EV_REQUEST_TIMER)
- {
- SetScriptResult(120) // Set timer to 120s
- }
- case(EV_REQUEST_SPELL_SCORE)
- {
- SetScriptResult(75000) // Set score get to 50k
- }
- }
- // TASKS
- // Power task, performing the bulk
- task TWork
- {
- // Parameters:
- // real: object id ,
- // real: X-coordinate (in this example, X coord of the center) ,
- // real: Y-coordinate (in this example, 60 pixels below (stgX,0)) ,
- // real: the frame the object should be placed in (stgX, 60)
- ObjMove_SetDestAtFrame(objEnemy, stgX, 60, 60);
- loop(60) { yield; } // Suspend this task for 60 frames or 1 second
- // Performs spell card activation
- let objScene = GetEnemyBossSceneObjectID();
- ObjEnemyBossScene_StartSpell(objScene);
- ObjEnemy_SetDamageRate(objEnemy, 10, 50);
- // Perform this while the enemy isn't dead yet
- while(!Obj_IsDeleted(objEnemy))
- {
- loop(90) { yield; }
- TShotBallA(rand(110,140));
- TShotBallA(rand(55,95));
- TShotBallA(rand(30,45));
- loop(60) { yield; }
- TShotGunA;
- ObjMove_SetSpeed(objEnemy, 2);
- ObjMove_SetDestAtFrame(objEnemy, 50, 60, 60);
- loop(90) { yield; }
- TShotBallA(rand(85,100));
- TShotBallA(rand(55,65));
- TShotBallA(rand(10,30));
- loop(60) { yield; }
- TShotGunA;
- ObjMove_SetSpeed(objEnemy, 3);
- ObjMove_SetDestAtFrame(objEnemy, stgX+110, 60, 60);
- loop(90) { yield; }
- TShotBallA(rand(70,95));
- TShotBallA(rand(110,130));
- TShotBallA(rand(140,165));
- loop(60) { yield; }
- TShotGunA;
- ObjMove_SetSpeed(objEnemy, 2);
- ObjMove_SetDestAtFrame(objEnemy, stgX, 60, 60);
- loop(30) { yield; }
- loop(5) {
- loop(45) { yield; }
- TShotGunA;
- }
- loop(70) { yield; }
- }
- }
- // Drawing task
- task TEnemDraw
- {
- let imgExRumia = GetCurrentScriptDirectory ~ "ExRumia.png";
- ObjPrim_SetTexture(objEnemy, imgExRumia); // Set exrumia.png as texture to objEnemy
- while(!Obj_IsDeleted(objEnemy)) // perform this while the enemy isn't dead yet
- {
- let angle = ObjMove_GetAngle(objEnemy);
- let speed = ObjMove_GetSpeed(objEnemy);
- if(speed == 0) // Only perform this entire block if Rumia's speed was 0
- {
- if(inMotion) // Perform this block if Rumia was in motion
- {
- // Parameters - Takes only ONE texture image:
- // real: object's id ,
- // real: lower-left point ,
- // real: upper-left point ,
- // real: upper-right point ,
- // real: lower-right point
- ObjSprite2D_SetSourceRect(objEnemy, 64, 1, 127, 64);
- }
- else // Otherwise, make her appear stationary.
- {
- ObjSprite2D_SetSourceRect(objEnemy, 1, 1, 64, 64);
- }
- }
- // positive value = move right, so make Rumia's body go right
- else if (cos(angle) > 0) { ObjSprite2D_SetSourceRect(objEnemy, 192, 1, 255, 64); }
- // negative value = move left, so make Rumia's body go left
- else if (cos(angle) < 0) { ObjSprite2D_SetSourceRect(objEnemy, 128, 1, 191, 64); }
- ObjSprite2D_SetDestCenter(objEnemy);
- yield; // This loop performed once per frame
- }
- }
- // BULLET ROUTINES
- // Shoots a big ball forward which spawns smaller stars
- // Parameters:
- // angle1 - real : the angle from Rumia which the bullet is shot
- task TShotBallA(angle1)
- {
- let posX = ObjMove_GetX(objEnemy);
- let posY = ObjMove_GetY(objEnemy);
- // Create bullet object
- // Parameters
- // real: X coordinate of the origin
- // real: Y coordinate of the origin
- // real: acceleration of the object
- // real: angle from the origin of the object
- // real: top speed
- // real: object id of the shot to generate
- // real: delay time
- let bObj = CreateShotA2(posX, posY, 5, angle1, -0.01, 0, DS_BALL_L_BLUE, 0);
- ascent(i in 0 .. 40)
- {
- if(Obj_IsDeleted(bObj)) { break; }
- let bSpd = rand(0.7,2.3);
- let bx = ObjMove_GetX(bObj);
- let by = ObjMove_GetY(bObj);
- // spawn a small star bullet as the bigger bullet travels
- CreateShotA1(bx, by, bSpd, rand(0,360), DS_STAR_S_SKY, 25);
- yield;
- }
- }
- // Shoots several pellets aimed at the player,
- // Each pellet breaks into 5 kunai also aimed at the player.
- task TShotGunA
- {
- let posX = ObjMove_GetX(objEnemy);
- let posY = ObjMove_GetY(objEnemy);
- let pcX = GetPlayerX();
- let pcY = GetPlayerY();
- // Get the angle of sight from the enemy to the player.
- // atan2 returns based on (0,0) - (x,y), but for some reason the parameters
- // are switched... atan2(y,x) -.-?
- let homingAngle = atan2(pcY - posY, pcX - posX);
- // DS_RICE_M --> kunai!!
- // 3-way shot first: -15,0,15
- let aAngle = -10;
- while(aAngle <= 10)
- {
- let bObj1 = CreateShotA1(posX, posY, 4,
- aAngle+homingAngle,
- DS_RICE_M_RED, 30); // FIRST SHOT
- ObjShot_SetDeleteFrame(bObj1,46);
- // 5-way shotgun next: -10,-5,0,5,10
- let bAngle = -10;
- while(bAngle <= 10) {
- let bObj2 = CreateShotA1(0,0,0,0, DS_KUNAI_ORANGE, 10); // SECOND SHOT
- // ugly as fuck addpattern
- // 9 (!!!) parameters
- // Object, Frame, Speed, Angle, Acceleration, Curvature, Max Speed,
- // Object angle relative, bullet id
- ObjMove_AddPatternA4(bObj2, 0, 3.5, bAngle, 0, 0, 3, objPlayer, NO_CHANGE);
- ObjShot_AddShotA1(bObj1, bObj2, 45);
- bAngle += 5;
- }
- aAngle += 5;
- }
- }
- // Post-fight processing
- task TFinish
- {
- // Suspend this task indefinitely as long as enemy is still alive
- while(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0)
- {
- yield;
- }
- let enemyX = ObjMove_GetX(objEnemy);
- let enemyY = ObjMove_GetY(objEnemy);
- // TExplosionA is found in "script/default_system/..."
- // Parameters:
- // real: X coordinate of the explosion ,
- // real: Y coordinate of the explosion ,
- // real: "dAlpha" - reduce the brightness of the explosion by this amount
- // real: "dScale" - adjust the size of the explosion by this multiplier
- TExplosionA(enemyX, enemyY, 45, 0.7);
- DeleteShotAll(TYPE_ALL, TYPE_ITEM); // Get rid of everything
- Obj_Delete(objEnemy); // Delete the enemy to kill the loops
- loop(30) { yield; } // suspend this task for half a second
- // Don't forget to close the script when it ends!
- CloseScript(GetOwnScriptID());
- }
Advertisement
Add Comment
Please, Sign In to add comment