[scratchblocks] when gf clicked switch backdrop to [tg v] wait (0.01) secs switch backdrop to [blank v] when I receive [Shutdown v] switch backdrop to [tg v] clear [/scratchblocks] [scratchblocks] when gf clicked clear broadcast [Init arcade v] broadcast [Play Intro v] reset timer forever set [Prev Timer v] to (timer) broadcast [Check Mouse and Keyboard v] and wait clear broadcast [Draw next frame v] repeat until <((timer) - (Prev Timer)) > ((1) / (#FPS))> wait (0.01) secs end end when I receive [Init arcade v] set [#Credits v] to [0] set [#Mode v] to ([PREGAME v] of [CONSTS v]) set [#FPS v] to [30] when I receive [New game v] broadcast [Kill banner v] set [#Score v] to [0] set [#Shields v] to [80] set [#ShipsPassed v] to [0] set [#Mode v] to ([PLAYING v] of [CONSTS v]) when [space v] key pressed if <(#Mode) < ([PLAYING v] of [CONSTS v])> then change [#Credits v] by (1) play sound [coin v] set [#Mode v] to ([COINED v] of [CONSTS v]) wait until > end when [3 v] key pressed change [#Credits v] by (1) play sound [coin v] if <(#Mode) < ([COINED v] of [CONSTS v])> then set [#Mode v] to ([COINED v] of [CONSTS v]) end wait until > when [1 v] key pressed if <(#Mode) = ([COINED v] of [CONSTS v])> then change [#Credits v] by (-1) wait until > broadcast [New game v] end when I receive [Check Mouse and Keyboard v] if <<(#Mode) = ([COINED v] of [CONSTS v])> and > then change [#Credits v] by (-1) broadcast [New game v] end [/scratchblocks] [scratchblocks] when gf clicked hide go to x:(0) y:(0) [/scratchblocks] [scratchblocks] when gf clicked hide define draw tg intro %n if <(stop intro flag) = [2]> then stop [this script v] end set [tg i v] to [0] if <([cos v] of ((param rot))) > [0]> then set [objects v] to ((length of [tailgunner logo v]) / (2)) else set [objects v] to [8] end repeat (objects) change [tg i v] by (1) set [tg from v] to (item (tg i) of [tailgunner logo v]) change [tg i v] by (1) set [tg to v] to (item (tg i) of [tailgunner logo v]) draw rotated line %n %n %n end define draw rotated line %n %n %n if > then Unpack positive %n set [tg x v] to (Pack X) set [tg y v] to (Pack Y) set [tg z v] to (Pack Z) Unpack positive %n change [Pack Z v] by ((Pack Y) * ([sin v] of ((param rot)))) set [Pack Y v] to ((Pack Y) * ([cos v] of ((param rot)))) set [screen x v] to (((512) * (Pack X)) / ((512) + (Pack Z))) set [screen y v] to (((512) * (Pack Y)) / ((512) + (Pack Z))) go to x:((cur x) + (screen x)) y:((cur y) + (screen y)) set pen color to (pen colour) pen down change [tg z v] by ((tg y) * ([sin v] of ((param rot)))) set [tg y v] to ((tg y) * ([cos v] of ((param rot)))) set [screen x v] to (((512) * (tg x)) / ((512) + (tg z))) set [screen y v] to (((512) * (tg y)) / ((512) + (tg z))) go to x:((cur x) + (screen x)) y:((cur y) + (screen y)) pen up end define Unpack positive %n set [Pack X v] to (((param packed)) mod (2048)) set [Pack Y v] to (([floor v] of (((param packed)) / (2048))) mod (2048)) set [Pack Z v] to (([floor v] of (((param packed)) / ((2048) * (2048)))) mod (2048)) change [Pack X v] by (-128) change [Pack Y v] by (-128) change [Pack Z v] by (cur z) when I receive [Kill banner v] set [stop intro flag v] to [2] when I receive [Play Intro v] Play intro define Play intro set [cur x v] to [0] set [cur y v] to [0] set [cur z v] to [206] set [pen colour v] to ((220) * (256)) set [rot v] to [90] set [flashing v] to [0] set [hide v] to [0] set [stop intro flag v] to [0] when I receive [Draw next frame v] set pen color to (pen colour) set pen size to (1) if <(flashing) > [0]> then change [flashing v] by (-1) set [pen colour v] to (([floor v] of ((127) + ((64) * (([sin v] of ((flashing) * (16))) + (1))))) * (256)) if <(flashing) = [0]> then set [rot v] to [90] set [cur z v] to [206] set [hide v] to [60] end end if <(hide) = [0]> then draw tg intro %n if <(flashing) = [0]> then set [rot v] to (((rot) + (-2)) mod (360)) change [cur z v] by (-1) if <(cur z) < [-199]> then if <(stop intro flag) = [1]> then clear stop [this script v] end set [pen colour v] to ((220) * (256)) set [flashing v] to [181] set [rot v] to [0] end end else change [hide v] by (-1) if <(hide) = [0]> then end end set pen color to ((250) * (256)) set [cur z v] to [-300] set [stop intro flag v] to [0] draw tg intro %n set [stop intro flag v] to [2] broadcast [Start new round v] [/scratchblocks] [scratchblocks] when gf clicked hide pen up set [text x v] to [-220] set [text y v] to [32] set [ptr v] to [1] set [flashing text timer v] to [0] when I receive [Draw next frame v] if <(#Mode) > ([COINED v] of [CONSTS v])> then Draw score Draw ships passed Draw shields left else Draw highscore Draw last game score if <(#Credits) > [0]> then broadcast [Kill banner v] Draw credits Press start else end end set [flashing text timer v] to (((flashing text timer) + (16)) mod (360)) define segment %n %n set [to v] to (((param coords)) mod (16)) set [to x v] to (((to) mod (5)) * (((4) * ((param text scale))) / (128))) set [to y v] to (([floor v] of ((to) / (5))) * (((12) * ((param text scale))) / (128))) set [from v] to ([floor v] of (((param coords)) / (16))) set [from x v] to (((from) mod (5)) * (((4) * ((param text scale))) / (128))) set [from y v] to (([floor v] of ((from) / (5))) * (((12) * ((param text scale))) / (128))) draw line 3d %n %n %n %n %n %n define draw line 3d %n %n %n %n %n %n go to x:((from x) + (text x)) y:((from y) + (text y)) pen down go to x:((to x) + (text x)) y:((to y) + (text y)) pen up define next char ch %n %n change [ptr v] by (1) define Draw shields left set pen color to ((220) * (256)) Draw num %n at %n %n define Draw num %n at %n %n set [text x v] to ((param x)) set [text y v] to ((param y)) set [ptr v] to [1] repeat (length of ((param num))) ch %n %n change [ptr v] by (1) end define Insert Coin set [text x v] to [-135] set [text y v] to [-120] set [pen colour v] to (((128) + ([floor v] of ((([sin v] of (flashing text timer)) + (1)) * (64)))) * (256)) set pen color to (pen colour) ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n define Draw score set pen color to ((220) * (256)) Draw num %n at %n %n define Draw highscore set pen color to ((220) * (256)) set [text x v] to [42] set [text y v] to [130] ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n if <(☁ Highscore) > (#HighScore)> then set [#HighScore v] to (☁ Highscore) end if <(#HighScore) > (☁ Highscore)> then set [☁ Highscore v] to (#HighScore) end Draw small num %n at %n %n define Draw ships passed set pen color to ((220) * (256)) Draw num %n at %n %n Insert Coin define Draw small num %n at %n %n set [text x v] to ((param x)) set [text y v] to ((param y)) set [ptr v] to [1] repeat (length of ((param num))) ch %n %n change [ptr v] by (1) end define Press start set [text x v] to [-120] set [text y v] to [-10] set [pen colour v] to (((128) + ([floor v] of ((([sin v] of (flashing text timer)) + (1)) * (64)))) * (256)) set pen color to (pen colour) ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n define Draw credits set pen color to ((220) * (256)) set [text x v] to [-100] set [text y v] to [-120] ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n if <(#Credits) > [9]> then ch %n %n else ch %n %n end define Draw last game score set pen color to ((220) * (256)) set [text x v] to [-220] set [text y v] to [130] ch %n %n ch %n %n ch %n %n ch %n %n ch %n %n Draw small num %n at %n %n define alphabet test set [text x v] to [-220] set [text y v] to [30] set [ptr v] to [1] set pen color to ((220) * (256)) repeat (10) next char end repeat (8) next char end change [text y v] by (-32) set [text x v] to [-220] repeat (18) next char end define ch %n %n if <((param charno)) > [0]> then set [i v] to (item ((param charno)) of [encoded v]) set [char v] to ((i) mod (256)) set [i v] to ([floor v] of ((i) / (256))) set [segments v] to ((i) mod (7)) set [i v] to ([floor v] of ((i) / (7))) repeat (segments) segment %n %n set [i v] to ([floor v] of ((i) / (256))) end end change [text x v] by ((24) * (((param text scale)) / (128))) [/scratchblocks] [scratchblocks] when gf clicked hide set [star movement v] to [0.025] set [my clone id v] to [0] repeat (64) if <(my clone id) = [0]> then create clone of [_myself_ v] wait (0.07) secs end end when I start as a clone change [my clone id v] by (1) Reinit when I receive [Draw next frame v] if <(my clone id) > [0]> then if <(distance to [StarfieldCenter v]) < [20]> then Reinit else change [ghost v] effect by (1) if <(size) > [10]> then change size by (-10) end move ((star movement) * (distance to [StarfieldCenter v])) steps end end when I receive [Passing v] if <(my clone id) = [0]> then set [star movement v] to [0.05] repeat (6) play sound [star v] wait (1) secs end set [star movement v] to [0.025] end define Point to %n %n point in direction (([atan v] of ((((param x)) - (x position)) / (((param y)) - (y position)))) + ((180) * (((param y)) < (y position)))) define Choose random edge to start on set [edge v] to (pick random (1) to (4)) if <(edge) = [1]> then go to x:(-239) y:(pick random (-179) to (180)) else if <(edge) = [2]> then go to x:(239) y:(pick random (-179) to (180)) else if <(edge) = [3]> then go to x:(pick random (-239) to (239)) y:(179) else go to x:(pick random (-239) to (239)) y:(-179) end end end define Reinit hide Choose random edge to start on point towards [StarfieldCenter v] set [ghost v] effect to (25) set size to (250)% go to front show [/scratchblocks] [scratchblocks] when gf clicked hide set [shield segment v] to [0] set [shield subticks left v] to [0] when I receive [Draw next frame v] if <<(#Mode) = ([PLAYING v] of [CONSTS v])> and <(?UsingShields) = [1]>> then Shield else set [shield subticks left v] to [0] end define Shield if <(shield subticks left) = [0]> then play sound [shield v] set [shield subticks left v] to ([ceiling v] of ((0.1) / (0.03333))) change [#Shields v] by (-1) else change [shield subticks left v] by (-1) end if <(pick random (0) to (3)) > [0]> then set pen color to ((pick random (160) to (255)) * (256)) set [shield segment v] to [1] repeat until <(shield segment) > [25]> go to x:(((item (shield segment) of [shieldvec v]) * (32)) - (256)) y:(((item ((shield segment) + (1)) of [shieldvec v]) * (32)) - (192)) pen down change [shield segment v] by (2) end pen up end [/scratchblocks] [scratchblocks] when gf clicked delete (all v) of [debug v] set [drawing semaphore v] to [0] pen up hide set [next wave ship type v] to [1] delete (all v) of [ships v] delete (all v) of [projectiles v] when I receive [New game v] delete (all v) of [ships v] delete (all v) of [projectiles v] define ship hit check %n %n set [e v] to [0] repeat ((length of [ships v]) / (*SHIP_MULT)) Get ship pos %n Get ship scale %n Get screen pos %n %n %n if <([sqrt v] of (((((param x)) - (X)) * (((param x)) - (X))) + ((((param y)) - (Y)) * (((param y)) - (Y))))) < (((15) * (scale)) * ((focalLength) / (Z)))> then change [#Score v] by (5) play sound [explode v] Delete ship %n else change [e v] by (1) end end define Draw ship %n at %n %n %n rotated %n %n %n scale %n set pen color to ((170) * (256)) set pen size to (1) Set rotation vars %n %n %n set [e v] to (item ((param ship type)) of [ShipMeshPointers v]) repeat ((item (((param ship type)) + (1)) of [ShipMeshPointers v]) - (e)) Transform point %n %n %n Get screen pos %n %n %n go to x:(X) y:(Y) pen down Transform point %n %n %n Get screen pos %n %n %n go to x:(X) y:(Y) pen up change [e v] by (1) end define Update ship %n Get ship pos %n Apply vel to ship pos %n Change ship %n velocity by %n if <<(Z Pos) < [100]> and <(?UsingShields) = [1]>> then play sound [bounce v] Set ship %n destination to %n %n %n Get ship vel %n Set ship %n velocity to %n Apply vel to ship pos %n Head ship towards destination %n Change ship %n time by %n Get ship pos %n end if <(Z Pos) > ((*SHIP_SPAWN_Z) + (500))> then Delete ship %n end if <(Z Pos) < [30]> then Delete ship %n change [#ShipsPassed v] by (1) else Get ship destination %n if and <(Y) = [0]>> and <(Z) > (*SHIP_SPAWN_Z)>>> then Get ship time %n if <((ship t) mod (40)) = [39]> then Get ship pos %n if <(Z Pos) < [1000]> then Set ship %n destination to %n %n %n else Set ship %n destination to %n %n %n end end end Head ship towards destination %n Change ship %n time by %n end define Change ship %n time by %n replace item (((*SHIP_MULT) * ((param id))) + (10)) of [ships v] with ((item (((*SHIP_MULT) * ((param id))) + (10)) of [ships v]) + ((param dt))) define Get ship pos %n set [X v] to (item (((*SHIP_MULT) * ((param id))) + (2)) of [ships v]) set [Y v] to (item (((*SHIP_MULT) * ((param id))) + (3)) of [ships v]) set [Z v] to (item (((*SHIP_MULT) * ((param id))) + (4)) of [ships v]) set [X Pos v] to (item (((*SHIP_MULT) * ((param id))) + (2)) of [ships v]) set [Y Pos v] to (item (((*SHIP_MULT) * ((param id))) + (3)) of [ships v]) set [Z Pos v] to (item (((*SHIP_MULT) * ((param id))) + (4)) of [ships v]) define Transform point %n %n %n set [XY v] to (((cosX) * ((param y))) - ((sinX) * ((param z)))) set [XZ v] to (((sinX) * ((param y))) + ((cosX) * ((param z)))) set [Z v] to (((cosY) * (XZ)) - ((sinY) * ((param x)))) set [YX v] to (((sinY) * (XZ)) + ((cosY) * ((param x)))) set [X v] to (((cosZ) * (YX)) - ((sinZ) * (XY))) set [Y v] to (((sinZ) * (YX)) + ((cosZ) * (XY))) define Change ship %n pos by %n %n %n replace item (((*SHIP_MULT) * ((param id))) + (2)) of [ships v] with ((item (((*SHIP_MULT) * ((param id))) + (2)) of [ships v]) + ((param dx))) replace item (((*SHIP_MULT) * ((param id))) + (3)) of [ships v] with ((item (((*SHIP_MULT) * ((param id))) + (3)) of [ships v]) + ((param dy))) replace item (((*SHIP_MULT) * ((param id))) + (4)) of [ships v] with ((item (((*SHIP_MULT) * ((param id))) + (4)) of [ships v]) + ((param dz))) define Change ship %n rotation by %n %n %n replace item (((*SHIP_MULT) * ((param id))) + (5)) of [ships v] with ((item (((*SHIP_MULT) * ((param id))) + (5)) of [ships v]) + ((param xrot))) replace item (((*SHIP_MULT) * ((param id))) + (6)) of [ships v] with ((item (((*SHIP_MULT) * ((param id))) + (6)) of [ships v]) + ((param yrot))) replace item (((*SHIP_MULT) * ((param id))) + (7)) of [ships v] with ((item (((*SHIP_MULT) * ((param id))) + (7)) of [ships v]) + ((param zrot))) define Get ship rotation %n set [x rot v] to (item (((*SHIP_MULT) * ((param id))) + (5)) of [ships v]) set [y rot v] to (item (((*SHIP_MULT) * ((param id))) + (6)) of [ships v]) set [z rot v] to (item (((*SHIP_MULT) * ((param id))) + (7)) of [ships v]) define Get length of %n %n %n set [distance v] to ([sqrt v] of ((((param x)) * ((param x))) + ((((param y)) * ((param y))) + (((param z)) * ((param z)))))) define Get ship time %n set [ship t v] to (item (((*SHIP_MULT) * ((param id))) + (10)) of [ships v]) define Point to %n %n point in direction (([atan v] of ((((param x)) - (x position)) / (((param y)) - (y position)))) + ((180) * (((param y)) < (y position)))) define Get ship scale %n set [scale v] to (item (((*SHIP_MULT) * ((param id))) + (8)) of [ships v]) define Get ship destination %n set [X v] to (item (((*SHIP_MULT) * ((param id))) + (11)) of [ships v]) set [Y v] to (item (((*SHIP_MULT) * ((param id))) + (12)) of [ships v]) set [Z v] to (item (((*SHIP_MULT) * ((param id))) + (13)) of [ships v]) set [X Dest v] to (item (((*SHIP_MULT) * ((param id))) + (11)) of [ships v]) set [Y Dest v] to (item (((*SHIP_MULT) * ((param id))) + (12)) of [ships v]) set [Z Dest v] to (item (((*SHIP_MULT) * ((param id))) + (13)) of [ships v]) define Change ship %n velocity by %n replace item (((*SHIP_MULT) * ((param id))) + (9)) of [ships v] with ((item (((*SHIP_MULT) * ((param id))) + (9)) of [ships v]) + ((param accel))) if <(item (((*SHIP_MULT) * ((param id))) + (9)) of [ships v]) > (*SHIP_MAXVEL)> then replace item (((*SHIP_MULT) * ((param id))) + (9)) of [ships v] with (*SHIP_MAXVEL) end define Create attack wave set [model v] to (next wave ship type) set [x rot v] to [270] set [y rot v] to [180] set [Z v] to (*SHIP_SPAWN_Z) set [scale v] to [2.0] repeat ([SHIPS PER WAVE v] of [CONSTS v]) set [random edge v] to (pick random (1) to (3)) if <(random edge) = [1]> then set [X v] to [-900] set [Y v] to (pick random (-500) to (500)) set [z rot v] to [90] New ship: type %n pos %n %n %n rot %n %n %n scale %n else if <(random edge) = [2]> then set [X v] to (pick random (-500) to (500)) set [Y v] to [700] set [z rot v] to [0] New ship: type %n pos %n %n %n rot %n %n %n scale %n else set [X v] to [900] set [Y v] to (pick random (-500) to (500)) set [z rot v] to [-90] New ship: type %n pos %n %n %n rot %n %n %n scale %n end end end when I receive [Draw next frame v] Draw frame define Set ship %n pos to %n %n %n replace item (((*SHIP_MULT) * ((param id))) + (2)) of [ships v] with ((param x)) replace item (((*SHIP_MULT) * ((param id))) + (3)) of [ships v] with ((param y)) replace item (((*SHIP_MULT) * ((param id))) + (4)) of [ships v] with ((param z)) define Get eigenvector to %n %n %n set [dirXZ v] to (([atan v] of (((param x)) / ((param z)))) + ((180) * (((param z)) < [0]))) set [dirY v] to ([asin v] of (((param y)) / ([sqrt v] of ((((param x)) * ((param x))) + ((((param y)) * ((param y))) + (((param z)) * ((param z)))))))) define Apply vel to ship pos %n Get ship vel %n Get ship rotation %n Change ship %n pos by %n %n %n define Set rotation vars %n %n %n set [sinX v] to ([sin v] of ((param xrot))) set [cosX v] to ([cos v] of ((param xrot))) set [sinY v] to ([sin v] of ((param yrot))) set [cosY v] to ([cos v] of ((param yrot))) set [sinZ v] to ([sin v] of ((param zrot))) set [cosZ v] to ([cos v] of ((param zrot))) define Set ship %n rotation to %n %n %n replace item (((*SHIP_MULT) * ((param id))) + (5)) of [ships v] with ((param xrot)) replace item (((*SHIP_MULT) * ((param id))) + (6)) of [ships v] with ((param yrot)) replace item (((*SHIP_MULT) * ((param id))) + (7)) of [ships v] with ((param zrot)) define Get ship vel %n set [vel v] to (item (((*SHIP_MULT) * ((param id))) + (9)) of [ships v]) define Head ship towards destination %n Get ship pos %n set [old X v] to (X) set [old Y v] to (Y) set [old Z v] to (Z) Get ship destination %n Get length of %n %n %n Rotate ship %n toward %n %n %n by %n \\% set [Z v] to ((*SHIP_SPAWN_Z) - (1)) define Draw frame if <(drawing semaphore) = [0]> then change [drawing semaphore v] by (1) if <(#Mode) > ([COINED v] of [CONSTS v])> then Update ships if <(#ShipsPassed) < [10]> then if <(length of [ships v]) = [0]> then Start attack wave end else if <(#Credits) > [0]> then set [#Mode v] to ([COINED v] of [CONSTS v]) else set [#Mode v] to ([PREGAME v] of [CONSTS v]) set [#LastScore v] to (#Score) end end if <(#Score) > (#HighScore)> then set [#HighScore v] to (#Score) end Render ships Render lasers else Update ships Render ships end change [drawing semaphore v] by (-1) end define Render lasers set [laser id v] to [0] repeat ((length of [projectiles v]) / (3)) set [laser t v] to (item (((3) * (laser id)) + (1)) of [projectiles v]) set [targetting x v] to (mouse x) set [targetting y v] to (mouse y) if <(laser t) < [0.98]> then set size to ((100) * ((1) - (laser t)))% go to x:(-240) y:(-180) Point to %n %n move ((laser t) * ([sqrt v] of ((((targetting x) - (x position)) * ((targetting x) - (x position))) + (((targetting y) - (y position)) * ((targetting y) - (y position)))))) steps stamp go to x:(240) y:(-180) Point to %n %n move ((laser t) * ([sqrt v] of ((((targetting x) - (x position)) * ((targetting x) - (x position))) + (((targetting y) - (y position)) * ((targetting y) - (y position)))))) steps stamp replace item (((3) * (laser id)) + (1)) of [projectiles v] with ((laser t) + ((0.25) * ((1) - (laser t)))) change [laser id v] by (1) else ship hit check %n %n repeat (3) delete (((3) * (laser id)) + (1)) of [projectiles v] end end end when I receive [Start new round v] set [#Shields v] to [80] set [#ShipsPassed v] to [0] delete (all v) of [ships v] delete (all v) of [projectiles v] Start attack wave define Start attack wave Create attack wave set [next wave ship type v] to (((next wave ship type) mod (4)) + (1)) define Render ships set [laser id v] to [0] repeat ((length of [ships v]) / (*SHIP_MULT)) Get ship type %n Get ship pos %n Get ship rotation %n Get ship scale %n Draw ship %n at %n %n %n rotated %n %n %n scale %n change [laser id v] by (1) end define Get screen pos %n %n %n set [X v] to ((focalLength) * (((param x)) / ((param z)))) set [Y v] to ((focalLength) * (((param y)) / ((param z)))) define New ship: type %n pos %n %n %n rot %n %n %n scale %n add ((param type)) to [ships v] add ((param x)) to [ships v] add ((param y)) to [ships v] add ((param z)) to [ships v] add ((param xrot)) to [ships v] add ((param yrot)) to [ships v] add ((param zrot)) to [ships v] add ((param scale)) to [ships v] add (((*SHIP_MAXVEL) * (pick random (80) to (120))) / (100)) to [ships v] add [0] to [ships v] add (pick random (-400) to (400)) to [ships v] add (pick random (-300) to (300)) to [ships v] add ((param z)) to [ships v] define Set ship %n velocity to %n replace item (((*SHIP_MULT) * ((param id))) + (9)) of [ships v] with ((param vel)) if <(length of [ships v]) = [0]> then Start attack wave end set [#ShipsPassed v] to [0] Set ship %n velocity to %n when I receive [Init arcade v] set [*SHIP_MULT v] to [13] set [*SHIP_ACCEL v] to [0.1] set [*SHIP_MAXVEL v] to [20] set [*SHIP_SPAWN_Z v] to [2000] set [focalLength v] to [512] define Delete ship %n repeat (*SHIP_MULT) delete (((*SHIP_MULT) * ((param id))) + (1)) of [ships v] end set [deleted ship id v] to ((param id)) define Get ship type %n set [model v] to (item (((*SHIP_MULT) * ((param id))) + (1)) of [ships v]) define Set ship %n destination to %n %n %n replace item (((*SHIP_MULT) * ((param id))) + (11)) of [ships v] with ((param x)) replace item (((*SHIP_MULT) * ((param id))) + (12)) of [ships v] with ((param y)) replace item (((*SHIP_MULT) * ((param id))) + (13)) of [ships v] with ((param z)) define Update ships set [ship id v] to [0] set [deleted ship id v] to [-1] repeat until > Update ship %n if > then change [ship id v] by (1) end end define Rotate ship %n toward %n %n %n by %n \\% Get ship pos %n Get eigenvector to %n %n %n Get ship rotation %n Change ship %n rotation by %n %n %n [/scratchblocks] [scratchblocks] when gf clicked set [PREGAME v] to [1] set [DEMO WAVE v] to [2] set [COINED v] to [3] set [PLAYING v] to [4] set [PASSING v] to [5] set [SHIPS PER WAVE v] to [3] set [TUMBLING v] to [1.1] set [INSERT COIN v] to [1.3] [/scratchblocks] [scratchblocks] when gf clicked hide set [?mouseDownPrev v] to [0] set [last firing time v] to (timer) when I receive [Fire v] play sound [laser v] add [0] to [projectiles v] add (mouse x) to [projectiles v] add (mouse y) to [projectiles v] when I receive [Check Mouse and Keyboard v] go to x:(mouse x) y:(mouse y) if <(#Mode) = ([PLAYING v] of [CONSTS v])> then go to front show if then if <(?mouseDownPrev) = [0]> then if <((timer) - (last firing time)) > [0.6]> then set [last firing time v] to (timer) broadcast [Fire v] end end set [?mouseDownPrev v] to [1] else set [?mouseDownPrev v] to [0] end if < and <(#Shields) > [0]>> then set [?UsingShields v] to [1] else set [?UsingShields v] to [0] end else set [?mouseDownPrev v] to [0] hide end when I receive [Start new round v] set [last firing time v] to (timer) change [#Shields v] by (-1) [/scratchblocks]