From 740fa42f8b879759e5feaa02ea4cbe405c2e97ff Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 3 Sep 2005 01:27:08 +0000 Subject: Initial import --- main.bmx | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 main.bmx (limited to 'main.bmx') diff --git a/main.bmx b/main.bmx new file mode 100644 index 0000000..1a2646b --- /dev/null +++ b/main.bmx @@ -0,0 +1,155 @@ +' It's all a bit rolly +' +Strict + +Import noddybox.vector +Import noddybox.bitmapfont + +' Includes +' +Include "types.bmx" + + +' Included binaries +' +Incbin "GFX/font.bmf" + + +' Initialise graphics +' +SetGraphicsDriver GLMax2DDriver() +Graphics 800,600,32,60 +'HideMouse + +SetBlend(ALPHABLEND) + +' Globals +' +Global font:TBitmapFont=TBitmapFont.Load("incbin::GFX/font.bmf",0) + +' Consts +' + +' Test code +' +Global main_mass:TMass=New TMass +Global mass:TList=CreateList() +Global star:TList=CreateList() +Global cx:Int=GraphicsWidth()/2 +Global cy:Int=GraphicsHeight()/2 + +main_mass.x=cx'/2 +main_mass.y=cy +main_mass.friend=False +main_mass.g=100 +main_mass.b=100 +main_mass.inverse=True + +For Local r:Int=0 Until 1000 + Local s:TPoint=New TPoint + Local d:Float + Local a:Float + s=New TPoint + d=Rnd(50,100) + 'a=Rnd(0,360) + a=Rand(0,3)*90 + s.x=main_mass.x+d*Sin(a) + s.y=main_mass.y+d*Cos(a) + s.v.x=Sin(a+90)/(d/30) + s.v.y=Cos(a+90)/(d/30) + star.AddLast(s) +Next + +mass.AddLast(main_mass) + +While Not KeyHit(KEY_ESCAPE) + Cls + + Local dead:Int=0 + Local lost:Int=0 + + For Local m:TMass=EachIn mass + For Local s:TPoint=EachIn star + s.Attract(m) + Next + Next + + For Local m:TMass=EachIn mass + m.MoveAndDraw() + Next + + For Local s:TPoint=EachIn star + s.MoveAndDraw() + + If s.dead + dead:+1 + ElseIf s.lost + lost:+1 + EndIf + Next + + font.Draw("PARTICLES",0,0) + font.DrawColoured(star.Count()-dead-lost,font.TextWidth("PARTICLES")+10,0,255,255,0) + font.Draw("CAPTURED",200,0) + font.DrawColoured(dead,font.TextWidth("CAPTURED")+210,0,255,0,255) + font.Draw("LOST",400,0) + font.DrawColoured(lost,font.TextWidth("LOST")+410,0,255,0,0) + + If MouseHit(1) + Local m:TMass=New TMass + m.x=MouseX() + m.y=MouseY() + mass.AddLast(m) + EndIf + + FlushMem + Flip +Wend + + + +' Globals +' +Rem +Global player:TBall=New TBall +player.r=255 +player.g=255 +player.b=255 + +Global balls:TList=CreateList() + +balls.AddLast(player) + +For Local f:Int=0 To 10 + balls.AddLast(New TBall) +Next + +While Not KeyHit(KEY_ESCAPE) + Cls + + If KeyHit(KEY_MOUSELEFT) + player.v.x=MouseX()-player.x + player.v.y=MouseY()-player.y + player.v.Normalise() + player.v.Scale(2) + EndIf + + For Local b1:TBall=EachIn balls + For Local b2:TBall=EachIn balls + If b1<>b2 + b1.Collide(b2) + EndIf + Next + Next + + For Local b1:TBall=EachIn balls + b1.MoveAndDraw() + Next + + FlushMem + Flip +Wend +EndRem + +EndGraphics +End \ No newline at end of file -- cgit v1.2.3