Rem Breakoids Rem By Patrick Lewis (RiiDii) Rem 12/Apr/2005 Sync On:Sync Rate 30:AutoCam Off: Hide Mouse Randomize Timer() Type Coordinates x as Float y as Float z As Float EndType Type Asteroids pos as Coordinates rot as Coordinates move as Coordinates Size as Float EndType Global Object as Coordinates Global Target as Coordinates Dim Asteroid (500) as Asteroids Global Ball as Coordinates Global Sticky Rem Start Game Make_Stars() Make_Paddle() Position Object 1000,0,-39,70 Make Object Sphere 1001,2 Troids=5 Rem Start Level Do For i = 1 to Troids Make_Asteroid(i,10) Next i Sticky=1 Do Total=Move_Asteroids() If Total=0 Then Exit Move_Paddle() Lose=Move_Ball() If Lose=1 Then Sticky=1 Sync Loop Troids=Troids+1 Loop Function Move_Ball() If MouseClick()=1 And Sticky=1 Sticky=0 Ball.x=rnd(100.0)/100.0-.5 Ball.y=1 Endif If Sticky=1 Return_Object(1000) Position Object 1001,Object.x,Object.y+2,Object.z ExitFunction Endif Move Object Right 1001,Ball.x Move Object Up 1001,Ball.y oc=Object Collision(1001,0) if oc<501 Return_Object(1001):Return_Target(oc) Position Object 1001,Target.x,Target.y,Target.z Point Object 1001,Object.x,Object.y,Object.z Move Object 1001,1.5 Ball.x=Object Position X(1001)-Target.x:Ball.y=Object Position Y(1001)-Target.y Position Object 1001,Object.x,Object.y,Object.z Rotate Object 1001,0,0,0 New_Asteroids(oc) Endif If oc=1000 Return_Object(1001):Return_Target(1000) Position Object 1001,Target.x,Target.y,Target.z Point Object 1001,Object.x,Object.y,Object.z Move Object 1001,1.5 Ball.x=(Object Position X(1001)-Target.x)*.8:Ball.y=Object Position Y(1001)-Target.y Position Object 1001,Object.x+Ball.x,Object.y+Ball.y,Object.z Rotate Object 1001,0,0,0 Endif Return_Object(1001) If object.x<-50 Then Ball.x=Abs(Ball.x) If object.x>50 Then Ball.x=Abs(Ball.x)*-1 If Object.y>40 Then Ball.y=Abs(Ball.y)*-1 If Object.y<-45 Then ExitFunction 1 If Abs(Ball.y)<.1 Then If Object.y<0 Then Ball.y=.1 Else Ball.y=-.1 EndFunction 0 Function New_Asteroids(ObjectID) size=Asteroid(ObjectID).Size Asteroid(ObjectID).Size=0 Return_Object(ObjectID) Delete Object ObjectID If size=3 then ExitFunction If Size=10 then Size=5 Else Size=3 For i = 1 to 3 For j=1 to 500 If Asteroid(j).Size=0 Then Exit Next j Make_Asteroid(j,size) Asteroid(j).pos.x=Object.x:Asteroid(j).pos.y=Object.y Next i EndFunction Function Make_Asteroid(ObjectID,Size) If Object Exist(ObjectID) Then Delete Object ObjectID For i = 1 to 8 Make Object Sphere ObjectID,1,rnd(3)+3,rnd(3)+3 Make Mesh from Object i,ObjectID Delete Object ObjectID Next i Make Object Sphere ObjectID,.1,1,1 For i = 1 to 8 Add Limb ObjectID,i,i Offset Limb ObjectID,i,Rnd(100.0)/200.0-.5,Rnd(100.0)/200.0-.5,Rnd(100.0)/200.0-.5 Delete Mesh i Next i Scale Object ObjectID,Size*100,Size*100,Size*100 Set Object Collision To SPheres ObjectID Asteroid(ObjectID).rot.x=rnd(9)-5:Asteroid(ObjectID).rot.y=rnd(9)-5:Asteroid(ObjectID).rot.z=rnd(9)-5 Asteroid(ObjectID).pos.x=rnd(100)-50:Asteroid(ObjectID).pos.y=rnd(60)-10:Asteroid(ObjectID).pos.z=70 Asteroid(ObjectID).move.x=rnd(100.0)/100.0-.5:Asteroid(ObjectID).move.y=rnd(100.0)/100.0-.5:Asteroid(ObjectID).move.z=0 Asteroid(ObjectID).Size=Size Color Object ObjectID,RGB(118,37,57) Set Object Ambience ObjectID,RGB(149,0,0) EndFunction Function Move_Asteroids() Count=0 For i = 1 to 500 If Asteroid(i).Size>0 Count=Count+1 Asteroid(i).pos.x=Asteroid(i).pos.x+Asteroid(i).move.x Asteroid(i).pos.y=Asteroid(i).pos.y+Asteroid(i).move.y Asteroid(i).pos.z=Asteroid(i).pos.z+Asteroid(i).move.z If Asteroid(i).pos.x<-60 then Asteroid(i).pos.x=Asteroid(i).pos.x+120 If Asteroid(i).pos.x>60 then Asteroid(i).pos.x=Asteroid(i).pos.x-120 If Asteroid(i).pos.y<-10 then Asteroid(i).move.y=abs(Asteroid(i).move.y) If Asteroid(i).pos.y>50 then Asteroid(i).move.y=abs(Asteroid(i).move.y)*-1 Position Object i,Asteroid(i).pos.x,Asteroid(i).pos.y,Asteroid(i).pos.z Pitch Object Down i,Asteroid(i).rot.x Turn Object Right i,Asteroid(i).rot.y Roll Object Right i,Asteroid(i).rot.z Endif Next i EndFunction Count Function Make_Stars() If Object Exist(5000) Then Delete Object 5000 If Bitmap Exist(1) Then Delete Bitmap 1 Create Bitmap 1,2048,2048 Set Current Bitmap 1 Ink 0,0 Box 0,0,1023,1023 For i = 1 to rnd(500)+Rnd(500)+Rnd(500)+Rnd(500)+500 Ink Rgb(rnd(55)+200,rnd(55)+200,rnd(55)+200),0 Dot rnd(2047),rnd(2047) Next i Get Image 1,0,0,2047,2047,1 Set Current Bitmap 0 Delete Bitmap 1 Make Object Sphere 5000,2000 Set Object Cull 5000,0 Texture Object 5000,1 Position Object 5000,0,0,0 Set Object Emissive 5000,RGB(255,255,255) EndFunction Function Make_Paddle() If Object Exist(1000) Then Delete Object 1000 Make Object Sphere 1000,1 Make Mesh from Object 1,1000 Delete Object 1000 Make Object Cylinder 1000,1 Scale Object 1000,100,500,100 Roll Object Right 1000,90 Fix Object Pivot 1000 Make Mesh from Object 1000,1000 Delete Object 1000 Make Object 1000,1000,0 Add Limb 1000,1,1 Add Limb 1000,2,1 Offset Limb 1000,1,-2.5,0,0 Offset Limb 1000,2,2.5,0,0 Scale Object 1000,200,200,200 Set Object Collision To Boxes 1000 EndFunction Function Move_Paddle() x#=MouseMoveX()*.5 Move Object Right 1000,x# Return_Object(1000) If Object.x<-52 Then Position Object 1000,-52,Object.y,Object.z If Object.x>52 Then Position Object 1000,52,Object.y,Object.z EndFunction Function Return_Object(ObjectID) Object.x=Object Position X(ObjectID):Object.y=Object Position Y(ObjectID):Object.z=Object Position Z(ObjectID) EndFunction Function Return_Target(TargetID) Target.x=Object Position X(TargetID):Target.y=Object Position Y(TargetID):Target.z=Object Position Z(TargetID) EndFunction