diff --git a/FPGA_FINAL.v b/FPGA_FINAL.v index bae23d5..2e91664 100644 --- a/FPGA_FINAL.v +++ b/FPGA_FINAL.v @@ -110,6 +110,7 @@ module FPGA_FINAL( else if(ball_y_position>1) ball_y_position <= ball_y_position-1; + // 判斷水平方向 @@ -134,7 +135,8 @@ module FPGA_FINAL( if(ball_y_position==1) if(ball_position==plat_position) begin - horizonPosition = -1; + if(horizonPosition==0) horizonPosition = -1; + else ball_y_position <= ball_y_position+1; upPosition = 1; end else if(ball_position==plat_position+1) @@ -143,8 +145,23 @@ module FPGA_FINAL( ball_y_position <= ball_y_position+1; end else if(ball_position==plat_position+2) + begin + if(horizonPosition==0) horizonPosition = 1; + else ball_y_position <= ball_y_position+1; + upPosition = 1; + end + else if(ball_position==plat_position-1 && horizonPosition==1) + begin + horizonPosition = -1; + //ball_position <= ball_position+1; + // ball_y_position <= ball_y_position-1; + upPosition = 1; + end + else if(ball_position==plat_position+3 && horizonPosition==-1) begin horizonPosition = 1; + //ball_position <= ball_position-1; + // ball_y_position <= ball_y_position-1; upPosition = 1; end else