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

Username:   Password: 
 RegisterRegister   
 moon help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
sosno




PostPosted: 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)
Sponsor
Sponsor
Sponsor
sponsor
guruguru




PostPosted: Fri Mar 05, 2004 5:28 pm   Post subject: (No 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.)
Dan




PostPosted: Fri Mar 05, 2004 5:36 pm   Post subject: (No 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.

code:

for i : 1 .. maxx
    cls
    Draw.FillOval (i, maxy - 100, 50, 50, 1)
    Draw.FillOval (maxx - i, maxy - 100, 100, 100, 0)
    delay (50)
end for


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.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
zylum




PostPosted: Fri Mar 05, 2004 6:25 pm   Post subject: (No subject)

maybe this version is a bit better:

code:

setscreen ("offscreenonly")
colorback (7)

var x1, x2, y : int := 0
var ang : real := 180

loop
    x1 += 2
    x2 += 1
    ang -= (180 / maxx) * 2
    y := round ((sind (ang) * maxy) / 2 + maxy / 4)
    drawfilloval (x1, y, 50, 50, yellow)
    drawfilloval (x2 + 150, y, 60, 60, 7)
    delay (20)
    View.Update
    cls
    exit when x1 > maxx
end loop


Laughing

-zylum
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  [ 4 Posts ]
Jump to:   


Style:  
Search: