Advertisement
Touch_Grass

Script 2

Jan 7th, 2023
90
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | Source Code | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. class Object {
  4. public:
  5.     int x, y,transparency;
  6.     string Name;
  7.     void MoveX(int Incr) {
  8.         x += Incr;
  9.     }
  10.     void MoveY(int Incr) {
  11.         y += Incr;
  12.     }
  13. };
  14. int main() {
  15.     //MyPart
  16.     bool Running;
  17.     string Input;
  18.     Object MyPart;
  19.     MyPart.x = 0; MyPart.y = 0;
  20.     MyPart.transparency = 0;
  21.     MyPart.Name = "MyPart";
  22.     cout << "THIS IS JUST A TECH DEMO" << endl;
  23.     //MainLoop
  24.     while (Running = true) {
  25.         cout << ">";
  26.         cin >> Input;
  27.         if (Input == "l") {
  28.             MyPart.MoveX(-10);
  29.             cout << MyPart.x << endl;;
  30.         }else if (Input == "r") {
  31.             MyPart.MoveX(10);
  32.             cout << MyPart.x << endl;;
  33.         }else if (Input == "u") {
  34.             MyPart.MoveY(10);
  35.             cout << MyPart.y << endl;;
  36.         }else if (Input == "d") {
  37.             MyPart.MoveY(-10);
  38.             cout << MyPart.y << endl;;
  39.         }else if (Input == ".Help") {
  40.             cout << "Controls: r = Move right, l = Move left, u = Move up, d = Move down" << endl;
  41.         }else if (Input == ".Quit") {
  42.             cout << "Thanks for running this." << endl;
  43.             Running = false;
  44.         }
  45.     }
  46. }
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement