Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Link to a new passage in Javascript [Sugarcube]

$
0
0
I'm fairly new to Twine so I'm not sure how this is supposed to work exactly. I've got a dungeon crawler that shows a map and I want to make it so you can move with the WASD keys instead of press to go to the directions. I've got a passage for each direction, but how do I make it so that the WASD keys go to their respective passages and only on the page where relevant?
<<display "Location">> \\Shows the map to the player.

<<script>>
$(document).on("keyup", function(dir) {
	if (dir.which = 68) {
		//This is where you'd go to passage called "East"
	}
});
<</script>>

Now I don't even know if I'm supposed to put the script somewhere else, I looked up the documentation on script in sugarcube and it didn't give much info.

Viewing all articles
Browse latest Browse all 1844

Trending Articles