Skip to content

Commit

Permalink
Updating ball acceleration settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
armandas committed Oct 27, 2009
1 parent 1b447c4 commit 7d910ab
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions graphics.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ architecture dispatcher of graphics is
type game_states is (start, waiting, playing, game_over);
signal state, state_next: game_states;

type counter_storage is array(0 to 4) of std_logic_vector(18 downto 0);
type counter_storage is array(0 to 3) of std_logic_vector(17 downto 0);
constant COUNTER_VALUES: counter_storage :=
(
"1000011110100010010", -- 277778
"0110010110111001101", -- 208333
"0101000101100001011", -- 166667
"0100001111010001001", -- 138889
"0011101000100001000" -- 119048
"110010110111001101", -- 208333
"101000101100001011", -- 166667
"100001111010001001", -- 138889
"011101000100001000" -- 119048
);
-- counters to determine ball control frequency
signal b_c_counter, b_c_counter_next: std_logic_vector(18 downto 0);
signal b_c_counter, b_c_counter_next: std_logic_vector(17 downto 0);
signal b_c_value: integer;

-- counts how many times the ball hits the bar
Expand Down Expand Up @@ -175,19 +174,18 @@ begin
end if;
end process;

bounce_counter_next <= bounce_counter + 1 when ball_bounce = '1' else
(others => '0') when ball_miss = '1' else
bounce_counter;

b_c_value <= 0 when bounce_counter < 4 else
1 when bounce_counter < 15 else
2 when bounce_counter < 25 else
3 when bounce_counter < 35 else
4;
3;

b_c_counter_next <= b_c_counter + 1 when b_c_counter < COUNTER_VALUES(b_c_value) else
(others => '0');

bounce_counter_next <= bounce_counter + 1 when ball_bounce = '1' else
(others => '0') when ball_miss = '1' else
bounce_counter;

ball_control: process(
px_x, px_y,
ball_x, ball_y,
Expand Down

0 comments on commit 7d910ab

Please sign in to comment.