Hi I am trying to develop a snake game using a Nexys 4 board and oled rgb screen. I can't generate automaticaly an other point on the screen when the snake's head meets the food and while the head is moving . My random generator(control_pomme) seems to work . I didn't base my project on the use of a RAM , do you think it is necessary because almost all the snake-like vga projects on the web seem to use this approach .
None of the vhdl-files instantiate each other. Therefore, I cannot reproduce any tests. If you need a lot of memory then you can use ram. Otherwise, FFs will do the job well.
Ya Y. wrote: > Thanks for your reply
1 | b_up : in STD_LOGIC; |
2 | b_down : in STD_LOGIC; |
3 | b_left : in STD_LOGIC; |
4 | b_right : in STD_LOGIC; |
If those are asynchronous real world buttons, then you must sync them to your clock. Otherwise you will encouter curious problems.
1 | type etat is (init, snake_right, snake_left, snake_up, snake_down, snake_pause); |
2 | :
|
3 | :
|
4 | case etat_present is |
5 | :
|
6 | :
|
7 | when others => go_up <= '0'; --others = snake_down |
Instead of "others" you better should have written "snake_down", because then there would remain no "others" and the obfuscating "others" clause would be not needed.
1 | signal sspixcol : unsigned( 6 downto 0 ):="0110000"; |
2 | signal sspixrow : unsigned( 5 downto 0 ):="100000"; |
3 | signal noir : STD_LOGIC_VECTOR (15 downto 0) :="0000000000000000"; |
4 | signal vert : STD_LOGIC_VECTOR (15 downto 0) :="0000001111100000"; |
5 | :
|
6 | :
|
7 | sspixrow <= sspixrow - "000001"; |
Why don't you work with integers throughout? Then you could use "real world numbers" instead of unreadable binary codes. And the arithmetic operations would be much easier to understand...
1 | signal sspixcol : integer range 0 to 127 := 96; |
2 | signal sspixrow : integer range 0 to 63 := 32; |
3 | :
|
4 | :
|
5 | sspixrow <= sspixrow - 1; |
:
Edited by Moderator
I use a debouncer for the buttons , all project files are in the second post. Thanks for the other remarks
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.