Home Robotics C++ Physics II AP Physics B Electronics AP Java Astronomy Independent Study Summer Session Contests  About
                                                       

Mighty Molly

#pragma once

 

 

namespace TheStoryofMightyMolly

{

            using namespace System;

            using namespace System::ComponentModel;

            using namespace System::Collections;

            using namespace System::Windows::Forms;

            using namespace System::Data;

            using namespace System::Drawing;

 

            /// <summary>

            /// Summary for Form1

            ///

            /// WARNING: If you change the name of this class, you will need to change the

            ///          'Resource File Name' property for the managed resource compiler tool

            ///          associated with all .resx files this class depends on.  Otherwise,

            ///          the designers will not be able to interact properly with localized

            ///          resources associated with this form.

            /// </summary>

            public ref class Form1 : public System::Windows::Forms::Form

            {

            public:

                        Form1(void)

                        {

                                    InitializeComponent();

                                    //

                                    //TODO: Add the constructor code here

                                    //

                        }

 

            protected:

                        /// <summary>

                        /// Clean up any resources being used.

                        /// </summary>

                        /// <param name="disposing">"description of the parameter"</param>

           

            private: System::Windows::Forms::Label^  lblWelcomeMsg;

            private: System::Windows::Forms::Button^  btnIntroText;

            private: System::Windows::Forms::Button^  btnInstructions;

            private: System::Windows::Forms::Button^  btnTellStory;

            private: System::Windows::Forms::Label^  lblCreature;

            private: System::Windows::Forms::Label^  lblRoom;

            private: System::Windows::Forms::Label^  lblColor;

            private: System::Windows::Forms::Label^  lblWeapon;

            private: System::Windows::Forms::Label^  lblFood;

            private: System::Windows::Forms::TextBox^  txbCreature;

            private: System::Windows::Forms::TextBox^  txbRoom;

            private: System::Windows::Forms::TextBox^  txbColor;

            private: System::Windows::Forms::TextBox^  txbWeapon;

            private: System::Windows::Forms::TextBox^  txbFood;

            private: System::Windows::Forms::StatusStrip^  stsControl;

            private: System::Windows::Forms::ToolStripStatusLabel^  tslMessage;

            private: System::Windows::Forms::ToolStripStatusLabel^  tslProgress;

            private: System::Windows::Forms::ToolStripProgressBar^  tspProgressBar;

            private: System::Windows::Forms::ToolTip^  tltGameTips;

            private: System::ComponentModel::IContainer^  components;

 

 

 

 

 

 

 

 

 

 

 

            protected:

 

            private:

                        /// <summary>

                        /// Required designer variable.

                        /// </summary>

 

 

#pragma region Windows Form Designer generated code

                        /// <summary>

                        /// Required method for Designer support - do not modify

                        /// the contents of this method with the code editor.

                        /// </summary>

                        void InitializeComponent(void)

                        {

                                    this->components = (gcnew System::ComponentModel::Container());

                                    this->lblWelcomeMsg = (gcnew System::Windows::Forms::Label());

                                    this->btnIntroText = (gcnew System::Windows::Forms::Button());

                                    this->btnInstructions = (gcnew System::Windows::Forms::Button());

                                    this->btnTellStory = (gcnew System::Windows::Forms::Button());

                                    this->lblCreature = (gcnew System::Windows::Forms::Label());

                                    this->lblRoom = (gcnew System::Windows::Forms::Label());

                                    this->lblColor = (gcnew System::Windows::Forms::Label());

                                    this->lblWeapon = (gcnew System::Windows::Forms::Label());

                                    this->lblFood = (gcnew System::Windows::Forms::Label());

                                    this->txbCreature = (gcnew System::Windows::Forms::TextBox());

                                    this->txbRoom = (gcnew System::Windows::Forms::TextBox());

                                    this->txbColor = (gcnew System::Windows::Forms::TextBox());

                                    this->txbWeapon = (gcnew System::Windows::Forms::TextBox());

                                    this->txbFood = (gcnew System::Windows::Forms::TextBox());

                                    this->stsControl = (gcnew System::Windows::Forms::StatusStrip());

                                    this->tslMessage = (gcnew System::Windows::Forms::ToolStripStatusLabel());

                                    this->tslProgress = (gcnew System::Windows::Forms::ToolStripStatusLabel());

                                    this->tspProgressBar = (gcnew System::Windows::Forms::ToolStripProgressBar());

                                    this->tltGameTips = (gcnew System::Windows::Forms::ToolTip(this->components));

                                    this->stsControl->SuspendLayout();

                                    this->SuspendLayout();

                                    //

                                    // lblWelcomeMsg

                                    //

                                    this->lblWelcomeMsg->AutoSize = true;

                                    this->lblWelcomeMsg->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,

                                                static_cast<System::Byte>(0)));

                                    this->lblWelcomeMsg->Location = System::Drawing::Point(115, 9);

                                    this->lblWelcomeMsg->Name = L"lblWelcomeMsg";

                                    this->lblWelcomeMsg->Size = System::Drawing::Size(222, 13);

                                    this->lblWelcomeMsg->TabIndex = 0;

                                    this->lblWelcomeMsg->Text = L"Welcome to The Story of Mighty Molly.";

                                    //

                                    // btnIntroText

                                    //

                                    this->btnIntroText->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,

                                                static_cast<System::Byte>(0)));

                                    this->btnIntroText->Location = System::Drawing::Point(116, 52);

                                    this->btnIntroText->Name = L"btnIntroText";

                                    this->btnIntroText->Size = System::Drawing::Size(90, 23);

                                    this->btnIntroText->TabIndex = 0;

                                    this->btnIntroText->Text = L"Introduction";

                                    this->tltGameTips->SetToolTip(this->btnIntroText, L"Click here to learn about Mighty Molly.");

                                    this->btnIntroText->Click += gcnew System::EventHandler(this, &Form1::btnIntroText_Click);

                                    //

                                    // btnInstructions

                                    //

                                    this->btnInstructions->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,

                                                static_cast<System::Byte>(0)));

                                    this->btnInstructions->Location = System::Drawing::Point(247, 52);

                                    this->btnInstructions->Name = L"btnInstructions";

                                    this->btnInstructions->Size = System::Drawing::Size(90, 23);

                                    this->btnInstructions->TabIndex = 1;

                                    this->btnInstructions->Text = L"Instructions";

                                    this->tltGameTips->SetToolTip(this->btnInstructions, L"Click here to learn how to play.");

                                    this->btnInstructions->Click += gcnew System::EventHandler(this, &Form1::btnInstructions_Click);

                                    //

                                    // btnTellStory

                                    //

                                    this->btnTellStory->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,

                                                static_cast<System::Byte>(0)));

                                    this->btnTellStory->Location = System::Drawing::Point(176, 244);

                                    this->btnTellStory->Name = L"btnTellStory";

                                    this->btnTellStory->Size = System::Drawing::Size(100, 23);

                                    this->btnTellStory->TabIndex = 7;

                                    this->btnTellStory->Text = L"Tell the Story!";

                                    this->tltGameTips->SetToolTip(this->btnTellStory, L"Click here once all the text boxes are filled to tell the story.");

                                    this->btnTellStory->Click += gcnew System::EventHandler(this, &Form1::btnTellStory_Click);

                                    //

                                    // lblCreature

                                    //

                                    this->lblCreature->AutoSize = true;

                                    this->lblCreature->Location = System::Drawing::Point(13, 98);

                                    this->lblCreature->Name = L"lblCreature";

                                    this->lblCreature->Size = System::Drawing::Size(174, 13);

                                    this->lblCreature->TabIndex = 4;

                                    this->lblCreature->Text = L"What creature scares you the most\?";

                                    //

                                    // lblRoom

                                    //

                                    this->lblRoom->AutoSize = true;

                                    this->lblRoom->Location = System::Drawing::Point(13, 126);

                                    this->lblRoom->Name = L"lblRoom";

                                    this->lblRoom->Size = System::Drawing::Size(165, 13);

                                    this->lblRoom->TabIndex = 5;

                                    this->lblRoom->Text = L"What\'s the worst room in a castle\?";

                                    //

                                    // lblColor

                                    //

                                    this->lblColor->AutoSize = true;

                                    this->lblColor->Location = System::Drawing::Point(13, 154);

                                    this->lblColor->Name = L"lblColor";

                                    this->lblColor->Size = System::Drawing::Size(129, 13);

                                    this->lblColor->TabIndex = 6;

                                    this->lblColor->Text = L"What\'s your favorite color\?";

                                    //

                                    // lblWeapon

                                    //

                                    this->lblWeapon->AutoSize = true;

                                    this->lblWeapon->Location = System::Drawing::Point(12, 210);

                                    this->lblWeapon->Name = L"lblWeapon";

                                    this->lblWeapon->Size = System::Drawing::Size(130, 13);

                                    this->lblWeapon->TabIndex = 7;

                                    this->lblWeapon->Text = L"What is your favorite food\?";

                                    //

                                    // lblFood

                                    //

                                    this->lblFood->AutoSize = true;

                                    this->lblFood->Location = System::Drawing::Point(12, 182);

                                    this->lblFood->Name = L"lblFood";

                                    this->lblFood->Size = System::Drawing::Size(265, 13);

                                    this->lblFood->TabIndex = 8;

                                    this->lblFood->Text = L"What kind of weapon can you find lying on the ground\?";

                                    //

                                    // txbCreature

                                    //

                                    this->txbCreature->Location = System::Drawing::Point(283, 95);

                                    this->txbCreature->Name = L"txbCreature";

                                    this->txbCreature->Size = System::Drawing::Size(150, 20);

                                    this->txbCreature->TabIndex = 2;

                                    this->txbCreature->TextChanged += gcnew System::EventHandler(this, &Form1::txbCreature_TextChanged);

                                    //

                                    // txbRoom

                                    //

                                    this->txbRoom->Location = System::Drawing::Point(283, 123);

                                    this->txbRoom->Name = L"txbRoom";

                                    this->txbRoom->Size = System::Drawing::Size(150, 20);

                                    this->txbRoom->TabIndex = 3;

                                    this->txbRoom->TextChanged += gcnew System::EventHandler(this, &Form1::txbRoom_TextChanged);

                                    //

                                    // txbColor

                                    //

                                    this->txbColor->Location = System::Drawing::Point(283, 151);

                                    this->txbColor->Name = L"txbColor";

                                    this->txbColor->Size = System::Drawing::Size(150, 20);

                                    this->txbColor->TabIndex = 4;

                                    this->txbColor->TextChanged += gcnew System::EventHandler(this, &Form1::txbColor_TextChanged);

                                    //

                                    // txbWeapon

                                    //

                                    this->txbWeapon->Location = System::Drawing::Point(283, 179);

                                    this->txbWeapon->Name = L"txbWeapon";

                                    this->txbWeapon->Size = System::Drawing::Size(150, 20);

                                    this->txbWeapon->TabIndex = 5;

                                    this->txbWeapon->TextChanged += gcnew System::EventHandler(this, &Form1::txbWeapon_TextChanged);

                                    //

                                    // txbFood

                                    //

                                    this->txbFood->Location = System::Drawing::Point(283, 207);

                                    this->txbFood->Name = L"txbFood";

                                    this->txbFood->Size = System::Drawing::Size(150, 20);

                                    this->txbFood->TabIndex = 6;

                                    this->txbFood->TextChanged += gcnew System::EventHandler(this, &Form1::txbFood_TextChanged);

                                    //

                                    // stsControl

                                    //

                                    this->stsControl->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->tslMessage, this->tslProgress,

                                                this->tspProgressBar});

                                    this->stsControl->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::Table;

                                    this->stsControl->Location = System::Drawing::Point(0, 283);

                                    this->stsControl->Name = L"stsControl";

                                    this->stsControl->Size = System::Drawing::Size(452, 23);

                                    this->stsControl->TabIndex = 14;

                                    this->stsControl->Text = L"statusStrip1";

                                    //

                                    // tslMessage

                                    //

                                    this->tslMessage->BorderSides = static_cast<System::Windows::Forms::ToolStripStatusLabelBorderSides>((((System::Windows::Forms::ToolStripStatusLabelBorderSides::Left | System::Windows::Forms::ToolStripStatusLabelBorderSides::Top)

                                                | System::Windows::Forms::ToolStripStatusLabelBorderSides::Right)

                                                | System::Windows::Forms::ToolStripStatusLabelBorderSides::Bottom));

                                    this->tslMessage->BorderStyle = System::Windows::Forms::Border3DStyle::Sunken;

                                    this->tslMessage->Name = L"tslMessage";

                                    this->tslMessage->Spring = true;

                                    this->tslMessage->Text = L"Get Ready!";

                                    //

                                    // tslProgress

                                    //

                                    this->tslProgress->BorderSides = static_cast<System::Windows::Forms::ToolStripStatusLabelBorderSides>(((System::Windows::Forms::ToolStripStatusLabelBorderSides::Left | System::Windows::Forms::ToolStripStatusLabelBorderSides::Top)

                                                | System::Windows::Forms::ToolStripStatusLabelBorderSides::Bottom));

                                    this->tslProgress->BorderStyle = System::Windows::Forms::Border3DStyle::Sunken;

                                    this->tslProgress->Name = L"tslProgress";

                                    this->tslProgress->Text = L"Progress: ";

                                    //

                                    // tspProgressBar

                                    //

                                    this->tspProgressBar->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::ImageAndText;

                                    this->tspProgressBar->Name = L"tspProgressBar";

                                    this->tspProgressBar->Size = System::Drawing::Size(100, 16);

                                    this->tspProgressBar->Step = 20;

                                    this->tspProgressBar->Text = L"toolStripProgressBar1";

                                    this->tspProgressBar->ToolTipText = L"The Story So Far...";

                                    //

                                    // Form1

                                    //

                                    this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);

                                    this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;

                                    this->ClientSize = System::Drawing::Size(452, 306);

                                    this->Controls->Add(this->txbFood);

                                    this->Controls->Add(this->txbWeapon);

                                    this->Controls->Add(this->txbColor);

                                    this->Controls->Add(this->txbRoom);

                                    this->Controls->Add(this->txbCreature);

                                    this->Controls->Add(this->lblFood);

                                    this->Controls->Add(this->lblWeapon);

                                    this->Controls->Add(this->lblColor);

                                    this->Controls->Add(this->lblRoom);

                                    this->Controls->Add(this->lblCreature);

                                    this->Controls->Add(this->btnTellStory);

                                    this->Controls->Add(this->btnInstructions);

                                    this->Controls->Add(this->btnIntroText);

                                    this->Controls->Add(this->lblWelcomeMsg);

                                    this->Controls->Add(this->stsControl);

                                    this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;

                                    this->MaximizeBox = false;

                                    this->MinimizeBox = false;

                                    this->Name = L"Form1";

                                    this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;

                                    this->Text = L"The Story of Mighty Molly";

                                    this->stsControl->ResumeLayout(false);

                                    this->ResumeLayout(false);

                                    this->PerformLayout();

 

                        }

#pragma endregion

            private: System::Void btnIntroText_Click(System::Object^  sender, System::EventArgs^  e) {

                                                 //Store intro in dialog string

                                                 String^ strDialogText = gcnew String(

                                                 "Mighty Molly was the bravest of all the Mollys."

                                                 "She was fearless in battle and relentless in "

                                                 "everything else. No one who ever met her was "

                                                 "left untouched, for the mighty one had a "

                                                 "certain mystical way about her that almost "

                                                 "magically seemed to rub off on those "

                                                 "around her. \n"

                                                 "Certainly, there never was before and may "

                                                 "never be again anyone as mighty as "

                                                 "Mighty Molly. For those of you who "

                                                 "have not heard the tales of the mighty one, "

                                                 "you are in luck, because today you get the "

                                                 "chance to participate in the telling of the "

                                                 "mighty one's last great adventure!" );

                                                 //Show into

                                                 MessageBox::Show( strDialogText, "Introduction" );

                                    }

private: System::Void btnInstructions_Click(System::Object^  sender, System::EventArgs^  e) {

                                     //Store intro in dialog string

                                    String^ strDialogText = gcnew String(

                                    "To play the game and participate in the "

                                    "telling of 'The Story of Mighty Molly,' "

                                    "you must enter text in the five boxes"

                                    "and then click on the 'Tell the Story!' "

                                    "button." );

                                    //Show instructions

                                    MessageBox::Show( strDialogText, "Instructions" );

                         }

private: System::Void btnTellStory_Click(System::Object^  sender, System::EventArgs^  e) {

                                     Boolean fAllTextEntered = true;

                                     //Test to see if all text was entered

                                     //  If any text string is empty, the flag

                                     //  fAllTextEntered will be set to false

                                     if( String::IsNullOrEmpty( txbCreature->Text ) )

                                                 fAllTextEntered = false;

                                     if( String::IsNullOrEmpty( txbRoom->Text ) )

                                                 fAllTextEntered = false;

                                     if( String::IsNullOrEmpty( txbColor->Text ) )

                                                 fAllTextEntered = false;

                                     if( String::IsNullOrEmpty( txbWeapon->Text ) )

                                                 fAllTextEntered = false;

                                     if( String::IsNullOrEmpty( txbFood->Text ) )

                                                 fAllTextEntered = false;

                                     //If no text was entered, issue an error

                                     if( fAllTextEntered == false )

                                     {

                                                 MessageBox::Show( "You must enter all text"

                                                 " to continue the game!", "Error!",

                                                 MessageBoxButtons::OK, MessageBoxIcon::Stop );

                                                 return; // Exit this function

                                     }

                                     //Assemble the strings that tell the story

                                     String^ strDialogText = gcnew String(

             "A long time ago in a land far away, there "

             "was a castle were the great Prince William lived. "

             "Prince William was a kindly boy who cared more for "

             "his people than he did for himself. One day a storm "

             "from out of nowhere swept upon the land where "

             "Prince William lived. A mysterious " );

                                     //Append the next group of text

                                     strDialogText = String::Concat( strDialogText,

             txbColor->Text,

             " mist soon followed the storm. Out of this mist "

             "appeared an evil ", txbCreature->Text, ".\n\nThe ");

                                     //Append the next group of text

                                     strDialogText = String::Concat( strDialogText,

             txbCreature->Text, "'s heart was dark and cold. The ",

             txbCreature->Text, " killed William's father, the "

             "good King Stefford. So William became the new king. "

             "Summoning up all his bravery, King William rode out "

             "ahead of his armies to do battle with the fearsome ",

             txbCreature->Text, ". However, King William's army was "

             "quickly crushed and King William was captured and "

             "locked away in the castle's " );

                                     //Append the next group of text

                                     strDialogText = String::Concat( strDialogText,

                                     txbRoom->Text, ".\n\n"

             "A call went out from far and wide for a great hero "

             "to rescue King William. But no one dared answered "

             "the call except for Mighty Molly, mightiest of all "

             "the Mollys. Within a fortnight the mighty one "

             "arrived in the land where King William once ruled. "

             "Upon hearing of the mighty one's arrival, the",

             txbCreature->Text, " quickly rushed out to meet her."

                                     "\n\nMighty Molly and the dreaded ",

             txbCreature->Text );

                                     //Append the next group of text

                                     strDialogText = String::Concat( strDialogText,

             " fought for 4 days and 4 nights. As they did battle "

                                     "a cloud of ", txbColor->Text, " dust gathered around "

             "them, making them invisible to all who tried to "

             "watch. Finally, at the end of the 4th day, the ",

             txbCreature->Text, " fell dead at the mighty one's feet."

             "With her strength all but gone, Mighty Molly had "

             "slain the " );

                                     //Append the next group of text

                                     strDialogText = String::Concat( strDialogText,

                                     txbCreature->Text, " with her final "

             "blow, using a large ", txbWeapon->Text, " that she had "

             "fallen on during the fight.\n\n"

             "When the fight was finally over and the ",

                                     txbColor->Text, " mist finally cleared, " );

                                     //Append the next group of text

                                     strDialogText = String::Concat( strDialogText,

             "a great roar arose from the people who had gathered "

             "around to watch. Happily, the people followed the "

             "mighty one to King William's castle where she "

             "freed him. In gratitude, good King William declared "

             "a holiday and ordered his cooks to prepare a great "

             "feast of meat, wine and ", txbFood->Text, ". At the "

             "feast, King William offered to give his kingdom over "

             "to Mighty Molly and he knelt at her knees and "

             "offered up his crown. But Mighty Molly turned down "

             "his offer, for she knew that King William was the "

             "true king and that as mighty as she was, she needed "

             "to be mightier still to rule as wisely as King "

             "William.\n\nThe End." );

                                     MessageBox::Show( strDialogText,

                                                               "The Story of Mighty Molly" );

                         }

private: System::Void txbCreature_TextChanged(System::Object^  sender, System::EventArgs^  e) {

                                     static Boolean fProgressBarUpdated = false;

                                     //Set the progress bar message

                                     tslMessage->Text = "Be Brave!";

                                     //Only update the progress bar once

                                     if( fProgressBarUpdated == false )

                                     {

                                                 tspProgressBar->PerformStep();

                                                 fProgressBarUpdated = true;

                                     }

                         }

private: System::Void txbRoom_TextChanged(System::Object^  sender, System::EventArgs^  e) {

                                     static Boolean fProgressBarUpdated = false;

                                     //Set the progress bar message

                                     tslMessage->Text = "Any Room Will Do!";

                                     //Only update the progress bar once

                                     if( fProgressBarUpdated == false )

                                     {

                                                 tspProgressBar->PerformStep();

                                                 fProgressBarUpdated = true;

                                     }

                         }

private: System::Void txbColor_TextChanged(System::Object^  sender, System::EventArgs^  e) {

                                     static Boolean fProgressBarUpdated = false;

                                     //Set the progress bar message

                                     tslMessage->Text = "Any Color Will Do!";

                                     //Only update the progress bar once

                                     if( fProgressBarUpdated == false )

                                     {

                                                 tspProgressBar->PerformStep();

                                                 fProgressBarUpdated = true;

                                     }

                         }

private: System::Void txbWeapon_TextChanged(System::Object^  sender, System::EventArgs^  e) {

                                     static Boolean fProgressBarUpdated = false;

                                     //Set the progress bar message

                                     tslMessage->Text = "Pick Something Strong!";

                                     //Only update the progress bar once

                                     if( fProgressBarUpdated == false )

                                     {

                                                 tspProgressBar->PerformStep();

                                                 fProgressBarUpdated = true;

                                     }

                         }

private: System::Void txbFood_TextChanged(System::Object^  sender, System::EventArgs^  e) {

                                     static Boolean fProgressBarUpdated = false;

                                     //Set the progress bar message

                                     tslMessage->Text = "Pick Something Tasty!";

                                     //Only update the progress bar once

                                     if( fProgressBarUpdated == false )

                                     {

                                                 tspProgressBar->PerformStep();

                                                 fProgressBarUpdated = true;

                                     }

                         }

};

}