Skip to content
Snippets Groups Projects
Commit 406213d2 authored by Aaron Sommer's avatar Aaron Sommer
Browse files

changed playability

parent e2c8cec6
Branches
No related tags found
No related merge requests found
...@@ -39,7 +39,7 @@ entity TopModule is ...@@ -39,7 +39,7 @@ entity TopModule is
vgaBlue : out std_logic_vector(3 downto 0); vgaBlue : out std_logic_vector(3 downto 0);
vgaGreen : out std_logic_vector(3 downto 0); vgaGreen : out std_logic_vector(3 downto 0);
Hsync, Vsync : out std_logic; 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); seg : out std_logic_vector(6 downto 0);
an : out std_logic_vector(7 downto 0); an : out std_logic_vector(7 downto 0);
dp : out std_logic dp : out std_logic
...@@ -207,7 +207,6 @@ signal exists_go : boolean; ...@@ -207,7 +207,6 @@ signal exists_go : boolean;
signal collision_sig : boolean; signal collision_sig : boolean;
signal collision_cnt : std_logic_vector(15 downto 0);
signal soft_reset : std_logic; signal soft_reset : std_logic;
signal fsm_reset : std_logic; signal fsm_reset : std_logic;
...@@ -324,20 +323,23 @@ largeObstacle : obstacle_L ...@@ -324,20 +323,23 @@ largeObstacle : obstacle_L
my_new_pos => pos_new_sig, my_new_pos => pos_new_sig,
my_start_pos => 1000 my_start_pos => 1000
); );
yetAnotherLargeObstacle : obstacle_L --yetAnotherLargeObstacle : obstacle_L
Port map(clk_pixel => clk25, -- Port map(clk_pixel => clk25,
btnCpuReset_o => soft_reset, -- btnCpuReset_o => soft_reset,
HCounter_o => hcounter_sig, -- HCounter_o => hcounter_sig,
VCounter_o => vcounter_sig, -- VCounter_o => vcounter_sig,
FCounter_o => fcounter_sig, -- FCounter_o => fcounter_sig,
FStrobe_o => fstrobe_sig, -- FStrobe_o => fstrobe_sig,
color_obstacle => color_obstacleL2_sig, -- color_obstacle => color_obstacleL2_sig,
exists_obstacle => exists_obstacleL2_sig, -- exists_obstacle => exists_obstacleL2_sig,
fsm_state => fsm_state, -- fsm_state => fsm_state,
my_pos => pos_3_sig, -- my_pos => pos_3_sig,
my_new_pos => pos_new_sig, -- my_new_pos => pos_new_sig,
my_start_pos => 1220 -- my_start_pos => 1220
); -- );
pos_3_sig <= 0;
exists_obstacleL2_sig <= false;
color_obstacleL2_sig <= x"FFF";
scoreDisplay : scorekeeper scoreDisplay : scorekeeper
port map( port map(
...@@ -394,16 +396,11 @@ soft_reset <= fsm_reset and btnCpuReset; ...@@ -394,16 +396,11 @@ soft_reset <= fsm_reset and btnCpuReset;
process(clk25) process(clk25)
begin begin
if soft_reset = '0' then if soft_reset = '0' then
collision_cnt <= x"0000"; collision_sig <= false;
elsif rising_edge(clk25) then 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 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
collision_sig <= true; 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 else
collision_sig <= false; collision_sig <= false;
end if; end if;
......
...@@ -84,26 +84,6 @@ end process; ...@@ -84,26 +84,6 @@ end process;
-- Draw object -- 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) process(HCounter_o, VCounter_o)
variable array_index : integer range 0 to koopa_max; variable array_index : integer range 0 to koopa_max;
variable x_relative : integer range 0 to LENGTH_SMALL_OBSTACLE; variable x_relative : integer range 0 to LENGTH_SMALL_OBSTACLE;
......
...@@ -103,8 +103,8 @@ begin ...@@ -103,8 +103,8 @@ begin
max := 600; max := 600;
end if; end if;
newpos_tmp := max + to_integer(unsigned(lfsr_Q)) mod (1600 - max); 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 if (newpos_tmp >= (max + 70) and newpos_tmp < (max + 300)) or (newpos_tmp <= (max + LENGTH_BIG_OBSTACLE)) then --forbidden zone
newpos_tmp := newpos_tmp + 150; newpos_tmp := newpos_tmp + 300;
end if; end if;
if newpos_tmp > 1600 then if newpos_tmp > 1600 then
pos_new <= 1650; pos_new <= 1650;
......
...@@ -61,7 +61,7 @@ signal pos_object_y_target: integer range 1 to 480; ...@@ -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 fcount_edge : integer range 0 to MAX_FCOUNNT-1;
signal FCounter_17bit : integer range 0 to MAX_FCOUNNT-1 * 2; signal FCounter_17bit : integer range 0 to MAX_FCOUNNT-1 * 2;
signal runner_not_landed : std_logic; -- after jump finished 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); signal button_up_shift_reg : std_logic_vector(1 downto 0);
...@@ -71,17 +71,6 @@ begin ...@@ -71,17 +71,6 @@ begin
pos_object_x_target <= POS_X_RUNNER; pos_object_x_target <= POS_X_RUNNER;
FCounter_17bit <= MAX_FCOUNNT-1 + FCounter_r; 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 -- Draw object
process(HCounter_r, VCounter_r) process(HCounter_r, VCounter_r)
variable array_index : integer range 0 to SUPERMARIO_MAX; 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 ...@@ -106,22 +95,6 @@ if (HCounter_r < (pos_object_x_actual + LENGTH_RUNNER) and HCounter_r >= pos_obj
end if; end if;
end process; 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 -- Jump process
process(clk_pixel) process(clk_pixel)
begin begin
...@@ -130,36 +103,29 @@ begin ...@@ -130,36 +103,29 @@ begin
button_up_shift_reg <= "00"; button_up_shift_reg <= "00";
pos_object_y_target <= GROUND_LEVEL; pos_object_y_target <= GROUND_LEVEL;
runner_not_landed <= '0'; runner_not_landed <= '0';
button_pressed <= false;
elsif rising_edge(clk_pixel) then --A 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 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 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; fcount_edge <= FCounter_r;
button_pressed <= true;
elsif FStrobe_r = '1' then --B elsif FStrobe_r = '1' then --B
if ((FCounter_17bit - fcount_edge) mod (MAX_FCOUNNT-1)) < JUMP_HEIGTH/JUMP_INCREMENT then --C 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 if pos_object_y_target > 0 then --H
pos_object_y_target <= pos_object_y_target - JUMP_INCREMENT; pos_object_y_target <= pos_object_y_target - JUMP_INCREMENT;
else --H else --H
pos_object_y_target <= GROUND_LEVEL; pos_object_y_target <= GROUND_LEVEL;
end if; --H end if; --H
runner_not_landed <= '1'; 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 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 if pos_object_y_target < 480 then --F
pos_object_y_target <= pos_object_y_target + JUMP_INCREMENT; pos_object_y_target <= pos_object_y_target + JUMP_INCREMENT;
else --F else --F
pos_object_y_target <= GROUND_LEVEL; pos_object_y_target <= GROUND_LEVEL;
end if; -- F end if; -- F
if pos_object_y_target = GROUND_LEVEL - 3 * JUMP_INCREMENT then --I if pos_object_y_target = GROUND_LEVEL - 10 * JUMP_INCREMENT then --I
button_pressed <= false;
runner_not_landed <= '0'; runner_not_landed <= '0';
else else
runner_not_landed <= '1'; runner_not_landed <= '1';
end if; end if;
end if; --D
else else
runner_not_landed <= '0'; runner_not_landed <= '0';
pos_object_y_target <= GROUND_LEVEL; pos_object_y_target <= GROUND_LEVEL;
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment