更新敌方坦克样式,增加简易ai判断

This commit is contained in:
2021-01-02 13:04:34 +08:00
parent 38350c37bb
commit 720f1c75e2
60 changed files with 833828 additions and 51 deletions
+4 -2
View File
@@ -3,7 +3,7 @@
module tank_move(
clk, reset_n, start,
init_H, init_V,
tank_dir, tank_en, tank_move_en, moving,
tank_dir, tank_en, tank_move_en, player_enermy, moving,
tank_H, tank_V, tank_dir_feedback
);
@@ -16,6 +16,7 @@ input [ 10: 0 ] init_V;
input [ 1: 0 ] tank_dir;
input tank_en;
input tank_move_en;
input player_enermy;
output reg [ 10: 0 ] tank_H;
output reg [ 10: 0 ] tank_V;
output reg [ 2: 0 ] tank_dir_feedback;
@@ -168,12 +169,13 @@ always @( posedge clk ) begin: tank_move_logic
end
reg [ 31: 0 ] counter;
wire [ 31: 0 ] counter_num = player_enermy ? 2_500_000 : 3_000_000;
always @( posedge clk ) begin
if ( !reset_n ) begin
counter <= 0;
counter_move_en <= 0;
end
else if ( counter == 5_000_000 ) begin
else if ( counter == counter_num ) begin
counter <= 0;
counter_move_en <= 1;
end