Some time ago we made a WiFi keyboard on ESP 8266. Long time ago we made a Piader game. From their combined powers comes Piader controlled by WiFi keyboard 😀
We need to change Piader a little, to be precise, event listener and keyboard server needs to use JSON packet not string. Why ? Because wifi keyboard is using it.
Piader will also move from TCP to UDP and this allows us to use broadcast.
What about keyboard changes ? Yey! No changes!
Piader source code
Our LCD Manager would be better with display server, something that will take care of rendering at constant FPS. If you look at Piader v2 you see that there is a main_loop function. In it we refresh lcd content at some fps but it is quite annoying because it shouldn’t be our problem. Manager should take care of it.
Our task for now: add display server.
We have a nice game and we may play it. But there is one problem we don’t see number of lives and our score. In this article we will create another view and position it on second display. I played with 40×4 for game and 20×4 for score but ended with one lcd with two vlcds 🙂
We will also do something with difficulty as we have such setting it would be nice that it would do something
And of course we can’t forget about bugs, we will fix few along the way.
We have all bricks to build a game view. It is the most important view in game 🙂
We have a home view now lets work on options and option view. We want to be able to set maximum lives and difficulty level. Still I have no idea what would be difference between easy and hard 🙂
In this article we will work on views and create our first view for home tab. We could put all code into one file but it would be a mess. So lets take a different approach, we will create a separate file for each view. Next we will work on button widget and create quit game action. Don’t forget that Piader is a tool to improve LCDManager.
LCDmanger doesn’t care about application logic its job is to display. So its up to us and application to use events and change views. Each app may have different actions and effects.
So what now ?
Simple we will create new project Piader and use LCD Manager as external package. This way we will have two separate projects. And we may focus on develop them separately.
We are almost ready to go public with CharLCD package. First some refactoring and next we will build dist package.
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 🙂
Download source code
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.