This week I began to create my game. After the player helps my flying object avoid obstacles the gradient background will change over time. I have placed the gradient background code I found on Processing’s reference page in my sketch and started sorting it into a class so I can execute a different background after a certain amount of time (or points) collected:

screen-shot-2019-03-19-at-1-14-33-am

Figure 1. Gradient background Class.

 

screen-shot-2019-03-19-at-1-20-35-am

Figure 2. First tab, initializing parameters for gradient class.

The above page shows the function within the class at play. I wanted to use the gradient functions’ parameters in the class but due to the constructions of the function itself, it seemed I was unable to do so. The function itself however, could have changed parameters for a different object within the class. Therefore it works in away but only within the class’s function.

 

screen-shot-2019-03-19-at-1-41-26-am

Figure 3. First Gradient Background.

Figure 3. First Gradient Background.

 

Figure 3. When gradient background 1 is active.

screen-shot-2019-03-19-at-1-20-48-am

Figure 4. Second Gradient background.

Static page of the white ellipse object and gradient background. (It will be controlled going up or down with the potentiometer to avoid incoming objects which just like the white ellipse will have their own classes.) The gradients will change stating a change in time from day to dusk to night.

References:

https://processing.org/examples/lineargradient.html