none
¿Alguien tiene un ejemplo de un Pac Man, hecho en Visual Basic 2008.Net? RRS feed

  • Pregunta

  • Por favor, que alguien puede mandarme un ejemplo de un Pac Man, hecho en Visual Basic 2008.Net, que sea fácil de entender por principiantes.

    miércoles, 26 de mayo de 2010 16:55

Respuestas

Todas las respuestas

  • hola

    algo como esto

    http://www.a1vbcode.com/app-4758.asp

    al final del articulo veras el linkd el download el codigo

    saludos


    Leandro Tuttini

    Blog
    Buenos Aires
    Argentina
    • Marcado como respuesta RSS2 jueves, 27 de mayo de 2010 2:45
    miércoles, 26 de mayo de 2010 17:23
  • Muchas gracias por responder siempre a mis dudas.

    Saludos.

    • Marcado como respuesta RSS2 jueves, 27 de mayo de 2010 2:47
    jueves, 27 de mayo de 2010 2:47
  •  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,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,4,4,0,1,1,0,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,0,4,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1},
     {1,1,4,4,4,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,0,4,0,1,1,1,1,1,1,1,1,1,1,0,0,1,0,3,0,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,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,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;
    }

    martes, 3 de diciembre de 2013 0:24
  • 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

    martes, 3 de diciembre de 2013 0:28
  • Hola!! Oye me agrado tu codigo, crees que me puedas ayudar a pasarlo a c# para visual studio 2014? es para un proyecto y ando muy desesperado! 

    te dejo mi mail: ricardorc1104@gmail.com

    miércoles, 4 de noviembre de 2015 15:09