juego pacman ala Fwh

juego pacman ala Fwh

Postby benjiben143 » Fri Apr 24, 2015 3:31 am

Hola buenas tardes

anexo prg del archivo del juego de pacman hecho en fivewin


le faltan detallitos pero ya se puede jugar


http://www.eleben.com.mx/pacman.zip




Code: Select all  Expand view

// 15 de abril del 2015
// chino72vale@hotmail.com
#include "Fivewin.ch"

MEMVAR xTeclas
MEMVAR nXPos, nYPos, xDonde, oSprite, nXposa, nYposa
MEMVAR aMatriz, Maxren, MaxCol, Omuro, xVidas
MEMVAR oComida, nComida, Van, aComidas, oFantasmas, fXpos, fYpos
MEMVAR xfdonde, XOTRA, XPOS, osay, csay, ofanta1, ofanta2, ofanta3, ofanta4, ofanta5, Ownd
FUNCTION MAIN()

    local oBrush, oTimer
    local i, y, n:=0, m:=0
   
    PUBLIC xTeclas, xvidas
    PUBLIC nXPos, nYPos
    PUBLIC Xdonde, oSprite, oMuro
    PUBLIC aMatriz, Maxren, Maxcol, Omuro
    PUBLIC oComida, nComida, Van, Acomidas
    PUBLIC fXpos, fYpos, Ofantasmas
    PUBLIC xFdonde, xotra, XPOS
    PUBLIC OSAY, CSAY, OFANTA, OFANTA2, OFANTA3, OFANTA4, ofanta5, Ownd
   
                 //12345678901234567890123456789
    amatriz := { {"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},;
                 {"x  o  o o o xxxxx o o o  o  x"},;
                 {"x xxx xxoxx ooooo xxoxx xxx x"},;
                 {"xoxxxoxxoxxoxxxxxoxxoxxoxxxox"},;
                 {"xooooooooooooooooooooooooooox"},;
                 {"xoxxxoxxoxxxxxoxxxxxoxxoxxxox"},;
                 {"xoooooxxoooooxoxoooooxxooooox"},;
                 {"xoxxxoxxxxxxoxoxoxxxxxxoxxxox"},;
                 {"xoxxxoxxoooooooooooooxxoxxxox"},;
                 {"toooooxxoxxxxxoxxxxxoxxooooof"},;
                 {"xoxxxoxxoxxxxxoxxxxxoxxoxxxox"},;
                 {"xoxxxoxxoooooooooooooxxoxxxox"},;
                 {"xoxxxoxxxxxxoxoxoxxxxxxoxxxox"},;
                 {"xoooooxxoooooxoxoooooxxooooox"},;
                 {"xoxxxoxxoxxxxxoxxxxxoxxoxoxox"},;
                 {"xoxxxoooooooooooooooooooxoxox"},;
                 {"xoooooxxxxoxxxoxxxxoxxxoxoxox"},;
                 {"xoxxxoxxxxooooooooooxxxoxoxox"},;
                 {"xooooooooooxxxxxxxxooooooooox"},;
                 {"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}}
                 //65*37
   
    nComida:=0
    XTECLAS = 0
    Van:=0
    XPOS:=0
    nXPos   = 450     // columna
    nYPos   = 540     // rengloN
    xdonde = 1
    Maxren:=20
    Maxcol:=29
    xotra:=0
    xfdonde:=2
    // posicion inicial fantasma
    fXpos:=5*30
    fYpos:=15*30
    xVidas:=0
   
    aComidas:=array(MaxRen,MaxCol)
    for i:=1 to maxren
      for y:= 1 to maxcol
        aComidas[i][y]=substr(amatriz[i][1],y,1)
        if substr(amatriz[i][1],y,1)="o"
           nComida++
        endif
      next y
    next i
   
    omuro:=array(maxren,maxcol)
   
    DEFINE WINDOW oWnd FROM 1,1 to 50,125
    @ nYpos, nxPos BITMAP oSprite FILE "recpac\pacman.bmp"  PIXEL  size 30,30 NOBORDER
   
    @ fxPos, fYpos BITMAP ofantasmas FILE "recpac\fanta1.bmp"  PIXEL  size 30,30 NOBORDER
   
    oFanta1:=TFANTASMON():NEW(270,300,,"recpac\fanta2.bmp")
    ofanta2:=TFANTASMON():NEW(360,360,,"recpac\fanta3.bmp")
    ofanta3:=TFANTASMON():NEW(360,360,,"recpac\fanta4.bmp")
    ofanta4:=TFANTASMON():NEW(360,360,,"recpac\fanta5.bmp")
    ofanta5:=TFANTASMON():NEW(360,360,,"recpac\fanta6.bmp")
    n:=30  
   
    // DIBUJANDO LA PANTALLA MAESTRA
    for i:= 1 to maxren
       m:=30
       for y:= 1 to maxcol
          if aComidas[i][y]="x"
             @ n, m BITMAP omuro[i][y] size 30,30 of ownd ;
                    FILE "recpac\marcos.bmp" PIXEL NO BORDER
          ELSE
            if aComidas[i][y]="o"
                 @ n, m BITMAP omuro[i][y] size 30,30 of ownd ;
                    FILE "recpac\comidita.bmp" PIXEL  NOBORDER
             ENDIF
          endif
          m:=m+30
      next y
      n:=n+30
     
    next i
         
    // TERMINA dibujo pantalla
   
    oWnd:bKeyDown :={ | nKey | xteclas:=Teclas(nKey, oSprite)  }        
 
                     
    oSprite:lTransparent = .t.
   
    ownd:binit := { || vueltacompleta() }
   
           
    ACTIVATE WINDOW oWnd // CENTERED
 
    RETURN NIL
   
   
   
FUNCTION TERMINO()
LOCAL DEV:=.t.
LOCAL I, Y
FOR I:=1 TO MAXREN
  FOR Y:=1 TO MAXCOL
     if aComidas[i][y]="o"
        dev:=.f.
     endif
  next y
next i
return dev    
     
   
FUNCTION VUELTACOMPLETA()
LOCAL I
local xcol:=15, xren:=18

sonido_Inicial()
 
 
do while xdonde<>10


checapos()
ofanta1:movimiento_Checapos()
ofanta2:movimiento_Checapos()
ofanta3:movimiento_Checapos()
ofanta4:movimiento_Checapos()
ofanta5:movimiento_Checapos()
nXposa:=nXpos
nyPosa:=nYpos
IF XDONDE =1 // abajo
   nypos = nypos +30
   xren:=nypos/30
   xcol:=nxpos/30
   if aComidas[xren][xcol]="x"
      nYpos := nYpos -30
   endif
  oSprite:LoadBmp( "recpac\pacmana.bmp")
  oWnd:Refresh()
ENDIF

IF XDONDE =0  // arriba
   nypos = nypos -30
   xren:=nypos/30
   xcol:=nxpos/30
   if aComidas[xren][xcol]="x"
      nYpos := nYpos +30
   endif
   oSprite:LoadBmp( "recpac\pacmant.bmp")
   oWnd:Refresh()
   
ENDIF


IF XDONDE =2  // izquierda
   nXpos = nXpos -30
   xren:=nypos/30
   xcol:=nxpos/30
   if aComidas[xren][xcol]="x"
      nXpos := nXpos +30
   else
      if aComidas[xren][xcol]="t"
         nxpos:=870
      endif
     
   endif
   oSprite:LoadBmp( "recpac\pacmani.bmp")
   oWnd:Refresh()
   
ENDIF


IF XDONDE =3 // derecha
   nXpos:= nXpos +30
   xren:=nypos/30
   xcol:=nxpos/30
   if aComidas[xren][xcol]="x"
      nXpos := nxpos -30
   else
      if aComidas[xren][xcol]="f"
         nxpos:=30
      endif
   endif
   
  oSprite:LoadBmp( "recpac\pacmand.bmp")
  oWnd:Refresh()
   
ENDIF


if aComidas[xren][xcol]="o"
    omuro[xren][xcol]:end()
    aComidas[xren][xcol]:=" "
    van ++
    Sonido_Comiendo()
else
   // Sonido_sincomer()
     
endif  

// corrida del fantasmon wey

ofanta1:Movimiento_Fantasma()
ofanta2:Movimiento_Fantasma()
ofanta3:Movimiento_Fantasma()
ofanta4:movimiento_Fantasma()
ofanta5:movimiento_Fantasma()

IF XFDONDE =1 // abajo
   fxpos = fxpos +30
   xren:=fxpos/30
   xcol:=fypos/30
   if aComidas[xren][xcol]="x"
      fxpos := fxpos -30
   endif
   
ENDIF

IF XFDONDE =0  // arriba
   fxpos = fxpos -30
   xren:=fxpos/30
   xcol:=fypos/30
   if aComidas[xren][xcol]="x"
      fxpos := fxpos +30
   endif
   
ENDIF

IF XFDONDE =2  // izquierda
   fypos = fypos -30
   xren:=fxpos/30
   xcol:=fypos/30
   if aComidas[xren][xcol]="x"
       fypos := fypos +30
   //   xfdonde:=1
   //   fxpos:=fxpos+30
     
   else
      if aComidas[xren][xcol]="t"
       //fypos := fypos +30
             fYpos:=840
      endif
     
   endif
   
ENDIF


IF XFDONDE =3 // derecha
   fypos:= fypos +30
   xren:=fxpos/30
   xcol:=fypos/30
   if aComidas[xren][xcol]="x"
      fypos := fypos -30
   else
      if aComidas[xren][xcol]="f"
        // fypos := fypos -30
         fYpos:=60
      endif
   endif
   
ENDIF
 
// movimiento del fantasma

Mueve_Pacman()
Mueve_Fantasma()
ofanta1:Mover_Fantasma()
oFanta2:Mover_Fantasma()
ofanta3:Mover_Fantasma()
ofanta4:Mover_Fantasma()
ofanta5:Mover_Fantasma()

if (nYpos=fxpos .and. nXpos=fypos) .or. (nYposa=fXpos .and. nxposa=fypos)     // agarre del fantamas al pacman
   sonido_tecomio()
   syswait(1.9)
 
 //  ? "ey estoy en 3 son dos opciones ", xpos, xotra, xfdonde
   nXPos   = 450     // movemos al pacman alos valor de inicio we
   nYPos   = 540  
   
   fXpos:=5*30       // movemos al fantasmas al valor inicial
   fYpos:=15*30
   xfdonde:= 2
     
   xVidas++     // ya le dio en la madre los fantamas del caribe al pacman
   if xvidas=3
      Sonido_final()
      syswait(5)
      quit
   endif
   
endif  


IF XDONDE=10 .or. van=nComida  // vamanos para fuera
// "ey estoy en 3 son dos opciones ",xpos, xotra,  xfdonde
   Sonido_final()
   syswait(5)
   QUIT
ENDIF

enddo
?//finalizo bye"
Sonido_final()
syswait(5)


RETURN NIL

 

Function Mueve_Pacman()
   oSprite:Move( nYPos, nXPos, , , .T. )
   syswait(.15)
Return NIl

Function Mueve_fantasma()
   ofantasmas:Move( fxPos, fyPos, , , .T. )
Return NIl


Function Sonido_Termina()
   SndPlaySound( "recpac\cry.wav", 3 )
   syswait(.5)
Return NIL


Function Sonido_Comiendo()
   SndPlaySound( "recpac\comida.wav", 3 )
Return Nil

Function Sonido_Inicial()
    SndPlaySound( "recpac\pacman_beginning\pacman_beginning.wav", 3 )
    syswait(4.0)
Return Nil

Function Sonido_rComiendo()
    SndPlaySound( "recpac\pacman_eatfruit\pacman_eatfruit.wav", 3 )
Return Nil

Function Sonido_Final()
    SndPlaySound( "recpac\pacman_intermission.wav", 3 )
Return Nil

Function Sonido_tecomio()
   SndPlaySound( "recpac\pacman_death\pacman_death.wav", 3 )
Return Nil

Function Sonido_finalizar()
   SndPlaySound( "recpac\pacman_death\pacman_death.wav", 3 )
Return Nil

   
Function teclas(xKey, oSprite)


IF xkey = 38  //ARRIBA
   XDONDE = 0
endif
if xkey = 40   // abajo
    XDONDE = 1
   
endif
if xkey = 37
   XDONDE = 2
endif
if xkey = 39
    XDONDE =3
endif

if xkey = 27
   xdonde=10
   
endif  
 
Return XKEY



Function  checapos()
local xren, xcol
//local xotra:=0
local xnpos :=0
   xren:=fxpos/30
   xcol:=fypos/30
xotra:=0  
XPOS:=0
if !acomidas[xren+1][xcol]="x"
   xpos++
   xotra:=xotra + 1
endif
if !acomidas[xren-1][xcol]="x"
   xpos++
   xotra:= xotra + 2
endif
if !acomidas[xren][xcol-1]="x"
   xpos++
   xotra:= xotra + 3
endif
if !acomidas[xren][xcol+1]="x"
   xpos++
   xotra:= xotra + 4
endif

if xpos>2    // quire decir que ay que random para decidi a que lugar ir we  


   xfdonde:=nrandom(3)
 
else
   if xpos=2
      if xotra = 4  .or. xotra=6 .OR. XOTRA=5  //quire decir que esta en la esquina del  muro
         xfdonde:=nrandom(3)
     else
     
      endif
   endif
   

endif

Return NIL


CLASS TFANTASMON
   DATA   xfdonde INIT 2
   DATA   ny      INIT 0
   DATA   xModo   INIT 0
   DATA   xRen    INIT 0
   DATA   XcOL    INIT 0
   DATA   fXpos   INIT 0
   DATA   FyPOS   INIT 0
   DATA   oFanta  
   METHOD New()
   METHOD Mover_Fantasma()
   METHOD Movimiento_Fantasma()
   METHOD Movimiento_ChecaPos()
   METHOD Movimiento_Agarre()

ENDCLASS

METHOD New(fxPos, fyPos, ofanta, odibujo )  CLASS TFANTASMON

     @ fxPos, fYpos BITMAP ofanta FILE odibujo  PIXEL  size 30,30 NOBORDER  
     ::oFanta:=ofanta
     ::fxPos:=fxpos
     ::fYpos:=fYpos

RETURN SELF


METHOD Mover_Fantasma() CLASS TFANTASMON
   ::ofanta:Move( ::fxPos, ::fyPos, , , .T. )
   ::Movimiento_Agarre()
Return NIl


// agarre del fantamas
METHOD Movimiento_Agarre()   CLASS TFANTASMON
if (nYpos=::fxpos .and. nXpos=::fypos)  .or. (nYposa=::fXpos .and. nxposa=::fypos)  // agarre del fantamas al pacman
   sonido_tecomio()
   syswait(1.9)
   //  ? "ey estoy en 3 son dos opciones ", xpos, xotra, xfdonde
   nXPos   = 450     // movemos al pacman alos valor de inicio we
   nYPos   = 540  
   
   xVidas++     // ya le dio en la madre los fantamas del caribe al pacman
   if xvidas=3
      Sonido_final()
      syswait(5)
      quit
   endif
   
Endif
RETURN NIL


// corrida del fantasmon wey
METHOD Movimiento_Fantasma()   CLASS TFANTASMON


IF ::XFDONDE =1 // abajo
   ::fxpos = ::fxpos +30
   ::xren:=::fxpos/30
   ::xcol:=::fypos/30
   if aComidas[::xren][::xcol]="x"
      ::fxpos := ::fxpos -30
   endif
   
   
ENDIF

IF ::XFDONDE =0  // arriba
   ::fxpos = ::fxpos -30
   ::xren:=::fxpos/30
   ::xcol:=::fypos/30
   if aComidas[::xren][::xcol]="x"
      ::fxpos := ::fxpos +30
   endif
   
ENDIF


IF ::XFDONDE =2  // izquierda
   ::fypos = ::fypos -30
   ::xren:=::fxpos/30
   ::xcol:=::fypos/30
   if aComidas[::xren][::xcol]="x"
       ::fypos := ::fypos +30
     
   else
      if aComidas[::xren][::xcol]="t"
       //fypos := fypos +30
             ::fYpos:=840
      endif
     
   endif
   
ENDIF


IF ::XFDONDE =3 // derecha
   ::fypos:= ::fypos +30
   ::xren:=::fxpos/30
   ::xcol:=::fypos/30
   if aComidas[::xren][::xcol]="x"
      ::fypos := ::fypos -30
   else
      if aComidas[::xren][::xcol]="f"
        // fypos := fypos -30
         ::fYpos:=60
      endif
   endif
   
ENDIF
RETURN NIL


METHOD Movimiento_ChecaPos()   CLASS TFANTASMON
local xren, xcol
local xnpos :=0

xren:=::fxpos/30
xcol:=::fypos/30
xotra:=0  
XPOS:=0
if !acomidas[xren+1][xcol]="x"
   xpos++
   xotra:=xotra + 1
endif
if !acomidas[xren-1][xcol]="x"
   xpos++
   xotra:= xotra + 2
endif
if !acomidas[xren][xcol-1]="x"
   xpos++
   xotra:= xotra + 3
endif
if !acomidas[xren][xcol+1]="x"
   xpos++
   xotra:= xotra + 4
endif


if xpos>2    // quire decir que ay que random para decidi a que lugar ir we  

   ::xfdonde:=nrandom(3)
 
else
   if xpos=2
      if xotra = 4  .or. xotra=6 .OR. XOTRA=5  //quire decir que esta en la esquina del  muro
         ::xfdonde:=nrandom(3)
       // ? "ey estoy en 3 son dos opciones ", xotra, xfdonde
     else
        // xfdonde:=nrandom(3)
       //  ? " son 1 opciones ", xotra, xfdonde
     
      endif
   endif
   

endif

Return NIL



 
 
Benjamin Casarrubias Moreno
Cd. Obregon, Sonora, Mexico
chino72vale@hotmail.com
Fivewin 16.05, Harbour 3.2, xharbour 1.2.1, Fivelinux, visual estudio 2013
benjiben143
 
Posts: 114
Joined: Wed Mar 11, 2009 7:32 pm
Location: Obregon, Sonora, Mexico

Re: juego pacman ala Fwh

Postby wmormar » Fri Apr 24, 2015 4:23 am

Excelente amigo

Eso eso es destreza
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: juego pacman ala Fwh

Postby Verhoven » Fri Apr 24, 2015 6:26 am

El zip no lo descarga. No encuentra la página web y sin eso, compila el código, pero no se ve nada.
Saludos.
Verhoven
 
Posts: 505
Joined: Sun Oct 09, 2005 7:23 pm

Re: juego pacman ala Fwh

Postby acuellar » Fri Apr 24, 2015 9:43 am

Muy bueno benjiben

Gracias.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1593
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: juego pacman ala Fwh

Postby hmpaquito » Fri Apr 24, 2015 9:54 am

Muy bueno, sí señor !

Gracias por compartirlo.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: juego pacman ala Fwh

Postby karinha » Fri Apr 24, 2015 1:36 pm

El link no funciona.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: juego pacman ala Fwh

Postby benjiben143 » Fri Apr 24, 2015 1:44 pm

hola ahorita tengo fallas con el servidor

se los puedo mandar por correo o si lo pueden subir a otro servidor


me pueden mandar correo a chino72vale@hotmail.com

saludos
Benjamin Casarrubias Moreno
Cd. Obregon, Sonora, Mexico
chino72vale@hotmail.com
Fivewin 16.05, Harbour 3.2, xharbour 1.2.1, Fivelinux, visual estudio 2013
benjiben143
 
Posts: 114
Joined: Wed Mar 11, 2009 7:32 pm
Location: Obregon, Sonora, Mexico

Re: juego pacman ala Fwh

Postby karinha » Fri Apr 24, 2015 3:09 pm

Excelente!! Muchas gracias.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: juego pacman ala Fwh

Postby Antonio Linares » Fri Apr 24, 2015 4:20 pm

Alguien puede poner unas imágenes de como se ve ? :-)

gracias!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: juego pacman ala Fwh

Postby Manuel Aranda » Fri Apr 24, 2015 4:47 pm

Muy buen trabajo. Muchas gracias.


Image
Un saludo,
Manuel

xH 1.2.3, FWH 23.07 32 bits, BC++ 7.4, xVerce CW 1.0, PellesC
User avatar
Manuel Aranda
 
Posts: 602
Joined: Wed Oct 19, 2005 8:20 pm
Location: España

Re: juego pacman ala Fwh

Postby Patricio Avalos Aguirre » Fri Apr 24, 2015 8:57 pm

Excelente

me he reido ijijiji

muy bien trabajo..
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
User avatar
Patricio Avalos Aguirre
 
Posts: 1059
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: juego pacman ala Fwh

Postby Pablo César » Fri Apr 24, 2015 9:08 pm

No consigo bajarlo... :cry:
Please note that in case you wish to send me PMs or eMails for technical purposes.
I prefer your doubts or solutions always being posted at forum in public.
So in that way, we all grow up together by our shared experience.
User avatar
Pablo César
 
Posts: 8
Joined: Wed Dec 10, 2014 1:14 pm
Location: Paranaguá - Brasil

Re: juego pacman ala Fwh

Postby benjiben143 » Fri Apr 24, 2015 10:04 pm

pásame tu correo al mi correo chino72vale@hotmail.com

y te lo mando

saludos
Benjamin Casarrubias Moreno
Cd. Obregon, Sonora, Mexico
chino72vale@hotmail.com
Fivewin 16.05, Harbour 3.2, xharbour 1.2.1, Fivelinux, visual estudio 2013
benjiben143
 
Posts: 114
Joined: Wed Mar 11, 2009 7:32 pm
Location: Obregon, Sonora, Mexico

Re: juego pacman ala Fwh

Postby luisduque » Fri Apr 24, 2015 10:08 pm

Muy bueno

Felicitaciones, Increíble lo que se puede hacer con Fivewin/Harbour

Imaginación es lo que hace falta
Fivewin 16.11
Harbour 3.2.0
Visual Studio 2015 community
MariaDb/MySql

Ing. MSc. Luis Duque
http://www.accasoft.net
luisduque
 
Posts: 133
Joined: Mon May 12, 2008 4:13 pm
Location: Venezuela

Re: juego pacman ala Fwh

Postby joseluisysturiz » Fri Apr 24, 2015 11:12 pm

INCREIBLE, aguanta FW que ahora es que hay para rato...FELICITACIONES por el ingenio...como lo descargo.? saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 74 guests