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

Username:   Password: 
 RegisterRegister   
 Direction Change via Mousewhere [snow]
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Flashkicks




PostPosted: Thu Apr 22, 2004 8:20 am   Post subject: Direction Change via Mousewhere [snow]

Hi~Flashkicks here! I am writing this program for snow as it looked fun; and I am trying to make it so that once you click once- the snow will blow to the right. If you click again; the snow will blow to the left. And keep switching with this pattern. For some reason I can Not get it so that it detects the SECOND time the mouse is clicked.. Take a look at my coding and if you think you can help-please do. BTW- The snow is supposed to start off in ALL directions- so that is Not a glitch..
code:

View.Set ("offscreenonly")
var mx, my, mb : int
var change : boolean := false
var click : int := 0
type snowDrop :
    record
        x : int
        y : int
        size : int
        spd : int
        dx : int
    end record

var snow : array 1 .. 100 of snowDrop

for i : 1 .. 100
    snow (i).x := Rand.Int (0, maxx)
    snow (i).y := Rand.Int (maxy, maxy + 100)
    snow (i).size := Rand.Int (1, 3)
    snow (i).spd := -1 - snow (i).size
    snow (i).dx := Rand.Int (-5, 5)
end for

loop
    mousewhere (mx, my, mb)
    cls
    drawfillbox (0, 0, maxx, maxy, 7)
    for i : 1 .. 100
        drawfilloval (snow (i).x, snow (i).y, snow (i).size, snow (i).size, 7)
        snow (i).x += snow (i).dx
        snow (i).y += snow (i).spd
        drawfilloval (snow (i).x, snow (i).y, snow (i).size, snow (i).size, 0)

        if mb = 1 and change = false then
            change := true
            click := 1
        end if
        if mb = 0 and change = true then
            change := false
            click := 2
        end if
        if click = 1 then
            snow (i).dx := 5
        elsif click = 2 then
            snow (i).dx := -5
        end if

        if snow (i).y <= 0 then
            snow (i).x := Rand.Int (0, maxx)
            snow (i).y := Rand.Int (maxy, maxy + 100)
            snow (i).size := Rand.Int (1, 3)
            snow (i).spd := -1 - snow (i).size
            % snow (i).dx := Rand.Int (-5, 5)
        end if
        if snow (i).x <= 0 then
            snow (i).x := maxx - 5
        elsif snow (i).x >= maxx then
            snow (i).x := 5
        end if
    end for
    View.Update
end loop


I will keep werking on it- but I have never been good with this mousewhere Confused ..lol
Sponsor
Sponsor
Sponsor
sponsor
Delta




PostPosted: Thu Apr 22, 2004 9:12 am   Post subject: (No subject)

Hey bill... whats up dawg Wink
heres your problem...fixed... lol and with the blizzard too Smile... well you could have just looked to your right and asked me to help you...but whatever... here it is.

code:
View.Set ("offscreenonly")
var mx, my, mb : int
var change : boolean := false
var click : int := 0
type snowDrop :
    record
        x : int
        y : int
        size : int
        spd : int
        dx : int
    end record

var snow : array 1 .. 100 of snowDrop

for i : 1 .. 100
    snow (i).x := Rand.Int (0, maxx)
    snow (i).y := Rand.Int (maxy, maxy + 100)
    snow (i).size := Rand.Int (1, 3)
    snow (i).spd := -1 - snow (i).size
    snow (i).dx := Rand.Int (-2-snow(i).size, 2+snow(i).size)
end for

loop
    mousewhere (mx, my, mb)
    cls
    drawfillbox (0, 0, maxx, maxy, 7)
            if mb = 0 and change = true then
            change := false
        elsif mb = 1 and change = false then
            change := true
            if click = 1 then
                click := 2
            elsif click = 2 then
                click := 3
            elsif click = 3 then
                click := 1
            else
                click := 1
            end if
            for i : 1 .. 100
                if click = 1 then
                   
                    snow (i).dx := 2 + snow(i).size
                elsif click = 2 then
                    snow (i).dx := -2 - snow(i).size
                elsif click = 3 then
                   
                    snow (i).dx := Rand.Int (-2-snow(i).size, 2+snow(i).size)
                end if
            end for
        end if
    for i : 1 .. 100
        drawfilloval (snow (i).x, snow (i).y, snow (i).size, snow (i).size, 7)
        snow (i).x += snow (i).dx
        snow (i).y += snow (i).spd
        drawfilloval (snow (i).x, snow (i).y, snow (i).size, snow (i).size, 0)
        if snow (i).y <= 0 then
            snow (i).x := Rand.Int (0, maxx)
            snow (i).y := Rand.Int (maxy, maxy + 100)
            snow (i).size := Rand.Int (1, 3)
            snow (i).spd := -1 - snow (i).size
            % snow (i).dx := Rand.Int (-5, 5)
        end if
        if snow (i).x <= 0 then
            snow (i).x := maxx - 5
        elsif snow (i).x >= maxx then
            snow (i).x := 5
        end if
    end for
    View.Update
end loop
Flashkicks




PostPosted: Thu Apr 22, 2004 9:19 am   Post subject: (No subject)

Wow Yo Thanks G!!! it werks!! [touching music comes in] and yeah.. Looking to my right and seeing you ove my shoulder is just no fun Razz .. But as for killing!! Twisted Evil ..lol.. But you know me- Id kill you.. ..Or would Iiiiiiiiiiiiiii...... Rolling Eyes
Flashkicks




PostPosted: Thu Apr 22, 2004 9:23 am   Post subject: (No subject)

WAIT- Im sorry for the doublwe posting ut I JUST came across a problem that I overlooked.. ummmmmm... okay. When the snow is either going LEFT or RIGHT [not the centeredBlizzard] The smaller snow flakes are supposed to be moving slower.. and more or less angled Down-ish.. The more bigger and heavier snow flakes are supposed to be moving faster- bcuz it is moe UpClose to you. understand??.. If anyone has help with this- then much appreciation to him/her..lol.. Thanks a bunch- Ill try to get it done- but me and my busy schedual Confused Rolling Eyes
Delta




PostPosted: Thu Apr 22, 2004 9:33 am   Post subject: (No subject)

Ok Flashkicks I fixed your lil problem that you were obvisously too lazy to do yourself you foolish lil boy. Well I edited my last post .
Flashkicks




PostPosted: Thu Apr 22, 2004 9:36 am   Post subject: (No subject)

Embarassed yaaaaaa.. Laziness runs in my family..lol.. Thanks Delta- I Wuv you's!! you guys should run this snow proggy- it is quite cool!!.. AHEM. Click to change directions of the snow.. cough.. WHY ARE YO STILL READING THIS!!???! GO GO Go0o0o0o0o!!
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  [ 6 Posts ]
Jump to:   


Style:  
Search: