Selling Modules: Is there any point?

BlitzMax Forums/BlitzMax Programming/Selling Modules: Is there any point?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'd pay a reasonable price for a good bmax collision system.
My physics lib actually uses an optimized version of my collision code in the archive.

I liked that demo, can we see how much code it took to produce that?
As mentioned above it was just some test code so it's probably not the best showcase for the syntax.
Strict

Framework BRL.D3D7Max2D
Import BRL.RamStream
Import BRL.Random
Import BRL.PNGLoader

Include "physics.bmx"
Incbin "boing.png"

Type TRocket
	Field body:TBody
	Field handle:TMass
	Field angle:TConstraint
	
	Function Create:TRocket(x:Float,y:Float)
		Local r:TRocket=New TRocket
		
		r.body=New TBody
		r.handle=TMass.Create(x,y,16,16,1)
		Local m1:TMass=TMass.Create(x,y-27,10,10,1,r.handle.GetColGroup())
		Local m2:TMass=TMass.Create(x-14,y+10,10,10,1,r.handle.GetColGroup())
		Local m3:TMass=TMass.Create(x+14,y+10,10,10,1,r.handle.GetColGroup())
		Local m4:TMass=TMass.Create(x,y-16,13,13,1,r.handle.GetColGroup())
		
		r.angle=TConstraint.Create(r.handle,m1)
		r.angle.Assign r.body
		TConstraint.Create(r.handle,m2).Assign r.body
		TConstraint.Create(r.handle,m3).Assign r.body
		TConstraint.Create(r.handle,m4).Assign r.body
		TConstraint.Create(m2,m1).Assign r.body
		TConstraint.Create(m3,m2).Assign r.body
		TConstraint.Create(m1,m3).Assign r.body
		TConstraint.Create(m1,m4).Assign r.body
		TConstraint.Create(m3,m4).Assign r.body
		TConstraint.Create(m4,m2).Assign r.body
		
		m1.Move Rand(-5,5),Rand(-5,5)
		
		Return r
	End Function
	
	Method Draw()
		SetRotation angle.GetAngle()+90
		DrawImage rocketImg,handle.GetPositionX(),handle.GetPositionY()
		SetRotation 0
	End Method

End Type

Graphics 800,600

Physics 800,800,0.1,,2

SetMaskColor 255,0,255
Global rocketImg:TImage=LoadImage("incbin::boing.png")
SetImageHandle rocketImg,31.5,44

Global rList:TList=New TList
For Local count=32 To 768 Step 64
	rList.AddLast TRocket.Create(count,45)
	rList.AddLast TRocket.Create(count,110)
	rList.AddLast TRocket.Create(count,175)
	rList.AddLast TRocket.Create(count,240)
	rList.AddLast TRocket.Create(count,305)
Next

Global scenery:TList=New TList

scenery.AddLast TZone.Create([0.0,400.0, 350.0,650.0, 350.0,700.0, 0.0,700.0],2)
scenery.AddLast TZone.Create([800.0,400.0, 450.0,650.0, 450.0,700.0, 800.0,700.0],2)

Global cog1:TZone=TZone.Create([-25.0,-25.0, 0.0,-100.0, 25.0,-25.0, 100.0,0.0, 25.0,25.0, 0.0,100.0, -25.0,25.0, -100.0,0.0],2)
cog1.Position 300,400
Global cog2:TZone=TZone.Create([-25.0,-25.0, 0.0,-100.0, 25.0,-25.0, 100.0,0.0, 25.0,25.0, 0.0,100.0, -25.0,25.0, -100.0,0.0],2)
cog2.Position 500,400
cog2.Rotate 45

SetClsColor 128,128,128

Repeat
	
	cog1.Rotate 1
	cog2.Rotate -1
	
	UpdatePhysics
	
	Cls
	SetOrigin 0,-100
	SetColor 255,255,255
	For Local rocket:TRocket=EachIn rList
		rocket.Draw
		If rocket.handle.GetPositionY()>750
			rocket.body.Clear
			rList.Remove rocket
			rList.AddLast TRocket.Create(Rnd(32,768),75)
		EndIf
	Next
	SetColor 0,0,255
	DrawPoly([0.0,400.0, 350.0,650.0, 350.0,700.0, 0.0,700.0])
	DrawPoly([800.0,400.0, 450.0,650.0, 450.0,700.0, 800.0,700.0])
	SetColor 0,255,0
	SetOrigin cog1.GetPositionX(),cog1.GetPositionY()-100
	DrawPoly cog1.GetArea()
	SetOrigin cog2.GetPositionX(),cog2.GetPositionY()-100
	DrawPoly cog2.GetArea()
	SetOrigin 0,0
	SetColor 255,255,255
	DrawText "Press 'SPACE' to pause",0,0
	Flip
	
	If KeyHit(KEY_SPACE)
		Repeat
		Until KeyHit(KEY_SPACE)
	EndIf
Until KeyHit(KEY_ESCAPE)

EndPhysics
EndGraphics
End