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

Click Anywhere to Continue

$
0
0
So, this question's probably been asked before, but Google is doing me no favors today.

In Sugarcube 2.0, is there a means to click anywhere on a passage to continue to the next passage? In my specific case, I'd need it to only trigger after all the text is displayed in my passage, as I use TheMadExile's delayed text code.

Delayed Text Javascript
/*
	Define up a setting to control the rate of inter-passage
	text fade-in.
*/
Setting.addList('textDelay', {
	label   : 'Choose how long it takes for text to appear.',
	list    : ['No delay', '1s', '2s', '3s'],
	default : '3s'
});

/*
	Set up a postrender task to handle fading in each text
	section based upon a player selected delay.
*/
postrender['delayed-text'] = function (content) {
	// Find all elements containing the `delayed` class.
	var $elems = $(content).find('.delayed');

	// Text appearance delay (in milliseconds).
	var delay;
	switch (settings.textDelay) {
	case '1s':
		delay = 1000;
		break;
	case '2s':
		delay = 2000;
		break;
	case '3s':
		delay = 3000;
		break;
	default:
		delay = 0;
		break;
	}
	
	if (delay > 0) {
		$elems.each(function (i, el) {
			$(this)
				.delay(delay * (i + 1))
				.fadeIn(1000); // 1 second fade-in
		});
	}
	else {
		$elems.removeClass('delayed');
	}
};

CSS
/*
	Set sections containing the `delayed` class to be hidden
	initially.
*/
.delayed {
	display: none;
}



In passage:
Initial text (Not delayed)
@@.delayed; 
First para (delayed)
@@
@@.delayed;
Second Para (Delayed)

[[Next|SomePassage]]
@@


The idea would be to replace the 'next' with being able to click anywhere. The reason I'm seeking this solution is because it's a 400k game, and there's a loooot of passages with [[Next]] or [[Continue]] or [[End]].

I'd like to just slap an animated arrow at the end of the delayed text, and have it so you could click the screen to continue. This would be more visually appealing and immersive, replicating the feel of many VNs I've played.

Viewing all articles
Browse latest Browse all 1844

Trending Articles