Hello everyone, thank you for the help. I tried using the method that user Khris suggested, but I wasn't able to make it work. In the end, I did it in a more brute-force way: I created several objects, each object could change its sprite with a hotspot, and once each object matched the correct sprite, another hotspot would check that variable. If object1 = sprite2, it would give a correct message; if it didn't match the expected sprite, it would give a negative response.
Code: ags
int currentSprite = 6; // Inicialmente empieza con el sprite 12
int spriteStart = 6; // Primer sprite de la secuencia
int spriteEnd = 25; // Último sprite de la secuencia
function hHotspot1_Interact() {
// Cambia el sprite al siguiente
currentSprite++;
// Si hemos llegado al último sprite, volvemos al primero
if (currentSprite > spriteEnd) {
currentSprite = spriteStart;
}
// Actualiza el sprite del objeto
oObject0.Graphic = currentSprite;
}
function hHotspot2_Interact(Hotspot *theHotspot, CursorMode mode)
{
// Cambia el sprite al siguiente
currentSprite++;
// Si hemos llegado al último sprite, volvemos al primero
if (currentSprite > spriteEnd) {
currentSprite = spriteStart;
}
// Actualiza el sprite del objeto
oObject1.Graphic = currentSprite;
}
function hHotspot3_Interact(Hotspot *theHotspot, CursorMode mode)
{
// Cambia el sprite al siguiente
currentSprite++;
// Si hemos llegado al último sprite, volvemos al primero
if (currentSprite > spriteEnd) {
currentSprite = spriteStart;
}
// Actualiza el sprite del objeto
oObject4.Graphic = currentSprite;
}
function hHotspot4_Interact(Hotspot *theHotspot, CursorMode mode)
{
// Cambia el sprite al siguiente
currentSprite++;
// Si hemos llegado al último sprite, volvemos al primero
if (currentSprite > spriteEnd) {
currentSprite = spriteStart;
}
// Actualiza el sprite del objeto
oObject5.Graphic = currentSprite;
}
function BotonVerificador_Interact(Hotspot *theHotspot, CursorMode mode)
{
// Verificamos si los sprites de los objetos coinciden con los valores deseados
if (oObject0.Graphic == 15 && //
oObject1.Graphic == 10 && //
oObject4.Graphic == 19 &&
oObject5.Graphic == 25) { // Aquí poner todos los objetos y sprites vinculados
// Si todos los objetos tienen los sprites correctos, ejecuta la acción
Display("¡Has desbloqueado la puerta!"); // Muestra un mensaje en pantalla
//(configurar) Cambia el sprite de la puerta para que parezca abierta (ejemplo)
// También podrías reproducir un sonido o activar un cambio de habitación:
// PlaySound(1); // Reproduce un sonido de puerta abriéndose (si has importado el sonido)
} else {
// Si los sprites no coinciden, puedes dar un mensaje de error o hacer otra cosa
Display("La puerta está cerrada, intenta de nuevo.");
}
}