Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #gool KongC 45 3
- #anim KONG_STAND_1 [KS1xV] 24
- #anim KONG_STAND_2 [KS2xV] 21
- #anim KONG_STAND_3 [KS3xV] 8
- #anim KONG_STAND_4 [KS4xV] 23
- #anim KONG_STAND_5 [KS5xV] 25
- #anim KONG_STAND_6 [KS6xV] 15
- #anim KONG_STAND_7 [KS7xV] 21
- #anim KONG_STAND_8 [KS8xV] 10
- #anim KONG_LIFT_1 [KL1xV] 15
- #anim KONG_LIFT_2 [KL2xV] 22
- #anim KONG_LIFT_3 [KL3xV] 24
- #anim KONG_WALK [KW1xV] 15
- #anim KONG_THROW_1 [KT1xV] 21
- #anim KONG_THROW_2 [KT2xV] 20
- #anim KONG_THROW_3 [KT3xV] 18
- #anim KONG_HOP [KH1xV] 16
- #anim KONG_HIT_1 [Kh1xV] 14
- #anim KONG_HIT_2 [Kh2xV] 16
- #anim KONG_DIE_1 [KD1xV] 18
- #anim KONG_DIE_2 [KD2xV] 18
- #spawn SPAWN_DEFAULT Kong_Default
- #spawn SPAWN_DONKEYKONG Kong_DonkeyKongSpawner
- #include "GOOL_EXPR.gooc"
- var loadstate, mem2, testduration
- event EventHit => state Kong_Hit
- /* unused, from levelg */
- state Kong_DonkeyKongSpawner {
- code () {
- x = parent->x + rand(-10m, 10m + 1)
- z = parent->x + rand(-10m, 10m + 1)
- mem2 = rand(5)
- testduration = 1.8s + rand(4.8s)
- statusb = FLAG_INVISIBLE
- do {
- var starttime = frametime
- do {
- playanim(0, KONG_HOP)
- } while (frametime - starttime < testduration)
- } while (true)
- }
- }
- state Kong_Default {
- code () {
- GVAR_3 = self
- statusb = 0
- health = 0
- spawn(29, 4, 1, 4.0, 2) // ShadC - ShabC, boss health bar
- zindex = -20
- pathprog = pathlen >> 1 // start in the middle of path
- calcpath()
- GVAR_1 = health
- loadstate = 0
- loadfile([Kh1xV])
- loadfile([KS1xG])
- loadfile([Kh2xV])
- loadfile([KS1xG])
- changestate(Kong_Stand)
- }
- }
- state Kong_Stand {
- statusc 0
- code () { // do stand (flex) animations then start throwing rocks
- playframes(KONG_STAND_1, 1.0, 0, 23.0)
- playframe(animframe, 0.4s)
- playframes(KONG_STAND_2, 1.0, 0, 20.0)
- playframes(KONG_STAND_3, 1.0, 0, 7.0)
- playframe(animframe, 0.4s)
- playframes(KONG_STAND_4, 1.0, 0, 22.0)
- playframes(KONG_STAND_5, 1.0, 0, 24.0)
- playframes(KONG_STAND_6, 1.0, 0, 14.0)
- playframe(animframe, 0.4s)
- playframes(KONG_STAND_7, 1.0, 0, 20.0)
- playframes(KONG_STAND_8, 1.0, 0, 9.0)
- changestate(Kong_Boss_NormalThrow)
- }
- event (e, a) {
- accepteventandchangestate(Kong_Boss_NormalThrow, e == EventTriggered)
- }
- }
- sub SpawnTNT(p) {
- var p = p
- if (p == 0) {
- if (player-> x < 0) {
- v0 = 3m
- }
- else {
- v0 = -3m
- }
- spawn(34, 16, 1, 5m, 60, v0, y, 4.5m) // BoxsC - 16
- }
- else if (p == 1.0) {
- if (health >= 2.0) {
- spawn(34, 16, 1, 5m, 60, 0, y, 4.5m) // BoxsC - 16
- }
- }
- else if (p == 2.0 || p == 3.0) {
- if (health >= 4.0) {
- v0 = 0 - v0
- spawn(34, 16, 1, 5m, 60, v0, y, 4.5m) // BoxsC - 16
- }
- }
- }
- state Kong_Boss_NormalThrow {
- statusc 0
- code () {
- /* set speed towards the right to 2.5x remaining length */
- if (pathprog < pathlen + 1) {
- velx = (pathlen - pathprog) * 30 / 12
- playframes(KONG_HOP, 1.0, 0.0, 15.0)
- }
- velx = 0
- {
- var boulders = 0
- do {
- /* pick up a rock fast */
- playframes(KONG_LIFT_1, 2.0, 0, 14.0)
- playframe(animframe, 0.15s)
- playframes(KONG_LIFT_2, 2.0, 0, 21.0)
- playframes(KONG_LIFT_3, 2.0, 0, 23.0)
- playframes(KONG_THROW_1, 2.0, 0, 20.0)
- playframes(KONG_THROW_2, 1.0, 0, 19.0)
- interrupter = objectget(13.0) // get object ID 13 (expecting KonOC object)
- sendevent(Event27, interrupter, interrupter, x, modeb, boulders) // send an event to spawn a rock using the selected object's spline
- SpawnTNT(boulders)
- sounddecay(0.375)
- soundpitch(3.6 + rand(0.8))
- soundplay([jmp0A], 12.8 + rand(12.8))
- playframes(KONG_THROW_3, 2.0, 0, 17.0)
- boulders += 1.0
- } while (boulders < 3.0)
- }
- /* pick up a rock slowly */
- playframes(KONG_LIFT_1, 1.0, 0, 14.0)
- playframe(animframe, 0.4s)
- playframes(KONG_LIFT_2, 1.0, 0, 21.0)
- playframes(KONG_LIFT_3, 1.0, 0, 23.0)
- statetime = frametime
- velx = -2.0
- {
- var walktime = 1.8s + rand(4.2s), step = 1.0
- do {
- SpawnTNT(step)
- step += 1.0
- playframes(KONG_WALK, 1.0, 0, 14.0)
- } until (frametime - statetime >= walktime)
- }
- changestate(Kong_Boss_HeavyThrow)
- }
- event (e, a) {
- if (e == EventHit) {
- acceptevent()
- sendevent(EventHit, interrupter, 0, 1)
- }
- }
- trans {
- if (!STATUS_FIRSTFRAME) {
- /* progress along path */
- pathprog = spd(pathprog, velx)
- if (pathprog >= pathlen) {
- pathprog = pathlen - 1
- }
- calcpath()
- }
- }
- }
- state Kong_Boss_HeavyThrow {
- statusc 0
- code () {
- /* throw rock and go back to standing state */
- playframes(KONG_THROW_1, 1.0, 0, 20.0)
- playframes(KONG_THROW_2, 1.0, 0, 19.0)
- interrupter = objectget(11.0) // get object ID 11 (expecting KonOC object)
- sendevent(Event27, interrupter, interrupter, x, modeb, 1) // send an event to spawn a rock using the selected object's spline
- sounddecay(0.375)
- soundpitch(3.6 + rand(0.8))
- soundplay([jmp0A], 12.8 + rand(12.8))
- playframes(KONG_THROW_3, 1.0, 0, 17.0)
- changestate(Kong_Stand)
- }
- event (e, a) {
- if (e == EventHit) {
- acceptevent()
- sendevent(EventHit, interrupter, 0, 1)
- }
- }
- }
- state Kong_Hit {
- statusc 0
- stateflag 0x3
- code () {
- /* become red */
- setcolor(0xFF, 21)
- setcolor(0x80, 22)
- setcolor(0x80, 23)
- setcolor(0xFF, 12)
- setcolor(0x80, 13)
- setcolor(0x80, 14)
- setcolor(0xFF, 15)
- setcolor(0x80, 16)
- setcolor(0x80, 17)
- setcolor(0xFF, 18)
- setcolor(0x80, 19)
- setcolor(0x80, 20)
- sendevent(EventHit, interrupter, 0, 0)
- health += 1.0
- GVAR_1 = health
- changestateif(Kong_Dead, health >= 4.0)
- sounddecay(0.5625)
- soundpitch(1.92 + rand(0.32))
- soundplay([hit0A], 64.0 - 1)
- playframes(KONG_HIT_1, 1.0, 0, 13.0)
- playframes(KONG_HIT_2, 1.0, 0, 15.0)
- /* become normal-colored */
- setcolor(0xFF, 21)
- setcolor(0xFF, 22)
- setcolor(0xFF, 23)
- setcolor(0xFF, 12)
- setcolor(0xFF, 13)
- setcolor(0xFF, 14)
- setcolor(0xFF, 15)
- setcolor(0xFF, 16)
- setcolor(0xFF, 17)
- setcolor(0xFF, 18)
- setcolor(0xFF, 19)
- setcolor(0xFF, 20)
- /* Dead animations will play instead of Hit animations when on the last hit point,
- * therefore we unload the Hit animations and load the Dead ones for use later
- */
- if (health >= 3.0) {
- deloadfile([Kh1xV])
- deloadfile([KS1xG])
- deloadfile([Kh2xV])
- deloadfile([KS1xG])
- loadfile([KD1xV])
- loadfile([KS1xG])
- loadfile([KD2xV])
- loadfile([KS1xG])
- loadstate = 1.0
- }
- changestate(Kong_Boss_NormalThrow)
- }
- }
- state Kong_Dead {
- statusc 0
- stateflag 0x21
- code () {
- /* fall back, play sound and win boss */
- entitysetspawn(0)
- playframes(KONG_DIE_1, 1.0, 0, 17.0)
- sounddecay(0.625)
- soundpitch(3.6 + rand(0.8))
- sounddelay(0.36s)
- soundplay([BSlaA], 64.0 - 1)
- playframes(KONG_DIE_2, 1.0, 0, 17.0)
- sendevent(EventBossWin, player, 0, 0)
- while (true) playframe(animframe, 2.1s);
- }
- }
- event Event19 => (e) {
- /* deload selected assets. unknown object to send this event (boss win cleanup?) */
- var loadstate = loadstate
- if (loadstate == 0) {
- deloadfile([Kh1xV])
- deloadfile([KS1xG])
- deloadfile([Kh2xV])
- deloadfile([KS1xG])
- }
- else if (loadstate == 1.0) {
- deloadfile([KD1xV])
- deloadfile([KS1xG])
- deloadfile([KD2xV])
- deloadfile([KS1xG])
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement