This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mygame; | |
import com.badlogic.gdx.ApplicationListener; | |
import com.badlogic.gdx.Input.Buttons; | |
import com.badlogic.gdx.InputAdapter; | |
import com.badlogic.gdx.Screen; | |
import com.badlogic.gdx.graphics.OrthographicCamera; | |
/** | |
* A simple input processor which supports dragging the view by clicking and holding the left mouse button, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* copy & paste into JavaScript portion of your code, or use with require.js */ | |
/* when directly copied into a SugarCube environment, adds itself as setup.Articles */ | |
(function(e,a){"function"===typeof define&&define.amd?define([],a):"object"===typeof exports?module.exports=a():"object"===typeof setup?setup.Articles=a():e.Articles=a()})("undefined"!==typeof self?self:this,function(){var e=[].slice;var a={0:{8:{_:"an"},9:{_:"an"},"-":{1:{1:{_:"an"}},4:{" ":{_:"a"},_:"an"},6:{"-":{_:"an"}},8:{_:"an"}}},1:{1:{0:{_:"a"},1:{_:"a"},2:{_:"a"},3:{_:"a"},4:{_:"a"},5:{_:"a"},6:{_:"a"},7:{_:"a"},8:{_:"a"},9:{_:"a"},_:"an",".":{4:{_:"a"}}},8:{0:{0:{_:"an"},1:{_:"an"},2:{_:"an"}, | |
3:{_:"an"},4:{_:"an"},5:{_:"an"},6:{_:"an"},7:{_:"an"},8:{_:"an"},9:{_:"an"},_:"a"},1:{"-":{_:"a"}," ":{_:"a"}},2:{"-":{_:"a"}," ":{_:"a"}},3:{"-":{_:"a"}," ":{_:"a"}},4:{"-":{_:"a"}," ":{_:"a"}},5:{"-":{_:"a"}," ":{_:"a"}},6:{"-":{_:"a"}," ":{_:"a"}},7:{"-":{_:"a"}," ":{_:"a"}},8:{"-":{_:"a"}," ":{_:"a"}},9:{"-":{_:"a"}," ":{_:"a"}},_:"an"}},8:{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(t,e){'object'==typeof exports&&'undefined'!=typeof module?module.exports=e():'function'==typeof define&&define.amd?define(e):'object'==typeof setup?setup.tippy=e():t.tippy=e()}('undefined'!=typeof self?self:this,function(){'use strict';function t(t){return'[object Object]'==={}.toString.call(t)}function a(t){return[].slice.call(t)}function o(e){if(e instanceof Element||t(e))return[e];if(e instanceof NodeList)return a(e);if(Array.isArray(e))return e;try{return a(document.querySelectorAll(e))}catch(t){return[]}}function r(t){t.refObj=!0,t.attributes=t.attributes||{},t.setAttribute=function(e,a){t.attributes[e]=a},t.getAttribute=function(e){return t.attributes[e]},t.removeAttribute=function(e){delete t.attributes[e]},t.hasAttribute=function(e){return e in t.attributes},t.addEventListener=function(){},t.removeEventListener=function(){},t.classList={classNames:{},add:function(e){return t.classList.classNames[e]=!0},remove:function(e){return delete t.classList.classNames[e],!0},contains:function(e){return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} tex | |
* @param {number[]} rect | |
*/ | |
var Sprite = function Sprite(tex, rect) { | |
var sp = this; | |
sp.tex = String(tex); | |
if (Array.isArray(rect)) { | |
if (rect.length != 4) { | |
throw new Error("new Sprite(): rect parameter needs to be exactly four numbers long - [x, y, width, height]"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Dialogue | |
/* dialogue variables - typically something you pass to the initial widget instead of setting them globally */ | |
<<set _dialog = [ | |
{ actor: "A female", text: "Hi!", enter: "<<set $in_dialog = true>>" }, | |
{ text: "Fancy seeing you here ..."}, | |
{ text: "So, do you like my new shoes?", exit: "<<set $in_dialog = false>><<goto 'Next Passage'>>" } | |
]>> | |
<<set _dialogIdx = -1>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The dialogue setup - typically at the start of the passage */ | |
<<set _dialogue = { | |
"": { | |
text: "<div>Before you stands a wizard, clad in heavy robes, scarves, and a pointed hat. He gives a cheerful but heavily muffled greeting. <q>Ownt fon?</q> the wizard inquires as he holds out a handful of rings which radiate magical energy.</div><div>Take one?</div>", | |
choices: [ | |
{ text: "One with a shiny jewel on top!", next: "death" }, | |
{ text: "A band with runes glowing around it!", next: "runes" }, | |
{ text: "Mom told me not to accept strange items from people I don't know…", next: "death"}, | |
{ text: "Go away.", next: "death", filter: "$day != 7" } | |
]}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Inventory 1 [nobr] | |
/* constant data - item pool mostly (goes into StoryInit) */ | |
<<set setup.items = { | |
}>> | |
<<set setup.createItem = function(id, data) { | |
id = String(id); | |
data = data || {}; | |
data.id = id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameEvent { | |
/** | |
* @param {string} target | |
* @param {string} trigger | |
* @param {string} weight | |
* @param {string} priority | |
*/ | |
constructor(target, trigger, weight, priority) { | |
this.target = String(target); | |
this.trigger = trigger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/* Compatibility version for older browsers, created with Babel */ | |
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* More complex, performance-improved version using a binary heap for the "open nodes" set */ | |
/* Binary heap class source by Marijn Haverbeke, https://eloquentjavascript.net/1st_edition/appendix2.html, modified */ | |
/** | |
* Use Dijkstra's algorithm to find the lowest-cost route between start and target nodes | |
* given a graph implementation which provides us with a suitable way to query | |
* the neighbors of a node as well as the cost of traversing from one (source) to | |
* a connected next (target) node. | |
* | |
* Note that this implementation relies on the individual nodes being equal under |
OlderNewer