Page MenuHomePhabricator (Chris)

No OneTemporary

Size
7 KB
Referenced Files
None
Subscribers
None
diff --git a/SRC/AlmacenDeGraficos.cpp b/SRC/AlmacenDeGraficos.cpp
index 72c0dca..08feafe 100644
--- a/SRC/AlmacenDeGraficos.cpp
+++ b/SRC/AlmacenDeGraficos.cpp
@@ -1,64 +1,64 @@
#include "AlmacenDeGraficos.hpp"
#include "Tablero.hpp"
AlmacenDeGraficos::AlmacenDeGraficos()
{
cargarSpritesPacman();
cargarSpritesFantasma();
cargarPuntos();
}
void AlmacenDeGraficos::cargarSpritesPacman()
{
sf::Image imagen;
- imagen.loadFromFile("/usr/share/comecocos/Sprites/pacman.png");
+ imagen.loadFromFile("./Sprites/pacman.png");
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 2; j++) // dos animaciones por fotograma
{
jugador[i][j].loadFromImage(imagen,sf::IntRect(j*Tablero::ESCALA+i*Tablero::ESCALA*2,0,Tablero::ESCALA,Tablero::ESCALA));
// Personaje::textura[i][j] = &textura[i][j];
}
}
for (int i = 0;i<11;i++)
{
muerto_jugador[i].loadFromImage(imagen,sf::IntRect(i*Tablero::ESCALA,Tablero::ESCALA,Tablero::ESCALA,Tablero::ESCALA));
}
}
void AlmacenDeGraficos::cargarSpritesFantasma()
{
sf::Image imagen;
- imagen.loadFromFile("/usr/share/comecocos/Sprites/Fantasma.png");
+ imagen.loadFromFile("./Sprites/Fantasma.png");
for (int i = 0; i < 4; i++) // 4 fantasmas
{
for (int j = 0; j < 4; j++) // 4 dirreciones
{
for (int k = 0; k < 2; k++) // 2 fotogramas
{
fantasma[i][j][k].loadFromImage(imagen,sf::IntRect(j*40+k*Tablero::ESCALA,i*Tablero::ESCALA,Tablero::ESCALA,Tablero::ESCALA));
}
}
muerto_fantasma[i].loadFromImage(imagen,sf::IntRect(80+Tablero::ESCALA*i,80,Tablero::ESCALA,Tablero::ESCALA));
//Muerto[i].setTexture(Muerto_Texture[i]);
panico_fantasma[i].loadFromImage(imagen,sf::IntRect(i*Tablero::ESCALA,80,Tablero::ESCALA,Tablero::ESCALA));
//Panico_Final[i].setTexture(Panico_Texture[i]);
}
}
void AlmacenDeGraficos::cargarPuntos()
{
sf::Image imagen;
- imagen.loadFromFile("/usr/share/comecocos/Image/Puntuacion.png");
+ imagen.loadFromFile("./Image/Puntuacion.png");
for (int i = 0;i<4;i++)
{
puntos[i].loadFromImage(imagen,sf::IntRect(i*20,0,20,20));
}
}
diff --git a/SRC/AlmacenDeSonido.cpp b/SRC/AlmacenDeSonido.cpp
index 5a0f1c6..6b43b74 100644
--- a/SRC/AlmacenDeSonido.cpp
+++ b/SRC/AlmacenDeSonido.cpp
@@ -1,11 +1,11 @@
#include "AlmacenDeSonido.hpp"
AlmacenDeSonido::AlmacenDeSonido()
{
//ctor
- pacman_beginning.loadFromFile("/usr/share/comecocos/Sound/pacman_beginning.wav");
- pacman_death.loadFromFile("/usr/share/comecocos/Sound/pacman_death.wav");
- pacman_eatfruit.loadFromFile("/usr/share/comecocos/Sound/pacman_eatfruit.wav");
- pacman_rampage.loadFromFile("/usr/share/comecocos/Sound/pacman_rampage.wav");
+ pacman_beginning.loadFromFile("./Sound/pacman_beginning.wav");
+ pacman_death.loadFromFile("./Sound/pacman_death.wav");
+ pacman_eatfruit.loadFromFile("./Sound/pacman_eatfruit.wav");
+ pacman_rampage.loadFromFile("./Sound/pacman_rampage.wav");
}
diff --git a/SRC/Tablero.cpp b/SRC/Tablero.cpp
index 62477f6..f7b53f0 100644
--- a/SRC/Tablero.cpp
+++ b/SRC/Tablero.cpp
@@ -1,139 +1,139 @@
#include "Tablero.hpp"
#include "Puntuacion.hpp"
const char mapa_orig[Tablero::Tamanyo_Mapa_Y][Tablero::Tamanyo_Mapa_X]={
{"xxxxxxxxxxxxxxxxxxxxxxxxxxxx"},
{"xccccccccccccxxccccccccccccx"},
{"xcxxxxcxxxxxcxxcxxxxxcxxxxcx"},
{"xCx xcx xcxxcx xcx xCx"},
/* Fxla 5 */ {"xcxxxxcxxxxxcxxcxxxxxcxxxxcx"},
{"xccccccccccccccccccccccccccx"},
{"xcxxxxcxxcxxxxxxxxcxxcxxxxcx"},
{"xcxxxxcxxcxxxxxxxxcxxcxxxxcx"},
{"xccccccxxccccxxccccxxccccccx"},
/* Fxla 10 */ {"xxxxxxcxxxxxcxxcxxxxxcxxxxxx"},
{" xcxxxxxcxxcxxxxxcx "},
{" xcxx xxcx "},
{" xcxx xxx xxx xxcx "},
{"xxxxxxcxx x x xxcxxxxxx"},
/* Fxla 15 */ {" c x x c "},
{"xxxxxxcxx x x xxcxxxxxx"},
{" xcxx xxxxxxxx xxcx "},
{" xcxx xxcx "},
{" xcxx xxxxxxxx xxcx "},
/* Fxla 20 */ {"xxxxxxcxx xxxxxxxx xxcxxxxxx"},
{"xccccccccccccxxccccccccccccx"},
{"xcxxxxcxxxxxcxxcxxxxxcxxxxcx"},
{"xcxxxxcxxxxxcxxcxxxxxcxxxxcx"},
{"xCccxxccccccc ccccccccxxccCx"},
/* Fxla 25 */ {"xxxcxxcxxcxxxxxxxxcxxcxxcxxx"},
{"xxxcxxcxxcxxxxxxxxcxxcxxcxxx"},
{"xccccccxxccccxxccccxxccccccx"},
{"xcxxxxxxxxxxcxxcxxxxxxxxxxcx"},
{"xcxxxxxxxxxxcxxcxxxxxxxxxxcx"},
/* Fxla 30 */ {"xccccccccccccccccccccccccccx"},
{"xxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
};
Tablero::Tablero(const int resolucionx,const int resoluciony,Puntuacion& p)
: RESOLUCION(resolucionx,resoluciony),puntuacion(p)
{
//ctor
for (int i = 0;i<Tamanyo_Mapa_Y;i++)
{
for (int j = 0;j<Tamanyo_Mapa_X;j++)
{
mapa[i][j] = mapa_orig[i][j];
}
}
- campo.loadFromFile("/usr/share/comecocos/Image/Nivel.png");
+ campo.loadFromFile("./Image/Nivel.png");
campo_con_la_comida.create(resolucionx,resoluciony);
comida_representacion.setRadius(ESCALA/4);
comida_representacion.setFillColor(sf::Color::Yellow);
pildora_representacion.setRadius(ESCALA/4+2);
pildora_representacion.setFillColor(sf::Color::Red);
generarRepresentacion();
}
void Tablero::generarRepresentacion()
{
campo_con_la_comida.clear();
campo_con_la_comida.draw(sf::Sprite(campo));
comida = 0;
for (int i = 0;i<Tamanyo_Mapa_X;i++)
{
for (int j = 0;j<Tamanyo_Mapa_Y;j++)
{
if (esComida(i,j))
{
comida++;
comida_representacion.setPosition(i*ESCALA+ESCALA/4,j*ESCALA+ESCALA/4);
campo_con_la_comida.draw(comida_representacion);
}
else if (esPildora(i,j))
{
comida++;
pildora_representacion.setPosition(i*ESCALA+ESCALA/4-2,j*ESCALA+ESCALA/4-2);
campo_con_la_comida.draw(pildora_representacion);
}
}
}
campo_con_la_comida.display();
sprite.setTexture(campo_con_la_comida.getTexture());
}
bool Tablero::esComida(int x,int y) const
{
return mapa[y][x] == 'c';
}
bool Tablero::esPildora(int x,int y) const
{
return mapa[y][x] == 'C';
}
bool Tablero::comible(int x,int y) const
{
return esComida(x,y) || esPildora(x,y);
}
int Tablero::comer(int x,int y)
{
if (esPared(x,y)) return 0;
else
{
if (comible(x,y))
{
//puntos++;
comida--;
if (esPildora(x,y))
{
puntuacion.comerPildora();
borrarComida(x,y);
return -1;
}
else
{
puntuacion.comerComida();
borrarComida(x,y);
}
return 1;
}
return 0;
}
}
void Tablero::borrarComida(int x,int y)
{
mapa[y][x] = ' ';
generarRepresentacion();
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Sep 12, 6:11 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42922
Default Alt Text
(7 KB)

Event Timeline