Computer Science Canada moon help |
Author: | sosno [ Fri Mar 05, 2004 5:15 pm ] |
Post subject: | moon help |
Im makin a house for school i want a moon to move arcoss the screen from left to right is night is chosen, and i want the moon to change stages (small left peice, slightly bigger left piece, ...., full moon, big right piece ect.. For what i posted can someone help me get back on trach i need some help var moona : real var moonb : real var moonc : real var moond : real var moone : real var moonf : real var moong : real var moonh : real var mooni : real var moonj : real var moonk : real var moonl : real var moonm : real drawarc (100,100,40,40,120,250,7) drawarc (110,100,45,45,120,250,9) moona := 100 moonb := 100 moonc := 40 moond := 40 moone := 120 moonf := 250 moong := 7 moonh := 110 mooni := 100 moonj := 45 moonk := 120 moonl := 250 moonm := 9 drawarc ( moona, moonb, moonc, moond, moone, moonf, moong) |
Author: | guruguru [ Fri Mar 05, 2004 5:28 pm ] |
Post subject: | |
Well first of all... I don't know how you want to finally do the program, you should try it at least. One big thing is it would be much easier for you to program and keep track of all the moon variables in an array. A alteration follows: var moon_left : array 1 .. 7 of int := init (100, 100, 40, 40, 120, 250, 7) var moon_right : array 1 .. 7 of int := init (110, 100, 45, 45, 120, 250, 9) drawarc (moon_left(1), moon_left(2), moon_left(3), moon_left(4), moon_left(5), moon_left(6), moon_left(7)) drawarc (moon_right(1), moon_right(2), moon_right(3), moon_right(4), moon_right(5), moon_right(6), moon_right(7)) Which is helluva lot shorter... I also had to add one variable because you were missing it. This also makes you program more versatile. Now to change the postion of your moon, simply change the array values. (And I changed them to integer for that reason.) |
Author: | Dan [ Fri Mar 05, 2004 5:36 pm ] | ||
Post subject: | |||
you are realy going to whont to use loops for this b/c typing out all the code whould be nuts. also if u whont it to look real i whould not use draw arc but rather set it up like it happens in real life witch is the moon being blacked out by a bigger object.
this code will make the moon go to an elcips and back near the midel of the screen. it works by moving the 1st blue cricle over by one each time satring from the left of the screen and the 2nd cricle the same color as the backgournd one pxile from the left. this in my option gives you a more real looking moon. |
Author: | zylum [ Fri Mar 05, 2004 6:25 pm ] | ||
Post subject: | |||
maybe this version is a bit better:
![]() -zylum |