diff --git a/game.srcs/sources_1/new/TopModule.vhd b/game.srcs/sources_1/new/TopModule.vhd index 46c98b28f597ea647e2b9f5c9bf5a4f28d570da5..4029b0d33c7b8635817b3e29edd6a1785cc531b5 100644 --- a/game.srcs/sources_1/new/TopModule.vhd +++ b/game.srcs/sources_1/new/TopModule.vhd @@ -39,7 +39,7 @@ entity TopModule is vgaBlue : out std_logic_vector(3 downto 0); vgaGreen : out std_logic_vector(3 downto 0); Hsync, Vsync : out std_logic; - led : out std_logic_vector (15 downto 0); + --led : out std_logic_vector (15 downto 0); seg : out std_logic_vector(6 downto 0); an : out std_logic_vector(7 downto 0); dp : out std_logic @@ -207,7 +207,6 @@ signal exists_go : boolean; signal collision_sig : boolean; -signal collision_cnt : std_logic_vector(15 downto 0); signal soft_reset : std_logic; signal fsm_reset : std_logic; @@ -324,21 +323,24 @@ largeObstacle : obstacle_L my_new_pos => pos_new_sig, my_start_pos => 1000 ); -yetAnotherLargeObstacle : obstacle_L - Port map(clk_pixel => clk25, - btnCpuReset_o => soft_reset, - HCounter_o => hcounter_sig, - VCounter_o => vcounter_sig, - FCounter_o => fcounter_sig, - FStrobe_o => fstrobe_sig, - color_obstacle => color_obstacleL2_sig, - exists_obstacle => exists_obstacleL2_sig, - fsm_state => fsm_state, - my_pos => pos_3_sig, - my_new_pos => pos_new_sig, - my_start_pos => 1220 - ); - +--yetAnotherLargeObstacle : obstacle_L +-- Port map(clk_pixel => clk25, +-- btnCpuReset_o => soft_reset, +-- HCounter_o => hcounter_sig, +-- VCounter_o => vcounter_sig, +-- FCounter_o => fcounter_sig, +-- FStrobe_o => fstrobe_sig, +-- color_obstacle => color_obstacleL2_sig, +-- exists_obstacle => exists_obstacleL2_sig, +-- fsm_state => fsm_state, +-- my_pos => pos_3_sig, +-- my_new_pos => pos_new_sig, +-- my_start_pos => 1220 +-- ); +pos_3_sig <= 0; +exists_obstacleL2_sig <= false; +color_obstacleL2_sig <= x"FFF"; + scoreDisplay : scorekeeper port map( clk_pixel => clk25, @@ -394,16 +396,11 @@ soft_reset <= fsm_reset and btnCpuReset; process(clk25) begin if soft_reset = '0' then - collision_cnt <= x"0000"; + collision_sig <= false; elsif rising_edge(clk25) then if exist_runner_sig = true and (exists_obstacleS_sig = true or exists_obstacleL_sig = true or exists_obstacleS2_sig = true or exists_obstacleL2_sig = true) then -- collision collision_sig <= true; - if collision_cnt = x"FFFF" then --overflow - collision_cnt <= x"0000"; - else - collision_cnt <= '1' & collision_cnt(15 downto 1); - end if; else collision_sig <= false; end if; diff --git a/game.srcs/sources_1/new/obstacle.vhd b/game.srcs/sources_1/new/obstacle.vhd index ea840977ab47d8d19c6c501b66cc05c0fd898141..c38bd3338ee7d9db4bb4f8d44bef65eca292ca05 100644 --- a/game.srcs/sources_1/new/obstacle.vhd +++ b/game.srcs/sources_1/new/obstacle.vhd @@ -84,26 +84,6 @@ end process; -- Draw object ---koopa_max ----- Draw object ---process(HCounter_r, VCounter_r) --- variable array_index : integer range 0 to SUPERMARIO_MAX; --- variable x_relative : integer range 0 to LENGTH_RUNNER; --- variable y_relative : integer range 0 to HEIGTH_RUNNER; ---begin ---if (HCounter_r < (pos_object_x_actual + LENGTH_RUNNER) and HCounter_r >= pos_object_x_actual and VCounter_r > (pos_object_y_actual - HEIGTH_RUNNER) and VCounter_r <= pos_object_y_actual) then - --- x_relative := HCounter_r - pos_object_x_actual; --- y_relative := VCounter_r - pos_object_y_actual + HEIGTH_RUNNER - 1; - --- array_index := y_relative * supermario_width + x_relative; --- color_runner <= std_logic_vector(to_unsigned(supermario(array_index),color_runner'length)) ; --- if supermario(array_index) = 3 then --- exists_runner <= false; --- else --- exists_runner <= true; --- end if; - process(HCounter_o, VCounter_o) variable array_index : integer range 0 to koopa_max; variable x_relative : integer range 0 to LENGTH_SMALL_OBSTACLE; diff --git a/game.srcs/sources_1/new/posgenerator.vhd b/game.srcs/sources_1/new/posgenerator.vhd index b9a076d36d07ac086b460cd62400256f70bf8cae..320962c619f18f9cede49023a7456bd7392b6ab6 100644 --- a/game.srcs/sources_1/new/posgenerator.vhd +++ b/game.srcs/sources_1/new/posgenerator.vhd @@ -103,8 +103,8 @@ begin max := 600; end if; newpos_tmp := max + to_integer(unsigned(lfsr_Q)) mod (1600 - max); - if (newpos_tmp >= (max + 90) and newpos_tmp < (max + 150)) or (newpos_tmp <= (max + LENGTH_BIG_OBSTACLE)) then --forbidden zone - newpos_tmp := newpos_tmp + 150; + if (newpos_tmp >= (max + 70) and newpos_tmp < (max + 300)) or (newpos_tmp <= (max + LENGTH_BIG_OBSTACLE)) then --forbidden zone + newpos_tmp := newpos_tmp + 300; end if; if newpos_tmp > 1600 then pos_new <= 1650; diff --git a/game.srcs/sources_1/new/runner.vhd b/game.srcs/sources_1/new/runner.vhd index 59ff35a35ae9af0e9ab072b93f56f49f0012ab60..8ee291444569eaf2d167f72d7885ae013e2a4f5a 100644 --- a/game.srcs/sources_1/new/runner.vhd +++ b/game.srcs/sources_1/new/runner.vhd @@ -61,7 +61,7 @@ signal pos_object_y_target: integer range 1 to 480; signal fcount_edge : integer range 0 to MAX_FCOUNNT-1; signal FCounter_17bit : integer range 0 to MAX_FCOUNNT-1 * 2; signal runner_not_landed : std_logic; -- after jump finished -signal button_pressed : boolean; +--signal button_pressed : boolean; signal button_up_shift_reg : std_logic_vector(1 downto 0); @@ -71,17 +71,6 @@ begin pos_object_x_target <= POS_X_RUNNER; FCounter_17bit <= MAX_FCOUNNT-1 + FCounter_r; ---variable array_index : integer range 0 to SUPERMARIO_MAX; ---begin --- if VCounter_b < supermario_heigth and HCounter_b < supermario_width then --- array_index := VCounter_b * supermario_width + HCounter_b; --- --led_bcd <= std_logic_vector(to_unsigned(cnt_thousands, led_bcd'length)); --- if supermario(array_index)= 3 then --- color_back <= x"4F5"; --- else --- color_back <= std_logic_vector(to_unsigned(supermario(array_index),color_back'length)) ; - - -- Draw object process(HCounter_r, VCounter_r) variable array_index : integer range 0 to SUPERMARIO_MAX; @@ -106,22 +95,6 @@ if (HCounter_r < (pos_object_x_actual + LENGTH_RUNNER) and HCounter_r >= pos_obj end if; end process; --- detect edge Button UP ---process(clk_pixel) ---begin --- if btnCpuReset_r = '0' then --- fcount_edge <= 0; --- button_up_shift_reg <= "00"; --- elsif rising_edge(clk_pixel) then --- button_up_shift_reg <= button_up_shift_reg(0) & btnU_r; -- put current button value into shift register --- if (btnU_r = '1') and (button_up_shift_reg(0)= '0') and runner_not_landed = '0' then -- if rising edge (btnU) ----- fcount_edge <= FCounter_r; --- else --- fcount_edge <= fcount_edge; --- end if; --- end if; ---end process; - -- Jump process process(clk_pixel) begin @@ -130,36 +103,29 @@ begin button_up_shift_reg <= "00"; pos_object_y_target <= GROUND_LEVEL; runner_not_landed <= '0'; - button_pressed <= false; elsif rising_edge(clk_pixel) then --A button_up_shift_reg <= button_up_shift_reg(0) & btnU_r; -- put current button value into shift register if (btnU_r = '1') and (button_up_shift_reg(0)= '0') and runner_not_landed = '0' and fsm_state = "00" then -- if rising edge (btnU) --B fcount_edge <= FCounter_r; - button_pressed <= true; elsif FStrobe_r = '1' then --B if ((FCounter_17bit - fcount_edge) mod (MAX_FCOUNNT-1)) < JUMP_HEIGTH/JUMP_INCREMENT then --C - if (button_pressed = true) then --G - if pos_object_y_target > 0 then --H - pos_object_y_target <= pos_object_y_target - JUMP_INCREMENT; - else --H - pos_object_y_target <= GROUND_LEVEL; - end if; --H + if pos_object_y_target > 0 then --H + pos_object_y_target <= pos_object_y_target - JUMP_INCREMENT; + else --H + pos_object_y_target <= GROUND_LEVEL; + end if; --H runner_not_landed <= '1'; - end if; --G elsif (((FCounter_17bit - fcount_edge) mod (MAX_FCOUNNT-1)) >= JUMP_HEIGTH/JUMP_INCREMENT) and (((FCounter_17bit - fcount_edge) mod (MAX_FCOUNNT-1)) < 2 * JUMP_HEIGTH/JUMP_INCREMENT) then - if (button_pressed = true) then --D - if pos_object_y_target < 480 then --F - pos_object_y_target <= pos_object_y_target + JUMP_INCREMENT; - else --F - pos_object_y_target <= GROUND_LEVEL; - end if; -- F - if pos_object_y_target = GROUND_LEVEL - 3 * JUMP_INCREMENT then --I - button_pressed <= false; - runner_not_landed <= '0'; - else - runner_not_landed <= '1'; - end if; - end if; --D + if pos_object_y_target < 480 then --F + pos_object_y_target <= pos_object_y_target + JUMP_INCREMENT; + else --F + pos_object_y_target <= GROUND_LEVEL; + end if; -- F + if pos_object_y_target = GROUND_LEVEL - 10 * JUMP_INCREMENT then --I + runner_not_landed <= '0'; + else + runner_not_landed <= '1'; + end if; else runner_not_landed <= '0'; pos_object_y_target <= GROUND_LEVEL; diff --git a/game.srcs/utils_1/imports/synth_1/TopModule.dcp b/game.srcs/utils_1/imports/synth_1/TopModule.dcp index 191a0cfc9804e25a4c5ac75c20e844fdadf159f8..cc9b9ce3126b2e086cd2ee6b898f4bd0439cb8b8 100755 Binary files a/game.srcs/utils_1/imports/synth_1/TopModule.dcp and b/game.srcs/utils_1/imports/synth_1/TopModule.dcp differ