Crayon Physic Game - Problems

Blitz3D Forums/Blitz3D Programming/Crayon Physic Game - Problems

Leszek(Posted 2009) [#1]
Hey guys,

Recently I started creating a game similar to Crayon Physic. Yesterday I finished module drawing and I wrote a DLL library which allow to use a tablet in a game.

Now I must creating a physics in game and it's a problem.

This is a function which create a line between two another point (image)- it's working but all of the image have a antoher value and I don't know how to control these images ?
Function Image_Line( oldx,oldy,pox,poy )
If Abs(oldy - poy) <= Abs(oldx - pox) Then
	If oldx > pox Then
		ptx = oldx
		pty = oldy
		oldx = pox
		oldy = poy
		pox = ptx
		poy = pty
	EndIf
	For x#=oldx To pox Step 6
		y# = oldy + (x# - oldx) * (poy - oldy) / (pox - oldx)
		If kredka=0 Then 
		    DrawImage brush0,x#,y#
		Else If kredka=1 Then 
		    DrawImage brush1,x#,y#
		Else If kredka=2 Then 
			DrawImage brush2,x#,y#
		Else If kredka=3 Then 
			DrawImage brush3,x#,y#
		Else If kredka=4 Then 
			DrawImage brush4,x#,y#
		Else If kredka=5 Then 
			DrawImage brush5,x#,y#
		End If
	Next
Else
	If oldy > poy Then
		ptx = oldx
		pty = oldy
		oldx = pox
		oldy = poy
		pox = ptx
		poy = pty
	EndIf
	x# = oldx
	For y# = oldy To poy Step 6
		x# = oldx + (y - oldy) * (pox - oldx) / (poy - oldy)
		If kredka=0 Then 
		    DrawImage brush0,x#,y#
		Else If kredka=1 Then 
		    DrawImage brush1,x#,y#
		Else If kredka=2 Then 
			DrawImage brush2,x#,y#
		Else If kredka=3 Then 
			DrawImage brush3,x#,y#
		Else If kredka=4 Then 
			DrawImage brush4,x#,y#
		Else If kredka=5 Then 
			DrawImage brush5,x#,y#
		End If
	Next
EndIf
End Function


Ok :)
I thought on the create of a type which control one big image (for example: painted box).

Link to another game which i found in a forum
http://blitzbasic.com/Community/posts.php?topic=80091#899901
I played a Chalk Physic and ther is all ok.

I write in Blitz3D

Yours,
Leszek