Skip to content

Commit

Permalink
Upload tonights work. Added in mController (the old frmController.frm
Browse files Browse the repository at this point in the history
  • Loading branch information
ejatgit committed May 20, 2024
1 parent f944414 commit 4c8ba03
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CPP/High_Voltage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()
project ("High_Voltage")

# Add source to this project's executable.
add_executable (High_Voltage "High_Voltage.cpp" "High_Voltage.h" "cPlayer.cpp" "cInterceptor.cpp" "cPlayer.h" "cInterceptor.h" "GlobalVariables.h" "mBuildMaze.h" "mRunGame.h" "mMoveCharacters.h")
add_executable (High_Voltage "High_Voltage.cpp" "High_Voltage.h" "cPlayer.cpp" "cInterceptor.cpp" "cPlayer.h" "cInterceptor.h" "GlobalVariables.h" "mBuildMaze.h" "mRunGame.h" "mMoveCharacters.h" "mController.cpp" "mController.h")

if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET High_Voltage PROPERTY CXX_STANDARD 20)
Expand Down
152 changes: 152 additions & 0 deletions CPP/High_Voltage/mController.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#include<string>
#include<iostream>
#include"GlobalVariables.h"
#include"mFunctions.h"
#include"mMoveCharacters.h"
#include"mController.h"

bool UnLoadMe{ false };

void mController_Show() {
MsgBox("Make your move: ", "MsgBox0");
std::string sNowInput{ "" };
do
{
std::cin >> sNowInput;
if (sNowInput=="0")
{
CommandButton0_Click();
}
else if (sNowInput == "1")
{
CommandButton1_Click();
}
else if (sNowInput == "2")
{
CommandButton2_Click();
}
else if (sNowInput == "3")
{
CommandButton3_Click();
}
else if (sNowInput == "4")
{
CommandButton4_Click();
}
else if (sNowInput == "5")
{
CommandButton5_Click();
}
else if (sNowInput == "6")
{
CommandButton6_Click();
}
else if (sNowInput == "7")
{
CommandButton7_Click();
}
else if (sNowInput == "8")
{
CommandButton8_Click();
}
else if (sNowInput == "9")
{
CommandButton9_Click();
}
else if (sNowInput == "q" || sNowInput == "x")
{
CommandButtonExit_Click();
}
else
{
//do nothing
MsgBox("I don't understand.", "MsgBox0");
}
} while (UnLoadMe==false);
}



void CommandButton0_Click() {
int iRow{ ((rand() % iMazeRows) + 1) - cActivePlayer.Row };
int iColumn{ ((rand() % iMazeCols) + 1) - cActivePlayer.Column };
MsgBox("Super Jump!!!", "MsgBox0");
MovePlayer(iRow, iColumn);
MoveInterceptors;
WhoIsAlive();
}

void CommandButton1_Click(){
MovePlayer(1, -1);
MoveInterceptors;
WhoIsAlive();
}

void CommandButton2_Click() {
MovePlayer(1, 0);
MoveInterceptors;
WhoIsAlive;
}

void CommandButton3_Click() {
MovePlayer(1, 1);
MoveInterceptors;
WhoIsAlive;
}

void CommandButton4_Click() {
MovePlayer(0, -1);
MoveInterceptors;
WhoIsAlive;
}

void CommandButton5_Click() {
MovePlayer(0, 0);
MoveInterceptors;
WhoIsAlive;
}

void CommandButton6_Click() {
MovePlayer(0, 1);
MoveInterceptors;
WhoIsAlive;
}

void CommandButton7_Click() {
MovePlayer(-1, -1);
MoveInterceptors;
WhoIsAlive;
}

void CommandButton8_Click() {
MovePlayer(-1, 0);
MoveInterceptors;
WhoIsAlive;
}

void CommandButton9_Click() {
MovePlayer(-1, 1);
MoveInterceptors;
WhoIsAlive;
}

void CommandButtonExit_Click(){
//Call Unload(Me)
UnLoadMe = true;
}

void WhoIsAlive(){

if (cActivePlayer.Alive == false) {
MsgBox("You are dead. You lose.", "nMsgbox2");
//Call Unload(Me)
UnLoadMe = true;
}
else if (CheckInterceptorsAlive() == false) {
MsgBox("All the interceptors are dead. You win.", "nMsgbox2");
//Call Unload(Me)
UnLoadMe = true;
}

}

18 changes: 18 additions & 0 deletions CPP/High_Voltage/mController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#ifndef mController_H
#define mController_H
void mController_Show();
void CommandButton0_Click();
void CommandButton1_Click();
void CommandButton2_Click();
void CommandButton3_Click();
void CommandButton4_Click();
void CommandButton5_Click();
void CommandButton6_Click();
void CommandButton7_Click();
void CommandButton8_Click();
void CommandButton9_Click();
void CommandButtonExit_Click();
void WhoIsAlive();
#endif
2 changes: 2 additions & 0 deletions CPP/High_Voltage/mRunGame.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include"GlobalVariables.h"
#include"mBuildMaze.h"
#include"mController.h"
#include"mRunGame.h"
//Attribute VB_Name = "mRunGame"
//Option Explicit
Expand All @@ -10,6 +11,7 @@ void RunGame() {
//Call InitialFillMaze
InitialFillMaze;
//frmController.Show
mController_Show;
//Call ExitGame
ExitGame;
//
Expand Down

0 comments on commit 4c8ba03

Please sign in to comment.