tangled
alpha
login
or
join now
dunkirk.sh
/
flea
1
fork
atom
bouncy fpga game
www.youtube.com/watch?v=IiLWF3GbV7w
1
fork
atom
overview
issues
pulls
pipelines
bug: vector overflow on width
dunkirk.sh
3 weeks ago
6a4219d3
f17b4db2
verified
This commit was signed with the committer's
known signature
.
dunkirk.sh
SSH Key Fingerprint:
SHA256:DqcG0RXYExE26KiWo3VxJnsxswN1QNfTBvB+bdSpk80=
+10
-9
2 changed files
expand all
collapse all
unified
split
physics_engine.vhd
visualizer.py
+5
-4
physics_engine.vhd
reviewed
···
192
192
end if;
193
193
194
194
-- == LEFT WALL ==
195
195
-
if px(9) = '1' or px <= LEFT_WALL then
196
196
-
px := LEFT_WALL;
195
195
+
-- Detect underflow: moving left (vx negative) but px wrapped to > pos_x
196
196
+
if (vx(9) = '1' and px > pos_x) or px <= LEFT_WALL + SIZE then
197
197
+
px := LEFT_WALL + SIZE;
197
198
bounced := '1'; bounce_wall := '1';
198
199
bounce_speed := (not vx) + 1;
199
200
vx := (not vx) + 1;
···
203
204
end if;
204
205
205
206
-- == RIGHT WALL ==
206
206
-
if px >= RIGHT_WALL then
207
207
-
px := RIGHT_WALL;
207
207
+
if px >= RIGHT_WALL - SIZE then
208
208
+
px := RIGHT_WALL - SIZE;
208
209
bounced := '1'; bounce_wall := '1';
209
210
bounce_speed := vx;
210
211
vx := (not vx) + 1;
+5
-5
visualizer.py
reviewed
···
32
32
GROUND = 440
33
33
CEILING = 16
34
34
LEFT_WALL = 8
35
35
-
RIGHT_WALL = 620
35
35
+
RIGHT_WALL = 631
36
36
GROUND_TOP = 448
37
37
CEIL_BOT = 8
38
38
···
215
215
vy = to_unsigned(svy)
216
216
217
217
# --- Left wall bounce ---
218
218
-
if px <= LEFT_WALL:
219
219
-
px = LEFT_WALL
218
218
+
if px <= LEFT_WALL + SIZE:
219
219
+
px = LEFT_WALL + SIZE
220
220
bounced = True; bounce_wall = True
221
221
bounce_speed = abs(to_signed(vx))
222
222
vx = negate(vx)
···
226
226
vx = to_unsigned(svx)
227
227
228
228
# --- Right wall bounce ---
229
229
-
if px >= RIGHT_WALL:
230
230
-
px = RIGHT_WALL
229
229
+
if px >= RIGHT_WALL - SIZE:
230
230
+
px = RIGHT_WALL - SIZE
231
231
bounced = True; bounce_wall = True
232
232
bounce_speed = abs(to_signed(vx))
233
233
vx = negate(vx)