Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Proggies
(06-27-2024, 01:09 PM)bplus Wrote:
Ohio's Heat Lightning
inspired sometime ago
I also found something from 'RhoSigma'.
I changed it a bit and added some sound.
I'm attaching the sound files below.


Code: (Select All)
$Embed:'.\gewitter.mp3','Gewi1'
$Embed:'.\gewitter2.mp3','Gewi2'
$Embed:'.\gewitter3.mp3','Gewi3'

$ExeIcon:'F:\QB64\ICO\candles.ico'
_Icon

'+---------------+---------------------------------------------------+
'| ###### ###### |    .--. .        .-.                            |
'| ##  ## ##  # |    |  )|        (  ) o                        |
'| ##  ##  ##    |    |--' |--. .-.  `-.  .  .-...--.--. .-.        |
'| ######  ##  |    |  \ |  |(  )(  ) | (  ||  |  |(  )      |
'| ##      ##    |    '  `'  `-`-'  `-'-' `-`-`|'  '  `-`-'`-      |
'| ##    ##  # |                            ._.'                  |
'| ##    ###### |  Sources & Documents placed in the Public Domain. |
'+---------------+---------------------------------------------------+
'|                                                                  |
'| === Lightning2.bas ===                                            |
'|                                                                  |
'| == The filnal result of joint efforts by bplus, TylerDarko and    |
'| == myself. (http://www.qb64.net/forum/index.php?topic=14532.0)    |
'|                                                                  |
'+-------------------------------------------------------------------+
'| Done by RhoSigma, R.Heyder, provided AS IS, use at your own risk. |
'| Find me in the QB64 Forum or mail to support@rhosigma-cw.net for  |
'| any questions or suggestions. Thanx for your interest in my work. |
'+-------------------------------------------------------------------+

Dim h1 As Long: h1 = _SndOpen(_Embedded$("Gewi1"), "memory")

Dim h2 As Long: h2 = _SndOpen(_Embedded$("Gewi2"), "memory")

Dim h3 As Long: h3 = _SndOpen(_Embedded$("Gewi3"), "memory")


Dim Shared scrX%, scrY%
di& = _ScreenImage
scrX% = _Width(di&)
scrY% = _Height(di&)
_FreeImage di&
si& = _NewImage(scrX%, scrY%, 32)
Screen si&
_Delay 0.2: _ScreenMove _Middle
_Delay 0.2: _FullScreen

Const FORKINESS = 20 '1 to 20

Dim Shared scrX2%, scrX10%, scrXE%
Dim Shared scrY4%, scrY6%, scrYE%
scrX2% = scrX% \ 2: scrX10% = scrX% \ 10: scrXE% = scrX% - 1
scrY4% = scrY% \ 4: scrY6% = scrY% \ 6: scrYE% = scrY% - 1


Randomize Timer
flash& = _NewImage(scrX%, scrY%, 32)
land& = _NewImage(scrX%, scrY%, 32)
_Dest land&
DrawLandscape 6
_Dest 0

_MouseHide
While InKey$ = "" And mx% = 0 And my% = 0
    _PutImage , land&
    _Dest flash&
    Cls , _RGBA32(0, 0, 0, 0)
    Select Case RangeRand%(0, 180)
        Case 0 To 35
            DrawLightning scrXE%, RangeRand%(25, scrY6%), 50, 2.748893571, 1
            _SndPlay h1 'My Sound file fo play
        Case 36 To 71
            DrawLightning RangeRand%(scrX2% + scrX10%, scrXE%), 0, 50, 1.963495408, 1
            _SndPlay h2 'My Sound file fo play
        Case 72 To 107
            DrawLightning RangeRand%(scrX2% - scrX10%, scrX2% + scrX10%), 0, 50, 1.570796326, 1
            _SndPlay h2 'My Sound file fo play
        Case 108 To 144
            DrawLightning RangeRand%(0, scrX2% - scrX10%), 0, 50, 1.178097245, 1
            _SndPlay h3 'My Sound file fo play
        Case 145 To 180
            DrawLightning 0, RangeRand%(25, scrY6%), 50, 0.392699081, 1
            _SndPlay h3 'My Sound file fo play
    End Select
    _Dest 0
    _PutImage , flash&
    _Display
    _Delay 0.05
    pulse% = RangeRand%(0, 3)

    '  h& = _SndOpen("splash_gewitter.mp3") 'My Sound file fo play
    'If h& = 0 Then Else _SndPlay h&


    For fade% = 1 To 24
        Line (0, 0)-(_Width, _Height), _RGBA32(0, 0, 0, 10), BF
        If fade% > 4 And fade% < 8 And pulse% > 0 And RangeRand%(1, 100) > 50 Then
            _PutImage , land&
            _PutImage , flash&
            pulse% = pulse% - 1
            fade% = 0
        End If
        _Display
        _Limit 80
    Next fade%
    _PutImage , land&
    For fade% = 1 To 24
        Line (0, 0)-(_Width, _Height), _RGBA32(0, 0, 0, 10), BF
    Next fade%
    _Display

    _Delay RangeRand%(50, 4500) / 1000 '<< milliseconds to next lightning

    Do While _MouseInput
        mx% = mx% + _MouseMovementX
        my% = my% + _MouseMovementY
    Loop

    _SndStop h&

Wend

_FullScreen _Off
_Delay 0.2: Screen 0
_Delay 0.2: _FreeImage si&

System

'======================================================================
Sub DrawLandscape (hills%)
    '--- sky ---
    For i% = 0 To scrY%
        Line (0, i%)-(scrX%, i%), _RGB32(128 * (i% / scrY%), 128 * (i% / scrY%), 128 * (i% / scrY%))
    Next i%
    '--- land ---
    startH# = scrY% - scrY4%
    rr% = 70: gg% = 70: bb% = 90
    For hill% = 1 To hills%
        Xright# = 0
        y# = startH#
        While Xright# < scrX%
            'upDown# = local up / down over range, change along Y
            'range#  = how far up / down, along X
            upDown# = ((Rnd(1) * 0.8) - 0.35) * (hill% * 0.5)
            range# = Xright# + RangeRand%(15, 25) * (2.5 / hill%)
            lastX# = Xright# - 1
            For x# = Xright# To range#
                y# = y# + upDown#
                Line (lastX#, y#)-(x#, scrY%), _RGB32(rr%, gg%, bb%), BF 'just lines weren't filling right
                lastX# = x#
            Next x#
            Xright# = range#
        Wend
        rr% = RangeRand%(rr% - 15, rr%): If rr% < 0 Then rr% = 0
        gg% = RangeRand%(gg% - 15, gg%): If gg% < 0 Then gg% = 0
        bb% = RangeRand%(bb% - 25, bb%): If bb% < 0 Then bb% = 0
        startH# = startH# + RangeRand%(5, 20)
    Next hill%
End Sub

'======================================================================
Sub DrawLightning (X&, Y&, Segments&, Dir#, Fork&)
    Sign# = 0.392699081
    xSeg# = scrX% / (15.0 * Fork&)
    ySeg# = scrY% / (15.0 * Fork&)
    Do
        Angle& = RangeRand%(0, 100)
        DeltaAngle# = Sign# * Angle& / 100.0
        Dir# = Dir# + DeltaAngle#
        Sign# = Sign# * -1.0

        nX& = X& + (Cos(Dir#) * xSeg#)
        nY& = Y& + (Sin(Dir#) * ySeg#)
    DrawLine X&, Y&, nX&, nY&, _RGBA32(RangeRand%(160, 180), _
                                      RangeRand%(117, 137), _
                                      RangeRand%(235, 255), _
                                      75 + (180 \ Fork&))
        X& = nX&
        Y& = nY&

        If ((Fork& < 3) And (RangeRand%(0, 50) < (FORKINESS \ Fork&))) Then
            DrawLightning (X&), (Y&), 5 + RangeRand%(1, 10), Dir# - (2.0 * DeltaAngle#), Fork& + 1
        End If
        Segments& = Segments& - 1
    Loop While Segments& > 0 And Y& < scrY% - RangeRand%(75, scrY4% - 50)
End Sub

'======================================================================
Sub DrawLine (x1%, y1%, x2%, y2%, col&)
    If x1% < 0 Then
        If x2% < 0 Then Exit Sub
        x1% = 0
    ElseIf x1% >= scrX% Then
        If x2% >= scrX% Then Exit Sub
        x1% = scrXE%
    End If
    If y1% < 0 Then
        If y2% < 0 Then Exit Sub
        y1% = 0
    ElseIf y1% >= scrY% Then
        If y2% >= scrY% Then Exit Sub
        y1% = scrYE%
    End If

    If x2% < 0 Then
        x2% = 0
    ElseIf x2% >= scrX% Then
        x2% = scrXE%
    End If
    If y2% < 0 Then
        y2% = 0
    ElseIf y2% >= scrY% Then
        y2% = scrYE%
    End If

    Line (x1%, y1%)-(x2%, y2%), col&
End Sub

'======================================================================
Function RangeRand% (low%, high%)
    RangeRand% = Int(Rnd(1) * (high% - low% + 1)) + low%
End Function


'INCLUDE: '.\Gewitter1.bas.bm'
'INCLUDE: '.\Gewitter2.bas.bm'
'INCLUDE: '.\Gewitter3.bas.bm'




.mp3   gewitter.mp3 (Size: 83.31 KB / Downloads: 17)

.mp3   gewitter2.mp3 (Size: 90.75 KB / Downloads: 16)

.mp3   gewitter3.mp3 (Size: 562.93 KB / Downloads: 18)
Reply


Messages In This Thread
Proggies - by bplus - 04-24-2022, 04:02 PM
RE: Proggies - by bplus - 04-26-2022, 03:23 PM
RE: Proggies - by bplus - 04-26-2022, 04:24 PM
RE: Proggies - by bplus - 05-01-2022, 12:10 AM
RE: Proggies - by dcromley - 05-01-2022, 04:00 AM
RE: Proggies - by bplus - 05-01-2022, 02:52 PM
RE: Proggies - by bplus - 05-01-2022, 02:56 PM
RE: Proggies - by bplus - 05-01-2022, 08:05 PM
RE: Proggies - by bplus - 05-03-2022, 01:43 AM
RE: Proggies - by vince - 05-03-2022, 02:13 AM
RE: Proggies - by bplus - 05-03-2022, 02:16 AM
RE: Proggies - by bplus - 05-08-2022, 02:13 AM
RE: Proggies - by OldMoses - 05-08-2022, 12:40 PM
RE: Proggies - by bplus - 05-08-2022, 03:16 PM
RE: Proggies - by bplus - 05-16-2022, 12:21 AM
RE: Proggies - by bplus - 05-16-2022, 12:58 AM
RE: Proggies - by PhilOfPerth - 05-16-2022, 01:40 AM
RE: Proggies - by bplus - 05-16-2022, 01:28 AM
RE: Proggies - by SMcNeill - 05-16-2022, 12:49 PM
RE: Proggies - by bplus - 05-16-2022, 02:44 PM
RE: Proggies - by bplus - 05-17-2022, 11:16 PM
RE: Proggies - by vince - 05-25-2022, 05:08 AM
RE: Proggies - by bplus - 05-17-2022, 11:23 PM
RE: Proggies - by bplus - 05-17-2022, 11:42 PM
RE: Proggies - by bplus - 05-18-2022, 01:14 AM
RE: Proggies - by bplus - 05-19-2022, 06:43 PM
RE: Proggies - by bplus - 05-20-2022, 01:52 AM
RE: Proggies - by SierraKen - 05-20-2022, 03:44 AM
RE: Proggies - by bplus - 05-20-2022, 07:59 PM
RE: Proggies - by bplus - 05-20-2022, 08:34 PM
RE: Proggies - by Dav - 05-21-2022, 12:48 AM
RE: Proggies - by bplus - 05-25-2022, 12:47 AM
RE: Proggies - by bplus - 05-29-2022, 11:32 PM
RE: Proggies - by bplus - 05-30-2022, 01:41 PM
RE: Proggies - by bplus - 06-04-2022, 10:01 PM
RE: Proggies - by triggered - 06-05-2022, 03:44 AM
RE: Proggies - by bplus - 06-05-2022, 03:03 PM
RE: Proggies - by bplus - 06-06-2022, 08:04 PM
RE: Proggies - by bplus - 06-07-2022, 02:18 AM
RE: Proggies - by dbox - 03-03-2023, 09:14 PM
RE: Proggies - by bplus - 06-07-2022, 10:51 AM
RE: Proggies - by SierraKen - 06-09-2022, 07:04 PM
RE: Proggies - by bplus - 06-09-2022, 10:40 PM
RE: Proggies - by bplus - 06-22-2022, 02:59 PM
RE: Proggies - by vince - 06-23-2022, 08:04 PM
RE: Proggies - by SierraKen - 06-24-2022, 06:28 PM
RE: Proggies - by bplus - 07-13-2022, 06:19 PM
RE: Proggies - by bplus - 07-17-2022, 11:38 PM
RE: Proggies - by bplus - 07-19-2022, 07:16 PM
RE: Proggies - by vince - 07-22-2022, 10:40 PM
RE: Proggies - by dbox - 07-23-2022, 12:47 AM
RE: Proggies - by SierraKen - 07-23-2022, 05:16 PM
RE: Proggies - by bplus - 07-24-2022, 04:16 PM
RE: Proggies - by dbox - 07-24-2022, 11:33 PM
RE: Proggies - by SierraKen - 07-24-2022, 11:38 PM
RE: Proggies - by bplus - 09-19-2022, 07:16 PM
RE: Proggies - by bplus - 09-20-2022, 03:42 PM
RE: Proggies - by James D Jarvis - 09-21-2022, 12:22 PM
RE: Proggies - by bplus - 09-21-2022, 02:39 PM
RE: Proggies - by mnrvovrfc - 09-24-2022, 03:25 AM
RE: Proggies - by James D Jarvis - 09-21-2022, 02:55 PM
RE: Proggies - by bplus - 09-21-2022, 03:46 PM
RE: Proggies - by James D Jarvis - 09-21-2022, 05:46 PM
RE: Proggies - by bplus - 09-21-2022, 06:29 PM
RE: Proggies - by bplus - 10-09-2022, 08:17 PM
RE: Proggies - by vince - 10-09-2022, 09:20 PM
RE: Proggies - by bplus - 10-10-2022, 01:52 PM
RE: Proggies - by vince - 10-10-2022, 04:20 PM
RE: Proggies - by bplus - 10-18-2022, 02:54 PM
RE: Proggies - by bplus - 01-16-2023, 03:53 PM
RE: Proggies - by bplus - 01-16-2023, 03:59 PM
RE: Proggies - by bplus - 01-16-2023, 04:05 PM
RE: Proggies - by bplus - 01-16-2023, 04:09 PM
RE: Proggies - by bplus - 01-16-2023, 04:13 PM
RE: Proggies - by bplus - 01-17-2023, 08:18 PM
RE: Proggies - by bplus - 03-06-2023, 07:04 PM
RE: Proggies - by bplus - 03-24-2023, 02:41 AM
RE: Proggies - by vince - 03-24-2023, 05:22 AM
RE: Proggies - by bplus - 03-24-2023, 05:32 AM
RE: Proggies - by mnrvovrfc - 03-24-2023, 05:54 AM
RE: Proggies - by vince - 04-09-2023, 06:49 AM
RE: Proggies - by bplus - 04-09-2023, 03:05 PM
RE: Proggies - by bplus - 07-23-2023, 12:16 PM
RE: Proggies - by GareBear - 07-23-2023, 05:47 PM
RE: Proggies - by bplus - 07-23-2023, 07:35 PM
RE: Proggies - by bplus - 07-24-2023, 07:04 PM
RE: Proggies - by bplus - 07-24-2023, 07:09 PM
RE: Proggies - by bplus - 08-17-2023, 07:17 AM
RE: Proggies - by johnno56 - 08-17-2023, 10:32 AM
RE: Proggies - by bplus - 08-28-2023, 03:24 PM
RE: Proggies - by Dav - 08-28-2023, 05:28 PM
RE: Proggies - by PhilOfPerth - 08-28-2023, 11:47 PM
RE: Proggies - by johnno56 - 08-29-2023, 07:11 AM
RE: Proggies - by bplus - 08-29-2023, 12:39 PM
RE: Proggies - by bplus - 09-03-2023, 02:47 PM
RE: Proggies - by vince - 09-03-2023, 11:10 PM
RE: Proggies - by SMcNeill - 09-03-2023, 05:22 PM
RE: Proggies - by bplus - 09-03-2023, 05:41 PM
RE: Proggies - by bplus - 09-03-2023, 05:47 PM
RE: Proggies - by bplus - 09-03-2023, 11:21 PM
RE: Proggies - by Dav - 09-04-2023, 01:00 AM
RE: Proggies - by grymmjack - 09-06-2023, 12:14 AM
RE: Proggies - by bplus - 09-04-2023, 01:45 AM
RE: Proggies - by mrbcx - 09-05-2023, 03:22 AM
RE: Proggies - by bplus - 09-05-2023, 12:35 PM
RE: Proggies - by bplus - 09-08-2023, 10:24 PM
RE: Proggies - by Dav - 09-09-2023, 12:43 AM
RE: Proggies - by bplus - 09-21-2023, 06:42 PM
RE: Proggies - by bplus - 09-27-2023, 03:16 AM
RE: Proggies - by Dav - 10-05-2023, 08:24 PM
RE: Proggies - by bplus - 10-05-2023, 08:49 PM
RE: Proggies - by bplus - 10-08-2023, 02:13 PM
RE: Proggies - by Dav - 10-08-2023, 06:04 PM
RE: Proggies - by Dav - 10-08-2023, 11:56 PM
RE: Proggies - by bplus - 10-09-2023, 12:22 AM
RE: Proggies - by Dav - 10-09-2023, 12:59 AM
RE: Proggies - by PhilOfPerth - 10-09-2023, 05:28 AM
RE: Proggies - by mnrvovrfc - 10-09-2023, 10:58 AM
RE: Proggies - by Dav - 10-09-2023, 12:33 PM
RE: Proggies - by bplus - 10-09-2023, 05:37 PM
RE: Proggies - by Dav - 10-09-2023, 08:56 PM
RE: Proggies - by bplus - 10-09-2023, 09:23 PM
RE: Proggies - by Dav - 10-18-2023, 02:11 PM
RE: Proggies - by bplus - 10-18-2023, 07:40 PM
RE: Proggies - by CharlieJV - 10-19-2023, 02:28 AM
RE: Proggies - by bplus - 10-19-2023, 01:48 PM
RE: Proggies - by dbox - 10-19-2023, 02:16 PM
RE: Proggies - by dbox - 10-19-2023, 04:07 PM
RE: Proggies - by bplus - 10-19-2023, 05:23 PM
RE: Proggies - by bplus - 10-19-2023, 09:32 PM
RE: Proggies - by Dav - 10-19-2023, 11:45 PM
RE: Proggies - by bplus - 10-27-2023, 08:00 AM
RE: Proggies - by vince - 10-27-2023, 08:49 AM
RE: Proggies - by bplus - 10-27-2023, 01:32 PM
RE: Proggies - by GareBear - 10-28-2023, 05:16 PM
RE: Proggies - by bplus - 10-28-2023, 05:29 PM
RE: Proggies - by dbox - 10-28-2023, 10:19 PM
RE: Proggies - by bplus - 10-28-2023, 11:10 PM
RE: Proggies - by bplus - 10-29-2023, 11:03 AM
RE: Proggies - by bplus - 01-06-2024, 03:12 PM
RE: Proggies - by CharlieJV - 01-06-2024, 05:01 PM
RE: Proggies - by bplus - 01-29-2024, 04:30 PM
RE: Proggies - by PhilOfPerth - 01-29-2024, 11:24 PM
RE: Proggies - by bplus - 01-30-2024, 02:52 PM
RE: Proggies - by bplus - 03-17-2024, 07:11 PM
RE: Proggies - by bplus - 03-24-2024, 11:25 PM
RE: Proggies - by vince - 03-25-2024, 12:27 AM
RE: Proggies - by bplus - 03-26-2024, 06:33 PM
RE: Proggies - by bplus - 05-11-2024, 06:13 PM
RE: Proggies - by bplus - 06-14-2024, 01:58 AM
RE: Proggies - by PhilOfPerth - 06-14-2024, 06:01 AM
RE: Proggies - by NakedApe - 06-14-2024, 04:13 AM
RE: Proggies - by vince - 06-14-2024, 09:15 AM
RE: Proggies - by bplus - 06-14-2024, 10:42 PM
RE: Proggies - by Dav - 06-14-2024, 10:58 PM
RE: Proggies - by bplus - 06-19-2024, 10:14 PM
RE: Proggies - by madscijr - 06-20-2024, 12:41 PM
RE: Proggies - by Dav - 06-20-2024, 06:28 PM
RE: Proggies - by bplus - 06-20-2024, 06:45 PM
RE: Proggies - by dbox - 06-20-2024, 06:48 PM
RE: Proggies - by bplus - 06-20-2024, 07:40 PM
RE: Proggies - by bplus - 06-20-2024, 07:46 PM
RE: Proggies - by bplus - 06-27-2024, 01:09 PM
RE: Proggies - by Steffan-68 - 06-27-2024, 04:02 PM
RE: Proggies - by bplus - 06-27-2024, 04:09 PM
RE: Proggies - by Steffan-68 - 06-27-2024, 04:51 PM
RE: Proggies - by GareBear - 06-27-2024, 05:08 PM
RE: Proggies - by Steffan-68 - 06-27-2024, 05:21 PM
RE: Proggies - by bplus - 06-29-2024, 01:39 PM
RE: Proggies - by bplus - 07-01-2024, 11:30 PM
RE: Proggies - by SMcNeill - 07-02-2024, 12:59 AM
RE: Proggies - by bplus - 07-02-2024, 01:53 PM
RE: Proggies - by SMcNeill - 07-02-2024, 03:07 PM
RE: Proggies - by vince - 07-02-2024, 04:15 AM
RE: Proggies - by bplus - 07-02-2024, 02:02 PM
RE: Proggies - by bplus - 07-02-2024, 05:30 PM
RE: Proggies - by SMcNeill - 07-02-2024, 11:11 PM
RE: Proggies - by bplus - 07-02-2024, 11:30 PM
RE: Proggies - by bplus - 07-15-2024, 12:07 AM
RE: Proggies - by vince - 07-17-2024, 02:06 PM
RE: Proggies - by bplus - 07-17-2024, 02:39 PM
RE: Proggies - by vince - 07-17-2024, 03:34 PM
RE: Proggies - by Dav - 08-30-2024, 05:47 PM
RE: Proggies - by bplus - 08-30-2024, 05:57 PM
RE: Proggies - by Dav - 08-30-2024, 06:00 PM
RE: Proggies - by Dav - 10-02-2024, 01:06 PM
RE: Proggies - by bplus - 10-02-2024, 02:59 PM
RE: Proggies - by Dav - 10-02-2024, 04:31 PM
RE: Proggies - by bplus - 10-02-2024, 08:45 PM
RE: Proggies - by Dav - 10-02-2024, 09:05 PM
RE: Proggies - by NakedApe - 10-02-2024, 09:13 PM
RE: Proggies - by Dav - 10-03-2024, 07:31 PM
RE: Proggies - by bplus - 10-03-2024, 10:35 PM
RE: Proggies - by Dav - 10-03-2024, 11:04 PM
RE: Proggies - by madscijr - 10-07-2024, 08:08 PM
RE: Proggies - by bplus - 10-07-2024, 08:37 PM
RE: Proggies - by bplus - 11-01-2024, 09:28 PM
RE: Proggies - by PhilOfPerth - 11-01-2024, 11:04 PM
RE: Proggies - by bplus - 11-01-2024, 11:48 PM
RE: Proggies - by bplus - 11-09-2024, 01:21 AM
RE: Proggies - by PhilOfPerth - 11-09-2024, 07:48 AM
RE: Proggies - by vince - 11-09-2024, 03:38 PM
RE: Proggies - by bplus - 11-09-2024, 03:53 PM
RE: Proggies - by PhilOfPerth - 11-09-2024, 11:06 PM



Users browsing this thread: 10 Guest(s)