- Intentant que l'aigua se pinte i tal
This commit is contained in:
@@ -11,12 +11,18 @@ namespace gamestate
|
|||||||
draw::surface *fondo = nullptr;
|
draw::surface *fondo = nullptr;
|
||||||
draw::surface *mapa = nullptr;
|
draw::surface *mapa = nullptr;
|
||||||
draw::surface *cursor = nullptr;
|
draw::surface *cursor = nullptr;
|
||||||
|
draw::surface *aigua = nullptr;
|
||||||
|
|
||||||
uint32_t arounderCount;
|
uint32_t arounderCount;
|
||||||
uint32_t startTicks;
|
uint32_t startTicks;
|
||||||
|
uint32_t currentTicks;
|
||||||
|
|
||||||
|
int aigua_frame1 = 0;
|
||||||
|
int aigua_frame2 = 5;
|
||||||
|
|
||||||
bool loop();
|
bool loop();
|
||||||
void draw();
|
void draw();
|
||||||
|
void draw_aigua();
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
@@ -32,6 +38,7 @@ namespace gamestate
|
|||||||
|
|
||||||
// [TODO] Carreagar la resta de gifs que facen falta
|
// [TODO] Carreagar la resta de gifs que facen falta
|
||||||
cursor = draw::loadSurface("cursor.gif");
|
cursor = draw::loadSurface("cursor.gif");
|
||||||
|
aigua = draw::loadSurface("aigua.gif");
|
||||||
//menu = drawManager->LoadFont("menu.gif");
|
//menu = drawManager->LoadFont("menu.gif");
|
||||||
|
|
||||||
// [TODO] CREAR AIGUA PROCESSOR
|
// [TODO] CREAR AIGUA PROCESSOR
|
||||||
@@ -54,6 +61,13 @@ namespace gamestate
|
|||||||
{
|
{
|
||||||
play::draw();
|
play::draw();
|
||||||
|
|
||||||
|
currentTicks = game::getTicks() - startTicks;
|
||||||
|
if( currentTicks >= mapa::velocitat ) {
|
||||||
|
startTicks = game::getTicks();
|
||||||
|
aigua_frame1 = (aigua_frame1+1)%10;
|
||||||
|
aigua_frame2 = (aigua_frame2+1)%10;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +81,7 @@ namespace gamestate
|
|||||||
// [QUESTION] Potser lo del seleccionat se deuria mirar dins de "mapa"?
|
// [QUESTION] Potser lo del seleccionat se deuria mirar dins de "mapa"?
|
||||||
mapa::pintar(accio, prevista); // [TODO] if (arounders::seleccionat) existeix, pillar la accio i la prevista de ell
|
mapa::pintar(accio, prevista); // [TODO] if (arounders::seleccionat) existeix, pillar la accio i la prevista de ell
|
||||||
|
|
||||||
// [TODO] aigua::pintar();
|
void draw_aigua();
|
||||||
// [TODO] arounders::pintar();
|
// [TODO] arounders::pintar();
|
||||||
|
|
||||||
// [TODO] de fet, pintar la marca en el modul "arounders"
|
// [TODO] de fet, pintar la marca en el modul "arounders"
|
||||||
@@ -83,5 +97,19 @@ namespace gamestate
|
|||||||
|
|
||||||
draw::render();
|
draw::render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw_aigua()
|
||||||
|
{
|
||||||
|
static int frames1[10] = {0,1,2,1,0,3,4,5,4,3};
|
||||||
|
static int frames2[10] = {6,7,8,7,6,9,10,11,10,9};
|
||||||
|
int *frames;
|
||||||
|
frames = (game::getConfig("fase")+1) % 5 == 0 ? frames2 : frames1;
|
||||||
|
|
||||||
|
draw::setSource(aigua);
|
||||||
|
for (int i=0;i<10;i++) {
|
||||||
|
draw::draw(i*32, 150, 16, 15, frames[aigua_frame1]*16, 0);
|
||||||
|
draw::draw(16+i*32, 150, 16, 15, frames[aigua_frame2]*16, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,9 @@ namespace mapa
|
|||||||
|
|
||||||
void carregar()
|
void carregar()
|
||||||
{
|
{
|
||||||
|
mapa::velocitat = 70;
|
||||||
|
mapa::contador = game::getTicks();
|
||||||
|
|
||||||
textfile::open("mapes.txt");
|
textfile::open("mapes.txt");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -72,6 +75,7 @@ namespace mapa
|
|||||||
if (mapa) draw::freeSurface(mapa);
|
if (mapa) draw::freeSurface(mapa);
|
||||||
mapa = draw::createSurface(320, 200);
|
mapa = draw::createSurface(320, 200);
|
||||||
draw::setDestination(mapa);
|
draw::setDestination(mapa);
|
||||||
|
draw::cls(0);
|
||||||
|
|
||||||
for (int y=0; y<10; ++y)
|
for (int y=0; y<10; ++y)
|
||||||
for (int x=0; x<20; ++x)
|
for (int x=0; x<20; ++x)
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ namespace mapa
|
|||||||
extern int corda;
|
extern int corda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int velocitat;
|
||||||
|
|
||||||
void carregar();
|
void carregar();
|
||||||
|
|
||||||
void pintar(int accio, int prevista);
|
void pintar(int accio, int prevista);
|
||||||
|
|||||||
Reference in New Issue
Block a user