Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
José Pardo Madera
/
ProjectoMultimeda2025
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d6bf7c33
authored
Apr 24, 2025
by
Jaime de la Chica Bergillos
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
El principio del fin
parent
a51d8578
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
9 deletions
Executable
Historia.cpp
Historia.h
ObjetoCombinable.h
Executable
View file @
d6bf7c33
No preview for this file type
Historia.cpp
View file @
d6bf7c33
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "Sprite.h"
#include "Sprite.h"
#include "Hitbox.h"
#include "Hitbox.h"
#include "Video.h"
#include "Video.h"
#include "ObjetoCombinable.h"
void
Historia
::
limpiarEstado
(){
void
Historia
::
limpiarEstado
(){
for
(
int
i
=
0
;
i
<
colPantallas
.
size
();
i
++
){
for
(
int
i
=
0
;
i
<
colPantallas
.
size
();
i
++
){
...
@@ -48,7 +49,7 @@ static Objeto generarObjetoIman() {
...
@@ -48,7 +49,7 @@ static Objeto generarObjetoIman() {
Hitbox
hitIman
(
0
,
0
,
0
,
0
);
// Trivial, solo esta en el inventario
Hitbox
hitIman
(
0
,
0
,
0
,
0
);
// Trivial, solo esta en el inventario
auto
funcionIman
=
[](
Objeto
*
Pantalla
,
Handle
&
handle
)
->
bool
{
auto
funcionIman
=
[](
Objeto
*
Pantalla
,
Handle
&
handle
)
->
bool
{
play_video
(
"assets/ConseguirLlave"
,
"es"
);
play_video
(
"assets/ConseguirLlave"
,
"es"
);
historiaPrincipal
.
pasarDeEstadoA
(
Historia
::
Secuencia
::
CarteraRecuperada
,
Historia
::
Secuencia
::
LlaveConseguida
);
historiaPrincipal
.
pasarDeEstadoA
(
Historia
::
Secuencia
::
ImanSacado
,
Historia
::
Secuencia
::
LlaveConseguida
);
return
false
;
return
false
;
};
};
Objeto
Iman
(
sprIman
,
sprIman
,
sprIman
,
hitIman
,
400
,
150
,
150
,
150
,
normal
,
funcionIman
);
Objeto
Iman
(
sprIman
,
sprIman
,
sprIman
,
hitIman
,
400
,
150
,
150
,
150
,
normal
,
funcionIman
);
...
@@ -161,6 +162,7 @@ static void iniciarCalendarioQuitado(){
...
@@ -161,6 +162,7 @@ static void iniciarCalendarioQuitado(){
}
}
static
void
iniciarPuzlePantallaResuelto
(){
static
void
iniciarPuzlePantallaResuelto
(){
Agapito
.
unsetInventario
(
0
);
play_video
(
"assets/colocarCaja"
,
"es"
);
play_video
(
"assets/colocarCaja"
,
"es"
);
Sprite
sprDestornillador
(
"assets/destornillador.png"
);
Sprite
sprDestornillador
(
"assets/destornillador.png"
);
Hitbox
hitDestornillador
(
0
,
0
,
0
,
0
);
Hitbox
hitDestornillador
(
0
,
0
,
0
,
0
);
...
@@ -234,6 +236,21 @@ static void iniciarCajaAbierta(){
...
@@ -234,6 +236,21 @@ static void iniciarCajaAbierta(){
Objeto
cama
(
sprCama
,
sprCama
,
sprCama
,
hitCama
,
100
,
150
,
50
,
50
,
normal
,
funcionCama
);
Objeto
cama
(
sprCama
,
sprCama
,
sprCama
,
hitCama
,
100
,
150
,
50
,
50
,
normal
,
funcionCama
);
getPantalla1
()
->
anadirObjeto
(
llave
);
getPantalla1
()
->
anadirObjeto
(
llave
);
getPantalla1
()
->
anadirObjeto
(
cama
);
getPantalla1
()
->
anadirObjeto
(
cama
);
Sprite
sprCandado
(
"assets/candado.png"
);
Hitbox
hitCandado
(
0
,
0
,
0
,
0
);
// Trivial, solo esta en el inventario
auto
funcionCandado
=
[](
Objeto
*
Candado
,
Handle
&
handle
)
->
bool
{
if
(
historiaPrincipal
.
getEstadoActual
()
==
Historia
::
Secuencia
::
LlaveConseguida
){
((
ObjetoCombinable
*
)
Candado
)
->
setPulsado
(
true
);
if
(((
ObjetoCombinable
&
)
Agapito
.
getInventario
(
0
).
value
()).
getPulsado
()){
play_video
(
"assets/Salida"
,
"es"
);
}
}
return
false
;
};
ObjetoCombinable
candado
(
sprCandado
,
sprCandado
,
sprCandado
,
hitCandado
,
400
,
150
,
150
,
150
,
normal
,
funcionCandado
);
Agapito
.
setInventario
(
1
)
=
candado
;
}
}
static
void
iniciarCarteraRecuperada
(){
static
void
iniciarCarteraRecuperada
(){
...
@@ -249,16 +266,50 @@ static void iniciarCarteraRecuperada(){
...
@@ -249,16 +266,50 @@ static void iniciarCarteraRecuperada(){
Objeto
llave
(
sprLlave
,
sprLlave
,
sprLlave
,
hitLlave
,
100
,
150
,
50
,
50
,
normal
,
funcionLlave
);
Objeto
llave
(
sprLlave
,
sprLlave
,
sprLlave
,
hitLlave
,
100
,
150
,
50
,
50
,
normal
,
funcionLlave
);
getPantalla1
()
->
anadirObjeto
(
llave
);
getPantalla1
()
->
anadirObjeto
(
llave
);
auto
funcionCartera
=
[](
Objeto
*
Pantalla
,
Handle
&
handle
)
->
bool
{
auto
funcionCartera
=
[](
Objeto
*
Pantalla
,
Handle
&
handle
)
->
bool
{
historiaPrincipal
.
pasarDeEstadoA
(
Historia
::
Secuencia
::
CarteraRecuperada
,
Historia
::
Secuencia
::
ImanSacado
);
play_video
(
"assets/AgapitoSacaIman"
,
"es"
);
play_video
(
"assets/AgapitoSacaIman"
,
"es"
);
getPantallaFecha
()
->
setTieneCarne
(
true
);
getPantallaFecha
()
->
setTieneCarne
(
true
);
Agapito
.
unsetInventario
(
0
);
Agapito
.
unsetInventario
(
0
);
Agapito
.
setInventario
(
0
)
=
generarObjetoIman
();
Agapito
.
setInventario
(
0
)
=
generarObjetoIman
();
return
false
;
return
false
;
};
};
Agapito
.
setInventario
(
0
)
=
generarObjetoCartera
(
funcionCartera
);
Agapito
.
setInventario
(
0
)
=
generarObjetoCartera
(
funcionCartera
);
}
}
static
void
iniciarImanSacado
(){
Objeto
Puerta
=
generarObjetoPuerta
();
getPantalla2
()
->
anadirObjeto
(
Puerta
);
Sprite
sprLlave
(
"assets/llaveHighlight.png"
);
Hitbox
hitLlave
(
300
,
200
,
500
,
-
1000000000
);
auto
funcionLlave
=
[](
Objeto
*
Cajon
,
Handle
&
handle
)
->
bool
{
play_video
(
"assets/ConseguirLlave"
,
"es"
);
historiaPrincipal
.
pasarDeEstadoA
(
Historia
::
Secuencia
::
ImanSacado
,
Historia
::
Secuencia
::
LlaveConseguida
);
return
false
;
};
Objeto
llave
(
sprLlave
,
sprLlave
,
sprLlave
,
hitLlave
,
100
,
150
,
50
,
50
,
normal
,
funcionLlave
);
getPantalla1
()
->
anadirObjeto
(
llave
);
}
static
void
iniciarLlaveConseguida
(){
Objeto
Puerta
=
generarObjetoPuerta
();
getPantalla2
()
->
anadirObjeto
(
Puerta
);
Sprite
sprLlave
(
"assets/llaveNormal.png"
);
Hitbox
hitLlave
(
0
,
0
,
0
,
0
);
// Trivial, solo esta en el inventario
auto
funcionLlave
=
[](
Objeto
*
Llave
,
Handle
&
handle
)
->
bool
{
((
ObjetoCombinable
*
)
Llave
)
->
setPulsado
(
true
);
if
(((
ObjetoCombinable
&
)
Agapito
.
getInventario
(
1
).
value
()).
getPulsado
()){
play_video
(
"assets/Salida"
,
"es"
);
}
return
false
;
};
Objeto
llave
(
sprLlave
,
sprLlave
,
sprLlave
,
hitLlave
,
400
,
150
,
150
,
150
,
normal
,
funcionLlave
);
Agapito
.
setInventario
(
0
)
=
llave
;
}
void
Historia
::
siguienteEstado
(
Secuencia
estado
){
void
Historia
::
siguienteEstado
(
Secuencia
estado
){
...
@@ -291,10 +342,12 @@ void Historia::siguienteEstado(Secuencia estado){
...
@@ -291,10 +342,12 @@ void Historia::siguienteEstado(Secuencia estado){
iniciarCarteraRecuperada
();
iniciarCarteraRecuperada
();
break
;
break
;
case
LlaveConseguida
:
case
ImanSacado
:
iniciarImanSacado
();
break
;
break
;
case
PuedeSalir
:
case
LlaveConseguida
:
iniciarLlaveConseguida
();
break
;
break
;
}
}
}
}
...
...
Historia.h
View file @
d6bf7c33
...
@@ -13,18 +13,18 @@ class Historia{
...
@@ -13,18 +13,18 @@ class Historia{
CajonAbierto
,
CajonAbierto
,
CajaAbierta
,
CajaAbierta
,
CarteraRecuperada
,
CarteraRecuperada
,
LlaveConseguida
,
ImanSacado
,
PuedeSalir
LlaveConseguida
};
};
private
:
private
:
Secuencia
estadoActual
=
CajaAbierta
;
Secuencia
estadoActual
=
PreInicio
;
void
limpiarEstado
();
void
limpiarEstado
();
void
siguienteEstado
(
Secuencia
estado
);
void
siguienteEstado
(
Secuencia
estado
);
public
:
public
:
Secuencia
getEstadoActual
(){
return
estadoActual
;}
void
pasarDeEstadoA
(
Secuencia
estadoAnterior
,
Secuencia
estadoPosterior
);
void
pasarDeEstadoA
(
Secuencia
estadoAnterior
,
Secuencia
estadoPosterior
);
Historia
();
Historia
();
};
};
...
...
ObjetoCombinable.h
0 → 100644
View file @
d6bf7c33
#pragma once
#include "GestorPantallas.h"
#include "Sprite.h"
#include "Hitbox.h"
#include <iostream>
#include "Objeto.h"
class
ObjetoCombinable
:
public
Objeto
{
bool
pulsado
=
false
;
public
:
using
Objeto
::
Objeto
;
bool
getPulsado
(){
return
pulsado
;}
void
setPulsado
(
bool
pul
){
pulsado
=
pul
;}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment