View difference between Paste ID: SC08gscM and eCrQajEc
SHOW: | | - or go back to the newest paste.
1-
#東方弾幕風[Single]
1+
#TouhouDanmakufu[Single]
2
#ScriptVersion[3]
3-
#Title["テスト「ダークネス」"]
3+
#Title["Stardust Claw"]
4-
#Text["azakacrossのはじめのスペカー"]
4+
#Text["SINGLE SERIES CARD[r] stardust claw[r] by kawamura-reo (1st)"]
5
6
// include files
7
#include"script/default_system/Default_ShotConst.txt"
8
#include"script/default_system/Default_Effect.txt"
9
10
// globs
11
let objPlayer;
12
let objEnemy; 
13
let inMotion = false;
14
let stgX = GetStgFrameWidth() / 2; // Obtains the X coordinate of the center of the stage
15
16
@Initialize
17
{
18
	objPlayer = GetPlayerObjectID();
19-
	ObjEnemy_SetDamageRate(objEnemy, 50, 75); // 50% dmg from bullets, 75% dmg from bomb
19+
20
	ObjEnemy_Regist(objEnemy); // Sets objEnemy to active
21
	ObjEnemy_SetDamageRate(objEnemy, 1, 50); // 1% dmg from bullets, 50% dmg from bomb
22
	
23
	// Load important tasks here
24
	// Tasks are "microthreads" which perform independently of one another
25
	// Using the yield; command in a task suspends it, when placed in loop(n) { }
26
	// It will suspend for n frames. 
27
	
28
	TWork;
29
	TEnemDraw;
30
	TFinish;
31
}
32
33
@MainLoop
34
{
35
	let enemyX = ObjMove_GetX(objEnemy);
36
	let enemyY = ObjMove_GetY(objEnemy);
37
	
38
	// Enemy collision to bullets
39
	ObjEnemy_SetIntersectionCircleToShot(objEnemy, enemyX, enemyY, 32);
40
	
41
	// Enemy collision to player chara
42
	ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, enemyX, enemyY, 24);
43
	
44
	yield; // Allows all tasks to perform their job before repeating @MainLoop
45
}
46
47
@Event
48
{
49
	alternative(GetEventType())
50
	case(EV_REQUEST_LIFE)
51-
		SetScriptResult(250) // Set eHP to 500
51+
52
		SetScriptResult(200) // Set eHP 
53
	}
54
	case(EV_REQUEST_TIMER)
55
	{
56
		SetScriptResult(120) // Set timer to 120s
57
	}
58
	case(EV_REQUEST_SPELL_SCORE)
59-
		SetScriptResult(50000) // Set score get to 50k
59+
60
		SetScriptResult(75000) // Set score get to 50k
61
	}
62
}
63-
/*******
63+
64-
* Tasks
64+
65-
********/
65+
// TASKS
66
67
// Power task, performing the bulk
68
69
task TWork
70
{
71-
	/*******
71+
72-
	* Parameters:
72+
	// Parameters:
73-
	* real: object id ,
73+
	// real: object id ,
74-
	* real: X-coordinate (in this example, X coord of the center) ,
74+
	// real: X-coordinate (in this example, X coord of the center) ,
75-
	* real: Y-coordinate (in this example, 60 pixels below (stgX,0)) ,
75+
	// real: Y-coordinate (in this example, 60 pixels below (stgX,0)) ,
76-
	* real: the frame the object should be placed in (stgX, 60)
76+
	// real: the frame the object should be placed in (stgX, 60)
77-
	********/
77+
78
	ObjMove_SetDestAtFrame(objEnemy, stgX, 60, 60);
79
	
80
	loop(60) { yield; } // Suspend this task for 60 frames or 1 second
81
	
82
	// Performs spell card activation
83
	let objScene = GetEnemyBossSceneObjectID();
84
	ObjEnemyBossScene_StartSpell(objScene);
85
	
86
	ObjEnemy_SetDamageRate(objEnemy, 10, 50);
87
	
88
	// Perform this while the enemy isn't dead yet
89
	while(!Obj_IsDeleted(objEnemy))
90-
		TShotBallA(135);
90+
91-
		TShotBallA(90);
91+
92-
		TShotBallA(45);
92+
		TShotBallA(rand(110,140));
93
		TShotBallA(rand(55,95));
94
		TShotBallA(rand(30,45));
95
		
96
		loop(60) { yield; }
97
		TShotGunA;
98
		
99
		ObjMove_SetSpeed(objEnemy, 2);
100
		ObjMove_SetDestAtFrame(objEnemy, 50, 60, 60);
101
		
102
		loop(90) { yield; }
103
		TShotBallA(rand(85,100));
104
		TShotBallA(rand(55,65));
105
		TShotBallA(rand(10,30));
106
		
107
		loop(60) { yield; }
108
		TShotGunA;
109
		
110
		ObjMove_SetSpeed(objEnemy, 3);
111
		ObjMove_SetDestAtFrame(objEnemy, stgX+110, 60, 60);
112-
					/**************************
112+
		
113-
					* Parameters - Takes only ONE texture image:
113+
114-
					* real: object's id ,
114+
		TShotBallA(rand(70,95));
115-
					* real: lower-left point ,
115+
		TShotBallA(rand(110,130));
116-
					* real: upper-left point ,
116+
		TShotBallA(rand(140,165));
117-
					* real: upper-right point , 
117+
		
118-
					* real: lower-right point
118+
		loop(60) { yield; }
119-
					**************************/
119+
		TShotGunA;
120
		
121
		ObjMove_SetSpeed(objEnemy, 2);
122
		ObjMove_SetDestAtFrame(objEnemy, stgX, 60, 60);
123
		
124
		loop(30) { yield; }
125
		
126
		loop(5) {
127
			loop(45) { yield; }
128
			TShotGunA;
129
		}
130
		
131
		loop(70) { yield; }
132
	}
133
}
134
135
// Drawing task
136
137
task TEnemDraw
138-
/******************
138+
139-
* Bullet routines
139+
140-
* go here
140+
141-
******************/
141+
142
	while(!Obj_IsDeleted(objEnemy)) // perform this while the enemy isn't dead yet
143
	{
144
			let angle = ObjMove_GetAngle(objEnemy);
145
			let speed = ObjMove_GetSpeed(objEnemy);
146
			
147
			if(speed == 0) // Only perform this entire block if Rumia's speed was 0 
148
			{
149
				if(inMotion) // Perform this block if Rumia was in motion
150
				{
151
					// Parameters - Takes only ONE texture image:
152
					// real: object's id ,
153-
	/**********************
153+
					// real: lower-left point ,
154-
	* Parameters
154+
					// real: upper-left point ,
155-
	* real: X coordinate of the origin
155+
					// real: upper-right point , 
156-
	* real: Y coordinate of the origin
156+
					// real: lower-right point
157-
	* real: acceleration of the object
157+
158-
	* real: angle from the origin of the object
158+
159-
	* real: top speed
159+
160-
	* real: object id of the shot to generate
160+
161-
	* real: delay time
161+
162-
	**********************/
162+
163-
	let bObj = CreateShotA2(posX, posY, 3, angle1, 0.05, 0, DS_BALL_L_PURPLE, 0);
163+
164
			// positive value = move right, so make Rumia's body go right
165-
	ascent(i in 0 .. 250)
165+
166
			// negative value = move left, so make Rumia's body go left
167
			else if (cos(angle) < 0) { ObjSprite2D_SetSourceRect(objEnemy, 128, 1, 191, 64); }
168-
		let bSpd = rand(0.3,2);
168+
169
			ObjSprite2D_SetDestCenter(objEnemy);
170
			
171
			yield; // This loop performed once per frame
172-
		CreateShotA1(bx, by, bSpd, rand(0,360), DS_STAR_S_PURPLE, 45);
172+
173
}
174
175
// BULLET ROUTINES
176
177
// Shoots a big ball forward which spawns smaller stars
178
// Parameters:
179
// angle1 - real : the angle from Rumia which the bullet is shot
180
181
task TShotBallA(angle1)
182
{
183
	let posX = ObjMove_GetX(objEnemy);
184
	let posY = ObjMove_GetY(objEnemy);
185
	
186
	// Create bullet object
187
	
188
	// Parameters
189
	// real: X coordinate of the origin
190-
	/******
190+
	// real: Y coordinate of the origin
191-
	* TExplosionA is found in "script/default_system/..." 
191+
	// real: acceleration of the object
192-
	* Parameters:
192+
	// real: angle from the origin of the object
193-
	* real: X coordinate of the explosion , 
193+
	// real: top speed
194-
	* real: Y coordinate of the explosion , 
194+
	// real: object id of the shot to generate
195-
	* real: "dAlpha" - reduce the brightness of the explosion by this amount
195+
	// real: delay time
196-
	* real: "dScale" - adjust the size of the explosion by this multiplier
196+
197-
	******/
197+
	let bObj = CreateShotA2(posX, posY, 5, angle1, -0.01, 0, DS_BALL_L_BLUE, 0);
198
	
199
	ascent(i in 0 .. 40)
200
	{
201
		if(Obj_IsDeleted(bObj)) { break; }
202
		let bSpd = rand(0.7,2.3);
203
		let bx = ObjMove_GetX(bObj);
204
		let by = ObjMove_GetY(bObj);
205
		// spawn a small star bullet as the bigger bullet travels
206
		CreateShotA1(bx, by, bSpd, rand(0,360), DS_STAR_S_SKY, 25);
207
208
		yield;
209
	}
210
}
211
212
// Shoots several pellets aimed at the player, 
213
// Each pellet breaks into 5 kunai also aimed at the player.
214
215
task TShotGunA
216
{
217
	let posX = ObjMove_GetX(objEnemy);
218
	let posY = ObjMove_GetY(objEnemy);
219
	let pcX = GetPlayerX();
220
	let pcY = GetPlayerY();
221
	
222
	// Get the angle of sight from the enemy to the player.
223
	// atan2 returns based on (0,0) - (x,y), but for some reason the parameters
224
	// are switched... atan2(y,x) -.-? 
225
	let homingAngle = atan2(pcY - posY, pcX - posX);
226
	
227
	// DS_RICE_M --> kunai!!
228
	// 3-way shot first: -15,0,15
229
	let aAngle = -10;
230
	while(aAngle <= 10)
231
	{
232
		let bObj1 = CreateShotA1(posX, posY, 4,
233
									aAngle+homingAngle,
234
									DS_RICE_M_RED, 30); // FIRST SHOT
235
		ObjShot_SetDeleteFrame(bObj1,46);
236
		
237
		// 5-way shotgun next: -10,-5,0,5,10
238
		let bAngle = -10;
239
		while(bAngle <= 10) {
240
			let bObj2 = CreateShotA1(0,0,0,0, DS_KUNAI_ORANGE, 10); // SECOND SHOT
241
			// ugly as fuck addpattern
242
			// 9 (!!!) parameters
243
			// Object, Frame, Speed, Angle, Acceleration, Curvature, Max Speed, 
244
			// Object angle relative, bullet id 
245
			ObjMove_AddPatternA4(bObj2, 0, 3.5, bAngle, 0, 0, 3, objPlayer, NO_CHANGE);
246
			ObjShot_AddShotA1(bObj1, bObj2, 45);
247
			bAngle += 5;
248
		}
249
		
250
		aAngle += 5;
251
	}
252
	
253
}
254
255
// Post-fight processing
256
257
task TFinish
258
{
259
	// Suspend this task indefinitely as long as enemy is still alive
260
	while(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0)
261
	{
262
		yield;
263
	}
264
	
265
	let enemyX = ObjMove_GetX(objEnemy);
266
	let enemyY = ObjMove_GetY(objEnemy);
267
	
268
	// TExplosionA is found in "script/default_system/..." 
269
	// Parameters:
270
	// real: X coordinate of the explosion , 
271
	// real: Y coordinate of the explosion , 
272
	// real: "dAlpha" - reduce the brightness of the explosion by this amount
273
	// real: "dScale" - adjust the size of the explosion by this multiplier
274
	TExplosionA(enemyX, enemyY, 45, 0.7); 
275
	
276
	DeleteShotAll(TYPE_ALL, TYPE_ITEM); // Get rid of everything
277
	Obj_Delete(objEnemy); // Delete the enemy to kill the loops
278
	
279
	loop(30) { yield; } // suspend this task for half a second
280
	
281
	// Don't forget to close the script when it ends!
282
	CloseScript(GetOwnScriptID()); 
283
}