This is a collision set up I use in one of my games. Insodently it is a spaceship shooter.
; Set collision type values
type_player1=1 ;the player ship
type_bullet=2
type_scenery=3 ;the skysphere
type_enimy=5
type_e_bullet=6
type_waypoint=7
;type_shieldpower=8
;set up for collision checking
Collisions type_player1,type_enimy,3,2
;Collisions type_player1,type_player1,1,1
Collisions type_bullet,type_enimy,1,1
Collisions type_bullet,type_scenery,2,1
Collisions type_player1,type_scenery,2,1
Collisions type_enimy,type_enimy,1,3
Collisions type_enimy,type_scenery,2,1
Collisions type_e_bullet,type_player1,1,1
Collisions type_e_bullet,type_scenery,2,1
Collisions type_player1,type_waypoint,2,2
I like to set up for all 3 kinds of collisions so where you create you playership you put something like this. Note you don't have to declare both entitybox and entityradius, but I do at first at least that way I can go for the best efect.
But you do have to declare an entitytype like so...
p_ship.player = New player
p_ship\p_pivot = pivot
EntityType p_ship\p_pivot,1
EntityRadius p_ship\p_pivot,10
EntityBox p_ship\p_pivot,-3,-3,-3,6,6,6
That might be a hard example here is another.
Graphics3D 640,480
AutoMidHandle True
light=CreateLight()
RotateEntity light,90,0,0
Global p_alpha#=.5
type_ground=1
type_character=2
type_charactershield=4
type_scenery=3
p_pivot=CreatePivot()
EntityRadius p_pivot,2.4
PositionEntity p_pivot,0,4,0
plane=CreatePlane()
EntityColor plane,200,100,0
cube = CreateCube(p_pivot)
EntityRadius cube,2.4
sphere = CreateSphere(16,p_pivot)
EntityRadius sphere,2
ScaleEntity sphere,2,2,2
EntityAlpha sphere,p_alpha#
PositionEntity sphere,0,0,0
PositionEntity cube,0,0,0
cam = CreateCamera(p_pivot)
;CameraProjMode cam,1
PositionEntity cam,0,1,10
PointEntity cam,cube
EntityType sphere,type_charactershield
EntityType cube,type_character
EntityType plane,type_ground
EntityType p_pivot,type_character
;EntityType red,type_scenery
shieldsgone=True
Global red=CreateCube()
backround()
;Collisions type_character,type_scenery,method,response
Collisions type_character,type_scenery,3,1
Collisions type_character,type_ground,2,1
;Collisions type_charactershield,type_ground,2,1
While Not KeyHit(1)
TurnEntity sphere,5,5,0
If KeyDown(200) TranslateEntity p_pivot,0,.5,0
If KeyDown(208) TranslateEntity p_pivot,0,-.5,0
If KeyDown(203) TranslateEntity p_pivot,.5,0,0
If KeyDown(205) TranslateEntity p_pivot,-.5,0,0
If KeyDown(30) TurnEntity cam,0,.5,0
If KeyDown(32) TurnEntity cam,0,-.5,0
If KeyDown(17) TurnEntity cam,.5,0,0
If KeyDown(31) TurnEntity cam,-.5,0,0
If EntityCollided (p_pivot,type_ground) Then
p_alpha#=p_alpha#-.001
EntityAlpha sphere,p_alpha#
EndIf
If KeyHit(57) Then
p_alpha#=.5
EntityAlpha sphere,p_alpha#
EndIf
RenderWorld()
UpdateWorld()
Flip
Wend
Function backround()
ScaleEntity red,10,10,1
RotateEntity red,0,90,0
EntityColor red,200,10,10
PositionEntity red,4,0,-10
End Function
End