Skip to content

Go to #15

Answered by okaybenji
davidmaoconnor asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, sorry I did not see this until now! Please feel free to tag me @okaybenji with questions.

There's a function you can call to move a player to a room called enterRoom. You just need to pass it the ID of the room to go to.

In order to allow the player to go to any room, you would need to either override the existing go command, or you could just add a goto command that lives alongside it. This is the simplest, as you can just use enterRoom directly.

Here's a simple example. Your player starts in the first room.

// Basic game disk with two rooms.
const disk = {
  roomId: 'start',
  rooms: [
    { id: 'start', name: 'The First Room' },
    { id: 'end, name: 'The Last Room' },
  ]
};

// …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by okaybenji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants