-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathball.vhd
899 lines (828 loc) · 35.9 KB
/
ball.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
---------------------------------------------------------------------------
---------------------------------------------------------------------------
-- Ball.vhd --
-- Viral Mehta --
-- Spring 2005 --
-- --
-- Modified by Stephen Kempf 03-01-2006 --
-- 03-12-2007 --
-- Fall 2012 Distribution --
-- --
-- For use with ECE 385 Lab 9 --
-- UIUC ECE Department --
---------------------------------------------------------------------------
---------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ball is
Port ( Reset : in std_logic;
frame_clk : in std_logic;
U : in std_logic;
D : in std_logic;
L : in std_logic;
R : in std_logic;
atk : in std_logic;
Ball_X_posi, Ball_Y_posi: in std_logic_vector(9 downto 0);
BallX : out std_logic_vector(9 downto 0);
BallY : out std_logic_vector(9 downto 0);
BallS : out std_logic_vector(9 downto 0);
BallMaps: out std_logic_vector(1 downto 0);
Enemy1 : out std_logic_vector(25 downto 0);
Enemy2 : out std_logic_vector(25 downto 0);
Enemy3 : out std_logic_vector(25 downto 0));
end ball;
--Enemy XPosition(10 bits) YPosition(10 bits) Health(2 bits) Enemy Type(4 bits)
--Enemy type is just the block type for blocks 7,8,9
architecture Behavioral of ball is
--Define initial status for Enemies
signal Map1En1_X, Map1En1_Y : std_logic_vector(9 downto 0);
signal Map1En1_Health : std_logic_vector(1 downto 0) := "01";
signal Map1En1_Type : std_logic_vector(3 downto 0);
signal Map1En2_X, Map1En2_Y : std_logic_vector(9 downto 0);
signal Map1En2_Health : std_logic_vector(1 downto 0) := "10";
signal Map1En2_Type : std_logic_vector(3 downto 0) := "1000";
signal Map1En3_X, Map1En3_Y : std_logic_vector(9 downto 0);
signal Map1En3_Health : std_logic_vector(1 downto 0) := "01";
signal Map1En3_Type : std_logic_vector(3 downto 0) := "1001";
signal Map2En1_X, Map2En1_Y : std_logic_vector(9 downto 0);
signal Map2En1_Health : std_logic_vector(1 downto 0) := "01";
signal Map2En1_Type : std_logic_vector(3 downto 0) := "0111";
signal Map2En2_X, Map2En2_Y : std_logic_vector(9 downto 0);
signal Map2En2_Health : std_logic_vector(1 downto 0) := "01";
signal Map2En2_Type : std_logic_vector(3 downto 0) := "1000";
signal Map2En3_X, Map2En3_Y : std_logic_vector(9 downto 0);
signal Map2En3_Health : std_logic_vector(1 downto 0) := "01";
signal Map2En3_Type : std_logic_vector(3 downto 0) := "1001";
signal Map3En1_X, Map3En1_Y : std_logic_vector(9 downto 0);
signal Map3En1_Health : std_logic_vector(1 downto 0) := "01";
signal Map3En1_Type : std_logic_vector(3 downto 0) := "0111";
signal Map3En2_X, Map3En2_Y : std_logic_vector(9 downto 0);
signal Map3En2_Health : std_logic_vector(1 downto 0) := "01";
signal Map3En2_Type : std_logic_vector(3 downto 0) := "1000";
signal Map3En3_X, Map3En3_Y : std_logic_vector(9 downto 0);
signal Map3En3_Health : std_logic_vector(1 downto 0) := "01";
signal Map3En3_Type : std_logic_vector(3 downto 0) := "1001";
signal Map4En1_X, Map4En1_Y : std_logic_vector(9 downto 0);
signal Map4En1_Health : std_logic_vector(1 downto 0) := "01";
signal Map4En1_Type : std_logic_vector(3 downto 0) := "0111";
signal Map4En2_X, Map4En2_Y : std_logic_vector(9 downto 0);
signal Map4En2_Health : std_logic_vector(1 downto 0) := "01";
signal Map4En2_Type : std_logic_vector(3 downto 0) := "1000";
signal Map4En3_X, Map4En3_Y : std_logic_vector(9 downto 0);
signal Map4En3_Health : std_logic_vector(1 downto 0) := "01";
signal Map4En3_Type : std_logic_vector(3 downto 0) := "1001";
signal Ball_X_pos, Ball_X_motion, Ball_Y_pos, Ball_Y_motion : std_logic_vector(9 downto 0);
signal sleft, sright, sup, sdown : std_logic;
signal maps : std_logic_vector(1 downto 0);
signal Ball_Size : std_logic_vector(9 downto 0);
type int_array is array (integer range <>) of integer;
--Map Arrays that hold what type of block goes into each section.
--Size of 32 by 32
--This translates out to 640 by 480
signal map0 :int_array(0 to 299):=(
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
signal Ball_X_Max2,Ball_Y_Max2,Ball_X_Min2,Ball_Y_Min2 : std_logic_vector(9 downto 0);
--signal frame_clk_div : std_logic_vector(5 downto 0);
--Enemy 1 must be of block type 7
--Enemy 2 must be of block type 8
--Enemy 3 must be of block type 9
--The Enemy's Starting coordinates are the same as the coordinates as where they are drawn on the 15x20 map
--So for Map 1, Enemy 1's X and Y must be the same coordinates as Block type 7 on map 1
constant M1E1_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(9*32, 10);
constant M1E1_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(2*32, 10);
constant M1E2_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(16*32, 10);
constant M1E2_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(8*32, 10);
constant M1E3_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(11*32, 10);
constant M1E3_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(13*32, 10);
constant M2E1_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(3*32, 10);
constant M2E1_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(2*32, 10);
constant M2E2_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(17*32, 10);
constant M2E2_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(2*32, 10);
constant M2E3_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(2*32, 10);
constant M2E3_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(12*32, 10);
constant M3E1_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(17*32, 10);
constant M3E1_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(11*32, 10);
constant M3E2_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(3*32, 10);
constant M3E2_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(11*32, 10);
constant M3E3_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(18*32, 10);
constant M3E3_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(1*32, 10);
constant M4E1_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(17*32, 10);
constant M4E1_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(1*32, 10);
constant M4E2_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(5*32, 10);
constant M4E2_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(10*32, 10);
constant M4E3_X : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(3*32, 10);
constant M4E3_Y : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(4*32, 10);
constant Ball_X_Center : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(320, 10); --Center position on the X axis
constant Ball_Y_Center : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(240, 10); --Center position on the Y axis
constant Ball_X_Min : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(0, 10); --Leftmost point on the X axis
constant Ball_X_Max : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(639, 10); --Rightmost point on the X axis
constant Ball_Y_Min : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(0, 10); --Topmost point on the Y axis
constant Ball_Y_Max : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(479, 10); --Bottommost point on the Y axis
constant Ball_X_Step : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(2, 10); --Step size on the X axis
constant Ball_Y_Step : std_logic_vector(9 downto 0) := CONV_STD_LOGIC_VECTOR(2, 10); --Step size on the Y axis
begin
Ball_Size <= CONV_STD_LOGIC_VECTOR(32, 10); -- assigns the value 4 as a 10-digit binary number, ie "0000000100"
Move_Ball: process(Reset, frame_clk, Ball_Size, U ,D, L, R)
--Temporary variables used to keep track of some calculated position
variable tempX, tempY: std_logic_vector(9 downto 0);
variable xcoord, ycoord, values, value2, value3:integer;
variable blocktype1, blocktype2, blocktype3: std_logic_vector(3 downto 0);
variable stop : std_logic := '0';
--Direction is determined by what the last key input was. IE if the user press 'W' last, the last direction was up.
--dir key translated
--UP 'W' 00
--DOWN 'S' 01
--LEFT 'A' 10
--RIGHT 'D' 11
variable dir : std_logic_vector(1 downto 0);
begin
blocktype1 := "0001";
blocktype2 := "0001";
if(Reset = '1') then --Asynchronous Reset
--Reset positions and status of all ememies and characters.
Ball_Y_Motion <= "0000000000";
Ball_X_Motion <= "0000000000";
Ball_Y_Pos <= Ball_Y_Center;
Ball_X_pos <= Ball_X_Center;
sleft <= '0';
sright <= '0';
sup <= '0';
sdown <= '0';
maps <= "00";
Map1En1_X <= M1E1_X;
Map1En1_Y <= M1E1_Y;
Map1En2_X <= M1E2_X;
Map1En2_Y <= M1E2_Y;
Map1En3_X <= M1E3_X;
Map1En3_Y <= M1E3_Y;
Map2En1_X <= M2E1_X;
Map2En1_Y <= M2E1_Y;
Map2En2_X <= M2E2_X;
Map2En2_Y <= M2E2_Y;
Map2En3_X <= M2E3_X;
Map2En3_Y <= M2E3_Y;
Map3En1_X <= M3E1_X;
Map3En1_Y <= M3E1_Y;
Map3En2_X <= M3E2_X;
Map3En2_Y <= M3E2_Y;
Map3En3_X <= M3E3_X;
Map3En3_Y <= M3E3_Y;
Map1En1_Health <= "01";
Map1En2_Health <= "01";
Map1En3_Health <= "01";
Map2En1_Health <= "01";
Map2En2_Health <= "01";
Map2En3_Health <= "01";
Map3En1_Health <= "01";
Map3En2_Health <= "01";
Map3En3_Health <= "01";
--Define how the ball moves with certain inputs
elsif(rising_edge(frame_clk)) then
case maps is
-- when "00" =>
-- Ball_X_Max2 <= Ball_X_Max;
-- Ball_Y_Max2 <= Ball_Y_Max;
-- Ball_X_Min2 <= Ball_X_Min + "0000100000";
-- Ball_Y_Min2 <= Ball_Y_Min + "0000100000";
-- when "01" =>
-- Ball_X_Max2 <= Ball_X_Max - "0000100000";
-- Ball_Y_Max2 <= Ball_Y_Max;
-- Ball_X_Min2 <= Ball_X_Min;
-- Ball_Y_Min2 <= Ball_Y_Min + "0000100000";
-- when "10" =>
-- Ball_X_Max2 <= Ball_X_Max;
-- Ball_Y_Max2 <= Ball_Y_Max - "0000100000";
-- Ball_X_Min2 <= Ball_X_Min;
-- Ball_Y_Min2 <= Ball_Y_Min + "0000100000";
-- when "11" =>
-- Ball_X_Max2 <= Ball_X_Max - "0000100000";
-- Ball_Y_Max2 <= Ball_Y_Max - "0000100000";
-- Ball_X_Min2 <= Ball_X_Min;
-- Ball_Y_Min2 <= Ball_Y_Min;
when others =>
Ball_X_Max2 <= Ball_X_Max;
Ball_Y_Max2 <= Ball_Y_Max;
Ball_X_Min2 <= Ball_X_Min;
Ball_Y_Min2 <= Ball_Y_Min;
end case;
if(Ball_Y_Pos + Ball_Size >= Ball_Y_Max2) then -- Ball is at the bottom edge, BOUNCE!
Ball_Y_Motion <= not(Ball_Y_Step) +'1'; --2's complement.
Ball_X_Motion <= "0000000000";
if(maps = "00" OR maps = "01") then -- If you are at top left map or top right map and you hit the bottom of the map, shift down to the next map
sdown <='1';
end if;
elsif(Ball_Y_Pos - '1' = Ball_Y_Min2) then -- Ball is at the top edge, BOUNCE!
Ball_Y_Motion <= Ball_Y_Step;
Ball_X_Motion <= "0000000000";
if(maps = "10" OR maps = "11") then -- If you are at bottom left map or bottom right map and you hit the topof the map, shift up to the next map
sup <= '1';
end if;
elsif (Ball_X_Pos + Ball_Size >= Ball_X_Max2) then -- Ball is at the right edge, BOUNCE!
--Ball_X_Motion <= not(Ball_X_Step) + '1'; --2's complement.
Ball_Y_Motion <= "0000000000";
if(maps = "00" OR maps = "10") then -- If you are at top left map or bottom left map and you hit the bottom of the map, shift right to the next map
sright <= '1';
end if;
elsif(Ball_X_Pos - '1' = Ball_X_Min2) then -- Ball is at the left edge, BOUNCE!
Ball_X_Motion <= Ball_X_Step;
Ball_Y_Motion <= "0000000000";
if(maps = "01" OR maps = "11") then -- If you are at top right map or bottom right map and you hit the bottom of the map, shift leftto the next map
sleft <= '1';
end if;
elsif(U = '1') then --If key press is '1', move up 1 pixel
Ball_Y_Motion <= not(Ball_Y_Step)+ '1';
Ball_X_Motion <= "0000000000";
dir := "00"; --set looking direction to up
elsif(D = '1') then --If key press is '1', move down 1 pixel
Ball_Y_Motion <= Ball_Y_Step;
Ball_X_Motion <= "0000000000";
dir := "01"; --set looking direction to down
elsif(R = '1') then --If key press is '1', move right 1 pixel
Ball_X_Motion <= Ball_X_Step;
Ball_Y_Motion <= "0000000000";
dir := "10"; --set looking direction to right
elsif(L = '1') then --If key press is '1', move left 1 pixel
Ball_X_Motion <= not(Ball_X_Step) + 1;
Ball_Y_Motion <= "0000000000";
dir := "11"; --set looking direction to left
else
Ball_Y_Motion <= "0000000000"; -- Ball is somewhere, no movement
Ball_X_Motion <= "0000000000"; -- Ball is somewhere, no movement
end if;
-- Ball_X_Motion <= Ball_X_Motion; -- You need to remove this and make both X and Y respond to keyboard input
--This Large if statement is used to determine if the next block up is a block that you can walk through depending on user inputed direction
if(U = '1') then
tempX := Ball_X_pos(9 downto 5) & "00100"; --Takes in the X position of the User
xcoord := conv_integer(unsigned(tempX))/32; --And converts it into a integer value to enter into the map array
tempY := Ball_Y_pos(9 downto 5) & "00100"; --Takes in the y position of the User
ycoord := conv_integer(unsigned(tempY))/32; --And converts it into an integer value to enter into the map array
values := ycoord*20+xcoord;
tempX := Ball_X_pos(9 downto 5) & "00100" + "100000"; --Takes in the opposite corner of the User position
--This is done to prevent the block to go through another block because the origin is on the top left instead of the middle
xcoord := conv_integer(unsigned(tempX))/32;
value2 := ycoord*20+xcoord;
if(xcoord < 20 AND ycoord < 15) then
--Finds the Block type at that X,Y coordinate
case maps is
when "00" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map0(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map0(value2), 4);
when "01" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map1(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map1(value2), 4);
when "10" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map2(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map2(value2), 4);
when "11" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map3(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map3(value2), 4);
when others=>
blocktype1 := "0001";
blocktype2 := "0001";
end case;
end if;
--if the block type is passable, do nothing
case blocktype1 is
when "0001" =>
when "0100" =>
when others =>
stop := '1'; --if not stop movement.
end case;
case blocktype2 is
when "0001" =>
when "0100" =>
when others =>
stop := '1'; -- This case prevents block glitches due to position of origin
end case;
elsif(D = '1') then --Same as before
tempX := Ball_X_pos(9 downto 5) & "00100";
xcoord := conv_integer(unsigned(tempX))/32;
tempY := Ball_Y_pos(9 downto 5) & "00100" + "100000";
ycoord := conv_integer(unsigned(tempY))/32;
values := ycoord*20+xcoord;
tempX := Ball_X_pos(9 downto 5) & "00100" + "100000";
xcoord := conv_integer(unsigned(tempX))/32;
value2 := ycoord*20+xcoord;
if(xcoord < 20 AND ycoord < 15) then
case maps is
when "00" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map0(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map0(value2), 4);
when "01" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map1(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map1(value2), 4);
when "10" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map2(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map2(value2), 4);
when "11" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map3(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map3(value2), 4);
when others=>
blocktype1 := "0001";
blocktype2 := "0001";
end case;
end if;
case blocktype1 is
when "0001" =>
when "0100" =>
when others =>
stop := '1';
end case;
case blocktype2 is
when "0001" =>
when "0100" =>
when others =>
stop := '1';
end case;
elsif(R = '1') then--Same as before
tempX := Ball_X_pos(9 downto 5) & "00100" + "100000";
xcoord := conv_integer(unsigned(tempX))/32;
tempY := Ball_Y_pos(9 downto 5) & "00100";
ycoord := conv_integer(unsigned(tempY))/32;
values := ycoord*20+xcoord;
tempY := Ball_Y_pos(9 downto 5) & "00100" + "100000";
ycoord := conv_integer(unsigned(tempY))/32;
value2 := ycoord*20+xcoord;
if(xcoord < 20 AND ycoord < 15) then
case maps is
when "00" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map0(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map0(value2), 4);
when "01" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map1(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map1(value2), 4);
when "10" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map2(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map2(value2), 4);
when "11" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map3(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map3(value2), 4);
when others=>
blocktype1 := "0001";
blocktype2 := "0001";
end case;
end if;
case blocktype1 is
when "0001" =>
when "0100" =>
when others =>
stop := '1';
end case;
case blocktype2 is
when "0001" =>
when "0100" =>
when others =>
stop := '1';
end case;
elsif(L = '1') then--Same as before
tempX := Ball_X_pos(9 downto 5) & "00100";
xcoord := conv_integer(unsigned(tempX))/32;
tempY := Ball_Y_pos(9 downto 5) & "00100";
ycoord := conv_integer(unsigned(tempY))/32;
values := ycoord*20+xcoord;
tempY := Ball_Y_pos(9 downto 5) & "00100" + "100000";
ycoord := conv_integer(unsigned(tempY))/32;
value2 := ycoord*20+xcoord;
if(xcoord < 20 AND ycoord < 15) then
case maps is
when "00" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map0(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map0(value2), 4);
when "01" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map1(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map1(value2), 4);
when "10" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map2(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map2(value2), 4);
when "11" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map3(values), 4);
blocktype2 := CONV_STD_LOGIC_VECTOR(map3(value2), 4);
when others=>
blocktype1 := "0001";
blocktype2 := "0001";
end case;
end if;
case blocktype1 is
when "0001" =>
when "0100" =>
when others =>
stop := '1';
end case;
case blocktype2 is
when "0001" =>
when "0100" =>
when others =>
stop := '1';
end case;
end if;
if(stop = '1') then
stop := '0';
Ball_X_Motion <= "0000000000";
Ball_Y_Motion <= "0000000000";
end if;
if(atk = '1') then --Checks if user is attacking
--Checks for different directions of attack
case dir is
when "00" => --UP
--checks the block straight ahead of the block the user is currently at.
tempX := Ball_X_pos(9 downto 5) & "00100" + "100000";
xcoord := conv_integer(unsigned(tempX))/32;
tempY := Ball_Y_pos(9 downto 5) & "10000";
ycoord := conv_integer(unsigned(tempY))/32;
values := ycoord*20+xcoord;
if(xcoord < 20 AND ycoord < 15) then
case maps is
when "00" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map0(values), 4);
when "01" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map1(values), 4);
when "10" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map2(values), 4);
when "11" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map3(values), 4);
when others=>
blocktype1 := "0001";
blocktype2 := "0001";
end case;
end if;
case blocktype1 is
--If the user hits a block that is a enemy( block 7,8,9) then the enemy will take a point of damage depending on which map the enemy is on.
when "0111" =>
case maps is
when "00" =>
Map1En1_Health <= Map1En1_Health - '1';
when "01" =>
Map2En1_Health <= Map2En1_Health - '1';
when "10" =>
Map3En1_Health <= Map3En1_Health - '1';
when "11" =>
Map4En1_Health <= Map3En1_Health - '1';
end case;
when "1000" =>
case maps is
when "00" =>
Map1En2_Health <= Map1En2_Health - '1';
when "01" =>
Map2En2_Health <= Map2En2_Health - '1';
when "10" =>
Map3En2_Health <= Map3En2_Health - '1';
when "11" =>
Map4En2_Health <= Map3En2_Health - '1';
end case;
when "1001" =>
case maps is
when "00" =>
Map1En3_Health <= Map1En3_Health - '1';
when "01" =>
Map2En3_Health <= Map2En3_Health - '1';
when "10" =>
Map3En3_Health <= Map3En3_Health - '1';
when "11" =>
Map4En3_Health <= Map3En3_Health - '1';
end case;
when others =>
end case;
when "01" => -- DOWN
tempX := Ball_X_pos(9 downto 5) & "10000" ;
xcoord := conv_integer(unsigned(tempX))/32;
tempY := Ball_Y_pos(9 downto 5) & "00100" + "100000";
ycoord := conv_integer(unsigned(tempY))/32;
values := ycoord*20+xcoord;
if(xcoord < 20 AND ycoord < 15) then
case maps is
when "00" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map0(values), 4);
when "01" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map1(values), 4);
when "10" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map2(values), 4);
when "11" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map3(values), 4);
when others=>
blocktype1 := "0001";
blocktype2 := "0001";
end case;
end if;
case blocktype1 is
when "0111" =>
case maps is
when "00" =>
Map1En1_Health <= Map1En1_Health - '1';
when "01" =>
Map2En1_Health <= Map2En1_Health - '1';
when "10" =>
Map3En1_Health <= Map3En1_Health - '1';
when "11" =>
Map4En1_Health <= Map3En1_Health - '1';
end case;
when "1000" =>
case maps is
when "00" =>
Map1En2_Health <= Map1En2_Health - '1';
when "01" =>
Map2En2_Health <= Map2En2_Health - '1';
when "10" =>
Map3En2_Health <= Map3En2_Health - '1';
when "11" =>
Map4En2_Health <= Map3En2_Health - '1';
end case;
when "1001" =>
case maps is
when "00" =>
Map1En3_Health <= Map1En3_Health - '1';
when "01" =>
Map2En3_Health <= Map2En3_Health - '1';
when "10" =>
Map3En3_Health <= Map3En3_Health - '1';
when "11" =>
Map4En3_Health <= Map3En3_Health - '1';
end case;
when others =>
end case;
when "10" => --LEFT
tempX := Ball_X_pos(9 downto 5) & "00100" ;
xcoord := conv_integer(unsigned(tempX))/32;
tempY := Ball_Y_pos(9 downto 5) & "00100" + "100000";
ycoord := conv_integer(unsigned(tempY))/32;
values := ycoord*20+xcoord;
if(xcoord < 20 AND ycoord < 15) then
case maps is
when "00" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map0(values), 4);
when "01" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map1(values), 4);
when "10" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map2(values), 4);
when "11" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map3(values), 4);
when others=>
blocktype1 := "0001";
blocktype2 := "0001";
end case;
end if;
case blocktype1 is
when "0111" =>
case maps is
when "00" =>
Map1En1_Health <= Map1En1_Health - '1';
when "01" =>
Map2En1_Health <= Map2En1_Health - '1';
when "10" =>
Map3En1_Health <= Map3En1_Health - '1';
when "11" =>
Map4En1_Health <= Map3En1_Health - '1';
end case;
when "1000" =>
case maps is
when "00" =>
Map1En2_Health <= Map1En2_Health - '1';
when "01" =>
Map2En2_Health <= Map2En2_Health - '1';
when "10" =>
Map3En2_Health <= Map3En2_Health - '1';
when "11" =>
Map4En2_Health <= Map3En2_Health - '1';
end case;
when "1001" =>
case maps is
when "00" =>
Map1En3_Health <= Map1En3_Health - '1';
when "01" =>
Map2En3_Health <= Map2En3_Health - '1';
when "10" =>
Map3En3_Health <= Map3En3_Health - '1';
when "11" =>
Map4En3_Health <= Map3En3_Health - '1';
end case;
when others =>
end case;
when "11" => --RIGHT
tempX := Ball_X_pos(9 downto 5) & "00100" + "10000";
xcoord := conv_integer(unsigned(tempX))/32;
tempY := Ball_Y_pos(9 downto 5) & "00100";
ycoord := conv_integer(unsigned(tempY))/32;
values := ycoord*20+xcoord;
if(xcoord < 20 AND ycoord < 15) then
case maps is
when "00" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map0(values), 4);
when "01" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map1(values), 4);
when "10" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map2(values), 4);
when "11" =>
blocktype1 := CONV_STD_LOGIC_VECTOR(map3(values), 4);
when others=>
blocktype1 := "0001";
blocktype2 := "0001";
end case;
end if;
case blocktype1 is
when "0111" =>
case maps is
when "00" =>
Map1En1_Health <= Map1En1_Health - '1';
when "01" =>
Map2En1_Health <= Map2En1_Health - '1';
when "10" =>
Map3En1_Health <= Map3En1_Health - '1';
when "11" =>
Map4En1_Health <= Map3En1_Health - '1';
end case;
when "1000" =>
case maps is
when "00" =>
Map1En2_Health <= Map1En2_Health - '1';
when "01" =>
Map2En2_Health <= Map2En2_Health - '1';
when "10" =>
Map3En2_Health <= Map3En2_Health - '1';
when "11" =>
Map4En2_Health <= Map3En2_Health - '1';
end case;
when "1001" =>
case maps is
when "00" =>
Map1En3_Health <= Map1En3_Health - '1';
when "01" =>
Map2En3_Health <= Map2En3_Health - '1';
when "10" =>
Map3En3_Health <= Map3En3_Health - '1';
when "11" =>
Map4En3_Health <= Map3En3_Health - '1';
end case;
when others =>
end case;
end case;
end if;
Ball_Y_pos <= Ball_Y_pos + Ball_Y_Motion; -- Update ball position
Ball_X_pos <= Ball_X_pos + Ball_X_Motion;
--If the user was at a border of the map and the border was passable into another map, logic to deal with that done here
if(sdown = '1') then
if(maps = "00") then
maps <= "10"; --From map 1 to map3
else
maps <= "11"; --From map 2 to map4
end if;
Ball_Y_pos <= "0000100100"; --Set the User's Y position such that when the user crosses, he will end up being drawn at the top of the map instead of the bottom
--which makes sense since he went from top to bottom
sdown <= '0'; -- turn of map shifting
elsif(sup = '1') then --same as before
if(maps = "10") then
maps <= "00";
else
maps <= "01";
end if;
Ball_Y_pos <= (Ball_Y_Max2 - "0000000010") - Ball_Size; -- Sets position from top of map to bottom
sup <= '0';
elsif(sright = '1') then--same as before
if(maps = "00") then
maps <= "01";
else
maps <= "11";
end if;
Ball_X_pos <= "0000100100"; --set from right side of map to the left
sright <= '0';
elsif(sleft = '1') then--same as before
if(maps = "01") then
maps <= "00";
else
maps <= "10";
end if;
Ball_X_pos <= (Ball_X_Max2 - "0000000010") - Ball_Size; --set from left side of map to the right
sleft <= '0';
end if;
--******************************************
--ATTENTION! Please answer the following quesiton in your lab report!
-- Note that Ball_Y_Motion in the above statement may have been changed at the same clock edge
-- that is causing the assignment of Ball_Y_pos. Will the new value of Ball_Y_Motion be used,
-- or the old? How will this impact behavior of the ball during a bounce, and how might that
-- interact with a response to a keypress? Can you fix it? Give an answer in your postlab.
--******************************************
case maps is
-- Output correct enemy depending on what the which map you are at
when "00" =>
Enemy1(25 downto 16) <= Map1En1_X;
Enemy1(15 downto 6) <= Map1En1_Y;
Enemy1(5 downto 4) <= Map1En1_Health;
Enemy1(3 downto 0) <= Map1En1_Type;
Enemy2(25 downto 16) <= Map1En2_X;
Enemy2(15 downto 6) <= Map1En2_Y;
Enemy2(5 downto 4) <= Map1En2_Health;
Enemy2(3 downto 0) <= Map1En2_Type;
Enemy3(25 downto 16) <= Map1En3_X;
Enemy3(15 downto 6) <= Map1En3_Y;
Enemy3(5 downto 4) <= Map1En3_Health;
Enemy3(3 downto 0) <= Map1En3_Type;
when "01" =>
Enemy1(25 downto 16) <= Map2En1_X;
Enemy1(15 downto 6) <= Map2En1_Y;
Enemy1(5 downto 4) <= Map2En1_Health;
Enemy1(3 downto 0) <= Map2En1_Type;
Enemy2(25 downto 16) <= Map2En2_X;
Enemy2(15 downto 6) <= Map2En2_Y;
Enemy2(5 downto 4) <= Map2En2_Health;
Enemy2(3 downto 0) <= Map2En2_Type;
Enemy3(25 downto 16) <= Map2En3_X;
Enemy3(15 downto 6) <= Map2En3_Y;
Enemy3(5 downto 4) <= Map2En3_Health;
Enemy3(3 downto 0) <= Map2En3_Type;
when "10" =>
Enemy1(25 downto 16) <= Map3En1_X;
Enemy1(15 downto 6) <= Map3En1_Y;
Enemy1(5 downto 4) <= Map3En1_Health;
Enemy1(3 downto 0) <= Map3En1_Type;
Enemy2(25 downto 16) <= Map3En2_X;
Enemy2(15 downto 6) <= Map3En2_Y;
Enemy2(5 downto 4) <= Map3En2_Health;
Enemy2(3 downto 0) <= Map3En2_Type;
Enemy3(25 downto 16) <= Map3En3_X;
Enemy3(15 downto 6) <= Map3En3_Y;
Enemy3(5 downto 4) <= Map3En3_Health;
Enemy3(3 downto 0) <= Map3En3_Type;
when "11" =>
Enemy1(25 downto 16) <= Map4En1_X;
Enemy1(15 downto 6) <= Map4En1_Y;
Enemy1(5 downto 4) <= Map4En1_Health;
Enemy1(3 downto 0) <= Map4En1_Type;
Enemy2(25 downto 16) <= Map4En2_X;
Enemy2(15 downto 6) <= Map4En2_Y;
Enemy2(5 downto 4) <= Map4En2_Health;
Enemy2(3 downto 0) <= Map4En2_Type;
Enemy3(25 downto 16) <= Map4En3_X;
Enemy3(15 downto 6) <= Map4En3_Y;
Enemy3(5 downto 4) <= Map4En3_Health;
Enemy3(3 downto 0) <= Map4En3_Type;
end case;
end if;
end process Move_Ball;
--Set outputs for the user
BallMaps <= maps;
BallX <= Ball_X_Pos;
BallY <= Ball_Y_Pos;
BallS <= Ball_Size;
end Behavioral;