From a49093259c92fa7c6202f7b51a3889ff5c81a3a1 Mon Sep 17 00:00:00 2001 From: snsd0805 Date: Sun, 10 Jan 2021 07:42:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=E6=9D=BF=E5=AD=90?= =?UTF-8?q?=E5=8F=8D=E5=BD=88=20&=20feat:=20=E6=96=B0=E5=A2=9E=E6=9C=80?= =?UTF-8?q?=E4=B8=8B=E5=B1=A4=E7=A3=9A=E5=A1=8A=E7=A2=B0=E6=92=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FPGA_FINAL.v | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/FPGA_FINAL.v b/FPGA_FINAL.v index 88249b5..e1a431a 100644 --- a/FPGA_FINAL.v +++ b/FPGA_FINAL.v @@ -52,6 +52,9 @@ module FPGA_FINAL( if(reset) begin + blockFirst = 8'b11111111; + blockSecond = 8'b11111111; + plat_position <= 3'b010; // 預設在 x=2 的位置 ball_position <= 3'b011; // 預設在 x=3 的位置 ball_y_position <= 3'b010; // 預設在 y=1 的位置 @@ -154,15 +157,15 @@ module FPGA_FINAL( else if(ball_position==plat_position-1 && horizonPosition==1) begin horizonPosition = -1; - //ball_position <= ball_position+1; - // ball_y_position <= ball_y_position-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; + ball_position <= ball_position+1; + ball_y_position <= ball_y_position+1; upPosition = 1; end else @@ -170,7 +173,27 @@ module FPGA_FINAL( horizonPosition = 0; ball_y_position <= ball_y_position-1; end - // 判斷特殊狀態 + + + + + // // 判斷特殊狀態 + if(ball_y_position==6) + if(blockSecond[ball_position]==1) + begin + blockSecond[ball_position] = 0; + + if(upPosition) upPosition = 0; + else upPosition = 1; + + if(ball_position==0) horizonPosition = 1; + if(ball_position==7) horizonPosition = -1; + + ball_position <= ball_position + horizonPosition; + if(upPosition) ball_y_position <= ball_y_position +1; + else ball_y_position <= ball_y_position -1; + end + end end end