Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Salamdandersad

#1
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.");
    }
}

#2
Quote from: eri0o on Thu 24/10/2024 00:59:59
Spoiler
OK, let's start with the basics and see if you are talking about something like Logic Grid Puzzles. Example below

QuotePuzzle Description:
Lucy is a sought-after cake maker in the friendly small town of Plumpton. There aren't enough residents in the town to run her business full-time, so she bakes and decorates the cakes in the evenings after her main job. Tomorrow night, Lucy will be busy with three cakes to prepare - all different flavors and occasions!

From the clues given, can you determine which client (identified by first name) ordered which type of cake, what the occasion is, and the price each customer will pay?

Clues
  • Emma ordered carrot cake for an event she is hosting at her home, but it did not cost $37.00.
  • Attendees of the farewell party will each be enjoying a big slice of vanilla cake.
  • The cake Michael ordered cost $2.00 less than the cake that is for a birthday.
  • The chocolate cake is Lucy's specialty, which she currently has discounted to $35.00.





It looks like it depends a lot on the size of the grid you wish to make if it's something like this. Essentially you would need to support three states per "cell" in the grid. I guess it also depends on the resolution of what you are doing - like, if it's anything above 320x200 I would suggest to avoid using dynamic sprites. Can you give at least a drawing of the scale of what you want to make?
[close]

Actually I don't think I understand what is Einstein game. I really wish people used more images here... Googling for Einstein game it appears its something like Simon says. I am a bit confused, there appears there is also a weird board game. I put in spoiler because I skipped the Einstein game on the first read of your question and read the description that happens later.

More or less, and simpler. But yes, the idea is that there are clues that help you locate each person (or anything) indirectly from direct statements
#3
I'm really sorry. But I'm very lost, and there aren't any tutorials for AGS in my language, and the ones that exist are too technical or directly advanced.

I'm trying to create a puzzle, a wall with the Einstein game (the typical puzzle where, based on some clues: John lives in the yellow house, the American is John, the Spaniard doesn't live next to the American, the one who buys the newspaper is two houses to the left of the one who buys the magazines... and based on those clues, you have to locate each person, house, nationality...)

The idea is that each element appears on a digital screen, and when you press a button, it changes until it's correct (it's verified to be correct by clicking a hotspot).

I tried doing it roughly, checking that each sprite is in a specific location, and it doesn't work. But from what I read in the guide, there are "arrays," but I'm not quite understanding how they work. Can someone help me with that?
#4
Thanks so much now work it!!! :-D
#5
Oh, okay, that's fine. As I said, this is my first time with this engine, but not with others, and I automatically thought it would be the same file handling as other engines.

So I understand that the code for saving is fine, but I would just have to change the file type.

How can I integrate Game.GetSaveSlotDescription into the code then?

Thanks  :smiley:
#6
Hello guys, I'm developing a game for the first time with this engine. I have the first rooms, the music, and the GUI for the start and pause menus. The game is in first person, Myst-style. However, when I try to configure the save and load, it doesn't allow me.

The game works with this code. However, when I try to save, it throws me the error message that I have set (it's in Spanish because I'm from Spain).

The button configuration for the GUIs is correct because I see the error messages. Do I need to do anything extra?

<<// main global script file

// called when the game starts, before the first room is loaded
function game_start()
{
    gGui1.Visible = true; // Muestra el menú de inicio
    gPauseMenu.Visible = false; // Asegúrate de que el menú de pausa esté oculto al inicio
    // Auto-save on the save slot 999
    SetRestartPoint();
}

// called on every game cycle, except when the game is blocked
function repeatedly_execute()
{
}

// called on every game cycle, even when the game is blocked
function repeatedly_execute_always()
{
}

// called when a key is pressed
function on_key_press(eKeyCode keycode, int mod)
{
    // Si el juego está pausado, no se procesan otras teclas
    if (IsGamePaused())
    {
        if (keycode == eKeyEscape)
        {
            // Si se presiona Escape, oculta el menú de pausa
            gPauseMenu.Visible = false;
            // Aquí puedes agregar cualquier lógica para reanudar el juego
        }
        else
        {
            // No reacciona a ninguna otra tecla
            return;
        }
    }

    // Lógica para el menú de inicio
    if (keycode == eKeyQ && (mod & eKeyModCtrl))
    {
        // Ctrl-Q will quit the game
        QuitGame(1);
    }
    else if (keycode == eKeyF9)
    {
        // F9 will restart the game
        RestartGame();
    }
    else if (keycode == eKeyF12)
    {
        // F12 will save a screenshot to the save game folder
        SaveScreenShot("screenshot.pcx");
    }
    else if (mod & eKeyModCtrl)
    {
        if (keycode == eKeyS)
        {
            // Ctrl-S will give the player all defined inventory items
            Debug(0, 0);
        }
        else if (keycode == eKeyV)
        {
            // Ctrl-V will show game engine version and build date
            Debug(1, 0);
        }
        else if (keycode == eKeyA)
        {
            // Ctrl-A will show walkable areas
            Debug(2, 3);
        }
        else if (keycode == eKeyX)
        {
            // Ctrl-X will let the player teleport to any room
            Debug(3, 0);
        }
    }

    // Manejo de la tecla Escape para pausar el juego
    if (keycode == eKeyEscape)
    {
        if (gPauseMenu.Visible == false)
        {
            // Mostrar el menú de pausa
            gPauseMenu.Visible = true;
            // Aquí puedes detener la lógica del juego si es necesario
        }
        else
        {
            // Ocultar el menú de pausa
            gPauseMenu.Visible = false;
            // Reanudar el juego
            // Si necesitas hacer algo específico para reanudar, hazlo aquí
        }
    }
}

// called when a mouse button is clicked
function on_mouse_click(MouseButton button)
{
    if (IsGamePaused())
    {
        // El juego está pausado, así que no procesar clics del ratón
        return;
    }
    else if (button == eMouseLeft)
    {
        // clic izquierdo, intenta usar el modo de cursor actual en esta posición
        Room.ProcessClick(mouse.x, mouse.y, mouse.Mode);
    }
    else if (button == eMouseRight)
    {
        // clic derecho, cambia el modo de cursor
        mouse.SelectNextMode();
    }
}

// Maneja el clic del botón para comenzar el juego
function Button1_OnClick(GUIControl *control, MouseButton button)
{
    // Cambia al jugador a la room 1
    player.ChangeRoom(1);
    // Oculta el menú de inicio después de comenzar el juego
    gGui1.Visible = false;
}

// Maneja el clic del botón "Resume" en el menú de pausa
function btnResume_OnClick(GUIControl *control, MouseButton button)
{
    // Oculta el menú de pausa
    gPauseMenu.Visible = false;
    // Aquí puedes agregar cualquier lógica adicional para reanudar el juego
}

// Maneja el clic del botón "Save" en el menú de pausa
function btnSave_OnClick(GUIControl *control, MouseButton button)
{
    // Guarda el juego en el slot 1, con la descripción "Juego guardado"
    if (SaveGameSlot(1, "Juego guardado en el menú de pausa"))
    {
        // Notifica al jugador que el juego se ha guardado correctamente
        Display("El juego se ha guardado correctamente.");
    }
    else
    {
        // Si el guardado falla, muestra un mensaje de error
        Display("Error: No se pudo guardar el juego en el slot 1.");
        Debug(0, 0); // Mostrar información de depuración
    }
}

// Maneja el clic del botón "Load" en el menú de inicio
function btnLoad_OnClick(GUIControl *control, MouseButton button)
{
    // Verifica si existe un archivo de guardado en el slot 1
    if (File.Exists("savegame1.sav")) // Cambiado para verificar la existencia del archivo
    {
        RestoreGameSlot(1); // Cambiado a RestoreGameSlot
        // Oculta el menú de inicio después de cargar el juego
        gGui1.Visible = false; // Opcional: si quieres ocultar el menú de inicio al cargar
    }
    else
    {
        Display("No hay juego guardado en slot 1.");
    }
}

// Función que se llama cuando se muestra el menú de pausa
function on_pause_menu_show()
{
    // Detén cualquier lógica de juego si es necesario
}

// Función que se llama cuando se oculta el menú de pausa
function on_pause_menu_hide()
{
    // Reanuda cualquier lógica de juego si es necesario
}>>
SMF spam blocked by CleanTalk