You are on page 1of 1

#pragma once

#include <iostream>
using namespace std;
using namespace System;
class CRaton
{
private:
int x, y;
int dx, dy;
int ancho, alto;
public:
CRaton(int px, int py);
void Pintar();
void Borrar();
void Mover();
};
CRaton::CRaton(int px, int py)
{
x = px; y = py;
dx = 1 ; dy = 1;
ancho = 10; alto = 3;
}
void CRaton::Pintar()
{
Console::SetCursorPosition(x, y); cout << " __()() ";
Console::SetCursorPosition(x, y + 1); cout << " / @@ ";
Console::SetCursorPosition(x, y + 2); cout << "`~~~~~\\m__m._>o ";
}
void CRaton::Borrar()
{
Console::SetCursorPosition(x, y); cout << " ";
Console::SetCursorPosition(x, y+1); cout << " ";
Console::SetCursorPosition(x, y+2); cout << " ";
}
void CRaton::Mover()
{
if (x + dx < 0 || x + ancho + dx > 79) dx = dx * -1;
if (y + dy < 0 || y + alto + dy > 24) dy = dy * -1;

x += dx;
y += dy;
}

You might also like