here is the problem:
and here is what i would like to happen except instead of that happening every time you press the space bar, it happens each time there is a collision with the sphere and the cube..
does anyone know?
Graphics3D 1280,800 SetBuffer BackBuffer() light=CreateLight() cam=CreateCamera() ;collision types type_sphere=1 type_cube=2 ;the sphere sphere=CreateSphere() PositionEntity sphere, -4,0,20 EntityType sphere, type_sphere ;the cube cube=CreateCube() PositionEntity cube, 2,0,20 EntityType cube, type_cube x=1 y=10 z=1 ;collisions Collisions type_sphere, type_cube, 2,1 Collisions type_cube, type_sphere, 2, 1 ;health health=10 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;MAIN LOOP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; While Not KeyDown(1) ;moving the sphere If KeyDown(205) Then MoveEntity sphere, 0.1,0,0 If KeyDown(203) Then MoveEntity sphere, -0.1,0,0 ;shortening the cube If EntityCollided (sphere, type_cube) And health=>2 Then y=y-1 health=health-1 HideEntity sphere EndIf ScaleEntity cube, x, y, z UpdateWorld RenderWorld ;diplaying the height of cube and the health Text 20,20,"y:"+y Text 100,20,"health:"+health Flip Wend End
and here is what i would like to happen except instead of that happening every time you press the space bar, it happens each time there is a collision with the sphere and the cube..
Graphics3D 1280,800 SetBuffer BackBuffer() light=CreateLight() cam=CreateCamera() type_sphere=1 type_cube=2 sphere=CreateSphere() PositionEntity sphere, -4,0,20 EntityType sphere, type_sphere x=1 y=10 z=1 cube=CreateCube() PositionEntity cube, 2,0,20 EntityType cube, type_cube Collisions type_sphere, type_cube, 2,1 Collisions type_cube, type_sphere, 2, 1 health=10 While Not KeyDown(1) If KeyDown(205) Then MoveEntity sphere, 0.1,0,0 If KeyDown(203) Then MoveEntity sphere, -0.1,0,0 If KeyHit(57) And health=> 2 Then y=y-1 health=health-1 EndIf ScaleEntity cube, x, y, z UpdateWorld RenderWorld Text 20,20,"y:"+y Text 100,20,"health:"+health Flip Wend End
does anyone know?