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

Username:   Password: 
 RegisterRegister   
 Blood Splattering
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
do_pete




PostPosted: Fri Nov 04, 2005 11:11 am   Post subject: Blood Splattering

I was bored so i made this little program of blood splattering aginst a wall and dripping off.
code:
%Blood Splatter and Drip Program
%Programmed by Peter Do
const DARKNESS := 15
const RANGE := 10
const SIZE := 100
const DENSITY := 1
const DRIP_SPACING := 4
var Colour, x, y, z : int := 0
var dripspace, dripspeed : array 1 .. 5 of int
View.Set ("offscreenonly,graphics:111;111,nobuttonbar,position:middle;middle,title:Blood Splatter")
loop
    for b : 1 .. DENSITY
        for decreasing a : SIZE div 2 .. 0
            for i : 1 .. a
                Colour := RGB.AddColour (Rand.Int (DARKNESS - RANGE, DARKNESS) / DARKNESS, 0.0, 0.0)
                randint (x, a, SIZE - a)
                randint (y, a, SIZE - a)
                drawdot (x, y, Colour)
            end for
            View.Update
            %Get rid of this delay if you computer is really slow
            delay (1)
        end for
    end for
    randint (z, 3, 5)
    dripspace (1) := Rand.Int (SIZE div 2 - 5, SIZE div 2 - 3)
    for i : 2 .. z
        dripspace (i) := Rand.Int (dripspace (i - 1) + DRIP_SPACING - 2, dripspace (i - 1) + DRIP_SPACING + 2)
    end for
    for i : 1 .. z
        dripspeed (i) := Rand.Int (1, 10)
    end for
    for decreasing a : SIZE div 2 + 5 .. 0
        for i : 1 .. z
            if whatdotcolour (dripspace (i), a) not= white then
                for decreasing w : dripspeed (i) .. 1
                    drawdot (dripspace (i), a - dripspeed (i) - w, whatdotcolour (dripspace (i), a))
                end for
            end if
        end for
        View.Update
        %If you computer is slow make this delay smaller
        delay (100)
    end for
    cls
    View.Update
end loop
Sponsor
Sponsor
Sponsor
sponsor
codemage




PostPosted: Fri Nov 04, 2005 1:30 pm   Post subject: (No subject)

Morbidilicious / Goretastic.

I'm good with that as long as your imagination confines itself to the virtual world. :/
Flikerator




PostPosted: Sat Nov 12, 2005 4:44 pm   Post subject: (No subject)

Very nice = )

To codemage:...its not like its a movie with someone being ripped apart or something, its a blood splater program. Hardly "Morbidilicious or Goretastic."
ZeroPaladn




PostPosted: Mon Nov 14, 2005 9:41 am   Post subject: (No subject)

i thought my blood animation was good (http://www.compsci.ca/v2/viewtopic.php?t=9900) very nice, as if someone was shot in the face Laughing . Keep them coming Do!
do_pete




PostPosted: Mon Nov 14, 2005 11:56 am   Post subject: (No subject)

you can screw around with the colour to make it look like a paint ball being shot at the wall
ZeroPaladn




PostPosted: Mon Nov 14, 2005 1:53 pm   Post subject: (No subject)

im no good at RBG coloring, how do you change the colours using RBG?
jamonathin




PostPosted: Mon Nov 14, 2005 2:37 pm   Post subject: (No subject)

What you can do with RGB is change the shade of whatever color you have.

You can add new colors by using RGB.AddColor (red,green,blue)
where the highest value of the red, green, blue can be 1, lowest being 0. You use decimals to represent the amount of color used.

So to get a full red color, you would use

code:

var c : int
c := RGB.AddColor(1,0,0)


If you were to drop the 1 to .5, the red would get darker (the lower the darker). So basically . .
RGB.AddColor(0, 0, 0) would be black
RGB.AddColor(1, 1, 1) would be white

Then you can use for loops to make the fade look nice. Here's an example.
code:
var c : int
for decreasing i : 20 .. 1
    c := RGB.AddColor (i / 20, 0, 0)
    colorback (c)
    cls
    delay (50)
end for

You can put that into the green or blue section and it would pull of the same effect.

Or what you could do is get the R, G and B values of a color, where you need 3 'real' variables and a color. Now you could insert a color number (such as 10 for brightgreen) or you could use whatdotcolor to pick up a color from the screen.
So you would call:
RGB.GetColor(colorID,r :real,g :real, b:real)
which would give the RGB values to r, g and b.
Here's an example. It produces a random background then gets the rgb values of it.
code:

colorback (Rand.Int (1, maxcolor))
cls
var r, g, b : real
RGB.GetColor (whatdotcolor (100, 100), r, g, b)
put "Color #", whatdotcolor (100, 100)
put "Red: ", r
put "Green: ", g
put "Blue: ", b

Note: If you use whatdotcolor to pick up colors other than the ones in Turing, you wont be able to reproduce that color because whatdotcolor picks up the nearest color in Turing, to the one you told it to grab.
do_pete




PostPosted: Mon Nov 14, 2005 2:45 pm   Post subject: (No subject)

RGB stands for Red, Green, and Blue so in order to change the colour you would change the postion of
code:
Rand.Int (DARKNESS - RANGE, DARKNESS) / DARKNESS
So if you wanted it to be green you would go
code:
Colour := RGB.AddColour (0.0,Rand.Int (DARKNESS - RANGE, DARKNESS) / DARKNESS, 0.0)

And if you want an other shade of colour you can change the value of 0.0 to somwthing below 1.0. For example this would make the colour yellow
code:
Colour := RGB.AddColour (1.0, Rand.Int (DARKNESS - RANGE, DARKNESS) / DARKNESS, 0.0)
Sponsor
Sponsor
Sponsor
sponsor
ZeroPaladn




PostPosted: Tue Nov 15, 2005 9:30 am   Post subject: (No subject)

woo! thanks jamonathin, do_pete. i understand now.
sylvester-27




PostPosted: Wed Nov 16, 2005 12:48 pm   Post subject: cool

its pretty cool but it would be cooler if u added a pic of a stickman getting shot then have the blood splat Smile
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: