[Add] Taking off after landing on a planet now has a direct affect on the system.
This commit is contained in:
parent
bfc3582d1e
commit
7889035b29
14
src/land.c
14
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;
|
||||
|
Loading…
Reference in New Issue
Block a user