Jumanah – Sprint 6

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.

Picture:

Screen Shot 2017-03-08 at 11.33.14 AM.png

 

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..

obstacleType; //

    /*

 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.

void ofApp::setObstacle(){

    obstacleType = ofRandom(0,3); // 0 is nothing, 1 is rain, 2 is wind

    obstacleStart = timer;

    obstacleTimer = timer + ofRandom(300,600);

}

Screen Shot 2017-03-08 at 2.35.28 PM

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.

Jumanah

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s