Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Object {
- public:
- int x, y,transparency;
- string Name;
- void MoveX(int Incr) {
- x += Incr;
- }
- void MoveY(int Incr) {
- y += Incr;
- }
- };
- int main() {
- //MyPart
- bool Running;
- string Input;
- Object MyPart;
- MyPart.x = 0; MyPart.y = 0;
- MyPart.transparency = 0;
- MyPart.Name = "MyPart";
- cout << "THIS IS JUST A TECH DEMO" << endl;
- //MainLoop
- while (Running = true) {
- cout << ">";
- cin >> Input;
- if (Input == "l") {
- MyPart.MoveX(-10);
- cout << MyPart.x << endl;;
- }else if (Input == "r") {
- MyPart.MoveX(10);
- cout << MyPart.x << endl;;
- }else if (Input == "u") {
- MyPart.MoveY(10);
- cout << MyPart.y << endl;;
- }else if (Input == "d") {
- MyPart.MoveY(-10);
- cout << MyPart.y << endl;;
- }else if (Input == ".Help") {
- cout << "Controls: r = Move right, l = Move left, u = Move up, d = Move down" << endl;
- }else if (Input == ".Quit") {
- cout << "Thanks for running this." << endl;
- Running = false;
- }
- }
- }
Advertisement
Comments
-
- On line 29, 32,35 and 38 i added 2 ";", sorry for the mistake.
Add Comment
Please, Sign In to add comment
Advertisement