This time I come to you with finger Dance Dance Revolution. It’s a fun and exciting way to exercise your fingers. This time I tried using one WIFI block with two Power Station Blocks to create a little dance floor for your fingers and a screen to follow along.
Power flow set up:
In order to use the Touch and LEDMatrix Block at the same time without using an additional WIFI Block, I used two Power Station blocks. I used the WebSDK page as a reference to allow the first block to port power and data to the second Power Station Block.
LED BLOCK LOGIC
Prior to using the Logic Maker I used the LED Pattern Maker to make four images that light up each of the four quadrants.
At the start of the game I wanted a countdown before the game started. To do this I used a SEQUENCE Gate and displayed the countdown value on the LED display for 0.5 seconds each. With the 4th state of the sequence block I triggered it to start the game.
LED state selector and Display:
The LED state selector and display section uses a counter to count the number of rounds the game has and displays a random quadrant of the led display to send. At the beginning of the count it sends the current round to the Touch Block Logic Maker.
The RANDOM Gate selects the state randomly and sends it through to the LED display that selects the corresponding image that was made earlier. At the same time it sends the current sate to the Touch Block Logic maker. This continues to loop back on itself until the counter reaches the maximum amount of rounds.
Endgame will be reached once all the rounds have been played. Throughout the game it will update the score given from the Touch Block Logic maker, however it will only be displayed once the counter has reached the maximum rounds and sets the switch to allow input through. Once the score is displayed it will show a blank screen and send a reset signal to the Touch Block Logic maker to reset the score.
I had an issue with this stage where the fact that the SET VALUE Gate does not trigger an event makes the system harder to follow and detracts from the flow of events. As shown in the end game section multiple inputs are required just to trigger the event. Maybe there is a more efficient and cleaner way of doing this but this is what I have come up with so far.
TOUCH BLOCK LOGIC
Check touch input:
To check that the state of the touch input I used the previous “Spinny game” as a basis and used the same gates. The issue with this is that, unlike spinny wheel where Each quadrant would get multiple inputs causing one of them to eventually trigger both X and Y at the same time, with this case it will only get an input in one instance that it is touched. This instance may not update both the X and Y value at the same time not giving triggering to two inputs to the AND Gate simultaneously. Due to this it will sometimes not recognise the touch input or show a completely different input. It is something I will have to update for this to work in the future.
Confirm LED + Touch state are same:
In order for a touch input to be correct I check that the state sent from the LED Block Logic matches with the current touch state being received. If they match they will flow through to the next gate.
In order to have a visual feedback that you are touching the correct block an image with the corresponding quadrant hollowed out is sent to the LED matrix. This was done by making images with the LED pattern maker.
Check round increment:
Since there can be multiple triggers from the touchpad there is a check that the round has increased by 1 before it will allow another score to be added.
Each time the score is incremented it is sent to the LED Block Logic Maker.
At the end of the game a Reset signal is sent from the LED Block Logic Maker which resets the counter making it ready for a new game.
~~~~CURRENT STATE OF THE GAME~~~~
Currently the game is buggy. It will randomly stop and become unresponsive. It may be the fact that the game depends on the DISPLAY Gate correctly receiving the data in order for the instructions to flow to the next gate, which may not be happening. Another issue is one that I have already touched on, which is that the touch sensor is not responsive at times. For this I will have to try a new approach and see if that will fix the issue. I thought I’d write this while everything was still fresh in my mind.