addding url link-pathway at door/hidden path

hello all im new to phaser, have a couple weeks experience now i have been expanding off of an example game pokemon style game and i have all my objects created in object layer, and now i am stuck trying to figure out how to open url link in same window when player overlaps a particular object in the object layer

:wave:

location.href = URL, but that will leave the game.

1 Like

thanks for the tip! ill give that a shot, im making a interactive menu for my web page so i want to leave game for the page so that works for me, correct me if im not understanding correctly, the object in object layer is labeled market, so it would be market.href = google.com thanks again!

i definitely wasnt understanding it right, i looked at a few other examples but still cant seem to figure it out
i have put this together from multiple examples, i think its what im after, but i still dont quite understand what im missing here, anytime i try to edit past this point it black/white screen or game stuck in corner and cant play,

const objectLayer = map.findObject(“objects”, (obj) => obj.name === “market”)

function create ()
{
var button = this.object(‘market’).setInteractive();

  button.on('overlap', openExternalLink, this);

}

function openExternalLink ()
{
location.href = url;

   url = 'https://google.com';

}