During this Sprint, one of the important things I worked on was adding a wind effect to the code. Since we already had similar code for rain and fire, it was much of the same. I created wind particles that move with an X gravity, and also gave the fire the same X and Y gravity, so that they move in the same direction. Then I added particle images instead of drawing ellipses, this was done with the use of pointers. The wind effect is seen by a few leaves blowing in the wind. I also added a rotation to the leaves and a random offset to make things look natural.
I really enjoyed this sprint because I also worked on refining the rain and obstacle generation code which was all hard coded up until this point. We added a rain image instead of an ellipse, so it all looks more visually appealing. One thing that did not work out well was the Fire particle image because of the way the colors change, so we are most likely going to keep our original fire with just ellipses.
Lastly, the toughest part was how we should make obstacles random, and not follow a predictable storyline so the user does not get bored.. so I created an obstacle generator function that would randomly assign an obstacle type..
0 – Rest (Nothing)
1 – Rain
2 – Wind
3 – Bear
obstacleB; //boolean if obstacle is happening
obstacleTimer; //duration of frames
This will be random, the duration of the obstacle. After the duration is over, reset the obstacleType randomly
Since we have a timer in the code from start, I just call the function whenever another obstacle has just ended, to assign a new obstacle, and it can literally go on forever! The great thing is that when the obstacle is 0, the user can rest.
obstacleType = ofRandom(0,3); // 0 is nothing, 1 is rain, 2 is wind
obstacleStart = timer;
obstacleTimer = timer + ofRandom(300,600);
The result is very nice, because now we don’t know what to expect every time the code runs!
I am very happy with this sprint! Ran into very little problems!
Next up is combining the code once again and having the user interact with the obstacles.