Computer Science Canada

A neat looking "fountain"

Author:  petree08 [ Tue Sep 04, 2007 12:56 pm ]
Post subject:  A neat looking "fountain"

i use the word "fountain" cuz i cant describe it any other way

click on the mouse to shoot "water"

you can change the angle it is being shot out with the arrow keys

now that school is back i have steady internet access and i have sum neat stuff i made over the summer to show. lol

have fun Canada Very Happy Canada

code:

const NUM_OF_OBS := 400
const G := .32 % gravity
const FORCE := 10 % the force given to the object when launched
% change these consts to change the colors of the
%projectiles
const C1 := 9
const C2 := 54

var XM, YM, Click : int
var XW, YW, VY, VX : array 1 .. NUM_OF_OBS of real4

var Angle : real4
var Key : array char of boolean
var Clicked : boolean
var DropNum, FireCount : nat
var Water : real4
Water := 1
Angle := 0

for W : 1 .. NUM_OF_OBS
    XW (W) := -10
    YW (W) := -10
    VY (W) := 0
    VX (W) := 0


end for

Clicked := false
setscreen ("graphics:max,max,nobuttonbar,offscreenonly")


DropNum := 1
FireCount := 1
colorback (7)
loop

    cls
    Input.KeyDown (Key)
    mousewhere (XM, YM, Click)



    if Key (KEY_RIGHT_ARROW) then
        Angle := Angle + 1
    elsif
            Key (KEY_LEFT_ARROW) then
        Angle := Angle - 1
    end if
    if Angle > 360 then
        Angle := 0
    elsif Angle < 0 then
        Angle := 360
    end if

    if Click = 1 /*and Clicked = false */ then


        XW (DropNum) := XM
        YW (DropNum) := YM

        VY (DropNum) := round (sind (Angle) * FORCE)
        VX (DropNum) := round (cosd (Angle) * FORCE)
        FireCount := 0
        if DropNum < NUM_OF_OBS then
            DropNum := DropNum + 1
        else
            DropNum := 1
        end if
        Clicked := true

    end if




    for W : 1 .. NUM_OF_OBS

        drawline (round (XW (W) - (VX (W) * 2)),
            round (YW (W) - (VY (W) * 2)),
            round (XW (W)), round (YW (W)), C1)


        XW (W) := XW (W) + VX (W)
        YW (W) := YW (W) + VY (W)
        VY (W) := VY (W) - G
        if YW (W) < 1 then


            VY (W) := - (VY (W) / 1.25)
        end if
        if XW (W) > maxx or XW (W) < 1 then
            VX (W) := -VX (W)
        end if
        drawline (round (XW (W) - (VX (W) * 2)),
            round (YW (W) - (VY (W) * 2)),
            round (XW (W)), round (YW (W)), C2)

    end for

    if Click = 0 then
        Clicked := false
    end if


    drawline (XM, YM, XM + round (cosd (Angle) * 15),
        YM + round (sind (Angle) * 15), 12)
    drawfilloval (XM, YM, 5, 5, 12)


    put DropNum
    View.Update
end loop


Author:  cavetroll [ Tue Sep 04, 2007 3:27 pm ]
Post subject:  RE:A neat looking "fountain"

Cool program. It's got some neat effects.

Good work

Author:  darkangel [ Mon Sep 17, 2007 12:58 pm ]
Post subject:  Re: A neat looking "fountain"

very cool, i could sooooo see this being a good game.

hmmmm, the cogs in my brain are turning.

Author:  cpu_hacker4.0 [ Fri Oct 05, 2007 9:03 pm ]
Post subject:  Re: A neat looking "fountain"

good job thats amazing!

Author:  Feorn [ Sat Oct 13, 2007 9:19 pm ]
Post subject:  Re: A neat looking "fountain"

I have to say this is a really cool program I have spent about 30 mins just changing some things in this program like changing it's color and its gravity, it's a really fun program I recomend people try this out and its an easy way to learn also. Smile

Author:  sam21292 [ Sat Dec 29, 2007 7:30 pm ]
Post subject:  RE:A neat looking "fountain"

This is a really good program, and Feorn must be flipping his mouse just by looking at it

Author:  Nyrd [ Sun Feb 10, 2008 10:28 pm ]
Post subject:  RE:A neat looking "fountain"

That's some bouncy water you got there . . . Razz

Author:  syntax_error [ Mon Feb 11, 2008 5:00 am ]
Post subject:  Re: A neat looking "fountain"

Nyrd wrote:

That's some bouncy water you got there . . . P


don't just start up a 2ish month old thread and just say that; please read over forum rules, over again.

Author:  Nyrd [ Mon Feb 11, 2008 12:05 pm ]
Post subject:  Re: A neat looking "fountain"

vSorryy! For some reason I didn't notice the date ... : Embarassed

Author:  DaveAngus [ Tue Mar 18, 2008 9:16 am ]
Post subject:  RE:A neat looking "fountain"

I really like this.
I think that we may use this in our class as a little assignment

Author:  Doug101 [ Tue Apr 01, 2008 10:44 am ]
Post subject:  Re: A neat looking "fountain"

sweet game i loved it it coll how you can simulate gravity.

Author:  Tallguy [ Tue Apr 15, 2008 9:53 am ]
Post subject:  RE:A neat looking "fountain"

that is really cool, it has really good reaction time and the boudries work, very good

Author:  Serk91 [ Wed Apr 23, 2008 8:30 am ]
Post subject:  RE:A neat looking "fountain"

siiiiick! awesonmme!

Author:  Prongs [ Fri May 21, 2010 8:40 am ]
Post subject:  Re: A neat looking "fountain"

That was so addictive. Wow.

Author:  Scott [ Fri May 21, 2010 9:16 am ]
Post subject:  Re: A neat looking "fountain"

Well thats addictive and fun.
I like it but I noticed when the "water" hits at a certain angle it loses its momentum? or bounce?
Just thought I'd mention.
Other then that its very good.

Author:  jmarsiglio [ Sat May 29, 2010 8:42 am ]
Post subject:  Re: A neat looking "fountain"

Hey, nice program!

There's one thing I don't quite understand however:

code:

        drawline (round (XW (W) - (VX (W) * 2)),
            round (YW (W) - (VY (W) * 2)),
            round (XW (W)), round (YW (W)), C2)


This is done twice, before and after gravity is applied to the y velocity. What does this do?

Thanks!

Author:  Cezna [ Fri Jun 04, 2010 7:39 pm ]
Post subject:  Re: A neat looking "fountain"

This thing is really cool !
For some reason, it reminds me of the head of one of those birds with the hats that swing back and forth and "drink" water from a cup.... I got that from a red circle with a red line coming out of it and a blue line coming out of that....


: