ZalaXa 7 — Moving the Ship

Just a short post today. As I’m sure you realised, I wanted to try and make a Galaga-like game for this multicolour tutorial series.

I designed a wide ship sprite, with two variants to give a flickering animation effect. My first attempt used square btiles, but I didn’t much like how it looked:

The biggest problem with this is the graphic can only be 10 pixels wide when preshifting left and right within a 16 pixel wide tile—any more and you need wide tiles to capture the full range of shifts. This is even worse when you’re preshifting in one pixel steps—then, the graphic can only be 9 pixels wide. The ship doesn’t look too bad in ZX-Paintbrush, but it looked way too small and unimposing on the Spectrum screen.

The original arcade Galaga operated in portrait mode, so perhaps this has a bearing on how they designed the sprites.

My wide tile ship looks better, I think. With 24 pixel wide tiles, the graphic can be a maximum of 18 pixels wide when preshifting in two pixel steps1. It reminds me of the God Phoenix from Battle of the Planets/Gatchaman.

This will cause us difficulties later, and we’ll probably have to squeeze every last T-state out of the machine to put aliens and bullets on the screen. Oh well, it’ll be a challenge!

I modified the code from part 6 by removing the lines of MovePlayer that related to moving up and down. I also speeded up the animation to cycle every four frames, to give more of a dynamic flickering effect:

; sprites.asm
                        ld a, (FRAMES)                  ; Read the LSB of the ROM frame counter (0.255)
                        and %00000011                   ; Take the lowest 2 bits (effectively FRAMES modulus 4),
                        ret nz                          ;   and return 3 out of every 4 frames.

Then I added some code to check the M key and flash the border red in every frame it is pressed. This won’t happen in the real game, but it feels like a small amount of progress to make something visual happen early on.

; sprites.asm
                        ld bc, zeuskeyaddr("M")
                        in a, (c)
                        and zeuskeymask("M")
                        ld b, Black
                        jp nz, SetBorder
                        ld b, Red
                        ld a, b
                        out (ULAPort), a

That’s pretty much it. I think the result looks quite nice.

More next time. Happy new year!

  1. Or 17 pixels wide when preshifting in one pixel steps.

Leave a Reply

Your email address will not be published. Required fields are marked *