We have our game and we have our vlcd. Lets mix it together.
Our goal is to create one vlcd 16×6 for game and small 4×4 for displaying score. Something like this:
Why right alignment ? Because I have short wires 🙂
We have a simple virtual display. It can join lcds in one virtual area. But there is one catch. Look at the following layouts (red area is virtual lcd):
No problem. But what about:
… we can’t do it ! And what if we want to use this small 4×4 as second virtual display ? We can’t !
When we add lcd its added at any (x,y) but always starts from (0,0). Lets add an offset, so we can specify area.
Update – error in code. see at the bottom
Last time when was time for Jenkins it stopped working. Few strange thing appeared, tests took very long time, there were IO errors, cobertura report was missing a source file and one file from project got so many warnings and errors that it wasn’t possible.
We have a fully functional game that is quite primitive but don’t wory. We will do something about it and during this we will upgrade Lcd classes.
Remember draw function in game.py ? It was doing all kind of checks and distinctions between lcds. It shouldn’t be like that. Game class shouldn’t care about proper display, such task goes to lower level of code. From game perspective it should have some area to display and thats all. It should write on any (x, y) allowed by combined displays and don’t care which display is top, bottom, left or right.
Its time for Virtual Display 🙂
We have just two things left. After that we are back to main goal – upgrading LCD class.
First we will go with shooting. Next small refactor of our controls and finally adding missile class and space as fire button. After that we will add collision detection.
Download source code.
Today we will add player and it’s controls.
Controls, that’s something we will do a different way, we have no keyboard attached, no joystick and no pad. So what now ? Lets write a control server, a threaded class that will listen for control signals on some port. This way we will be able to use anything to move a player.
As first input we will use host keyboard, small class that will read keys and send them to game.
Download source code