sync on sync rate 0 randomize timer() hide mouse backdrop on color backdrop 0 `Generate texture w = 512 h = 512 make memblock 1, 12 + (w*h*4) write memblock dword 1, 0, w write memblock dword 1, 4, h write memblock dword 1, 8, 32 `Generate randomness dim texture(w,h) for x = 0 to w-1 : for y = 0 to h-1 write memblock dword 1, 12 + ((y*w)+x)*4, rgb(32, 64 + rnd(127), 32) texture(x,y) = rgb(64, 128 + rnd(64), 64) next y : next x make image from memblock 1, 1 delete memblock 1 #constant ARENA_X 10.0 #constant ARENA_Z 10.0 #constant MAX_TILT 20.0 #constant grav -9.81 #constant T_TO_LIVE 3000 make object plain 1000, 1, 1 position object 1000, 0, 0, 0 make mesh from object 1, 1000 make object plain 1001, 1, 1 position object 1001, 0, 0, 0 make mesh from object 2, 1001 `Make floor make object plain 1, ARENA_X*2.0, ARENA_Z*2.0 rotate limb 1, 0, 90, 0, 0 position object 1, 0,0,0 `Make Walls in Z offset limb 1000, 0, 0, 0.5, ARENA_Z scale limb 1000, 0, 200 * ARENA_X, 100, 100 add limb 1000, 1, 1 rotate limb 1000, 1, 0, 180, 0 offset limb 1000, 1, 0, 0.5, -ARENA_Z scale limb 1000, 1, 200 * ARENA_X, 100, 100 `Make Walls in X offset limb 1001, 0, ARENA_X, 0.5, 00 rotate limb 1001, 0, 0, 90, 0 scale limb 1001, 0, 200 * ARENA_Z, 100, 100 add limb 1001, 1, 2 rotate limb 1001, 1, 0, 270, 0 offset limb 1001, 1, -ARENA_X, 0.5, 0 scale limb 1001, 1, 200 * ARENA_Z, 100, 100 texture object 1, 1 set object collision off 1 set object cull 1000, 0 texture object 1000, 1 set object collision off 1000 set object cull 1001, 0 texture object 1001, 1 set object collision off 1001 tiltX# = 0.0 tiltZ# = 0.0 type Coord x# y# z# endtype type Mine Speed as Coord Pos as Coord colX colZ BirthTime endtype type Orb Speed as Coord Pos as Coord Mass# colX colZ endtype BlankCoord as Coord BlankCoord.x# = 0.0 BlankCoord.y# = 0.0 BlankCoord.z# = 0.0 make object sphere 2, 1, 24, 24 set object collision to spheres 2 position object 2, 0, 0.5, 0 Dim P(1) as Orb P(1).Mass# = 2.0 P(1).Speed = BlankCoord P(1).Pos = BlankCoord Dim Mines(1000) as Mine FartTime = timer() FartCount = 0 autocam off position camera -15, 20, 15 point camera 0,0,0 set directional light 0, -1, -1, -1 RUNNING = 1 position mouse screen width() * 0.5, screen height() * 0.5 frameTime# = 1.0 startTime = timer() do frameTime# = (frameTime# * 0.8) + ((timer() - startTime) * 0.2) startTime = timer() text 10, 10, "Mines Farted: " + str$(FartCount) if RUNNING = 1 tiltX# = ((-2.0 * MAX_TILT * mousex()) / screen width() ) + MAX_TILT tiltZ# = (( 2.0 * MAX_TILT * mousey()) / screen height()) - MAX_TILT rotate object 1, tiltX#, 0.0, tiltZ# rotate object 1000, tiltX#, 0.0, tiltZ# rotate object 1001, tiltX#, 0.0, tiltZ# inc P(1).Speed.x#, sin(tiltZ#) * grav * P(1).mass# * frameTime# * 0.001 inc P(1).Speed.z#, sin(tiltX#+180) * grav * P(1).mass# * frameTime# * 0.001 inc P(1).Pos.x#, P(1).Speed.x# * frameTime# * 0.001 inc P(1).Pos.z#, P(1).Speed.z# * frameTime# * 0.001 P(1).Pos.y# = (P(1).Pos.x# * sin(tiltZ#)) + (P(1).Pos.z# * sin(tiltX#+180)) position object 2, P(1).Pos.x#, P(1).Pos.y#+0.5, P(1).Pos.z# if P(1).Speed.z# > 0 then if P(1).Pos.z# > ARENA_Z - 0.5 then P(1).Speed.z# = P(1).Speed.z# * -0.75 if P(1).Speed.z# < 0 then if P(1).Pos.z# < -ARENA_Z + 0.5 then P(1).Speed.z# = P(1).Speed.z# * -0.75 if P(1).Speed.x# > 0 then if P(1).Pos.x# > ARENA_X - 0.5 then P(1).Speed.x# = P(1).Speed.x# * -0.75 if P(1).Speed.x# < 0 then if P(1).Pos.x# < -ARENA_X + 0.5 then P(1).Speed.x# = P(1).Speed.x# * -0.75 if timer() - FartTime > 1500 FartTime = timer() inc FartCount gosub CREATE_MINE endif gosub UPDATE_MINES else center text screen width() * 0.5, screen height() * 0.5, "YOU LOSE!!!" endif sync loop end UPDATE_MINES: for j = 5000 to 5000 + FartCount if object exist(j) = 1 i = j - 5000 inc Mines(i).Speed.x#, sin(tiltZ#) * grav * 0.1 * frameTime# * 0.001 inc Mines(i).Speed.z#, sin(tiltX#+180) * grav * 0.1 * frameTime# * 0.001 inc Mines(i).Pos.x#, Mines(i).Speed.x# * frameTime# * 0.001 inc Mines(i).Pos.z#, Mines(i).Speed.z# * frameTime# * 0.001 Mines(i).Pos.y# = (Mines(i).Pos.x# * sin(tiltZ#)) + (Mines(i).Pos.z# * sin(tiltX#+180)) position object j, Mines(i).Pos.x#, Mines(i).Pos.y#+0.5, Mines(i).Pos.z# if Mines(i).Speed.z# > 0 then if Mines(i).Pos.z# > ARENA_Z - 0.25 then Mines(i).Speed.z# = Mines(i).Speed.z# * -0.75 if Mines(i).Speed.z# < 0 then if Mines(i).Pos.z# < -ARENA_Z + 0.25 then Mines(i).Speed.z# = Mines(i).Speed.z# * -0.75 if Mines(i).Speed.x# > 0 then if Mines(i).Pos.x# > ARENA_X - 0.25 then Mines(i).Speed.x# = Mines(i).Speed.x# * -0.75 if Mines(i).Speed.x# < 0 then if Mines(i).Pos.x# < -ARENA_X + 0.25 then Mines(i).Speed.x# = Mines(i).Speed.x# * -0.75 if timer() - Mines(i).BirthTime < T_TO_LIVE center text object screen x(j), object screen y(j), left$(str$((T_TO_LIVE - (timer() - Mines(i).BirthTime)) * 0.001), 4) else if object collision(j, 2) RUNNING = 0 endif endif endif next i return CREATE_MINE: i = FartCount + 5000 make object sphere i, 0.5 set object collision to spheres i position object i, object position x(2), object position y(2), object position z(2) set object diffuse i, rgb(255, 0, 0) set object specular i, rgb(0,0,0) set object specular power i, 10 j = FartCount Mines(j).Speed = P(1).Speed Mines(j).Pos.x# = object position x(2) Mines(j).Pos.y# = object position y(2) Mines(j).Pos.z# = object position z(2) Mines(j).BirthTime = timer() return