CMM2: Game: CrateAway - Feeling pushy? Push some crates!


Author Message
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3161
Posted: 03:44pm 25 Apr 2021      

A version that also runs on the Armmite F4 with IPS/OTM8009A 800.480 LCD

To add to another one of VegiPete's gems, I've tested this on 5 hardware configurations:

1) CMM2 with VGA and keyboard
2) CMM2 with VGA and PC console
3) CMM2 with VGA->HDMI->USB3 and PC console
4) F4 with PC console
5) F4 with hat  and keyboard

To handle the varying input (particularly arrow keys when using the PC console or F4 or CMM2), I replaced all INKEY$ with _INKEY$() and provided this FUNCTION _INKEY$

Function _inkey$()
 local ky$
 ky$=inkey$
 if asc(ky$)=27 then ' escape sequence
   ky$=inkey$: ky$=inkey$: ky$=ucase$(ky$)
   If ky$="A" Then: ky$=chr$(128) ' up arrow
   ElseIf ky$="B" Then: ky$=chr$(129) ' down arrow
   ElseIf ky$="C" Then: ky$=chr$(131) ' right arrow
   ElseIf ky$="D" Then: ky$=chr$(130) ' left arrow
   ElseIf ky$="5" Then: ky$=chr$(136) ' pgdn
   ElseIf ky$="6" Then: ky$=chr$(137) ' pgup
   ' Function keys are ???
   EndIf
 endif
 _inkey$=ky$
end function


Otherwise I had to replace blits of the sprite graphics page on a separate CMM2 page with F4 sprites created with BLIT READ and BLIT WRITE.

The F4 looked to have generous memory compared to most other micromites, but compared to the CMM2, it's miserly--114K compared to 5M+. I could not build all the necessary sprites without running out of memory. I wanted to keep the walking/pushing man on the instruction page--that took 29 sprites and left 4K of RAM remaining (other program RAM included).

(Note--VegiPete used the CMM2s mirroring parameter to flip the walking man and pushing man--I had to reverse the pixels on the bmp image screen and save walking left and pushing left and right.  It would be useful to save memory on the F4 by providing that mirroring parameter to BLIT WRITE.)

I squeezed some array sizes to gain more memory.

Then to get the sprites to play the game, I had to BLIT CLOSE all 29, reload the sprite image .bmp file and set another 7 game tile sprites.

Other than the blits, there was not much that had to be changed. The CMM2 game plays with 500x500 pixels, so I had to squeeze the vertical down to 480. That changed sprite depth by a pixel.

MATH ADD is also not available on the F4. It's used to make a copy of the game board. I used enclosed FOR loops to copy the double-dimensioned array.





F4 MMBasic doesn't have include files, so I didn't try to provide that way to add more games. The text file games found on the internet can be pasted into this program.

Zipped MMBasic file with .bmp sprite file:
CrateAwayF4.zip


F4 on Fruit of the Shed

~
Edited 2021-04-26 01:51 by lizby