Code

--script wirten, tested and designed by Geoffrey Samuel, all rights reserved 2008.

--KNOW BUGS: -- *Script returns a game_setup = undefined at first launch -- SOLOUTION: Close down rollout and re-run script-- *Script tries to access deleted scene objects when the exit button is pressed and then the start button (ends up crashing max) -- SOLOUTION: Dont do it. close down rollout and re-run script

convertToblocks[n](Editable_Poly)addModifierblocks[n](shellinnerAmount:0outerAmount:0.5)addModifierblocks[n](subdividemanualUpdate:1size:35))------------------------------------------------------PLAYER--makes a new varibal to hold the LINE (SPLINE) dataglobalPlayer_ship=line()--converts the line to a editable spline so vertexs (knots) can be addedconvertToSplineShape(Player_ship)--adds a new spline section to the lineaddNewSplinePlayer_ship--creates the outline of the player shipaddKnotPlayer_ship1#corner#curve[-29.487,-120.004,0]addKnotPlayer_ship1#corner#curve[-29.487,-129.853,0]addKnotPlayer_ship1#corner#curve[-0.549,-129.853,0]addKnotPlayer_ship1#corner#curve[-0.601,-119.94,0]addKnotPlayer_ship1#corner#curve[-10.031,-119.94,0]addKnotPlayer_ship1#corner#curve[-10.031,-116.761,0]addKnotPlayer_ship1#corner#curve[-13.131,-116.761,0]addKnotPlayer_ship1#corner#curve[-13.131,-114.103,0]addKnotPlayer_ship1#corner#curve[-16.428,-114.103,0]addKnotPlayer_ship1#corner#curve[-16.428,-116.667,0]addKnotPlayer_ship1#corner#curve[-19.963,-116.667,0]addKnotPlayer_ship1#corner#curve[-19.963,-119.963,0]--closes the spline off so it keeps loopingclosePlayer_ship1--updates the shape so it can be displayed in the viewportupdateShape(Player_ship)--gives the player ship that classic green colour
Player_ship.wirecolor=green

-- center the player shipCenterPivotPlayer_ship--select it to apply an edit mesh and a subdeive to itconvertToPlayer_ship(Editable_Poly)addModifierPlayer_ship(subdividemanualUpdate:1size:35)--positon the ship where it should start from
Player_ship.pos=[0,-127.463,0]

--makes a new varibal to hold the LINE (SPLINE) dataglobalalien_shot_orginal=line()--converts the line to a editable spline so vertexs (knots) can be addedconvertToSplineShape(alien_shot_orginal)--adds a new spline section to the lineaddNewSplinealien_shot_orginal--creates the outline of the alien shotaddKnotalien_shot_orginal1#corner#curve[-111.647,13.54,0]addKnotalien_shot_orginal1#corner#curve[-106.363,13.54,0]addKnotalien_shot_orginal1#corner#curve[-110.212,6.756,0]addKnotalien_shot_orginal1#corner#curve[-104.928,5.908,0]addKnotalien_shot_orginal1#corner#curve[-109.69,-3.486,0]addKnotalien_shot_orginal1#corner#curve[-113.539,-3.42,0]addKnotalien_shot_orginal1#corner#curve[-110.077,3.311,0]addKnotalien_shot_orginal1#corner#curve[-115.27,4.688,0]--closes the spline off so it keeps loopingclosealien_shot_orginal1--updates the shape so it can be displayed in the viewportupdateShape(alien_shot_orginal)--gives the alien shot a yellow colour
alien_shot_orginal.wirecolor=Yellow-- center the alien shotCenterPivotalien_shot_orginal--select it to apply an edit mesh and a subdeive to itconvertToalien_shot_orginal(Editable_Poly)addModifieralien_shot_orginal(shellinnerAmount:0outerAmount:1)addModifieralien_shot_orginal(subdividemanualUpdate:1size:35)--positon the ship where it should start from
alien_shot_orginal.pos=[827.694,-459.594,0]

hidealien_shot_orginal

------------------------------------------------------GUI parts--LIVES--copy the low res player ship for the lives indicatorsgloballife_1=instancePlayer_shipgloballife_2=instancePlayer_shipgloballife_3=instancePlayer_ship--position the lives indicators where they should be
life_1.pos=[95.95,134.28,0]
life_2.pos=[131.973,134.28,0]
life_3.pos=[168.756,134.28,0]--gives the lives ship that classic green colour
life_1.wirecolor=green
life_2.wirecolor=green
life_3.wirecolor=green

--makes a new varibal to hold the LINE (SPLINE) data
alien_ship=line()--converts the line to a editable spline so vertexs (knots) can be addedconvertToSplineShape(alien_ship)--adds a new spline section to the lineaddNewSplinealien_ship--creates the outline of the player shipaddKnotalien_ship1#corner#curve[-158.681,121.033,0]addKnotalien_ship1#smooth#curve[-167.002,108.471,0]addKnotalien_ship1#corner#curve[-163.279,107.176,0]addKnotalien_ship1#corner#curve[-167.002,100.992,0]addKnotalien_ship1#corner#curve[-166.614,100.992,0]addKnotalien_ship1#corner#curve[-162.761,107.047,0]addKnotalien_ship1#corner#curve[-160.624,107.111,0]addKnotalien_ship1#corner#curve[-162.016,104.456,0]addKnotalien_ship1#corner#curve[-161.369,104.456,0]addKnotalien_ship1#corner#curve[-159.912,107.047,0]addKnotalien_ship1#corner#curve[-157.45,107.047,0]addKnotalien_ship1#corner#curve[-155.993,104.456,0]addKnotalien_ship1#corner#curve[-155.346,104.456,0]addKnotalien_ship1#corner#curve[-156.738,107.111,0]addKnotalien_ship1#corner#curve[-154.601,107.047,0]addKnotalien_ship1#corner#curve[-150.748,100.992,0]addKnotalien_ship1#corner#curve[-150.36,100.992,0]addKnotalien_ship1#corner#curve[-154.083,107.176,0]addKnotalien_ship1#smooth#curve[-150.36,108.471,0]

--closes the spline off so it keeps loopingclosealien_ship1--updates the shape so it can be displayed in the viewportupdateShape(alien_ship)--gives the player ship that classic green colour
alien_ship.wirecolor=white

-- center the player shipCenterPivotalien_ship--select it to apply an edit mesh and a subdeive to itconvertToalien_ship(Editable_Poly)addModifieralien_ship(subdividemanualUpdate:1size:35)

--positon the ship where it should start from
alien_ship.pos=[-163.361,111.534,0]------populate the alien sideglobalalien_ships_array= #()forside=0to4do(num_side=side*11fortop=0to10do(num=num_side+top+1alien_ships_array[num]=instancealien_shipalien_ships_array[num].wirecolor=color255255255movealien_ships_array[num][(top*26.5326),(side*-22.2702),0]))deletealien_ship)fngame_exit=(viewport.ResetAllViews()mybox=box()togo=maxselectalliftogo!=undefinedthen(delete$))fnalient_check_dir=(ifalien_ships_array[1].pos.x>-77.976then(forp=1toalien_ships_array.countdo(movealien_ships_array[p][0,-22.2702,0])alien_move_dir="Left"level+=0.025)ifalien_ships_array[1].pos.x<-189.617then(forp=1toalien_ships_array.countdo(movealien_ships_array[p][0,-11.1351,0])alien_move_dir="Right"level+=0.025))fnaliens_move=(--move leftifalien_move_dir=="Right"do(forp=1toalien_ships_array.countdo(movealien_ships_array[p][level*2,0,0]))--move rightifalien_move_dir=="Left"do(forp=1toalien_ships_array.countdo(movealien_ships_array[p][-level*2,0,0])))fnshooting=(ifShoot_HOLDUP=="1"do(appendshot(instanceorignal_shot)Shoot_HOLDUP="0"))toolmoveplayer(onfreeMovedo(Player_ship.pos.x=worldPoint.xifPlayer_ship.pos.x>185.357do(Player_ship.pos.x=185.356)ifPlayer_ship.pos.x<-186.598do(Player_ship.pos.x=-186.597)