Doubble Functions?

Blitz3D Forums/Blitz3D Beginners Area/Doubble Functions?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Ok I'm still having trouble getting this to work. Here are parts of my scrips so you might be able to help me get this timer going.

;This is part of the main program. I want Timer() and Ball1Main() to work as one.
While Not KeyDown(1)

If KeyDown(48) Then ;If B is pressed then...
Cls
Timer()
Dim ball1image(500)
Ball1Main()

Flip
;--------------------------------------------------------------
Function Ball1Main()

;IMAGES
ball1 = LoadImage("ball 1.bmp") ;Load Ball 1 image

Cls ;Clear the screen

SetBuffer BackBuffer() ;Set buffer to back buffer

TFormFilter 1

For a = 0 To 360
rr = CopyImage(ball1)
ball1image(a) = rr
MidHandle ball1image(a)
Next


While Not KeyDown(1)
Cls

If MouseDown (1)

r.ball1 = New ball1

r\x = Rand(1,800)
r\y = Rand(1,600)
r\angle = 0
r\speed = Rand (1,10)
r\turnrate = Rand (1,10)


End If


For h.ball1 = Each ball1


h\iangle = ATan2((MouseY()-h\y),((MouseX()-h\x)))

xmov# = Cos(h\angle) * h\speed
ymov# = Sin(h\angle) * h\speed

h\x = h\x + xmov#
h\y = h\y + ymov#


realangle_current = h\angle
realangle_intend = h\iangle

If h\angle < 1
realangle_current = 180+(180 - Abs(h\angle))
End If
If h\iangle < 1
realangle_intend = 180+(180 - Abs(h\iangle))
EndIf


If realangle_intend > realangle_current And h\iangle > 0 Then h\angle = h\angle + h\turnrate
If realangle_intend > realangle_current And h\iangle < 1 Then h\angle = h\angle + h\turnrate
If realangle_intend < realangle_current And h\iangle > 0 Then h\angle = h\angle - h\turnrate
If realangle_intend < realangle_current And h\iangle < 1 Then h\angle = h\angle - h\turnrate

If realangle_current> 360 Then realangle_current = 1
If realangle_current< 1 Then realangle_current = 360


DrawImage ball1image(realangle_current),h\x,h\y ;Draw Ball1Image

Next
Flip
Wend

End Function
;---------------------------------------------------------------------
Function Timer()

Start = MilliSecs ()
Finish = Start + HowLong

; Start Finish
; | ----> |
; v v
; , _,___,___,___,___,___,___,___,___,___,_ ,
; | | | | | | | | | | | | | | | | | | |
; | |
; |<----------------->|
; 75000 ms

SetBuffer FrontBuffer()
Repeat

minutes = Floor((Finish - MilliSecs ())/60000)
seconds = Ceil(((Finish - MilliSecs ()) - minutes*60000)/1000)
If seconds < 10 Then
Text 0 , 0 , minutes + ":0" + seconds
Else
Text 0 , 0 , minutes + ":" + seconds
End If
Flip
Cls



If KeyHit(1) Then Exit

Until MilliSecs () >= Finish

End

End Function
;------------------------------------------------------------------


If you could tell me how to fix this I'd be the happiest man in the world. Also how can I get my scrips to show up in that black background with green text?