2d plataform game question

Blitz3D Forums/Blitz3D Beginners Area/2d plataform game question

Santiworld(Posted 2009) [#1]
hello, I am learning to create 2D games blitz

I realized that there are many different ways to detect collision.

eh noticed that if there are many objects that collision checked the game makes me slow.

I am currently using this method to detect collision between objects.



If img\name = "object1" Then
	
	For t.img = Each img
		
		If t\name = "object2"   Then
			
			If Abs(t\x - img\x) < 20 Then
				If Abs(t\y - img\y) < 20 Then
					
					;Object1 collided with Object2
					
					
				End If
			End If
			
		End If
		
	Next
End If




some of the functions of blitz will be faster than this calculated?


the other question I have is, if you want to do a scene with mountains and tunnels in 2d ... which is the fastest way to calculate whether a collision object against a complex scenario (nonlinear)

some of the features of the blitz is adequate, or must write a custom method?


regards...


_PJ_(Posted 2009) [#2]
If ( (Abs(t\x - img\x) < 20) * (Abs(t\y - img\y) < 20) )

Not sure if that will affect speed significantly.

As far as I know, the pre-defind commands for checking work on a similar method anyway, relying on input of the images positions and areas. So I assume tey do somethig similar.