1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bug: fix horizontal clipping?

+11 -11
+6 -6
physics_engine.vhd
··· 301 301 c_top := py - SIZE11; 302 302 c_bot := py + SIZE11; 303 303 304 - -- Swept overlap 304 + -- Swept overlap: strict on "was on correct side" to prevent wall sticking 305 305 if vx(9) = '0' then 306 - x_overlap := (c_right >= OBS_L(obs_i)) and (c_prev_left <= OBS_R(obs_i)); 306 + x_overlap := (c_right >= OBS_L(obs_i)) and (c_prev_left < OBS_R(obs_i)); 307 307 else 308 - x_overlap := (c_prev_right >= OBS_L(obs_i)) and (c_left <= OBS_R(obs_i)); 308 + x_overlap := (c_prev_right > OBS_L(obs_i)) and (c_left <= OBS_R(obs_i)); 309 309 end if; 310 310 311 311 -- Strict y: exclude characters at/below bottom face (down) or at/above top face (up) ··· 317 317 318 318 if x_overlap and y_overlap then 319 319 320 - if c_prev_bot <= OBS_T(obs_i) then 320 + if c_prev_bot <= OBS_T(obs_i) + SIZE11 and vy(9) = '0' then 321 321 py := OBS_T(obs_i) - SIZE11; grounded := '1'; 322 322 bounced := '1'; 323 323 vy := (not vy) + 1; ··· 339 339 vy := vy - ("000" & vy(9 downto 3)); 340 340 end if; 341 341 342 - elsif c_prev_right <= OBS_L(obs_i) then 342 + elsif c_prev_right <= OBS_L(obs_i) and vx(9) = '0' then 343 343 px := OBS_L(obs_i) - SIZE11; 344 344 bounced := '1'; bounce_wall := '1'; 345 345 vx := (not vx) + 1; ··· 349 349 vx := vx + ("000" & ((not vx(9 downto 3)) + 1)); 350 350 end if; 351 351 352 - elsif c_prev_left >= OBS_R(obs_i) then 352 + elsif c_prev_left >= OBS_R(obs_i) and vx(9) = '1' then 353 353 px := OBS_R(obs_i) + SIZE11; 354 354 bounced := '1'; bounce_wall := '1'; 355 355 vx := (not vx) + 1;
+5 -5
visualizer.py
··· 249 249 c_top = py - SIZE; c_bot = py + SIZE 250 250 251 251 if to_signed(vx) >= 0: 252 - x_overlap = c_right >= ol and prev_left <= orr 252 + x_overlap = c_right >= ol and prev_left < orr 253 253 else: 254 - x_overlap = prev_right >= ol and c_left <= orr 254 + x_overlap = prev_right > ol and c_left <= orr 255 255 if to_signed(vy) >= 0: 256 256 y_overlap = c_bot >= ot and prev_top < ob 257 257 else: 258 258 y_overlap = prev_bot > ot and c_top <= ob 259 259 260 260 if x_overlap and y_overlap: 261 - if prev_bot <= ot: 261 + if prev_bot <= ot + SIZE and to_signed(vy) >= 0: 262 262 py = ot - SIZE; grounded = True 263 263 bounced = True 264 264 bounce_speed = abs(to_signed(vy)) ··· 277 277 if svy > 1: 278 278 svy -= svy >> BOUNCE_SHIFT 279 279 vy = to_unsigned(svy) 280 - elif prev_right <= ol: 280 + elif prev_right <= ol and to_signed(vx) >= 0: 281 281 px = ol - SIZE 282 282 bounced = True; bounce_wall = True 283 283 bounce_speed = abs(to_signed(vx)) ··· 286 286 if svx > 1: svx -= svx >> BOUNCE_SHIFT 287 287 elif svx < -1: svx += (-svx) >> BOUNCE_SHIFT 288 288 vx = to_unsigned(svx) 289 - elif prev_left >= orr: 289 + elif prev_left >= orr and to_signed(vx) < 0: 290 290 px = orr + SIZE 291 291 bounced = True; bounce_wall = True 292 292 bounce_speed = abs(to_signed(vx))