diff --git a/src/land.c b/src/land.c index 191412e..9a96d65 100644 --- a/src/land.c +++ b/src/land.c @@ -1,5 +1,7 @@ #include "toolkit.h" #include "pause.h" +#include "player.h" +#include "rng.h" #include "land.h" // Global/main window. @@ -137,6 +139,18 @@ void land(Planet* p) { void takeoff(void) { if(!landed) return; + int sw, sh; + sw = planet->gfx_space->w; + sh = planet->gfx_space->h; + + // Set player to another position with random facing direction and no velocity. + vect_cset(&player->solid->pos, + planet->pos.x + RNG(-sw/2, sw/2), planet->pos.y + RNG(-sh/2, sh/2)); + vect_pset(&player->solid->vel, 0., 0.); + player->solid->dir = RNG(0, 359) * M_PI/180.; + + space_init(NULL); + planet = NULL; window_destroy(land_wid); landed = 0;