-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathobjMoon_Create
36 lines (25 loc) · 1.09 KB
/
objMoon_Create
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
// remember --> Create only runs once, as each instance is created.
secondsPerLunarDay = irandom_range(3,8);
secondsPerSolarYear = irandom_range(23,48);
// how shall we control the overall size of this moon?
moonScale = random_range(0.1,0.3);
//image_xscale && image_yscale
// use these to permanently scale our sprites...
image_xscale = moonScale;
image_yscale = moonScale;
// how much has the moon spun (on its axis) so far?
// if we assume a 24 hour day, for example,
// then every hour is another 15 degrees.
moonSpinAngle = random_range(0,360);
// how far into its lunar year is it?
// How many degrees into the orbit path are we?
moonOrbitAngle = random_range(0,360);
// randomly set the distance of moon from planet.
// To keep things in scale, we'll then multiply
// this value by the diameter of the sprite --
// and the game will always rely on the size of
// the moon to calculate how far it is from the Planet.
orbitalRadius = random_range(2.2,10.5);
orbitalRadiusPixels = orbitalRadius * sprite_width;
// classic circumference EQN
orbitalTravelDistanceTotal = 2 * pi * orbitalRadiusPixels;