summaryrefslogtreecommitdiff
path: root/main.bmx
diff options
context:
space:
mode:
Diffstat (limited to 'main.bmx')
-rw-r--r--main.bmx175
1 files changed, 31 insertions, 144 deletions
diff --git a/main.bmx b/main.bmx
index f6ca18d..2d0e539 100644
--- a/main.bmx
+++ b/main.bmx
@@ -1,23 +1,30 @@
-' It's all a bit rolly
+' Particle Pinch
+'
+' Copyright 2005 Ian Cowburn
+'
+' $Id$
'
Strict
Import noddybox.vector
Import noddybox.bitmapfont
+Import noddybox.simplegui
-' Includes
-'
-Include "types.bmx"
-
+Import "types.bmx"
+Import "level.bmx"
+Import "game.bmx"
+Import "designer.bmx"
' Included binaries
'
Incbin "GFX/font.bmf"
+Incbin "GFX/gui.bmf"
Incbin "GFX/STAR.png"
Incbin "GFX/MASS.png"
Incbin "GFX/POINT.png"
Incbin "GFX/PARTICLE.png"
Incbin "GFX/POINTER.png"
+Incbin "GFX/COLLECTOR.png"
' Initialise graphics
@@ -30,21 +37,24 @@ SetBlend(ALPHABLEND)
' Globals
'
-Global font:TBitmapFont=TBitmapFont.Load("incbin::GFX/font.bmf",0)
-Global star_img:TImage=LoadAnimImage("incbin::GFX/STAR.png",8,8,0,2)
-Global mass_img:TImage=LoadAnimImage("incbin::GFX/MASS.png",8,8,0,2)
-Global point_img:TImage=LoadImage("incbin::GFX/POINT.png",0)
-Global particle_img:TImage=LoadImage("incbin::GFX/PARTICLE.png",0)
-Global pointer_img:TImage=LoadImage("incbin::GFX/POINTER.png",0)
-
-SetImageHandle(star_img,3,3)
-SetImageHandle(mass_img,3,3)
-SetImageHandle(point_img,3,3)
-SetImageHandle(particle_img,3,3)
-SetImageHandle(pointer_img,0,0)
-
-TPoint.img=point_img
-TParticle.img=particle_img
+GameGFX.font=TBitmapFont.Load("incbin::GFX/font.bmf",0)
+GameGFX.guifont=TBitmapFont.Load("incbin::GFX/gui.bmf",0)
+GameGFX.star=LoadAnimImage("incbin::GFX/STAR.png",8,8,0,2)
+GameGFX.mass=LoadAnimImage("incbin::GFX/MASS.png",8,8,0,2)
+GameGFX.collector=LoadAnimImage("incbin::GFX/COLLECTOR.png",8,8,0,2)
+GameGFX.point=LoadImage("incbin::GFX/POINT.png",0)
+GameGFX.particle=LoadImage("incbin::GFX/PARTICLE.png",0)
+GameGFX.pointer=LoadImage("incbin::GFX/POINTER.png",0)
+
+SetImageHandle(GameGFX.star,3,3)
+SetImageHandle(GameGFX.mass,3,3)
+SetImageHandle(GameGFX.collector,3,3)
+SetImageHandle(GameGFX.point,3,3)
+SetImageHandle(GameGFX.particle,3,3)
+SetImageHandle(GameGFX.pointer,0,0)
+
+TPoint.img=GameGFX.point
+TParticle.img=GameGFX.particle
TParticleMachine.Init()
@@ -53,130 +63,7 @@ TParticleMachine.Init()
' 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.inverse=True
-main_mass.img=star_img
-
-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)
-
-TParticleMachine.Clear()
-
-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
-
- TParticleMachine.Process()
-
- 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()
- m.img=mass_img
- mass.AddLast(m)
- EndIf
-
- SetColor(255,255,255)
- DrawImage(pointer_img,MouseX(),MouseY())
- 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
+LevelDesigner()
EndGraphics
End \ No newline at end of file