CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: nullweist on March 02, 2016, 04:25:01 AM

Title: Snake on a HP Prime
Post by: nullweist on March 02, 2016, 04:25:01 AM
This is a remake of the classic Snake game. You use the arrow keys to move. If you hit the edge, or yourself, you die. If you "eat" the red dot you get bigger. Be warned that this program uses a matrix to store temporary data. If there are any issues feel free to let me know.
Title: Re: Snake on a HP Prime
Post by: Dream of Omnimaga on March 02, 2016, 04:34:29 AM
I'll give this a try in a few minutes in the emulator (by the way, the emulator is located at ftp://ftp.hp.com/pub/calculators/Prime/ and you can use it to make screenshots, but your games will run faster unless you use the WAIT() command). :)


EDIT:

I made an animated screenshot with Camstudio and VirtualDub:

(https://img.ourl.ca/snake-2.gif)


I like it so far, but I found two issues (although I think one is caused by the emulator?)

-Keys takes a while to register, so to make the snake turn, I have to keep the arrow key pressed for a while, else it won't turn

-If you go backwards, the snake seems to go through itself, as demonstrated in the screenshot above.


What would be cool as new feature would be to add extra colors, such as making the background green and the snake yellow. Perhaps a mode where the field wraps around (so we can go outside the screen and appear on the other) would be nice as well.
Title: Re: Snake on a HP Prime
Post by: nullweist on March 02, 2016, 04:44:10 AM
Thanks for the input. The backwards thing is a bug, you are supposed to die when that happens. I didn't notice the key press delay and will try to figure it out.
Title: Re: Snake on a HP Prime
Post by: nullweist on March 05, 2016, 03:22:14 AM
New Version!
Changes:
-Fixed the issue of being able to go backwards
-New Color Options
    >Black Snake/White Background
    >Green Snake/Black Background
    >Yellow Snake/Green Background
-New Difficulty Options
    >Easy - Normal Speed/Field Wraps Around
    >Medium - Faster Speed/Field Wraps Around
    >Normal - Normal Speed/Collision with border kills
    >Hard - Faster Speed/Collision with border kills

I can't make an animated screenshot, but here are some normal screenshots of the new colors.
(http://i.imgur.com/l7Qo8x0.jpg) (http://i.imgur.com/rUQzHk4.jpg)
Title: Re: Snake on a HP Prime
Post by: Dream of Omnimaga on March 05, 2016, 09:02:22 PM
I like the changes, especially the difficulty settings :D. I can't test the new version yet, but one thing I liked about the other version is that it was playable in the emulator as well, speed-wise.
Title: Re: Snake on a HP Prime
Post by: aetios on March 06, 2016, 08:07:13 AM
That looks really nice! Does the minimap serve any function? (Other than 'fancy')
Title: Re: Snake on a HP Prime
Post by: nullweist on March 13, 2016, 01:35:32 AM
The minimap is the actual game. The game is scaled up in order to make it easier to see what is happening.
Title: Re: Snake on a HP Prime
Post by: Dream of Omnimaga on March 13, 2016, 01:47:04 AM
Aah I see. It actually looks cool anyway. Also it's a good move to use smaller resolutions for games that don't requires HQ graphics. It's faster.