Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Fade effect?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Thuged_Out_G




PostPosted: Fri Dec 12, 2003 4:51 pm   Post subject: Fade effect?

i wanted to make a sonar like thing

here is what i have so far, its not much lol

code:

View.Set ("graphics")
for decreasing i : maxint .. 1
    Draw.FillArc (100, 100, 100, 100, 0, 360, black)
    Draw.FillArc (100, 100, 100, 100, i - 1, i, 10)
    delay(15)
end for


i was wondering how i could add like a fade effect to the green bar

any ideas anyone?
Sponsor
Sponsor
Sponsor
sponsor
Mazer




PostPosted: Fri Dec 12, 2003 5:33 pm   Post subject: (No subject)

with turing, you start off with a pretty crappy (for most things) palette of 256 colours. if you plan on drawing with any other colours you're either loading pictures, or making your own colours. luckily there's a way to make your own colours in turing: RGB.SetColour(). it takes 4 parameters: colour number, red component, green component, and blue component. using this you can mix your own colours by using various values of red green and blue (between 0.0 and 1.0, see link for (a little) more information)


code:

var angle := 0

for i : 0 .. 255
    RGB.SetColour (i, 0, (i - 150) / 150 * i / 255, 0)
end for
RGB.SetColour (255, 0, .8, 0)
RGB.SetColour (0, 0, 0, 0)
cls

View.Set ("offscreenonly")
loop
    angle += 5
    for decreasing c : 255 .. 170
        Draw.FillArc (100, 100, 100, 100, angle + c, angle + c + 1, c)
        drawfillarc (100, 100, 100, 100, angle + 255, angle + 257, 255)
    end for
    View.Update
    delay (20)
    drawfilloval (100, 100, 100, 100, 170)
end loop
DanShadow




PostPosted: Fri Dec 12, 2003 5:41 pm   Post subject: (No subject)

Ah! RGB is the answer to not using the 256 colors...ive been secretly wondering about that for a couple weeks, tx!
Also, that sonar looks great. Very Happy
Homer_simpson




PostPosted: Fri Dec 12, 2003 6:44 pm   Post subject: (No subject)

mazer yer effect is pretty creative i like it... + bits
Thuged_Out_G




PostPosted: Fri Dec 12, 2003 7:38 pm   Post subject: (No subject)

thanks mazer, that was a pretty cool solution...im gonna try it on my own now Very Happy
Thuged_Out_G




PostPosted: Fri Dec 12, 2003 7:50 pm   Post subject: (No subject)

i have another question
i made the sonar bleep things to appear where the user clicks the mouse, and i am trying to make it so the bleeps are black when the user clicks outside the sonar....it works, but as soon as you click on the sonar area, and then outside it draws a green bleep

code:

var angle := 0
var x, y, button : int

for i : 0 .. 255
    RGB.SetColour (i, 0, (i - 150) / 150 * i / 255, 0)
end for
RGB.SetColour (255, 0, .8, 0)
RGB.SetColour (0, 0, 0, 0)
cls

View.Set ("offscreenonly")
loop
    angle += 5
    for decreasing c : 255 .. 170
        Draw.FillArc (100, 100, 100, 100, angle + c, angle + c + 1, c)
        drawfillarc (100, 100, 100, 100, angle + 255, angle + 257, 255)
    end for
    View.Update
    delay (20)
    drawfilloval (100, 100, 100, 100, 170)
    Mouse.Where (x, y, button)
    if button = 1 then
        if x  > angle and y > angle then
            Draw.Oval (x, y, 5, 5, 0)
        else
            Draw.Oval (x, y, 5, 5, 10)
            Draw.Oval (x, y, 10, 10, 10)
        end if
    end if
end loop


any suggestions?
Mazer




PostPosted: Fri Dec 12, 2003 8:38 pm   Post subject: (No subject)

that's because the only part of the screen that's being drawn over is the radar part. anything that's drawn somewhere else will stay there until something else is drawn over it or the screen is cleared. try this:
code:

var angle := 0
var x, y, button : int

for i : 0 .. 255
    RGB.SetColour (i, 0, (i - 150) / 150 * i / 255, 0)
end for
RGB.SetColour (255, 0, .8, 0)
RGB.SetColour (0, 0, 0, 0)
cls

View.Set ("offscreenonly")
loop
    angle += 5
    for decreasing c : 255 .. 170
        Draw.FillArc (100, 100, 100, 100, angle + c, angle + c + 1, c)
        drawfillarc (100, 100, 100, 100, angle + 255, angle + 257, 255)
    end for
    Mouse.Where (x, y, button)
    if button = 1 then
        /*
         if x > angle and y > angle then %<-- not a good idea. angle gets very large very fast... not sure what you're trying to do here anyways
         Draw.Oval (x, y, 5, 5, 0)
         else
         Draw.Oval (x, y, 5, 5, 10)
         Draw.Oval (x, y, 10, 10, 10)
         end if
         */
        if x >= 0 and x <= 190 and y >= 0 and y <= 190 then
            Draw.Oval (x, y, 5, 5, 10)
            Draw.Oval (x, y, 10, 10, 10)
        end if
    end if

    View.Update
    delay (20)
    drawfillbox (0, 0, 200, 200, 170) % clear a box shaped part of the screen
    %if you want, use cls to clear the whole screen (comment out the last line if you do)

end loop
Thuged_Out_G




PostPosted: Fri Dec 12, 2003 9:19 pm   Post subject: (No subject)

thanks mazer Very Happy

i didnt really know what i was doing with the part you commented...im new to the whole graphics part of turing, and was just trying different things Confused lol
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: