Permalink
Browse files

bugfix planet speed was set once

  • Loading branch information...
Jeremy Heminger Jeremy Heminger
Jeremy Heminger authored and Jeremy Heminger committed Nov 29, 2018
1 parent 3ccd03a commit ccb51126c43459c8a5cce10bdc7ad951ab38de40
Showing with 3 additions and 3 deletions.
  1. +3 −3 js/script.js
@@ -92,7 +92,7 @@ function run() {
size = MINPLANETSIZE + Math.floor(Math.random() * MAXPLANETSIZE);
mass = (size * PLANETMASS);
if(!STARTSTATIC) {
start = {x:STARTCHAOS, y:0};
start = {x:(STARTSPEED + Math.random() * MAXSTARTSPEED), y:0};
let a = trig(hW,hH,(MINDISSTART + Math.random() * MAXDISSTART),-90,true);
x = a[0];
y = a[1];
@@ -113,8 +113,8 @@ function run() {
// convert to radians
sd = sd * Math.PI / 180;
// set planet in that direction at velocity of STARTCHAOS
start.x += (Math.cos(sd) * Math.PI / 180) * (STARTCHAOS * 100);
start.y += (Math.sin(sd) * Math.PI / 180) * (STARTCHAOS * 100);
start.x += (Math.cos(sd) * Math.PI / 180) * ((STARTSPEED + Math.random() * MAXSTARTSPEED) * 100);
start.y += (Math.sin(sd) * Math.PI / 180) * ((STARTSPEED + Math.random() * MAXSTARTSPEED) * 100);
}
}else{
// first loop init the SUN

0 comments on commit ccb5112

Please sign in to comment.