- Crec que ja està tot preparat per a implementar... EL MÒDUL "AROUNDERS"!!!! WOOOO!!!!!
This commit is contained in:
@@ -30,6 +30,8 @@ namespace gamestate
|
||||
bool loop_pause();
|
||||
bool loop_menu();
|
||||
|
||||
void backToLoop();
|
||||
|
||||
void draw();
|
||||
void draw_aigua();
|
||||
|
||||
@@ -54,7 +56,6 @@ namespace gamestate
|
||||
play::aigua = draw::loadSurface("aigua.gif");
|
||||
play::faded = draw::createSurface(320, 200);
|
||||
|
||||
// [TODO] CREAR AIGUA PROCESSOR
|
||||
// [TODO] CREAR MARCADOR PROCESSOR
|
||||
|
||||
// [TODO] Crear el primer Arounder
|
||||
@@ -72,10 +73,21 @@ namespace gamestate
|
||||
|
||||
bool loop()
|
||||
{
|
||||
if (play::exit) {
|
||||
if (!draw::isfading()) {
|
||||
play::finalize();
|
||||
if (exit==1) gamestate::postfase::init();
|
||||
// [TODO] if (exit==2) gamestate::mort::init();
|
||||
}
|
||||
draw::render();
|
||||
return true;
|
||||
}
|
||||
|
||||
play::draw();
|
||||
|
||||
if (input::keyPressed(SDL_SCANCODE_P) || input::mouseClk(2) || !game::windowHasFocus)
|
||||
if (input::keyPressed(SDL_SCANCODE_P) || input::mouseClk(input::mouse::button::middle) || !game::windowHasFocus)
|
||||
{
|
||||
arounderCount = game::getTicks() - arounderCount;
|
||||
draw::setSource(nullptr);
|
||||
draw::setDestination(play::faded);
|
||||
draw::draw();
|
||||
@@ -97,6 +109,7 @@ namespace gamestate
|
||||
|
||||
if (input::keyPressed(SDL_SCANCODE_ESCAPE))
|
||||
{
|
||||
arounderCount = game::getTicks() - arounderCount;
|
||||
draw::setSource(nullptr);
|
||||
draw::setDestination(play::faded);
|
||||
draw::draw();
|
||||
@@ -124,14 +137,64 @@ namespace gamestate
|
||||
|
||||
draw::setSource(cursor);
|
||||
draw::draw(input::mouseX(), input::mouseY());
|
||||
|
||||
draw::render();
|
||||
|
||||
if (input::mouseClk(input::mouse::button::right))
|
||||
{
|
||||
// [TODO] arounders::abortarAccio();
|
||||
}
|
||||
|
||||
if (input::mouseClk(input::mouse::button::left))
|
||||
{
|
||||
/* [TODO]
|
||||
if (!arounders::seleccionar())
|
||||
{
|
||||
if (input::mouseY()<165 && arounders::seleccionat != nullptr && arounders::seleccionat->accio == arounders::accions::caminar)
|
||||
{
|
||||
arounders::seleccionat->orientacio = input::mouseX() > arounders::seleccionat->x ? arounders::orientacions::dreta : arounders::orientacions::esquerra;
|
||||
}
|
||||
}
|
||||
|
||||
const int botoPulsat = mapa::procesar();
|
||||
if (botoPulsat != -1 && arounders::seleccionat != nullptr)
|
||||
{
|
||||
if (botoPulsat == arounders::seleccionat->prevista) {
|
||||
arounders::seleccionat->prevista = arounders::seleccionat->accio;
|
||||
} else {
|
||||
arounders::seleccionat->prevista = botoPulsat;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
currentTicks = game::getTicks() - startTicks;
|
||||
if( currentTicks >= mapa::velocitat ) {
|
||||
startTicks = game::getTicks();
|
||||
aigua_frame1 = (aigua_frame1+1)%10;
|
||||
aigua_frame2 = (aigua_frame2+1)%10;
|
||||
|
||||
// [TODO] arounders::update();
|
||||
}
|
||||
|
||||
/* [TODO]
|
||||
if ( (game::getTicks() - arounderCount) >= mapa::velocitat*58) {
|
||||
if (mapa::arounders::eixits < mapa::arounders::totals) {
|
||||
arounders::afegir();
|
||||
mapa::arounders::eixits++;
|
||||
arounderCount = game::getTicks();
|
||||
}
|
||||
}*/
|
||||
|
||||
if (mapa::arounders::arrivats + mapa::arounders::morts == mapa::arounders::totals) {
|
||||
if (mapa::arounders::arrivats >= mapa::arounders::necessaris) {
|
||||
game::setConfig("fase", game::getConfig("fase")+1);
|
||||
draw::fadeout();
|
||||
audio::fadeoutMusic();
|
||||
play::exit = 1;
|
||||
} else {
|
||||
draw::fadeout();
|
||||
audio::fadeoutMusic();
|
||||
play::exit = 2;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -147,9 +210,7 @@ namespace gamestate
|
||||
|
||||
if (input::keyPressed(SDL_SCANCODE_P) || input::keyPressed(SDL_SCANCODE_ESCAPE))
|
||||
{
|
||||
draw::setPalette(play::original_palette, 256);
|
||||
free(play::original_palette);
|
||||
game::setState(gamestate::play::loop);
|
||||
play::backToLoop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -174,18 +235,14 @@ namespace gamestate
|
||||
|
||||
if (input::keyPressed(SDL_SCANCODE_ESCAPE))
|
||||
{
|
||||
draw::setPalette(play::original_palette, 256);
|
||||
free(play::original_palette);
|
||||
game::setState(gamestate::play::loop);
|
||||
play::backToLoop();
|
||||
}
|
||||
|
||||
if (input::mouseClk(1))
|
||||
if (input::mouseClk(input::mouse::button::left))
|
||||
{
|
||||
if (input::mouseX() >= 97 && input::mouseX() <= 223) {
|
||||
if (input::mouseY() >= 60 && input::mouseY() <= 65) {
|
||||
draw::setPalette(play::original_palette, 256);
|
||||
free(play::original_palette);
|
||||
game::setState(gamestate::play::loop);
|
||||
play::backToLoop();
|
||||
}
|
||||
if (input::mouseY() >= 71 && input::mouseY() <= 76) {
|
||||
free(play::original_palette);
|
||||
@@ -208,6 +265,14 @@ namespace gamestate
|
||||
return true;
|
||||
}
|
||||
|
||||
void backToLoop()
|
||||
{
|
||||
draw::setPalette(play::original_palette, 256);
|
||||
free(play::original_palette);
|
||||
game::setState(gamestate::play::loop);
|
||||
arounderCount = game::getTicks() - arounderCount;
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
draw::draw(play::fondo);
|
||||
|
||||
Reference in New Issue
Block a user