
' ' 2026-11-16 ' load hiscore ' Config Gameplay ?start_asteroids = 3 ?debug = 0 ' camera position ?distance = 0 ?distance_target = 50 ?distance_ingame = 150 ' play area (16:9) ?zone_x = ?distance_ingame * 1.6 ?zone_y = ?distance_ingame * 0.9 ' particles index ?dust_min = 0 ?dust_max = 0 goto "prepare asteroids" goto "prepare stars" goto "prepare background" goto "prepare cargo" goto "prepare scene" ' ' ship ' ?player_x = 0 ?player_y = 0 ?player_angle = 0 ?player_speed = 0 ?player_roll = 0 ?player_vx = 0 ?player_vy = 0 ' anim cargo impact ?impact_fx = 0 ?impact_fx_angle = 0 ' goto "game reset" goto "menu start" ' === ' === MAIN LOOP ' === do if ?menu_mode <> 0 goto "menu title" else goto "ui main" end goto "manage player" if ?over = 1 and (press "enter") = 1 goto "game reset" goto "menu start" 'goto "game start" end goto "manage hits" goto "manage asteroids" goto "manage scene" ' if ?debug = 1 and (press "x") = 1 goto "game over" end ' particules collisions goto "manage fx" update loop ' ' ' label "prepare scene" ' default lighting reconfig delete "light" ' blue space power "glow" to 100 color "glow" to #36d ' bacl light create light as "sun" power "sun" to 150 move "sun" to -30, 20, 20 color "sun" to #e60'#F80 target "sun" to 0, 0, 0 ' main light create light as "light" power "light" to 100 color "light" to #fff 'glue "light-ship" to "ship" move "light" to -20, 20, -20 target "light" to 0, 0, 0 ' player light focus create orb as "orb" power "orb" to 100 color "orb" to #def glue "orb" to "ship" move "orb" to 5, 0, -10 target "orb" auto "ship" clear screen free "camera" return ' ' ' label "game start" reset timer for 1 to ?asteroids as ?n clone "t-32" as "ast-?n" ' random position around the player [ast, ?n, x] = (random real -?zone_x to ?zone_x) + ?player_x [ast, ?n, y] = (random real -?zone_y to ?zone_y) + ?player_y ' movement [ast, ?n, roll] = (random real 0 to 360) [ast, ?n, angle] = (random real 0 to 360) [ast, ?n, speed] = (.5 + (random real 0 to 1) / 2) * .7 ' hp [ast, ?n, size] = 32 [ast, ?n, lock] = 0 [ast, ?n, alive] = 1 next return ' label "game reset" ' First game + Restart ?over = 0 select screen "front" clear screen ' collisions needed to cleanup ?asteroids = ?start_asteroids ?stat_total = ?asteroids * 15' 1+2+4+8 ?stat_hits = 0 ' delete "final" return ' ' ' label "prepare asteroids" ' création de la collection nécessaire ' Précréation x4 asteroïdes ' 8, 16, 24, 32 ?size = 8 do goto "ui loading", ?size / 32 ?template = "t-?size" goto "craft asteroid" hide ?template ?size + 8 loop if ?size <= 32 return ' label "craft asteroid" ' create asteroid sprites ?benchmark = timer ?step = 1 ?mid = ?size / 2 ?rx = ?size / 3.0 ?rz = ?size / 3.5 ?ry = ?size / 2.4 create sprite ?size as ?template hide ?template ' the bigger the smaller hitbox ?template to 100 - (?size * .65) ?rgb = #999 ?add_rgb = #987 ?an = (random real 0 to 360) ?evo = (random real 20 to 40) / 10 ?ff = (random real 15 to 15) / 10 ?fe = (random real 10 to 20) / 10 for 0 to 180 step ?step as ?ay ?an + 1.5 ?f = 1 + .3 * (cos ?an / ?ff) for 0 to 360 step 8 as ?az ?r = .2 * (abs (sin ?an)) ?e = 1 - ?r ?cx = (cos ?ay * ?evo) ?cy = (sin ?ay) ?cz = (sin ?an / ?ff) ' tentative cubique : '?cx = (sign ?cx) * (pow (abs ?cx), 2 / 4) '?cy = (sign ?cy) * (pow (abs ?cy), 2 / 4) '?cz = (sign ?cz) * (pow (abs ?cz), 2 / 4) ?midx = ?mid + ?fe * ?cx' e * (cos ?ay * ?evo) ?midz = ?mid + ?fe * ?cz'e * (sin ?an / ?ff) ?midy = ?mid ?x = 1 + ?midx + ?rx * (cos ?az) * ?cy * ?e ?z = 1 + ?midz + ?rz * (sin ?az) * ?cy * ?e ?y = 1 + ?midy + ?ry * (cos ?ay) color ?rgb add ?template dot ?x, ?y, ?z ' 2% d'aspérités ?o = (random real 0 to 100) if ?o < 2 color ?add_rgb for -1 to 1 as ?xx for -1 to 1 as ?yy for -1 to 1 as ?zz ?dist = (abs ?xx) + (abs ?yy) + (abs ?zz) if ?dist < 3 add ?template dot ?x + ?xx, ?y + ?yy, ?z + ?zz end next next next end next next return ' ' ' label "prepare background" ' nebula background ' clear screen mix trace "screen" for 1 to 4 as ?yy ?x = random real -100 to 200 ?y = -100 + ?yy * 50' random 0 to 600 for 40 color 0, 0, 2, 25 trace circle (random real 20 to 60) to ?x + (random real -100 to 100), ?y + (random real -100 to 100) trace fill next next return ' ' ' label "prepare cargo" '?main_color = #234 '?main_color = #248 '?second_color = #c60 ?main_color = #821' #813 ?second_color = #c92 create sprite 20 as "ship" zoom "ship" to 1, 1, .75 move "ship" to 1000' hide paint "ship" to "glass" color ?main_color add "ship" box 5, 4, 2 to 13, 16, 6 color #888 add "ship" frame 5, 4, 2 to 13, 16, 6 ' 4 airpads for 2 to 5 step 3 as ?z color ?main_color add "ship" box 1, 1, ?z to 7, 7, ?z + 1 add "ship" box 1, 13, ?z to 7, 19, ?z + 1 add "ship" box 11, 1, ?z to 17, 7, ?z + 1 add "ship" box 11, 13, ?z to 17, 19, ?z + 1 color ?second_color add "ship" box 11, 5, ?z to 17, 7, ?z add "ship" box 11, 13, ?z to 17, 15, ?z color #888 add "ship" frame 1, 1, ?z to 7, 7, ?z add "ship" frame 1, 13, ?z to 7, 19, ?z add "ship" frame 11, 1, ?z to 17, 7, ?z add "ship" frame 11, 13, ?z to 17, 19, ?z next ' rea color 99 add "ship" frame 1, 3, 4 to 1, 5, 4 add "ship" frame 1, 15, 4 to 1, 17, 4 ' hull color #999 add "ship" box 8, 7, 1 to 15, 13, 8 color #111 add "ship" box 10, 8, 1 to 14, 12, 7 ' power engine create sprite 8 as "power" paint "power" to "neon" for 1 to 8 as ?x color (rgb ?x * 10, ?x * 15, ?x * 30) add "power" dot ?x, 1, 1 add "power" dot ?x, 7, 1 next glue "power" to "ship" center "power" to 6, 4, 1 zoom "power" to 2 move "power" to -10, 0, 0 return ' ' ' label "prepare stars" select screen "back" for 1 to 2 as ?s create sprite 256 as "stars?s-1" if ?s = 1 color #468 else color #68a end for 50 add "stars?s-1" dot (random real 1 to 256), (random real 1 to 256), 1 next for 2 to 6 as ?n clone "stars?s-1" as "stars?s-?n" next next return ' ' ----------------------------- ' label "manage asteroids" ?stat_alive = 0 for 1 to ?asteroids as ?n if [ast, ?n, alive] = 1 ?stat_alive + 1 [ast, ?n, x] + [ast, ?n, speed] * (cos [ast, ?n, angle]) [ast, ?n, y] + [ast, ?n, speed] * (sin [ast, ?n, angle]) if [ast, ?n, x] < -?zone_x + ?player_x [ast, ?n, x] + ?zone_x * 2 end if [ast, ?n, x] > ?zone_x + ?player_x [ast, ?n, x] - ?zone_x * 2 end if [ast, ?n, y] < -?zone_y + ?player_y [ast, ?n, y] + ?zone_y * 2 end if [ast, ?n, y] > ?zone_y + ?player_y [ast, ?n, y] - ?zone_y * 2 end move "ast-?n" to [ast, ?n, x], [ast, ?n, y], 0 ?roll_speed = [ast, ?n, speed] / 2 ?tax = (sin [ast, ?n, roll]) * ?roll_speed ?tay = (cos [ast, ?n, roll]) * ?roll_speed ?taz = (cos [ast, ?n, roll] / 3) * ?roll_speed turn "ast-?n" by ?tax, ?tay, ?taz [ast, ?n, lock] - 1 end next return ' === ' === INTERFACE ' === label "ui loading" param ?p select screen "front" font size 3 clear screen color #fff ?label = "Loading " + (round ?p * 100) + "%" trace text ?label center 0, 0 update return ' label "menu start" ' start intro menu ?menu_mode = 1 ?distance_target = 50 ?intro_hiscore = 0' show 10 select screen "front" color 1 font size 4 trace text (username) center 0, -40 font size 3 trace text "Head straight into the asteroids to destroy them all..." center 0, -50 trace text "Use the arrow keys to drive your cargo." center 0, -60 color 3 trace text "Now, move your cargo to start!" center 0, -70 ?hi = (10000 - (hiscore 1)) font size 6' + (mod (frame), 10) / 10 color #ff8 trace text (format timer ?hi) center 0, 90 font size 2 trace text "BEST TIME TO BEAT" center 0, 82 color 1 create text "AsteroidZ" as "title" paint "title" to "metal" color 22 outline "title" return ' label "menu title" ' anim intro move "title" to ?player_x - 50, ?player_y, 0 turn "title" to -20, 0, 0 ' nb player_speed to ajust title position ?player_speed + (1.4 - ?player_speed) / 20 ?player_angle + (0 - ?player_angle) / 20 ' ?intro_hiscore if ?intro_hiscore < 10 if (mod (frame), 60) = 0 ?intro_hiscore + 1 color 1 font size 2 ?y = 80 - (?intro_hiscore * 6) ?hiscore = 10000 - (hiscore ?intro_hiscore) if ?hiscore < 10000 ?hiscore = (format timer ?hiscore) else ?hiscore = "" end trace text "?intro_hiscore ... " to -20, ?y trace text (hiscore ?intro_hiscore username) to -10, ?y trace text "... ?hiscore" to 10, ?y 'trace text "... ?hiscore" + to 10, ?y end end return ' label "menu stop" ' turn cargo = game starts! ?menu_mode = 0 ?distance_target = ?distance_ingame goto "game start" delete "title" return ' label "game over" ' all cleard clear screen font size 4 color #ff8 trace text "FINAL TIME" center 0, 65 ?final_timer = (timer) create text (format timer ?final_timer) as "final" paint "final" to "ui" color 1 font size 5 ?name = (username) trace text "Well done ?name!" center 0, -50 font size 3 trace text "Press ENTER to try again" center 0, -60 ' reverse score: le lower the better if ?debug = 0 save hiscore 10000 - ?final_timer update end ?over = 1 return ' label "ui main" select screen "front" if ?over = 1 ' partie achevée : score final move "final" to ?camera_x, ?camera_y + 25, -?distance / 2 else if (mod (frame), 30) = 1 clear screen color #0af ?chrono = (timer) font size 5 trace text (format timer ?chrono) center 0, 90 ?pct = ?stat_hits / ?stat_total color #d312 trace frame -80 + 160 * ?pct, -93 to 80, -96 trace fill color #48f6 ?x2 = -80 + 160 * ?pct trace frame -80, -93 to ?x2, -96 trace fill font size 2 color 1 trace text (round ?pct * 100) + "%" center ?x2, -90 end end return ' === ' === GAME MANAGEMENT ' === label "manage player" ?tangle = 0' tangage ?moved = 0 if ?over = 1 ' game is over - no movement else if (key "left") = 1 ?player_angle + 2 ?tangle = -45 ?moved = 1 end if (key "right") = 1 ?player_angle - 2 ?tangle = 45 ?moved = 1 end end ?player_roll + (?tangle - ?player_roll) / 30 if ?player_speed > 0 ?ps = ?player_speed * .05 ?player_vx + ?ps * (cos ?player_angle) ?player_vy + ?ps * (sin ?player_angle) end ?player_vx - ?player_vx / 60 ?player_vy - ?player_vy / 60 if (key "up") = 1 ?speed = 1 ?moved = 1 else if (key "down") = 1 and ?player_speed > 0 ?speed = 0 ?player_vx * .95 ?player_vy * .95 ?moved = 1 else ?speed = 0 end if ?menu_mode <> 0 and ?moved = 1 goto "menu stop" end ?player_speed + (?speed - ?player_speed) / 30 ?player_x + ?player_vx ?player_y + ?player_vy move "ship" to ?player_x, ?player_y, 2 turn "ship" to ?player_roll * (cos ?player_angle), ?player_roll * (sin ?player_angle), ?player_angle 'move "light-ship" to ?player_x, ?player_y, -50 ' engine animation : zoom x "power" to ?player_speed * (random real 0.5 to 1.0) return ' ' ' label "manage scene" ?distance + (?distance_target - ?distance) / 50 ?camera_x + (?player_x - ?camera_x) / 15 ?camera_y + (?player_y - ?camera_y) / 15 move "camera" to ?camera_x, ?camera_y, -?distance ' fx impact if ?impact_fx > 0 ?impact_fx * .96 ?impact_fx_angle + ?impact_fx end move z "camera" by ?impact_fx * (abs (sin ?impact_fx_angle)) for 1 to 2 as ?s ?pos_z = 25 if ?s = 1 ?pos_z = 75 end ?ox = (floor ?player_x / 256) * 256 - 128 ?oy = (floor ?player_y / 256) * 256' + 128 'move "stars" move "stars?s-1" to ?ox, ?oy, ?pos_z move "stars?s-2" to ?ox + 256, ?oy, ?pos_z move "stars?s-3" to ?ox + 512, ?oy, ?pos_z move "stars?s-4" to ?ox, ?oy + 256, ?pos_z move "stars?s-5" to ?ox + 256, ?oy + 256, ?pos_z move "stars?s-6" to ?ox + 512, ?oy + 256, ?pos_z next return ' ' ' label "manage hits" for 1 to ?asteroids as ?n if [ast, ?n, alive] = 1 and [ast, ?n, lock] < 0 if (hit "ast-?n" to "ship") = 1 update [ast, ?n, angled] = [ast, ?n, angle]' conserve ?impact_fx = [ast, ?n, size] * 1.25 goto "test asteroid hit", ?n ?stat_hits + 1 if ?stat_hits = ?stat_total goto "game over" end goto "fx impact", ?n end end next return ' ' ' label "test asteroid hit" ' astéroide touché = duplication ! param ?hit update ' ?h = hit # ' 32,16,8 if [ast, ?hit, size] <= 8 ' destruction [ast, ?hit, alive] = 0 hide "ast-?hit" else ' brisé x 2 [ast, ?hit, size] - 8 [ast, ?hit, lock] = 20 '[ast,?hit,speed] * 1.5 [ast, ?hit, speed] + ?player_speed / 2 '[ast,?hit,move] = random 0 to 360 [ast, ?hit, angle] = ((mod [ast, ?hit, angle], 360) + (mod ?player_angle, 360)) / 2 [ast, ?hit, angle] - 45 ?size = [ast, ?hit, size] clone "t-?size" as "ast-?hit" ' add ?asteroids + 1 ?new = ?asteroids [ast, ?new, x] = [ast, ?hit, x] [ast, ?new, y] = [ast, ?hit, y] [ast, ?new, angle] = [ast, ?hit, angle] + 90 [ast, ?new, roll] = random real -900 to 900 [ast, ?new, speed] = [ast, ?hit, speed] [ast, ?new, size] = [ast, ?hit, size] [ast, ?new, alive] = [ast, ?hit, alive] [ast, ?new, lock] = [ast, ?hit, lock] clone "t-?size" as "ast-?new" turn "ast-?new" to (random real 1 to 360), (random real 0 to 180), (random real 1 to 90) end return ' ' ' label "fx impact" param ?hit ' add impact particles ?q = 8 ?s = [ast, ?n, size] / 2 color #987 'color #fed for 1 to ?q [dust, ?dust_max, x] = [ast, ?hit, x] + (random real -?s to ?s) [dust, ?dust_max, y] = [ast, ?hit, y] + (random real -?s to ?s) [dust, ?dust_max, angle] = random real 0 to 360 [dust, ?dust_max, speed] = .2 + (random real 0 to 1) / 4 [dust, ?dust_max, lp] = random real 1 to 2' random size [dust, ?dust_max, angled] = [ast, ?hit, angled]' same movement as parent asteroid ?vox = "dust-?dust_max" create sprite 1 as ?vox add ?vox dot 1, 1, 1 zoom ?vox to 2 move ?vox to ?player_x, ?player_y, 0 ?dust_max + 1 next return ' ' ' label "manage fx" ' anima impact particles for ?dust_min to ?dust_max as ?d if (is "dust-?d") = 1 if [dust, ?d, lp] > 0 ' minify particles until size 0 [dust, ?d, lp] - .01 [dust, ?d, x] + [dust, ?d, speed] * .5 * (sin [dust, ?d, angle]) [dust, ?d, y] + [dust, ?d, speed] * .5 * (cos [dust, ?d, angle]) [dust, ?d, x] + [dust, ?d, speed] * 3 * (cos [dust, ?d, angled]) [dust, ?d, y] + [dust, ?d, speed] * 3 * (sin [dust, ?d, angled]) move "dust-?d" to [dust, ?d, x], [dust, ?d, y], 0 zoom "dust-?d" to [dust, ?d, lp]' * 100 else ' cleanup fx particles array if ?d = ?dust_min ' start of queue ?dust_min + 1 delete "dust-?d" end if ?d = ?dust_max ' end of queue ?dust_max - 1 delete "dust-?d" end end end next return ' ' DONE :) '
Exécuter
Plus dozzen games