Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "functions.h"
- #include "windows.h"
- #include <iostream>
- #include <fstream>
- using namespace std;
- virtual void functions::Shoot(int x, int y) { // rebound/bounce
- int sleep = 100;
- int l = 0;
- int repeat = 0;
- x += 1;
- while (y < 24) { // bounce down
- system("cls");
- x += 1;
- y += 1;
- cout << "information:" << endl << "x: " << x << " y: " << y;
- WriteTo(x, y);
- cout << "()";
- repeat += 1;
- Sleep(sleep);
- }
- while (l < repeat) { // bounce back up
- l += 1;
- system("cls");
- x += 1;
- y -= 1;
- cout << "information:" << endl << "x: " << x << " y: " << y;
- WriteTo(x, y);
- cout << "()";
- Sleep(sleep);
- }
- system("cls");
- cout << "information:" << endl << "x: " << x << " y: " << y;
- WriteTo(x, y);
- cout << "()";
- }
- virtual void functions::WriteTo(int x, int y) {
- static HANDLE hStdout = NULL;
- COORD coord;
- coord.X = x;
- coord.Y = y;
- if(!hStdout) {
- hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- }
- SetConsoleCursorPosition(hStdout,coord); // sets console cursor position for writing
- ofstream log;
- log.open("c:/users/snowflake/desktop/log.txt", ios::app); // only valid on my pc, I guess I can make it work for everyone
- log << "x: " << x << " y: " << y << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement