Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Need help trying to figure out code

    Help
    3
    4
    130
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kendog400 F last edited by MikeDX

      n=0
      c=10
      loop
      
        a=n*137.5
        r=c*sqrt(n)
        x=r*cos(a)+gwidth()/2
        y=r*sin(a)+gheight()/2
      
      // ------------------------------------------------------------------------------
      // In this line circle x,y is the locaion, 10 stands for the radius
      // What does {1, (a%256)/255, (n%255)/255, 1,} mean ?
        circle(x, y, 6, 10, {1, (a%256)/255, (n%255)/255, 1,} false)
      // -------------------------------------------------------------------------
      
        n+=1
        if n=400 then break endif
      
        update()
      repeat
      
      print("Press [A] to exit...")
      while controls(0).a==false loop
      
        update()
      repeat
      
      
      1 Reply Last reply Reply Quote 1
      • Willpowered
        Willpowered Fuze Team last edited by

        Hi @kendog400, the parameter in question is the color of the circle. It's a vector in the format {red, green, blue, alpha}, although it looks like your alpha parameter is missing. Use an alpha value of 1 for an opaque circle. Check out the circle command help page for more details.

        The green parameter (a%256)/255 will give you a value in the range 0 to 1, no matter what a is. It will increase as your loop runs. To visualize this, check out these graphs. You'll notice that no matter what the range of a is for input, the Y value of any point on the line is limited to (and including) 0 and 1. (Note: I think you have a typo here, as using 256 will give you a value slightly outside this range. Try 255.)

        The blue parameter (n%255)/255 is pretty much the same. As n increases, your blue value increases. As n nears 255, blue nears 1. When n passes 255, blue loops back to 0.

        I hope that's able to answer your question!

        1 Reply Last reply Reply Quote 2
        • Martin
          Martin Fuze Team last edited by

          @kendog400 I can see you've sent a post with the content: "Thanks!" but the forum software won't allow that to be approved because it's not long enough. If you literally just want to say thanks, do so by clicking the little up arrow next to the word Quote which "upvotes" the message. Otherwise you'll need to make the post longer for it to be approved. Again, this isn't us being funny, there is just a minimum length for post content (which I've now forgotten because I closed the error message).

          1 Reply Last reply Reply Quote 0
          • K
            kendog400 F last edited by

            OK, I'm new to site so I havenet figure out the ins-&-outs...

            1 Reply Last reply Reply Quote 1
            • First post
              Last post