diff --git a/physics_engine.vhd b/physics_engine.vhd index 821e991..faf1b29 100644 --- a/physics_engine.vhd +++ b/physics_engine.vhd @@ -301,18 +301,17 @@ begin c_top := py - SIZE11; c_bot := py + SIZE11; - -- Swept horizontal overlap: union of prev and new extents along motion axis + -- Swept overlap: edge-crossing checks (prev and new extents straddle the face) if vx(9) = '0' then - x_overlap := (c_right >= OBS_L(obs_i)) and (c_prev_left <= OBS_R(obs_i)); + x_overlap := (c_right >= OBS_L(obs_i)) and (c_prev_right <= OBS_L(obs_i)); else - x_overlap := (c_prev_right >= OBS_L(obs_i)) and (c_left <= OBS_R(obs_i)); + x_overlap := (c_left <= OBS_R(obs_i)) and (c_prev_left >= OBS_R(obs_i)); end if; - -- Swept vertical overlap if vy(9) = '0' then - y_overlap := (c_bot >= OBS_T(obs_i)) and (c_prev_top <= OBS_B(obs_i)); + y_overlap := (c_bot >= OBS_T(obs_i)) and (c_prev_bot <= OBS_T(obs_i)); else - y_overlap := (c_prev_bot >= OBS_T(obs_i)) and (c_top <= OBS_B(obs_i)); + y_overlap := (c_top <= OBS_B(obs_i)) and (c_prev_top >= OBS_B(obs_i)); end if; if x_overlap and y_overlap then diff --git a/renderer.vhd b/renderer.vhd index 3d51f40..6a9aeba 100644 --- a/renderer.vhd +++ b/renderer.vhd @@ -26,8 +26,6 @@ entity renderer is char_height : in std_logic_vector(9 downto 0); cam_x : in std_logic_vector(10 downto 0); cam_y : in std_logic_vector(10 downto 0); - vel_x_in : in std_logic_vector(9 downto 0); - vel_y_in : in std_logic_vector(9 downto 0); trail_on_in : in std_logic; red : out std_logic; green : out std_logic; @@ -48,7 +46,6 @@ architecture behavior of renderer is signal wr : std_logic_vector(10 downto 0); signal char_on, ground_on, wall_on, ceiling_on, obs_on : std_logic; - signal arrow_on : std_logic := '0'; -- disabled begin @@ -90,17 +87,12 @@ begin end process render; - -- Velocity vector arrow disabled — arrow_on held '0' by signal initializer - -- ---------------------------------------------------------------- -- Color output with priority -- ---------------------------------------------------------------- - color : process(char_on, ground_on, wall_on, ceiling_on, - obs_on, arrow_on, trail_on_in) + color : process(char_on, ground_on, wall_on, ceiling_on, obs_on, trail_on_in) begin - if arrow_on = '1' then - red <= '1'; green <= '1'; blue <= '1'; -- White - elsif char_on = '1' then + if char_on = '1' then red <= '1'; green <= '0'; blue <= '0'; -- Red elsif obs_on = '1' then red <= '1'; green <= '1'; blue <= '0'; -- Yellow diff --git a/visualizer.py b/visualizer.py index 117c8b4..e2cef85 100644 --- a/visualizer.py +++ b/visualizer.py @@ -249,13 +249,13 @@ def main(): c_top = py - SIZE; c_bot = py + SIZE if to_signed(vx) >= 0: - x_overlap = c_right >= ol and prev_left <= orr + x_overlap = c_right >= ol and prev_right <= ol else: - x_overlap = prev_right >= ol and c_left <= orr + x_overlap = c_left <= orr and prev_left >= orr if to_signed(vy) >= 0: - y_overlap = c_bot >= ot and prev_top <= ob + y_overlap = c_bot >= ot and prev_bot <= ot else: - y_overlap = prev_bot >= ot and c_top <= ob + y_overlap = c_top <= ob and prev_top >= ob if x_overlap and y_overlap: if prev_bot <= ot: