(34S) Crude Snake game - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (34S) Crude Snake game (/thread-1506.html) |
(34S) Crude Snake game - Dave Britten - 06-01-2014 12:55 PM 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? RE: (WP-34S) Crude Snake game - inaqui76 - 11-05-2015 04:35 PM 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? RE: (WP-34S) Crude Snake game - fhub - 11-05-2015 04:50 PM (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 RE: (WP-34S) Crude Snake game - inaqui76 - 11-05-2015 06:16 PM 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. RE: (WP-34S) Crude Snake game - fhub - 11-05-2015 06:44 PM (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' ??? After selecting LBL? from the TEST menu, press following keys: [->] [ENTER] [.] Franz RE: (WP-34S) Crude Snake game - inaqui76 - 11-05-2015 06:51 PM 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' ??? RE: (WP-34S) Crude Snake game - Paul Dale - 11-12-2015 07:39 AM 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 |