Results 1 to 2 of 2

Thread: Tough graphic programming question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Posts
    117
    I am trying to make this fireworks effect in a language called Turing. It has gr predefined procedures like drawdot, drawcircle, drawarc etc. The syntax doesn't matter at all. I would like to know if anyone knows the logic or the basic steps on how to do it. you might want ot look into trignometry and radians of a circle. PLEASE HELP. This is for a school assignment

  2. #2
    Addicted Member Shrog's Avatar
    Join Date
    Aug 1999
    Location
    Darkest Africa
    Posts
    186

    Cool Try this.

    Here is something I wrote many, many, many, many, many years ago in QBasic. Please forgive my coding, I'm giving it to you unedited.

    Code:
    Screen 12
    xmax = 640
    ymax = 470
    INPUT max
    PI = 3.141592654
    rad = PI / 180
    Dim f(100, 5)
    
    Cls
    Do
        cnt = cnt + 1
        If cnt > 20 Then cnt = 0: Max = Max + 1
        elev = 90 + Rnd * 40 - 20
        Line (0, ymax)-(xmax, ymax)
        elrad = elev * rad
        charg = 1.5 * ymax + Rnd * ymax
        For t = 1 To Max
            f(t, 5) = 15
            f(t, 1) = xmax / 2: f(t, 2) = ymax
            f(t, 3) = (charg * Cos(elrad)) / 10
            f(t, 4) = (-charg * Sin(elrad)) / 10
        Next t
        flag = ymax / 2000
        shower = 5 + Int(Rnd * 40) + Int(Rnd * 40) + Int(Rnd * 40) + Int(Rnd * 40)
        'PRINT shower
        For rep = 1 To 500
            k$ = INKEY$
            If rep = shower Then GoSub splash
            dead = 0
            For t = 1 To Max
                If rep > shower + 60 And f(t, 5) > 0 Then If Rnd < 0.1 Then f(t, 5) = f(t, 5) - 1
                If f(t, 5) = 0 Then dead = dead + 1
                PSet (f(t, 1), f(t, 2)), 0
                f(t, 1) = f(t, 1) + f(t, 3) / 10
                f(t, 2) = f(t, 2) + f(t, 4) / 10
                f(t, 3) = f(t, 3) * 0.98
                f(t, 4) = f(t, 4) * 0.98 + 0.1 + flag
                PSet (f(t, 1), f(t, 2)), f(t, 5)
            Next t
            If k$ = Chr$(27) Or dead = Max Then Exit For
        Next rep
    Loop Until k$ = Chr$(27)
    End
    
    splash:
        For t = 1 To Max
            f(t, 3) = f(t, 3) + Rnd * ymax / 10 - ymax / 20
            f(t, 4) = f(t, 4) + Rnd * ymax / 10 - ymax / 20
        Next t
        flag = 0
    Return
    I hope this helps.
    Shrog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width