Está en la página 1de 1

#pragma once

#include <iostream>
#include <vector>
#include <conio.h>

using namespace std;


using namespace System;

const int ANCHO = Console::WindowWidth;


const int ALTO = Console::WindowHeight;

class Letra {
private:
int x, y;
char letra;
int dy;
ConsoleColor color;
public:
Letra(int x, int y, char letra)
: x(x), y(y), letra(letra) {
Random aleatorio;
dy = aleatorio.Next(1, 5);
color = (ConsoleColor)aleatorio.Next(1, 16);
}

void mostrar() {
Console::SetCursorPosition(x, y);
Console::ForegroundColor = color;
cout << letra;
}

void mover() {
Random aleatorio;
y += dy; // Mover hacia abajo en el eje Y
if (y >= ALTO) {
y = 0;
x = aleatorio.Next(0, ANCHO); // Cambiar la posici�n horizontal
aleatoriamente
dy = aleatorio.Next(1, 5); // Cambiar dy aleatoriamente
}
}
};

También podría gustarte