From March 21-25 2019
I have been working on the following:
Setting a class to change the gradient background – Done
Setting a class for the player and enemies – Done
Setting a class for the time. – Wasn’t needed
That’s a lot of classes!
I also tried to make a tail made out of ellipses using an array to move together in motion and create a kind of wave animation affect to follow the position of the first ellipse. (That’s why the player array count is 20.)
The premise of the game is to avoid the flying obstacles coming toward you as you fly through the sky. After a period of time, the gradient background will change colour from day to dusk to dawn.
The game will use the ultrasonic sensor to control the tails height and the potentiometer could be used to change the Chasing Tails colour (for fun).
Here’s a quick sketch of the interface:
I wanted to create a weird yet enticing game of soft pastel colours. Most of the pieces are there now it’s just a matter of putting them all together before the critique.
I used to not be a fan of arrays and mainly used them without knowing how well they worked but after some research and help from the Instructors I managed to find and work with some code that I could work with to make my tail:
The enemies ArrayList may need a timer since I plan to have only a couple of objects appear on screen after a certain amount of time before they exit the other side of the screen.
I still need to work on a code for collision. If the tail hits one of the rectangles objects then the game ends.
The tail also goes past the screen so later I will have to add a bit of code that automatically kills the tail if they sink to low to the ground or just map the position and bound the tail so it does not go past the sketch window.
Next Steps Before Critique
Make a switch case for the game states:
- Game Over
Add collision code.
Integrate the sensor.
I managed to get the enemies to come in one by one by removing the first object in my arrayList and adding a new one when it missed the payer and hits the other side of the screen:
I can control the speed with the velocity vector: velocity = new PVector(-0.2, 0); (
I feel this speed is fast enough to doge flying white cubes :P)
I also added an opacity to the gradients so it looks like the objects are actually flying through that space:
I had a lot of trouble detecting collision from two objets in different classes….I might have to create and draw the player and enemy objects in the same class to make this work given previous experience.
Tuesday April 2nd 2019
I added the 4 pin ultra sonic sensor data input to control the tail’s movement’s. I was going to incase it in a box and have the sensor point upward so the distance of the user’s hand could be detected:
Instead of movement the ultrasonic sensor’s data was being parsed into a for loop inside the player array function. This caused a wind wave like affect on the player itself:
Gradients as Backgrounds: https://processing.org/examples/lineargradient.html
Millis() Function: https://processing.org/reference/millis_.html
Smoothing incoming Serial Data Codehttps://www.arduino.cc/en/Tutorial/Smoothing