Computer Science Canada Help with basic animation |
Author: | mattman [ Fri Dec 07, 2007 9:42 am ] |
Post subject: | Help with basic animation |
hey i need some help with a project. I need to know how to make a night sky twinkle. like stars and clouds . Any Ideas???? |
Author: | Sean [ Fri Dec 07, 2007 10:26 am ] |
Post subject: | Re: Help with basic animation |
You could run a low colour at first, then after a certain time, it clears quickly, and the new ones come in and switch back and forth, to add the twinkle effect. |
Author: | mattman [ Fri Dec 07, 2007 10:31 am ] |
Post subject: | RE:Help with basic animation |
heres what i got soo far colourback (black) loop cls drawfillstar (500, 500, 200, 200, yellow) % stars delay (100) drawfillstar (200, 200, 300, 300, yellow) delay (100) cls drawfillstar (150, 150, 200, 200, yellow) delay (100) cls drawfillstar (100, 100, 120, 120, yellow) delay (100) cls drawfillstar (75, 75, 50, 50, yellow) delay (100) cls end loop any ideas??? |
Author: | mattman [ Fri Dec 07, 2007 10:32 am ] |
Post subject: | RE:Help with basic animation |
its only a shooting star but anything to make it look better? |
Author: | HeavenAgain [ Fri Dec 07, 2007 11:40 am ] |
Post subject: | RE:Help with basic animation |
add a back ground colour of black maybe, draw a ground, with grass, trees, and a house, and you standing there, and theres a lot of starts on the sky, and then suddenly add your shooting star in it, that would be nice ![]() |
Author: | Zampano [ Fri Dec 07, 2007 11:48 am ] | ||
Post subject: | Re: Help with basic animation | ||
For your shooting star, you should instead use a loop in which the previous star is erased, then the x1 and y1 go down by a certain amount, and x2, and y2 go down by a lesser amount (so that the star is bigger than it used to be); something like this:
If that violates compsci.ca's policy concerning posting code, then please remove it. I only posted it because I thought it was pretty basic. |
Author: | mattman [ Fri Dec 07, 2007 3:13 pm ] |
Post subject: | RE:Help with basic animation |
wow thankz for that budz but when u did the x1 -= 2 x2 -= 1 y1 -= 2 y2 -= 1 drawfillstar (x1, y1, x2, y2, 14) View.Update what are the varibles doing?? and why did you draw another star?? just wondering cuz this is neat ![]() |
Author: | HeavenAgain [ Fri Dec 07, 2007 3:41 pm ] |
Post subject: | RE:Help with basic animation |
y1 -= 1 is short for y1 = y1 - 1 and drawing another star in white is to earse the previous draw star, so its like cls, but smaller -> only for the star you draw instead of the whole screen. I think! |
Author: | mattman [ Fri Dec 07, 2007 4:07 pm ] |
Post subject: | RE:Help with basic animation |
okay i see soo saying x1 -=2 is saying that your getting rid of x2 and x1? and vice versa??? sorry im farly new to this.. and veiw.update does what to the star? |
Author: | Zampano [ Fri Dec 07, 2007 4:51 pm ] |
Post subject: | Re: Help with basic animation |
No, what -= or += does is add the amount after the syntax to the integer or real variable specified. So in the case of y1 -= 2, every time the code executes, the 2 is taken away from the variable called y1. You might have been thinking that the variable is destroyed because it has 'x' in its name, but that's just programming convention. I'm only taking away 2 from the value of the variable, the name means nothing. HeavenAgain is right. The first star is drawn in colour 0, which is white. The second star is drawn in fourteen, which is the yellow that you see. If you want to learn more about the line that follows (View.Update), then you should look here: http://compsci.ca/v3/viewtopic.php?t=12533 Just scroll down to the area where View.Update is taught. |
Author: | mattman [ Fri Dec 07, 2007 5:07 pm ] |
Post subject: | RE:Help with basic animation |
THANKS!!! i get it now! i appreciate the help! |
Author: | Sean [ Fri Dec 07, 2007 5:28 pm ] |
Post subject: | Re: Help with basic animation |
Post your finished program soon, can't wait to see what you have done. |
Author: | mattman [ Fri Dec 07, 2007 5:44 pm ] |
Post subject: | RE:Help with basic animation |
k |
Author: | mattman [ Fri Dec 07, 2007 6:06 pm ] |
Post subject: | RE:Help with basic animation |
heres what i got do you think he'll like it for a gr 10? if not any suggestions to make it better cuz i cant get some of the stars to more in the right position setscreen ("offscreenonly") colourback(black)%setting background colour cls var x1, x2, y1, y2, a1, a2, b1, b2, c1, c2, d1, d2, e1, e2, f1, f2: int % set variables x1 := 700% declare variables y1 := 600 x2 := 750 y2 := 400 a1 :=500 b1 :=400 a2 :=600 b2 :=500 c1 := 450 d1 := 700 c2 := 400 d2 := 700 e1 := 650 f1 := 600 e2 := 300 f2 := 500 loop drawfillstar(e1,f1,e2,f2,black)%stars in motion e1-=2 e2-=1 f1-=2 f2-=1 drawfillstar(e1,f1,e2,f2,14) drawfillstar(c1,d1,c2,d2,black) c1-= 2 c2-=1 d1-=2 d2-=1 drawfillstar (c1,d1,c2,d2,14) drawfillstar (a1,b1,a2,b2,black) a1 -= 2 a2 -= 1 b1 -= 2 b2 -= 1 drawfillstar (a1,b1,a2,b2,14) drawfillstar (x1, y1, x2, y2, black) x1 -= 2 x2 -= 1 y1 -= 2 y2 -= 1 drawfillstar (x1, y1, x2, y2, 14) View.Update end loop big thanks for the x1-= thing from Zampano:) it helped alot |