Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

You can access the x, y, and room as variables by modifying the direction in dialog hack.


First add these lines to the last part of the hack code (in bold):

before('startDialog', function () {

    var direction = keys[bitsy.curPlayerDirection];

    if (direction) {

        bitsy.scriptInterpreter.SetVariable('playerDirection', direction);

    }

    //Extra variables

    bitsy.scriptInterpreter.SetVariable('playerRoom', bitsy.player().room);

    bitsy.scriptInterpreter.SetVariable('playerX', bitsy.player().x);

    bitsy.scriptInterpreter.SetVariable('playerY', bitsy.player().y);

});

})(window);


In your case I don't think you'll need to save the room, so save X and Y to new variables (play_last_x, play_last_y) before you move, then load them when you exit to the new room.

Save:

{play_last_x = playerX}{play_last_y = playerY}

Exit/Load (replace with your room):

{exit "2" play_last_x play_last_y }

If you run into problems, make sure you save the variables in a different set of code than the one that loads them. Since this a hack, you won't be able to see it in the editor. I recommend uploading to itch to test following this guide.