Skip to content

Instantly share code, notes, and snippets.

@ohiofi
ohiofi / screenShake README.md
Last active November 25, 2015 16:26 — forked from dariusk/README.md
Twine screenShake macro

This Twine version 1 macro lets you make the screen shake! Tested in Chrome and Firefox. Should work in Opera and IE 10+. Uses CSS3 animations, taken from this CSS Reset tutorial.

See a demo in action here.

How to set it up

IMPORTANT NOTE: Due to a bug in Twine 1.3.5, macros did not work on the Start passage. This issue has been fixed in Twine 1.4.1.

  • Paste the contents of the stylesheet.css file below into a new passage. Call the passage whatever you want, and add the tag "stylesheet" to it.
  • Paste the contents of the script.js file below into a new passage. Call the passage whatever you want, and add the tag "script" to it.
@ohiofi
ohiofi / Start passage
Created November 25, 2015 15:38
Twine v1 Screen Shake Effect
<<screenShake 1400>>
"EARTHQUAKE!!!" You yell. No one answers. The shaking seems to have stopped.
/* The number 1400 is the amount of time (in milliseconds) that the screen will shake */
@ohiofi
ohiofi / playSound README
Last active November 25, 2015 16:40
playSound Macro for Twine v1
Audio macro for Twine version 1
Not sure where I found this code, sorry. Will give proper credit when I figure it out.
<<playsound "sfx1.mp3">>
Use playsound to simply play a sound once.
<<loopsound "track1.mp3">><<loopsound "track2.mp3">><<loopsound "track3.mp3">>
Use loopsound to loop background music.
You can split it into tracks, like bass, guitar, drums. If the tracks are the same length, they will remain in sync.
@ohiofi
ohiofi / sheetsMultiSelectCode
Last active May 24, 2018 13:36
Google Sheets Code to Automatically Grade a Multi-Select Question
=countif(C2,"*Jupiter*")+countif(C2,"*Mars*")+countif(C2,"*Neptune*")+countif(C2,"<>*Ares*")+countif(C2,"<>*Poseiden*")
@import url(https://fonts.googleapis.com/css?family=Press+Start+2P);
tw-story {
/* The following changes the text */
color: darkgreen; /* Set text to green or other color */
text-shadow: 1px 1px lightgreen; /* Green text shadow */
font-size: 20px;
font-family: "Press Start 2P","Helvetica","Arial",sans-serif;
@ohiofi
ohiofi / hideTwineBackArrow.css
Last active November 5, 2016 22:23
Hide the Back Arrow in Twine
tw-sidebar {
display:none; /* Hide the undo and redo buttons */
}
// STEP ONE: load all 10 of the sounds. For example…
// var soundA = new Audio("https://cdn.glitch.com/475828fb-3da7-4c90-8b9a-8217d8db7a15%2F0.mp3?1509508399315");
var soundA = new Audio(
"https://cdn.glitch.com/475828fb-3da7-4c90-8b9a-8217d8db7a15%2F0.mp3?1509508399315"
);
var soundB;
var soundC;
var soundD;
@ohiofi
ohiofi / textinputbootstrap.html
Created January 18, 2018 14:39
Read-only text input form with Use button for JS with classes for Bootstrap
<label for="text">Your Backpack:</label><br>
<div class="input-group">
<input type="text" class="form-control input-lg" id="backpack" placeholder="none" readonly>
<div class="input-group-btn">
<button class="btn btn-default btn-lg" type="button" id="useItem" onclick="useItem(document.getElementById('backpack').value)">Use</button>
</div>
</div>
@ohiofi
ohiofi / CookieStuff.js
Created February 1, 2018 15:32
cookie stuff
//Cookie stuff
function setCookie(variablename, variablevalue, exdays) {
var expiredate = new Date();
expiredate.setTime(expiredate.getTime() + (exdays* 24 * 60 * 60 * 1000));
var expires = "expires="+expiredate.toUTCString();
document.cookie = variablename + "=" + variablevalue + ";"+ expires + ";path=/";
console.log(document.cookie);
}
function getCookie(searchVariable) {