This will be used when planets can be merged together at collision.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
+#include <math.h>
+
#include "random.h"
#include "planet.h"
#include "utils.h"
buf[offset] = r;
}
+static void reshape_planet(struct planet *p)
+{
+ p->size = sqrt(p->mass / 100);
+}
+
void init_planet(const SDL_Surface *screen, struct planet *p)
{
p->speed.x = 0;
p->pos.x = get_random() % screen->w;
p->pos.y = get_random() % screen->h;
p->mass = get_random() % 1000 + 100;
- p->size = p->mass / 100;
+ reshape_planet(p);
p->r = get_random() % 256;
p->g = get_random() % 256;
p->b = get_random() % 256;