Tune jetpack, kill things that are too far away

main
Cameron Murphy Reikes 2 years ago
parent 1bdcc958c5
commit 08144acd52

@ -1180,6 +1180,11 @@ void process(GameState* gs, float dt)
{
cpVect p = cpvsub(cpBodyGetPosition(e->body), v2_to_cp(SUN_POS));
cpFloat sqdist = cpvlengthsq(p);
if(sqdist > (INSTANT_DEATH_DISTANCE_FROM_SUN*INSTANT_DEATH_DISTANCE_FROM_SUN))
{
entity_destroy(gs, e);
continue;
}
if (sqdist < (SUN_RADIUS * SUN_RADIUS))
{
entity_destroy(gs, e);

@ -790,10 +790,18 @@ frame(void)
sgp_draw_filled_rect(gs.goldpos.x, gs.goldpos.y, 0.1f, 0.1f);
// the SUN
set_color(WHITE);
sgp_set_image(0, image_sun);
draw_texture_centered(SUN_POS, SUN_RADIUS*2.0f);
sgp_reset_image(0);
transform_scope
{
sgp_translate(SUN_POS.x, SUN_POS.y);
set_color(WHITE);
sgp_set_image(0, image_sun);
draw_texture_centered((V2) { 0 }, SUN_RADIUS * 2.0f);
sgp_reset_image(0);
// sun DEATH RADIUS
set_color(RED);
draw_circle((V2) { 0 }, INSTANT_DEATH_DISTANCE_FROM_SUN);
}
sgp_set_color(1.0f, 1.0f, 1.0f, 1.0f);
dbg_drawall();

@ -5,8 +5,8 @@
#define BOX_SIZE 0.25f
#define PLAYER_SIZE ((V2){.x = BOX_SIZE, .y = BOX_SIZE})
#define PLAYER_MASS 0.5f
#define PLAYER_JETPACK_FORCE 1.0f
#define PLAYER_JETPACK_SPICE_PER_SECOND 0.1f
#define PLAYER_JETPACK_FORCE 2.0f
#define PLAYER_JETPACK_SPICE_PER_SECOND 0.3f
#define MAX_HAND_REACH 1.0f
#define GOLD_COLLECT_RADIUS 0.3f
#define BUILD_BOX_SNAP_DIST_TO_SHIP 0.2f
@ -16,6 +16,7 @@
#define VISION_RADIUS 16.0f
#define MAX_BYTES_SIZE 1024 * 8 // maximum size of gamestate buffer
#define SUN_RADIUS 10.0f
#define INSTANT_DEATH_DISTANCE_FROM_SUN 300.0f
#define SUN_POS ((V2){50.0f,0.0f})
#define SUN_GRAVITY_STRENGTH (5.0e3f)
#define SOLAR_ENERGY_PER_SECOND 0.02f

Loading…
Cancel
Save