(34S) Crude Snake game
|
06-01-2014, 12:55 PM
(This post was last modified: 06-15-2017 01:21 PM by Gene.)
Post: #1
|
|||
|
|||
(34S) Crude Snake game
Since the 34S has some simple commands for polling the keyboard and drawing directly to the (tiny) dot-matrix screen, I figured I may as well see how suitable it is for action games. The results aren't too bad.
Code: 001 LBL'SNK' Just XEQ'SNK', and the game begins immediately. Use 2, 4, 6, and 8 to control the snake's direction. The snake can wrap around the edges of the playfield. Your score is displayed during and after the game. There's plenty of room for improvement here. I'm not real pleased with the keyboard handling, but I wrote it at 2:00 AM. Seems like it's a bit more sluggish than I would expect based on the hardware, but that's probably because gPLOT has to blit the entire screen from several registers, rather than being able to directly poke at bits in the display RAM. Paul, Walter, more graphics commands for future firmware versions perhaps? |
|||
11-05-2015, 04:35 PM
Post: #2
|
|||
|
|||
RE: (WP-34S) Crude Snake game
hi, I just bought a wp 34s and I'm trying to learn to code...
I can't input line 028 and 029 LBL? -> X GTO->X I put it without "->" but the snake doesn't turn... in fact keys 2, 4, 6 and 8 doesn't work... any help? |
|||
11-05-2015, 04:50 PM
(This post was last modified: 11-05-2015 04:58 PM by fhub.)
Post: #3
|
|||
|
|||
RE: (WP-34S) Crude Snake game
(11-05-2015 04:35 PM)inaqui76 Wrote: I can't input line 028 and 029After -> you have to use the ENTER key (displays a small 's' for stack), and then X is working. That's needed for a many operations which addresses the stack registers, when the key for it (e.g. [.] for X) has also a different meaning. So it's a good idea to always precede such stack calls with an ENTER key. PS: here are 2 other examples which also work only with ENTER STO T needs: STO ENTER T because without ENTER it would give STO* RCL Z needs RCL ENTER Z (without ENTER you get RCL+) Franz |
|||
11-05-2015, 06:16 PM
Post: #4
|
|||
|
|||
RE: (WP-34S) Crude Snake game
Thanks!
now those lines convert into LBL?->X to LBL?'H' is that correct? because "my snake" doesn't turn around, the 2, 4, 6 and 8 key does nothing... (11-05-2015 04:50 PM)fhub Wrote:(11-05-2015 04:35 PM)inaqui76 Wrote: I can't input line 028 and 029After -> you have to use the ENTER key (displays a small 's' for stack), and then X is working. |
|||
11-05-2015, 06:44 PM
Post: #5
|
|||
|
|||
RE: (WP-34S) Crude Snake game | |||
11-05-2015, 06:51 PM
Post: #6
|
|||
|
|||
RE: (WP-34S) Crude Snake game
my bad... I mean X instead of H... shame on me...
Now I got it... [->] key is the one with CONV... the program now works perfect.... Thanks for the help!! (11-05-2015 06:44 PM)fhub Wrote:(11-05-2015 06:16 PM)inaqui76 Wrote: now those lines convert intoNo, I don't understand how you end up with the letter 'H' ??? |
|||
11-12-2015, 07:39 AM
Post: #7
|
|||
|
|||
RE: (WP-34S) Crude Snake game
You can enter the X register as . . pretty much everywhere. I.e. you don't need the ENTER to bring the s onto the display.
Also, the program will be faster if the #xxx constants are used instead of digits wherever possible. Especially the single digit numbers. The reason is the digits are entered into the command line and then they are parsed into a number using lots of floating point arithmetic. The #xxx constants are directly loaded into the register. A neat program nonetheless. - Pauli |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)