Computer Science Canada

Make the stars flash randomly

Author:  Krocker [ Mon Nov 08, 2010 1:21 pm ]
Post subject:  Make the stars flash randomly

What is it you are trying to achieve?
make stars flash randomly at the same time


What is the problem you are having?
getting the stars to smothly flash randomly


Describe what you have tried to solve this problem
putting each star in between loops and loop ends


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


loop

drawfillstar (250, 600, 255, 605, white)
delay (1000)
drawfillstar (250, 600, 255, 605, black)
delay (1000)


drawfillstar (400, 400, 405, 405, white)
delay (1000)
drawfillstar (400, 400, 405, 405, black)
delay (1000)


drawfillstar (605, 600, 610, 605, white)
delay (1000)
drawfillstar (605, 600, 610, 605, black)
delay (1000)


drawfillstar (470, 350, 475, 355, white)
delay (1000)
drawfillstar (470, 350, 475, 355, black)
delay (1000)

drawfillstar (970, 220, 975, 225, white)
delay (1000)
drawfillstar (970, 220, 975, 225, black)
delay (1000)

drawfillstar (950, 300, 955, 305, white)
delay (1000)
drawfillstar (950, 300, 955, 305, black)
delay (1000)

drawfillstar (130, 240, 135, 245, white)
delay (1000)
drawfillstar (130, 240, 135, 245, black)
delay (1000)

drawfillstar (80, 650, 85, 655, white)
delay (1000)
drawfillstar (80, 650, 85, 655, black)
delay (1000)

drawfillstar (425, 550, 430, 555, white)
delay (1000)
drawfillstar (425, 550, 430, 555, black)
delay (1000)

drawfillstar (900, 600, 905, 605, white)
delay (1000)
drawfillstar (900, 600, 905, 605, black)


drawfillstar (60, 360, 65, 365, white)
delay (1000)
drawfillstar (60, 360, 65, 365, black)
delay (1000)

drawfillstar (80, 650, 85, 655, white)
delay (1000)
drawfillstar (80, 650, 85, 655, black)
delay (1000)

drawfillstar (310, 290, 315, 295, white)
delay (1000)
drawfillstar (310, 290, 315, 295, black)
delay (1000)

drawfillstar (900, 400, 905, 405, white)
delay (1000)
drawfillstar (900, 400, 905, 405, black)
delay (1000)

drawfillstar (720, 620, 725, 625, white)
delay (1000)
drawfillstar (720, 620, 725, 625, black)
delay (1000)

drawfillstar (400, 640, 405, 645, white)
delay (1000)
drawfillstar (400, 640, 405, 645, black)
delay (1000)

drawfillstar (555, 420, 550, 425, white)
delay (1000)
drawfillstar (555, 420, 550, 425, black)
delay (1000)


end loop

Author:  SNIPERDUDE [ Mon Nov 08, 2010 1:33 pm ]
Post subject:  RE:Make the stars flash randomly

I think if you play around with if blocks and Rand.Int you can get it.

Author:  Krocker [ Mon Nov 08, 2010 3:56 pm ]
Post subject:  Re: Make the stars flash randomly

uh? i have no idea what u mean. that is y i posted this question. lol. plz give me an example

Author:  SNIPERDUDE [ Mon Nov 08, 2010 7:54 pm ]
Post subject:  RE:Make the stars flash randomly

Turing:
setscreen("nobuttonbar, offscreenonly, graphics:max;max")
var randy : int

loop
    drawfillbox (0, 0, maxx, maxy, black)

    randy := Rand.Int(0, 1)
    if randy = 1 then
        drawfillstar (250, 600, 255, 605, white)
    end if

    %repeat the previous 4 lines (but modify them accordingly) for each star
   
    View.Update
    delay(200)
end loop


: