Source Code: RandomPulse( )
Syntax
bool = RandomPulse( freq )
- bool - if pulse is on
- freq - general frequency of pulse
Explanation
RandomPulse() will generate a random pulse ( return True) randomly based on the frequency used as it's argument. The higher number used for the frequency, the farther apart the pulses will be. The lower, the faster.
Example
SetFPS 60
Do
Cls 0
If RandomPulse(60) Then Circle 100, 100, 20, True
Sync
Loop
Source Code
Function RandomPulse(Freq)
Static Count
If Freq < 2 Then Freq = 2
Freq = -Freq
If Count > 0
Count = RndRange(Freq,0)
PulseOn = True
EndIf
Count = Count + 1
EndFunction PulseOn
| Categories: Graphics : Graphics Source Code : Source Code |