teaching machines

Homework 1 – Raptor Quest

September 30, 2011 by . Filed under cs491 mobile, fall 2011, postmortems.

For this homework assignment I decide to write my own Choose Your Own Adventure story called “Raptor Quest” where you are trying to avoid dying during a raptor attack. There are way more then the minimum 5 ‘Questions’ required if you follow all the different paths the story can take. I encourage you to play it multiple times to see where your choices lead you.

The program has three activities. The Main Activity, Adventure Activity and End Activity.

Currently the Main Activity has no purpose other then being a title screen. It has a large Textview that says “Raptor Quest” and a start button. The Raptor Quest uses both a custom font and color.

Main Activity

To change the color of a Textview just add android:textColor=”#000000″, where #000000 is the RGB values of a given color, to your Textview element in the layout xml.

To add your own custom font you first need to add your .ttf font file to the assets folder. If there is no assets folder, create one. Then in ‘onCreate” method of your activity put the following code.

TextView text = (TextView) findViewById(R.id.yourTextviewsID);
Typeface font = Typeface.createFromAsset(getAssets(), "YourFontsName.ttf");
text.setTypeface(font);

The Adventure Activity is were the main meat of the adventure takes part. The screen is always a question or statement along with 3 possible responds or courses of action. Depending on which action the user selects they might be ask another ‘Question’, defeat the raptor threat or die a horrible death.

Adventure Activity

The End Activity is what you see if you manage to defeat the raptors or if you end up eaten by them. Either way you get a final description of what events your actions have caused and you see a ‘Try Again’ button.

I used a database to hold all the question data. I built all the database code before Fridays class where we learned about databases because I couldn’t think of an easier way to store the questions and answers. Everything was pretty easy to pick up and I had it working after a few hours of tinkering.

Overall the hardest part of this assignment was writing the text for the choose your own adventure. Keeping all the different branches straight get exponentially harder with every decision you introduce to the user. Overall I created a fun adventure with reasonable replay value that satisfied all the requirements of this assignment.