diff --git a/intro.txt b/intro.txt index b63704d..d0228ab 100644 --- a/intro.txt +++ b/intro.txt @@ -13,7 +13,7 @@ HITBOX 2309 392 454 503 TEXTBOX 1566 120 123 134 info_plate_small_1 Press\s';'\sto\sdash,\son\sground\sor\smidair.\nYou\scan\sonly\sdash\s1\stime\smidair. HAZARD 1797 733 513 103 HAZARD_RESPAWN 1492 23 297 242 1706 250 -LEVEL_TRANSITION 2762 1000 142 76 level1.txt +LEVEL_TRANSITION 2762 750 142 76 level1.txt TEXTBOX 2577 264 137 132 info_plate_small_2 Jump\sdown\sto\sthe\snext\slevel.\nNow\scomplete\swith\slevel\stransitions! HAZARD_RESPAWN 2315 41 107 368 2372 392 CAMERA_FOCUS 1050 -70 1400 1000 @@ -24,4 +24,4 @@ FILL 40 40 40 2903 -1000 1000 3000 FILL 40 40 40 -2500 -270 2400 1000 FILL 0 0 0 1181 600 300 1000 FILL 0 0 0 1797 733 513 1000 -FILL 255 255 255 2762 1000 142 1000 +FILL 255 255 255 2762 750 142 1000 diff --git a/mapper_misc.c b/mapper_misc.c index c9eab97..3380d5e 100644 --- a/mapper_misc.c +++ b/mapper_misc.c @@ -4,6 +4,7 @@ #include "entity.h" #include "physics.h" #include "player.h" +#include "render_util.h" #include "types.h" #include "util/assert.h" #include "util/rand.h" @@ -141,6 +142,28 @@ void misc_thinker_ChangeLevel(App *app, Entity *e, Duration deltaTime) { } if (app->player->player == NULL) // No player return; + + // Copied from Hazard thinker + uint64_t emitCooldown = 400.0 * 60000.0 / e->misc->trigger.size.x; // 60 msec across 400px + TimePoint lastEmit = {.microseconds = (uint64_t)e->thinkerData}; + if (time_Since(lastEmit).microseconds > emitCooldown) { + lastEmit = time_Now(); + lastEmit.microseconds -= 10000 * rand_Double01(); + Box2 worldbox = ABSOLUTE_BOX(e, e->misc->trigger); + particle_Emit( + app->particle, + 0, + vec2_Random( + worldbox.lefttop.x + 20, + worldbox.lefttop.x + worldbox.size.x - 20, + worldbox.lefttop.y + 20.0, + worldbox.lefttop.y + 40.0), + vec2(0.0, rand_DoubleRange(-250.0, -300.0)), + rand_DoubleRange(1, 1.5), + rand_DoubleRange(20, 30), + 20, duration_FromSeconds(0), &render_ModeDefault); + e->thinkerData = (void *)lastEmit.microseconds; + } Component_Player *p = app->player->player; Box2 playerbox = physics_HitboxAbsolute(p->super->hitbox);