View difference between Paste ID: rSmiHMqj and Pt49AdnL
SHOW: | | - or go back to the newest paste.
1
#TouhouDanmakufu [Single]
2
#Title[DDD Part 34a]
3
#Text[Danmaku dodging for Dummies part 34a
4
Love Sign: Master Spark]
5
#Player[FREE]
6
#ScriptVersion[2]
7
//This is uploaded, Feb 10, 2013
8
9
script_enemy_main {
10
	#include_function ".\function_cutin.txt";
11
	let count = -60; //Counter
12
	let angle = 22.5; //Primary Angle
13
	let angle2 = 45; //Secondary Angle
14
	let angle3 = 0; //Tertiary Angle
15
	let bulletID = 5; //Bullet ID #
16
	let wvel = 0.25; //Angular Velocity
17
	let BossImage = GetCurrentScriptDirectory~"yukkuri2.png";
18
	let BossCutIn = GetCurrentScriptDirectory~"yukkuri2.png";
19
	let bullet = GetCurrentScriptDirectory~"bullet.wav";
20
	let laser = GetCurrentScriptDirectory~"laser.wav";
21
	let spark = GetCurrentScriptDirectory~"spark.wav";
22
	let ZUNbullet = GetCurrentScriptDirectory~"supershot.txt";
23
24
	@Initialize {
25-
	LoadGraphic(BossImage);
25+
		LoadGraphic(BossImage);
26-
	LoadGraphic(BossCutIn);
26+
		LoadGraphic(BossCutIn);
27-
	LoadUserShotData(ZUNbullet);
27+
		LoadUserShotData(ZUNbullet);
28-
	SetLife(5000);
28+
		SetLife(5000);
29-
	SetDamageRate(80, 40); //% of shot damage, % of bomb damage
29+
		SetDamageRate(80, 40); //% of shot damage, % of bomb damage
30-
	SetTimer(50);
30+
		SetTimer(50);
31-
	SetInvincibility(30);
31+
		SetInvincibility(30);
32-
	cutin("BYAKUREN","Love Sign "\""Master Spark"\",BossCutIn,0,0,207,234);
32+
		cutin("BYAKUREN","Love Sign "\""Master Spark"\",BossCutIn,0,0,207,234);
33-
	SetScore(1000000);
33+
		SetScore(1000000);
34-
	SetEnemyMarker(true);
34+
		SetEnemyMarker(true);
35-
	SetDurableSpellCard;
35+
		SetDurableSpellCard;
36-
	//LastSpell;
36+
		//LastSpell;
37-
	Concentration01(30); //Frames to charge energy
37+
		Concentration01(30); //Frames to charge energy
38-
	MagicCircle(true);
38+
		MagicCircle(true);
39-
	//SetEffectForZeroLife(30, 130, 0); //TimeIntensitySlowdown0=none
39+
		//SetEffectForZeroLife(30, 130, 0); //TimeIntensitySlowdown0=none
40-
	SetMovePosition02(GetCenterX, GetCenterY - 150, 30);
40+
		SetMovePosition02(GetCenterX, GetCenterY - 150, 30);
41-
	LoadSE(bullet);
41+
		LoadSE(bullet);
42-
	LoadSE(laser);
42+
		LoadSE(laser);
43-
	LoadSE(spark);
43+
		LoadSE(spark);
44
	}
45
46
	@MainLoop {
47
		SetCollisionA(GetX, GetY, 32);
48
		SetCollisionB(GetX, GetY, 24);
49
		if(count % 720 == 540){
50
			SetMovePosition03(GetPlayerX, GetCenterY - rand(60,180), 5, 1);
51
			//Xcor,Ycor,weight deceleration (lower = fluid), velocity
52
		}
53
		if(count % 720 == 20){
54
			Spark;
55
			PlaySE(spark);
56
		}
57
		if(count > 100 && count % 720 < 480 && count % 24 == 0){
58
			bulletID = rand_int(195,196);
59
			loop(15){
60
				CreateShot01(GetX, GetY, 1.5, angle, bulletID, 10);
61
				angle+=24;
62
			}
63
			PlaySE(bullet);
64
			angle+=12;
65
		}
66
		count++;
67
		yield;
68
	}
69
70
	@DrawLoop {
71
		SetTexture(BossImage);
72
		SetGraphicRect(0, 0, 207, 234); //Add one pixel to height and width
73
		SetAlpha(250);
74
		SetGraphicAngle(0, 0, 0);
75
		SetGraphicScale(0.5, 0.5);
76
		DrawGraphic(GetX,GetY);
77
	}
78
79
	task Spark{
80
		let sparkE = Obj_Create(OBJ_EFFECT);
81
		let sparkimg = GetCurrentScriptDirectory~"spell.png";
82
		let sparkS;
83
		
84
		Obj_SetPosition(sparkE, GetX, GetY);
85
		ObjEffect_SetAngle(sparkE, 0, 0, GetAngleToPlayer);
86
		ObjEffect_SetTexture(sparkE, sparkimg);
87
		ObjEffect_SetRenderState(sparkE, ALPHA);
88
		ObjEffect_SetPrimitiveType(sparkE, PRIMITIVE_TRIANGLEFAN);
89
		ObjEffect_CreateVertex(sparkE, 4);
90
		//LOOK AT HOW I DO THE VERTICES HERE
91
		ObjEffect_SetVertexUV(sparkE,0, 0, 128);
92
		ObjEffect_SetVertexUV(sparkE,1, 0, 0);
93
		ObjEffect_SetVertexUV(sparkE,2, 256, 0);
94
		ObjEffect_SetVertexUV(sparkE,3, 256, 128);
95
		//THE UV->XY COORDINATES ARE SET UP LIKE THIS
96
		// (0,0)---------------(256,0)
97
		//   |                    |
98
		// (BOSS)                 |
99
		//   |                    |
100
		// (0,128)-------------(256,128)
101-
		loop(120){ yield; }						//few frames of delay without laser hitbox
101+
102
		ObjEffect_SetVertexXY(sparkE,1, 0, -64);
103
		ObjEffect_SetVertexXY(sparkE,2, 256, 64);
104
		ObjEffect_SetVertexXY(sparkE,3, 256, -64)
105
		ascent(i in 0..4){ObjEffect_SetVertexColor(sparkE, i, 255, 255, 255, 255);}
106
107
		//use SetScale to flatteh and widen laser, including making it twice as long
108-
		Obj_SetAlpha(sparkS, 200);	//not sure why this is even here if the laser is invisible
108+
109
		loop(120){ yield; }	//few frames of delay without laser hitbox
110
111
		//delay done, actually fire laser
112
		sparkS = Obj_Create(OBJ_LASER);
113
		Obj_SetPosition(sparkS, GetX, GetY);
114
		Obj_SetAngle(sparkS, GetAngleToPlayer);
115
		Obj_SetSpeed(sparkS, 0);
116
		Obj_SetAlpha(sparkS, 200);	//the laser is invisible, why is this here
117
		ObjLaser_SetLength(sparkS, 512);
118
		ObjLaser_SetSource(sparkS, false);
119
120
		ascent(i in 1..121){
121
			ObjLaser_SetWidth(sparkS, i);	//widen laser hitbox
122
			ObjEffect_SetScale(sparkE, i/120, 2);	//widen laser graphic
123
			yield;
124
		}
125
126
		loop(360){yield;} //some frames with the laser at full size
127
128
		descent(i in 1..121){
129
			ObjLaser_SetWidth(sparkS, i);	//flatten laser hitbox
130
			ObjEffect_SetScale(sparkE, i/120, 2);	//flatten laser graphic
131
			yield;
132
		}
133
134
		//lasers disappear, done
135
		Obj_Delete(sparkS);
136
		Obj_Delete(sparkE);
137
	}
138
139
140
	@Finalize {
141
		DeleteGraphic(BossImage);
142
		DeleteGraphic(BossCutIn);
143
		DeleteSE(bullet);
144
		DeleteSE(laser);
145
		DeleteSE(spark);
146
	}
147
148
	@BackGround {
149
	}
150
}