From efd6c90400a0b14a6e93c044b9afc4ebf5575cd8 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 29 Jul 2025 17:59:14 +0200 Subject: [PATCH] bouncy blocks from above, left, and right --- rogueviz/ru/entity.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rogueviz/ru/entity.cpp b/rogueviz/ru/entity.cpp index ea453a2b..56b393bd 100644 --- a/rogueviz/ru/entity.cpp +++ b/rogueviz/ru/entity.cpp @@ -105,7 +105,7 @@ void entity::apply_walls() { for(int x = obb.minx; x < obb.maxx; x++) for(int y = obb.maxy; y < jbb.maxy; y++) { eWall b = current_room->at(x, y); if(walls[b].flags & blocking) { - if(walls[b].flags & W_BOUNCY) { vel.y = -vel.y; on_bounce = true; goto again; } + if(walls[b].flags & W_BOUNCY) { vel.y = -vel.y; apply_grav(); apply_grav(); if(vel.y > 0) vel.y = 0; on_bounce = true; goto again; } on_floor = true; if(walls[b].flags & W_FROZEN) on_ice = true; vel.y /= 2; @@ -132,6 +132,7 @@ void entity::apply_walls() { for(int x = obb.minx; x < obb.maxx; x++) for(int y = jbb.miny; y < obb.miny; y++) { eWall b = current_room->at(x, y); if(walls[b].flags & W_BLOCK) { + if(walls[b].flags & W_BOUNCY) { vel.y = -vel.y; apply_grav(); apply_grav(); on_bounce = true; goto again; } vel.y /= 2; if(abs(vel.y) < 1e-6) vel.y = 0; if(pixel_to_block(get_pixel_bbox_at(where + vel)).miny > y) where.y += vel.y; @@ -154,6 +155,7 @@ void entity::apply_walls() { for(int x = obb.maxx; x < jbb.maxx; x++) for(int y = jbb.miny; y < jbb.maxy; y++) { eWall b = current_room->at(x, y); if(walls[b].flags & W_BLOCK) { + if(walls[b].flags & W_BOUNCY) { vel.x = -vel.x; on_bounce = true; goto again; } if(freezing()) { hit_wall(); } if(burning()) { if(b == wWoodWall) current_room->replace_block_frev(x, y, wAir); @@ -169,6 +171,7 @@ void entity::apply_walls() { for(int x = jbb.minx; x < obb.minx; x++) for(int y = jbb.miny; y < jbb.maxy; y++) { eWall b = current_room->at(x, y); if(walls[b].flags & W_BLOCK) { + if(walls[b].flags & W_BOUNCY) { vel.x = -vel.x; on_bounce = true; goto again; } if(freezing()) { hit_wall(); } if(burning()) { if(b == wWoodWall) current_room->replace_block_frev(x, y, wAir);