Sorry, It seems I missed a part after the code out.
The full code is in the source thingy. It does have an endif, (I forgot to put that on there) but its doesn't work. I changed the if to a while too, but the game suddenly went VERY slow. So I changed it back.
I can't figure out what it is. I tried using Else If, but darkbasic doesn't use them.
Dan
rem ********************
rem ***==============***
rem ***= Crazy Golf =***
rem ***==============***
rem ********************
rem Screen Settings
Hide Mouse
Autocam Off
rem Backdrop
Backdrop On
Color Backdrop 1
rem Manual Syncronisation
Sync On
rem Load Images
Load Image "surface1.bmp",1
rem Make Golf Surface
Make Matrix 1,40,80,2,4
Prepare Matrix Texture 1,1,2,2
Position Matrix 1,-20,-1,0
rem Make Golf Ball
Make Object Sphere 1,2.0
Position Object 1,0,0,2.5
Color Object 1,RGB(255,255,255)
XRotate Object 1,180
Fix Object Pivot 1
rem Make Hole
Make Object Cylinder 2,5.0
Color Object 2,RGB(80,50,5)
Position Object 2,0,-3.0,70
rem Make Club
Make Object Cube 3,1.5
YRotate Object 3,90
Fix Object Pivot 3
Glue Object to Limb 3,1,0
Scale Object 3,300,150,50
Color Object 3,RGB(40,40,40)
Move Object 3,2.5
rem Make Side Barriers
Make Object Cube 4,3.0
Scale Object 4,150.0,200.0,2670.0
Position Object 4,-22,2,40
Color Object 4,RGB(0,0,80)
Make Object Cube 5,3.0
Scale Object 5,150.0,200.0,2670.0
Position Object 5,20,2,40
Color Object 5,RGB(0,0,80)
Make Object Cube 6,3.0
Scale Object 6,150,200,1560
YRotate Object 6,90
Position Object 6,-1,2,82
Color Object 6,RGB(0,0,80)
rem Position Camera
Position Camera 0,40,-20
Pitch Camera Down 35
control=1
speed#=0
rem Begin Loop ============================================================
DO
rem Set Global Collision On
Set Global Collision On
rem Only Do the Following if Player Has Control
If control=1
rem Print Variables
Set Cursor 0,0
Print "Ball Angle: "; angle#
Print "Speed: "; speed#
rem Declare Variables
angle#=Object Angle Y(1)
rem Angle Ball
If Rightkey()=1
YRotate Object 1,wrapvalue(angle#-1.0)
Endif
If Leftkey()=1
YRotate Object 1,wrapvalue(angle#+1.0)
Endif
rem Input Speed
If Inkey$()="1" then speed#=1
If Inkey$()="2" then speed#=2
If Inkey$()="3" then speed#=3
If Inkey$()="4" then speed#=4
If Inkey$()="5" then speed#=5
If Inkey$()="6" then speed#=6
If Inkey$()="7" then speed#=7
If Inkey$()="8" then speed#=8
Shoot:
rem Hit Ball
If Spacekey()=1
If speed#=0 then goto Shoot
Unglue Object 3
While speed#>0.0
Move Object 1,speed#
speed#=speed#-0.5
sleep 25
If Object Collision(1,5)=1
YRotate Object 1,360-angle#
Endif
If Object Collision(1,4)=1
YRotate Object 1,360-angle#
Endif
If Object Collision(1,6)=1
YRotate Object 1,360-angle#
Endif
Endwhile
Endif
rem Ball Enters Hole or Club follows Ball
If Object Collision(1,2)
Hide Object 1
control=0
Else
Glue Object to Limb 3,1,0
Move Object 3,2.5
Endif
Endif
If Escapekey()=1 then End
rem Sync
Sync
rem Loop Game =============================================================
Loop