Beginners Animation Help

Hey all so i am doing a summer project involving the solar system, using C++ graphics. I have the picture so far.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include<iostream>
#include<graphics.h>
using namespace std;

void main()
{
SetupGraphics();
//Creating the orbits
SetPenColor(Black);
Circle(800,500,34);
Circle(800,500,47);
Circle(800,500,92);
Circle(800,500,141);
Circle(800,500,223);
Circle(800,500,326);
Circle(800,500,402);
Circle(800,500,594);
Circle(800,500,766);

//Creating the sun
SetPenColor(Red);
SetBrushColor(Red);
SetBrushStyle(Solid);
Circle(800,500,23);

//Creating planets

SetPenColor(Black);

//Mercury
SetBrushColor(Green);
SetBrushStyle(Solid);
Circle(834,500,4);

//Venus
SetBrushColor(Brown);
SetBrushStyle(Solid);
Circle(847,500,6);

//Earth
SetBrushColor(Blue);
SetBrushStyle(Solid);
Circle(892,500,6);

//Mars
SetBrushColor(Red);
SetBrushStyle(Solid);
Circle(941,500,5);

//Jupiter
SetBrushColor(Brown);
SetBrushStyle(Solid);
Circle(1023,500,14);

//Saturn
SetBrushColor(Yellow);
SetBrushStyle(Solid);
Circle(1126,500,10);
SetPenColor(Brown);
MoveTo(1111,500);
LineTo(1141,500);

//Uranus
SetPenColor(Black);
SetBrushColor(Blue);
SetBrushStyle(Solid);
Circle(1202,500,10);
MoveTo(1190,515);
LineTo(1214,485);

//Neptune
SetBrushColor(Green);
SetBrushStyle(Solid);
Circle(1394,500,9);

//Pluto
SetBrushColor(Blue);
SetBrushStyle(Solid);
Circle(1566,500,3);


which just draws the solar system (to a crude inaccurate scale)

Now i need to animate the planets to rotate around the sun.......
I have never learned how to do this so this is where i need your help.
THIS IS NOT FOR A GRADE OR A CLASS
just so everyone is clear i am not trying to use you for cheating purposes. simply trying to learn animation. the compiler i am using is HiC. But i do also have visual studios (way too complex for me as of now).

Any and all help is greatly appreciated. Thanks again.
Take a look at SDL library for an easy to learn and use graphics API, SFML will also work.
I don't know how to write your code...

Consider the sun to be your origin (0,0). Every planet is drawn along a circle of a certain radius. So a planet exists at a point of some radius and some angle of that circle. Make a function that, given a radius and angle, returns a point which will be the center of the planet you want to draw.

You might consider a planet struct of sorts:
1
2
3
4
5
6
7
8
struct Planet
{
  (type) penColor;
  (type) brushColor;
  (type) brushStyle;
  int x,y // maybe floats
  float radius;
}


Have a Planet system[9]; and you're all set.
Topic archived. No new replies allowed.