Principales respuestas
¿Alguien tiene un ejemplo de un Pac Man, hecho en Visual Basic 2008.Net?

Pregunta
-
Respuestas
Todas las respuestas
-
-
-
YO TENGO UNA ACA DE PACMAN O ALGO PARECIDO A ESO ENSERIO PERO ES PARA VISUAL STUDIO 2010
OJJJOOO SI COMPILA BIEN LES RECOMIENDO NO SE ARREPENTIRAN :-)
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <Windows.h>
#define TECLA_ARRIBA 72
#define TECLA_ABAJO 80
#define TECLA_DERECHA 77
#define TECLA_IZQUIERDA 75
#define DORMIR Sleep(80);
#define ALTO 22
#define ANCHO 70
#define TIEMPOMAX 200
using namespace System;
int enemigody=1,enemigoy=21,enemigox=58,enemigod2y=1,enemigo2y=7,enemigo2x=8,enemigod3y=1,enemigo3y=6,enemigo3x=32;
int mapa1[ALTO][ANCHO] = {{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1},
{0,1,1,4,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,0,4,4,0,1,1,1,1,1,1,1,1,1,1,1},
{0,1,1,4,1,1,1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,0,4,0,1,1,1,1,1,1,1,1,1,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,3,3,3,3,3,0,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
int mapa[ALTO][ANCHO];
int posx;
int posy;
int suma_puntos1;
int puntos;
int suma_puntos2;
int suma_vida;
int lado;
int sumapuntos1;
void copiarMapa(){
for (int i = 0; i < ALTO; i++)
{
for (int j=0; j < ANCHO ; j++)
{
mapa[i][j] = mapa1[i][j];
}
}
}
void mostrarMapa(){
Console::SetCursorPosition(0,0);
Console::BackgroundColor=ConsoleColor::Red;
Console::ForegroundColor=ConsoleColor::Blue;
Console::BackgroundColor=ConsoleColor::Black;//fondo
for (int i = 0; i < ALTO; i++)
{
for (int j = 0; j < ANCHO ; j++)
{
if (mapa[i][j] == 1)
{Console::ForegroundColor = ConsoleColor::Blue;
printf("%c",219);
}
if (mapa[i][j] == 0)
{Console::ForegroundColor = ConsoleColor::Black;
printf(" ");
}
if (mapa[i][j] == 3)
{Console::ForegroundColor = ConsoleColor::Cyan;
printf("%c",4);
}
if (mapa[i][j] == 4)
{ Console::ForegroundColor = ConsoleColor::Green;
printf("%c",36);
}
if (mapa[i][j] == 5)
{ Console::ForegroundColor = ConsoleColor::Red;
printf("%c",3);
}
}
printf("\n");
}
}
//PERSONAJES
void mostrarPersonaje(){
Console::SetCursorPosition(posx,posy);
Console::ForegroundColor=ConsoleColor::Red;
printf("%c",1);
}
void borrarPersonaje()
{
Console::SetCursorPosition(posx,posy);
printf(" ");
mapa1[posy][posx]=3;
}
void moverPersonaje()
{
int aux,tecla;
while(1)
{
if(kbhit())
{
aux=getch();
if(aux==2 || aux==224)
{
tecla=getch();
Console::ForegroundColor=ConsoleColor::Red;
Console::SetCursorPosition(posx,posy);
printf(" ");
mapa[posy][posx]=0;
switch(tecla)
{
case 72: if(posy>2)
posy--;break;//arriba
case 80: if(posy<21)
posy++;break;//abajo
case 75: if(posx>0)
posx--;break;//izquierda
case 77: if(posx<69)
posx++;break;//derecha
}
Console::SetCursorPosition(posx,posy);
printf("%c",2);
Sleep(10);
}
}
//ENEMIGO
Console::ForegroundColor=ConsoleColor::DarkYellow;
Console::SetCursorPosition(enemigox,enemigoy);
printf(" ");
if(enemigoy==0 || enemigoy==21 || mapa[enemigoy+enemigody][enemigox]==1)
enemigody=enemigody*-1;
enemigoy=enemigoy+enemigody;
Console::SetCursorPosition(enemigox,enemigoy);
printf("%c",2);
//SEGUNDO ENEMIGO
Console::ForegroundColor=ConsoleColor::Yellow;
Console::SetCursorPosition(enemigo3x,enemigo3y);
printf(" ");
if(enemigo3y==0 || enemigo3y==21 || mapa[enemigo3y+enemigod3y][enemigo3x]==1)
enemigod3y=enemigod3y*-1;
enemigo3y=enemigo3y+enemigod3y;
Console::SetCursorPosition(enemigo3x,enemigo3y);
printf("%c",2);
//TERCER ENEMIGO
Console::ForegroundColor=ConsoleColor::Yellow;
Console::SetCursorPosition(enemigo2x,enemigo2y);
printf(" ");
if(enemigo2y==0 || enemigo2y==21 || mapa[enemigo2y+enemigod2y][enemigo2x]==1)
enemigod2y=enemigod2y*-1;
enemigo2y=enemigo2y+enemigod2y;
Console::SetCursorPosition(enemigo2x,enemigo2y);
printf("%c",2);
//Puntaje
Console::ForegroundColor=ConsoleColor::Red;
Console::SetCursorPosition(67,21);
if(mapa[posy][posx]==3)
{
suma_puntos1=suma_puntos1+20;
mapa[posy][posx]=0;
}
if(mapa[posy][posx]==4)
{
suma_puntos1=suma_puntos1+100;
mapa[posy][posx]=0;
}
printf("Puntaje: %d",suma_puntos1);
//Vidas
Console::ForegroundColor=ConsoleColor::Red;
Console::SetCursorPosition(67,20);
if(mapa[posy][posx]==5)
{
suma_vida=suma_vida+1;
mapa[posy][posx]=0;
}
printf("Vida: %d",suma_vida);
Sleep(50);
Console::ForegroundColor=ConsoleColor::Red;
Console::SetCursorPosition(32,5);
if(posx==enemigox && posy==enemigoy)
{printf("perdiste");break;
}
if(posx==enemigo2x && posy==enemigo2y)
{printf("perdiste");break;
}
if(posx==enemigo3x && posy==enemigo3y)
{printf("perdiste");break;
}
if(sumapuntos1==2000)
{printf("perdiste");
}
Sleep(150);
}
}
int main()
{
printf("Creador : \n\n");
printf("Kevin Silupu");
printf("\n\n Presione una tecla para continuar");
getch();
Console::Clear();
copiarMapa();
mostrarMapa();
borrarPersonaje();
moverPersonaje();
getch();
return 0;
}
-
UNA COSA MAS LOS NUMEROS K APARECEN ARRIBA DEBEN ESTAR ALINEADOS PORSEACASO SI NO LES COMPILA EJM: {{1,0,0,0,0,1,1,1,1,,5,5,5,,3,3,3}
{1,0,0,0,0,1,1,1,1,,5,5,5,,3,3,3,}
{1,0,0,0,0,1,1,1,1,,5,5,5,,3,3,3,}}
ALGO ASI DEBE ESTAR TODO QUE FORMN UN CUADRADO BIEN ALINEADOS ESPERO K L SIRVA CUIDENSE ALAMOS
-