1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-25 06:33:19 +00:00

ads-game:: fuel/crash particles

This commit is contained in:
Zeno Rogue 2022-09-12 13:20:04 +02:00
parent 7958c095d0
commit 2f78601f0b
2 changed files with 9 additions and 3 deletions

View File

@ -124,7 +124,6 @@ bool ads_turn(int idelta) {
if(a[16+8] && !la[16+8]) pushScreen(game_menu);
if(!paused) {
dynamicval<eGeometry> g(geometry, geometry == gRotSpace ? geometry : gCubeTiling);
/* proper time passed */
ld pt = delta * simspeed;
@ -155,6 +154,9 @@ bool ads_turn(int idelta) {
apply_lorentz(spin(ang*degree) * lorentz(0, 2, -delta*accel*mul) * spin(-ang*degree));
pdata.fuel -= delta*accel*mul;
cell *c = hybrid::get_where(vctr).first;
gen_particles(rpoisson(delta*accel*mul*20), c, ads_inverse(current * vctrV) * spin(ang*degree+M_PI) * rots::uxpush(0.06), rsrc_color[rtFuel], 0.15, 0.02);
current.T = cspin(3, 2, pt) * current.T;
optimize_shift(current);

View File

@ -148,10 +148,10 @@ void gen_rocks(cell *c, cellinfo& ci, int radius) {
ci.rock_dist = radius;
}
void gen_particles(int qty, cell *c, shiftmatrix from, color_t col, ld t) {
void gen_particles(int qty, cell *c, shiftmatrix from, color_t col, ld t, ld spread = 1) {
auto& ro = ci_at[c].rocks;
for(int i=0; i<qty; i++) {
auto r = std::make_unique<ads_object>(oParticle, c, from * spin(randd() * TAU) * lorentz(0, 2, 1 + randd()), col );
auto r = std::make_unique<ads_object>(oParticle, c, from * spin(randd() * TAU * spread) * lorentz(0, 2, 1 + randd()), col );
r->shape = &shape_particle;
r->life_end = randd() * t;
r->life_start = 0;
@ -187,6 +187,10 @@ void crash_ship() {
invincibility_pt = ship_pt + how_much_invincibility;
pdata.hitpoints--;
if(pdata.hitpoints <= 0) game_over = true;
hybrid::in_actual([&] {
cell *c = hybrid::get_where(vctr).first;
gen_particles(16, c, ads_inverse(current * vctrV) * spin(ang*degree), rsrc_color[rtHull], 0.5);
});
}
void handle_crashes() {