Ball troubles
Blitz3D Forums/Blitz3D Beginners Area/Ball troubles
| ||
hello again.... Remember those hand held games with the little shiney balls which you had to get in the holes? My problem'o is that my ball keeps falling through my maze! and wont roll about depending on how much its tilted, will the slide collision let it roll about or do i have to program the ball directly depending on the amount of tilt is on the maze? Use the arrow keys to tilt the cube. Graphics3D 640,480 SetBuffer BackBuffer() ; Set collision type values type_character=1 type_scenery=2 camera=CreateCamera() RotateEntity camera,45,0,0 PositionEntity camera,0,15,-10 light=CreateLight() RotateEntity light,45,0,0 ; Create sphere 'character' sphere=CreateSphere( 32 ) EntityRadius sphere,1 EntityType sphere,type_character PositionEntity sphere,0,7,0 ; Create cube 'scenery' cube=CreateCube() EntityRadius cube,1 EntityType cube,type_scenery PositionEntity cube,0,-5,0 EntityColor cube,127,0,0 ScaleEntity cube,10,10,10 ;load maze ;level=LoadAnimMesh("maze1.b3d") ;EntityRadius level,10 ;EntityType level,type_scenery ;ScaleEntity level,5,5,5 ;PositionEntity level,0,0,-100 While Not KeyDown( 1 ) MoveEntity sphere,x#,-0.02,z# If KeyDown(200) ;arrow keys by#=by#-.1 z#=z#-.001 RotateEntity cube, by#,0,0,0 EndIf If KeyDown(208) by#=by#+.1 z#=z#+.001 RotateEntity cube, by#,0,0,0 EndIf If KeyDown(203) bx#=bx#+0.1 RotateEntity cube, 0,0,bx#,0 EndIf If KeyDown(205) bx#=bx#-0.1 RotateEntity cube, 0,0,bx#,0 EndIf Collisions type_character,type_scenery,2,2 UpdateWorld RenderWorld Flip Wend End |
| ||
If you paste this into each keydown check, under the rotateentity command, it should work:PositionEntity sphere, EntityX#(sphere),EntityY#(sphere)+0.02,EntityZ#(sphere) |