Jump to content


Photo

(HTML5/Win) room_persistent working differently


  • Please log in to reply
No replies to this topic

#1 Polatrite

Polatrite

    GMC Member

  • New Member
  • 28 posts

Posted 26 February 2012 - 09:20 PM

I am an old GM user who is trying to take some of his old apps and convert them into HTML5.

I have some code so the player can hit the "E" key and bring up a spell menu to select different spells. He then can hit "E" again to go back to the game. It uses room_persistent to keep the room alive as it switches from the Game room to the Menu room and back to the Game room.

In the player Step event:


if (keyboard_check_pressed(ord('E')))
    {
        global.mousedown = 0;
        global.autofire = 0;
        show_message(global.lastroom);
        show_message(room);
        global.lastroom = room;
        show_message(global.lastroom);
        room_set_persistent(room, true);
        room_goto(room_stats);
    }

In the menu Step event:

if (keyboard_check_pressed(ord('E')) || keyboard_check_pressed(vk_escape))
    {
        show_message(global.lastroom);
        room_set_persistent(room, true);
        room_goto(global.lastroom);
    }

If I ran this code in Windows mode, in the HTML5 editor, it will work fine. When the show_message() boxes pop up, they will print out the room index (5) for global.lastroom, and they'll transition the player correctly.

But when I run this as an HTML5 game, it no longer works. Instead it puts a blank message (perhaps NULL) for the show_message() calls, and when it calls room_goto(global.lastroom) the player receives a black screen and nothing else works.

Does anyone have any ideas?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users