Hi
I'm trying to make a basic jousting game.
However I'm having some problem with the collision.
Thanks for your time.
Graphics3D 800,600
Const CUBE_COL=1
Const SPHERE_COL=2
SetBuffer BackBuffer()
camera=CreateCamera()
CameraViewport camera,0,0,800,600
PositionEntity camera,0,0,-5
light=CreateLight()
cube=CreateCube()
PositionEntity cube,-5,0,5
EntityColor cube,70,80,190
EntityType cube,CUBE_COL
sphere=CreateSphere(12)
PositionEntity sphere,5,0,5
EntityColor sphere,170,80,90
EntityType sphere,SPHERE_COL
Collisions SPHERE_COL,CUBE_COL,3,1
Collisions CUBE_COL,SPHERE_COL,3,1
While Not KeyHit(1)
If KeyDown(30) MoveEntity sphere,-0.02,0,0
If KeyDown(31) MoveEntity Cube,0.02,0,0
UpdateWorld
RenderWorld
If EntityCollided(sphere,1) Then
Text 370,60,"sphere Collided !"
EndIf
If EntityCollided(cube,2) Then
Text 370,80,"Cube Collided !"
EndIf
Text 300,40,"Use (A) and (S) keys to move."
Text 335,500," Collision Demo "
Flip
Wend
End
I'm trying to make a basic jousting game.
However I'm having some problem with the collision.
Thanks for your time.
Graphics3D 800,600
Const CUBE_COL=1
Const SPHERE_COL=2
SetBuffer BackBuffer()
camera=CreateCamera()
CameraViewport camera,0,0,800,600
PositionEntity camera,0,0,-5
light=CreateLight()
cube=CreateCube()
PositionEntity cube,-5,0,5
EntityColor cube,70,80,190
EntityType cube,CUBE_COL
sphere=CreateSphere(12)
PositionEntity sphere,5,0,5
EntityColor sphere,170,80,90
EntityType sphere,SPHERE_COL
Collisions SPHERE_COL,CUBE_COL,3,1
Collisions CUBE_COL,SPHERE_COL,3,1
While Not KeyHit(1)
If KeyDown(30) MoveEntity sphere,-0.02,0,0
If KeyDown(31) MoveEntity Cube,0.02,0,0
UpdateWorld
RenderWorld
If EntityCollided(sphere,1) Then
Text 370,60,"sphere Collided !"
EndIf
If EntityCollided(cube,2) Then
Text 370,80,"Cube Collided !"
EndIf
Text 300,40,"Use (A) and (S) keys to move."
Text 335,500," Collision Demo "
Flip
Wend
End