diff options
530 files changed, 64232 insertions, 429 deletions
@@ -1 +1,5 @@ -*DS_Store*
\ No newline at end of file +*DS_Store* +/docs/source.txt +/docs/docs.txt +/docs/docs.html +/docs/search_results.txt diff --git a/deploy_template/.dragonruby/stubs/html5/dragonruby-html5-loader.js b/deploy_template/.dragonruby/stubs/html5/dragonruby-html5-loader.js new file mode 100644 index 0000000..c321422 --- /dev/null +++ b/deploy_template/.dragonruby/stubs/html5/dragonruby-html5-loader.js @@ -0,0 +1,688 @@ +function syncDataFiles(dbname, baseurl) +{ + var retval = {}; + if (typeof (dbname) === "undefined") { dbname = "files"; } + if (typeof (baseurl) === "undefined") { baseurl = ""; } + + // this is appended to files as an arg to defeat XMLHttpRequest cacheing. + // (Don't do this on most hosting services, from itch.io to + // playonjump.com, since we generally don't update the datafiles anyhow + // once we're shipping, and it defeats Cloudflare cacheing, causing it + // to abuse Amazon S3, etc.) + var urlrandomizerarg = ''; + if (false) { + urlrandomizerarg = "?nocache=" + (Date.now() / 1000 | 0); + } + + var state = { + db: null, + reported_result: false, + xhrs: {}, + remote_manifest: {}, + remote_manifest_loaded: false, + local_manifest: {}, + local_manifest_loaded: false, + total_to_download: 0, + total_downloaded: 0, + total_files: 0, + pending_files: 0 + }; + + var log = function(str) { console.log("CACHEAPPDATA: " + str); } + var debug = function(str) {} + //debug = function(str) { log(str); } + + var clear_state = function() { + for (var i in state.xhrs) { + state.xhrs[i].abort(); + } + delete state.db; + delete state.xhrs; + delete state.remote_manifest; + delete state.local_manifest; + }; + + var failed = function(why) { + if (state.reported_result) { return; } + state.reported_result = true; + log("[FAILURE] " + why); + clear_state(); + if (retval.onerror) { + retval.onerror(why); + } + }; + + retval.abort = function() { + failed("Aborted."); + } + + var succeeded = function() { + if (state.reported_result) { return; } + state.reported_result = true; + var why = "File data synchronized (downloaded " + Math.ceil(state.total_downloaded / 1048576) + " megabytes in " + state.total_files + " files)"; + log("[SUCCESS] " + why); + retval.db = state.db; + retval.manifest = state.remote_manifest; + clear_state(); + if (retval.onsuccess) { + retval.onsuccess(why); + } + }; + + var prevprogress = ""; + var progress = function(str) { + if (state.reported_result) { return; } + if (str == prevprogress) { return; } + prevprogress = str; + log("[PROGRESS] " + str); + if (retval.onprogress) { + retval.onprogress(str, state.total_downloaded, state.total_to_download); + } + } + + debug("Database name is '" + dbname + "'."); + progress("Opening database..."); + var dbopen = window.indexedDB.open(dbname, 1); + + // this is called if we change the version or the database doesn't exist. + // Use it to create the schema. + dbopen.onupgradeneeded = function(event) { + progress("Upgrading/creating local database..."); + var db = event.target.result; + var metadataStore = db.createObjectStore("metadata", { keyPath: 'filename' }); + var dataStore = db.createObjectStore("data", { keyPath: 'chunkid', autoIncrement: true }); + dataStore.createIndex("data", "filename", { unique: false }); + }; + + dbopen.onerror = function(event) { + failed("Couldn't open local database: " + event.target.error.message); + }; + + var finished_file = function(fname) { + debug("Finished writing '" + fname + "' to the database!"); + state.pending_files--; + if (state.pending_files < 0) { + state.pending_files = 0; + debug("Uhoh, pending_files went negative?!"); + } + if (state.pending_files == 0) { + succeeded(); + } + }; + + var store_file = function(xhr) { + // write to the database... + var databuf = xhr.response; + var transaction = state.db.transaction(["metadata", "data"], "readwrite"); + var objstoremetadata = transaction.objectStore("metadata"); + var objstoredata = transaction.objectStore("data"); + + objstoremetadata.add({ filename: xhr.filename, filesize: xhr.filesize, filetime: xhr.filetime }); + // !!! FIXME: _of course_ this crashes Safari on large files + /* + var chunksize = 1048576; // 1 megabyte each. + var chunks = Math.ceil(xhr.response.byteLength / chunksize); + for (var i = 0; i < chunks; i++) { + var bufoffset = i * chunksize; + objstoredata.add({ + filename: xhr.filename, + offset: bufoffset, + chunk: new Uint8Array(databuf, bufoffset, chunksize); + }); + } + */ + objstoredata.add({ filename: xhr.filename, offset: 0, chunk: databuf }); + + transaction.oncomplete = function(event) { + finished_file(xhr.filename); // all done here! + }; + }; + + var download_new_files = function() { + if (state.reported_result) { return; } + progress("Downloading new files..."); + var downloadme = []; + for (var i in state.remote_manifest) { + var remoteitem = state.remote_manifest[i]; + var remotefname = i; + if (typeof state.local_manifest[remotefname] !== "undefined") { + debug("remote filename '" + remotefname + "' already downloaded."); + } else { + debug("remote filename '" + remotefname + "' needs downloading."); + // the browser will let a handful of these go in parallel, and + // then will queue the rest, firing events as appropriate + // when it gets around to them, so just fire them all off + // here. + + // !!! FIXME: use the Fetch API, plus streaming, as an option. + // !!! FIXME: It can use less memory, since it doesn't need + // !!! FIXME: to keep the whole file in memory. + state.total_to_download += remoteitem.filesize; + state.total_files++; + state.pending_files++; + + var xhr = new XMLHttpRequest(); + state.xhrs[remotefname] = xhr; + xhr.previously_loaded = 0; + xhr.filename = remotefname; + xhr.filesize = state.remote_manifest[i].filesize; + xhr.filetime = state.remote_manifest[i].filetime; + xhr.expected_filesize = remoteitem.filesize; + xhr.responseType = "arraybuffer"; + xhr.addEventListener("error", function(e) { failed("Download error on '" + e.target.filename + "'!"); }); + xhr.addEventListener("timeout", function(e) { failed("Download timeout on '" + e.target.filename + "'!"); }); + xhr.addEventListener("abort", function(e) { failed("Download abort on '" + e.target.filename + "'!"); }); + + xhr.addEventListener('progress', function(e) { + if (state.reported_result) { return; } + var xhr = e.target; + var additional = e.loaded - xhr.previously_loaded; + state.total_downloaded += additional; + xhr.previously_loaded = e.loaded; + debug("Downloaded " + additional + " more bytes for file '" + xhr.filename + "'"); + var percent = state.total_to_download ? Math.floor((state.total_downloaded / state.total_to_download) * 100.0) : 0; + progress("Downloaded " + percent + "% (" + Math.ceil(state.total_downloaded / 1048576) + "/" + Math.ceil(state.total_to_download / 1048576) + " megabytes)"); + }); + + xhr.addEventListener("load", function(e) { + if (state.reported_result) { return; } + var xhr = e.target; + if (xhr.status != 200) { + failed("Server reported failure downloading '" + xhr.filename + "'!"); + } else { + debug("Finished download of '" + xhr.filename + "'!"); + state.total_downloaded -= xhr.previously_loaded; + state.total_downloaded += xhr.expected_filesize; + xhr.previously_loaded = xhr.expected_filesize; + delete state.xhrs[xhr.filename]; + var percent = state.total_to_download ? Math.floor((state.total_downloaded / state.total_to_download) * 100.0) : 0; + progress("Downloaded " + percent + "% (" + Math.ceil(state.total_downloaded / 1048576) + "/" + Math.ceil(state.total_to_download / 1048576) + " megabytes)"); + store_file(xhr); + } + }); + + xhr.open("get", baseurl + remotefname + urlrandomizerarg, true); + xhr.send(); + } + } + + if (state.pending_files == 0) { + succeeded(); // we're already done. :) + } + }; + + var delete_old_files = function() { + if (state.reported_result) { return; } + var deleteme = [] + for (var i in state.local_manifest) { + var localitem = state.local_manifest[i]; + var localfname = localitem.filename; + var removeme = false; + if (typeof state.remote_manifest[localfname] === "undefined") { + removeme = true; + } else { + var remoteitem = state.remote_manifest[localfname]; + if ( (localitem.filesize != remoteitem.filesize) || + (localitem.filetime != remoteitem.filetime) ) { + removeme = true; + } + } + + if (removeme) { + debug("Marking old file '" + localfname + "' for removal."); + deleteme.push(localfname); + delete state.local_manifest[i]; + } + } + + if (deleteme.length == 0) { + debug("No old files to delete."); + download_new_files(); // just move on to the next stage. + } else { + progress("Cleaning up old files..."); + var transaction = state.db.transaction(["data", "metadata"], "readwrite"); + transaction.oncomplete = function(event) { + debug("All old files are deleted."); + download_new_files(); + }; + + var objstoremetadata = transaction.objectStore("metadata"); + var objstoredata = transaction.objectStore("data"); + var dataindex = objstoredata.index("data"); + for (var i of deleteme) { + debug("Deleting metadata for '" + i + "'."); + objstoremetadata.delete(i); + dataindex.openCursor(IDBKeyRange.only(i)).onsuccess = function(event) { + var cursor = event.target.result; + if (cursor) { + debug("Deleting file chunk " + cursor.value.chunkid + " for '" + cursor.value.filename + "' (offset=" + cursor.value.offset + ", size=" + cursor.value.size + ")."); + objstoredata.delete(cursor.value.chunkid); + cursor.continue(); + } + } + } + } + }; + + var manifest_loaded = function() { + if (state.reported_result) { return; } + if (state.local_manifest_loaded && state.remote_manifest_loaded) { + debug("both manifests loaded, moving on to next step."); + delete_old_files(); // on success, will start downloads. + } + }; + + var load_local_manifest = function(db) { + if (state.reported_result) { return; } + debug("Loading local manifest..."); + var transaction = db.transaction("metadata", "readonly"); + var objstore = transaction.objectStore("metadata"); + var cursor = objstore.openCursor(); + + // this gets called once for each item in the object store. + cursor.onsuccess = function(event) { + if (state.reported_result) { return; } + var cursor = event.target.result; + if (cursor) { + debug("Another local manifest item: '" + cursor.value.filename + "'"); + state.local_manifest[cursor.value.filename] = cursor.value; + cursor.continue(); + } else { + debug("All local manifest items iterated."); + state.local_manifest_loaded = true; + manifest_loaded(); // maybe move on to next step. + } + }; + }; + + dbopen.onsuccess = function(event) { + debug("Database is open!"); + var db = event.target.result; + state.db = db; + + // just catch all database errors here, where they will bubble up + // from objectstores and transactions. + db.onerror = function(event) { + failed("Database error: " + event.target.error.message); + }; + + progress("Loading file manifests..."); + + // this is async, so it happens while remote manifest downloads. + load_local_manifest(db); + + debug("Loading remote manifest..."); + var xhr = new XMLHttpRequest(); + xhr.responseType = "text"; + xhr.addEventListener("error", function(e) { failed("Manifest download error!"); }); + xhr.addEventListener("timeout", function(e) { failed("Manifest download timeout!"); }); + xhr.addEventListener("abort", function(e) { failed("Manifest download abort!"); }); + xhr.addEventListener("load", function(e) { + if (e.target.status != 200) { + failed("Server reported failure downloading manifest!"); + } else { + debug("Remote manifest loaded!"); + debug("json: " + e.target.responseText); + state.remote_manifest_loaded = true; + try { + state.remote_manifest = JSON.parse(e.target.responseText); + } catch (e) { + failed("Remote manifest is corrupted."); + } + delete state.remote_manifest[""] + manifest_loaded(); // maybe move on to next step. + } + }); + xhr.open("get", "manifest.json" + urlrandomizerarg, true); + xhr.send(); + }; + + return retval; +} + +var statusElement = document.getElementById('status'); +var progressElement = document.getElementById('progress'); +var canvasElement = document.getElementById('canvas'); + +canvasElement.style.width = '1280px'; +canvasElement.style.height = '720px'; +canvasElement.style.display = 'block'; +canvasElement.style['margin-left'] = 'auto'; +canvasElement.style['margin-right'] = 'auto'; + +statusElement.style.display = 'none'; +progressElement.style.display = 'none'; +document.getElementById('progressdiv').style.display = 'none'; +document.getElementById('output').style.display = 'none'; +document.getElementById('game-input').style.display = "none" + +if (!window.parent.window.gtk) { + window.parent.window.gtk = {}; +} + +window.parent.window.gtk.saveMain = function(text) { + FS.writeFile('app/main.rb', text); + window.gtk.play(); +} + + +var loadDataFiles = function(dbname, baseurl, onsuccess) { + var syncdata = syncDataFiles(dbname, baseurl); + window.gtk.syncdata = syncdata; + + syncdata.onerror = function(why) { + Module.setStatus(why); + } + + syncdata.onprogress = function(why, total_downloaded, total_to_download) { + Module.setStatus(why); + } + + syncdata.onsuccess = function(why) { + //Module.setStatus(why); + console.log(why); + + GGameFilesDatabase = syncdata.db; + window.gtk.filedb = syncdata.db; + + var db = syncdata.db; + var manifest = syncdata.manifest; + syncdata.failed = false; + syncdata.num_requests = 0; + syncdata.total_requests = 0; + + db.onerror = function(event) { + Module.setStatus("Database error: " + event.target.error.message); + syncdata.failed = true; + }; + + var transaction = db.transaction("data", "readonly"); + var objstore = transaction.objectStore("data"); + var dataindex = objstore.index("data"); + + for (var i in manifest) { + // !!! FIXME: this assumes the whole file is in one chunk, but + // !!! FIXME: that was not my original plan. + syncdata.total_requests++; + syncdata.num_requests++; + //console.log("'" + i + "' is headed for MEMFS..."); + var req = dataindex.get(i); + req.filesize = manifest[i].filesize; + req.onsuccess = function(event) { + var path = "/" + event.target.result.filename; + //console.log("'" + path + "' is loaded in from IndexedDB..."); + var ui8arr = new Uint8Array(event.target.result.chunk); + var len = event.target.filesize; + var arr = new Array(len); + for (var i = 0; i < len; ++i) { + arr[i] = ui8arr[i]; + } + + var basedir = PATH.dirname(path); + FS.mkdirTree(basedir); + + var okay = false; + try { + okay = FS.createDataFile(basedir, PATH.basename(path), arr, true, true, true); + } catch (err) { // throws if file exists, etc. Nuke and try one more time. + FS.unlink(path); + try { + okay = FS.createDataFile(basedir, PATH.basename(path), arr, true, true, true); + } catch (err) { + okay = false; // oh well. + } + } + + if (!okay) { + Module.setStatus("ERROR: Failed to put '" + path + "' in MEMFS."); + } else { + var completed = syncdata.total_requests - syncdata.num_requests; + var percent = Math.floor((completed / syncdata.total_requests) * 100.0); + Module.setStatus("Preparing game data: " + percent + "%"); + //console.log("'" + path + "' has made it to MEMFS! (" + syncdata.num_requests + " to go)"); + syncdata.num_requests--; + if (syncdata.num_requests <= 0) { + if (!syncdata.failed) { + onsuccess(); + } + } + } + }; + } + } +} + +// https://stackoverflow.com/a/7372816 +var base64Encode = function(ui8array) { + var CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var out = "", i = 0, len = ui8array.length, c1, c2, c3; + while (i < len) { + c1 = ui8array[i++] & 0xff; + if (i == len) { + out += CHARS.charAt(c1 >> 2); + out += CHARS.charAt((c1 & 0x3) << 4); + out += "=="; + break; + } + c2 = ui8array[i++]; + if (i == len) { + out += CHARS.charAt(c1 >> 2); + out += CHARS.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); + out += CHARS.charAt((c2 & 0xF) << 2); + out += "="; + break; + } + c3 = ui8array[i++]; + out += CHARS.charAt(c1 >> 2); + out += CHARS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); + out += CHARS.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6)); + out += CHARS.charAt(c3 & 0x3F); + } + return out; +} + +var Module = { + noInitialRun: true, + preInit: [], + clickedToPlay: false, + clickToPlayListener: function() { + if (Module.clickedToPlay) return; + Module.clickedToPlay = true; + var div = document.getElementById('clicktoplaydiv'); + if (div) { + div.removeEventListener('click', Module.clickToPlayListener); + document.body.removeChild(div); + } + if (window.parent.window.gtk.starting) { + window.parent.window.gtk.starting(); + } + Module["callMain"](); // go go go! + }, + startClickToPlay: function() { + var base64 = base64Encode(FS.readFile(GDragonRubyIcon, {})); + var div = document.createElement('div'); + var leftPx = ((window.innerWidth - 640) / 2); + var leftPerc = Math.floor((leftPx / window.innerWidth) * 100); + div.id = 'clicktoplaydiv'; + div.style.backgroundColor = 'rgb(40, 44, 52)'; + div.style.left = leftPerc.toString() + "%"; + div.style.top = '10%'; + div.style.display = 'block'; + div.style.position = 'absolute'; + div.style.width = "640px" + div.style.height = "360px" + + + + var img = new Image(); + img.onload = function() { // once we know its size, scale it, keeping aspect ratio. + var zoomRatio = 100.0 / this.width; + img.style.width = (zoomRatio * this.width.toString()) + "px"; + img.style.height = (zoomRatio * this.height.toString()) + "px"; + img.style.display = "block"; + img.style['margin-left'] = 'auto'; + img.style['margin-right'] = 'auto'; + } + + img.style.display = 'none'; + img.src = 'data:image/png;base64,' + base64; + div.appendChild(img); + + + var p; + + p = document.createElement('h1'); + p.textContent = GDragonRubyGameTitle + " " + GDragonRubyGameVersion + " by " + GDragonRubyDevTitle; + p.style.textAlign = 'center'; + p.style.color = '#FFFFFF'; + p.style.width = '100%'; + p.style['font-family'] = "monospace"; + div.appendChild(p); + + p = document.createElement('p'); + p.innerHTML = 'Click here to begin.'; + p.style['font-family'] = "monospace"; + p.style['font-size'] = "20px"; + p.style.textAlign = 'center'; + p.style.backgroundColor = 'rgb(40, 44, 52)'; + p.style.color = '#FFFFFF'; + p.style.width = '100%'; + div.appendChild(p); + + document.body.appendChild(div); + div.addEventListener('click', Module.clickToPlayListener); + window.gtk.play = Module.clickToPlayListener; + }, + preRun: function() { + // set up a persistent store for save games, etc. + FS.mkdir('/persistent'); + FS.mount(IDBFS, {}, '/persistent'); + FS.syncfs(true, function(err) { + if (err) { + console.log("WARNING: Failed to populate persistent store. Save games likely lost?"); + } else { + console.log("Read in from persistent store."); + } + + loadDataFiles(GDragonRubyGameId, 'gamedata/', function() { + console.log("Game data is sync'd to MEMFS. Starting click-to-play()..."); + //Module.setStatus("Ready!"); + //setTimeout(function() { Module.setStatus(""); statusElement.style.display='none'; }, 1000); + Module.setStatus(""); + statusElement.style.display='none'; + Module.startClickToPlay(); + }); + }); + }, + postRun: [], + print: (function() { + var element = document.getElementById('output'); + if (element) element.value = ''; // clear browser cache + return function(text) { + if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); + // These replacements are necessary if you render to raw HTML + //text = text.replace(/&/g, "&"); + //text = text.replace(/</g, "<"); + //text = text.replace(/>/g, ">"); + //text = text.replace('\n', '<br>', 'g'); + console.log(text); + if (element) { + element.value += text + "\n"; + element.scrollTop = element.scrollHeight; // focus on bottom + } + }; + })(), + printErr: function(text) { + if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); + if (0) { // XXX disabled for safety typeof dump == 'function') { + dump(text + '\n'); // fast, straight to the real console + } else { + console.error(text); + } + }, + canvas: (function() { + var canvas = document.getElementById('canvas'); + + // As a default initial behavior, pop up an alert when webgl context is lost. To make your + // application robust, you may want to override this behavior before shipping! + // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 + canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false); + canvas.addEventListener("click", function() { + document.getElementById('toplevel').click(); + document.getElementById('toplevel').focus(); + document.getElementById('game-input').style.display = "inline" + document.getElementById('game-input').focus(); + document.getElementById('game-input').blur(); + document.getElementById('game-input').style.display = "none" + canvas.focus(); + }); + + + return canvas; + })(), + setStatus: function(text) { + if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' }; + if (text === Module.setStatus.text) return; + var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/); + var now = Date.now(); + if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon + if (m) { + text = m[1]; + progressElement.value = parseInt(m[2])*100; + progressElement.max = parseInt(m[4])*100; + progressElement.hidden = false; + } else { + progressElement.value = null; + progressElement.max = null; + progressElement.hidden = true; + } + statusElement.innerHTML = text; + }, + totalDependencies: 0, + monitorRunDependencies: function(left) { + this.totalDependencies = Math.max(this.totalDependencies, left); + Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.'); + } +}; +Module.setStatus('Downloading...'); +window.onerror = function(event) { + // TODO: do not warn on ok events like simulating an infinite loop or exitStatus + Module.setStatus('Exception thrown, see JavaScript console'); + Module.setStatus = function(text) { + if (text) Module.printErr('[post-exception status] ' + text); + }; +}; + +var hasWebAssembly = false; +if (typeof WebAssembly==="object" && typeof WebAssembly.Memory==="function") { + hasWebAssembly = true; +} +//console.log("Do we have WebAssembly? " + ((hasWebAssembly) ? "YES" : "NO")); + +var buildtype = hasWebAssembly ? "wasm" : "asmjs"; +var module = "dragonruby-" + buildtype + ".js"; +window.gtk = {}; +window.gtk.module = Module; + +//console.log("Our main module is: " + module); + +var script = document.createElement('script'); +script.src = module; +if (hasWebAssembly) { + script.async = true; +} else { + script.async = false; // !!! FIXME: can this be async? + (function() { + var memoryInitializer = module + '.mem'; + if (typeof Module['locateFile'] === 'function') { + memoryInitializer = Module['locateFile'](memoryInitializer); + } else if (Module['memoryInitializerPrefixURL']) { + memoryInitializer = Module['memoryInitializerPrefixURL'] + memoryInitializer; + } + var meminitXHR = Module['memoryInitializerRequest'] = new XMLHttpRequest(); + meminitXHR.open('GET', memoryInitializer, true); + meminitXHR.responseType = 'arraybuffer'; + meminitXHR.send(null); + })(); +} +document.body.appendChild(script); diff --git a/deploy_template/.dragonruby/stubs/html5/stub/game.css b/deploy_template/.dragonruby/stubs/html5/stub/game.css new file mode 100644 index 0000000..3fb16d4 --- /dev/null +++ b/deploy_template/.dragonruby/stubs/html5/stub/game.css @@ -0,0 +1,8 @@ +body { + margin: 0; + padding: 0; + border: 0; +} +canvas { + background-color: rgb(40, 44, 52); +} diff --git a/deploy_template/.dragonruby/stubs/html5/stub/index.html b/deploy_template/.dragonruby/stubs/html5/stub/index.html new file mode 100644 index 0000000..b2bcf9f --- /dev/null +++ b/deploy_template/.dragonruby/stubs/html5/stub/index.html @@ -0,0 +1,93 @@ +<!doctype html> +<html lang="en-us"> + <head> + <meta charset="utf-8"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel="icon" href="favicon.png" type="image/png" /> + <title>DragonRuby</title> + <style> + body { + font-family: arial; + margin: 0; + padding: none; + background: #000000; + } + + .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; } + div.emscripten { text-align: center; } + div.emscripten_border { border: 1px solid black; } + /* the canvas *must not* have any border or padding, or mouse coords will be wrong */ + canvas.emscripten { border: 0px none; background-color: black; } + + #emscripten_logo { + display: inline-block; + margin: 0; + } + + @-webkit-keyframes rotation { + from {-webkit-transform: rotate(0deg);} + to {-webkit-transform: rotate(360deg);} + } + @-moz-keyframes rotation { + from {-moz-transform: rotate(0deg);} + to {-moz-transform: rotate(360deg);} + } + @-o-keyframes rotation { + from {-o-transform: rotate(0deg);} + to {-o-transform: rotate(360deg);} + } + @keyframes rotation { + from {transform: rotate(0deg);} + to {transform: rotate(360deg);} + } + + #status { + display: inline-block; + font-weight: bold; + color: rgb(120, 120, 120); + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + + #progress { + height: 20px; + width: 30px; + } + + #output { + width: 100%; + height: 200px; + margin: 0 auto; + margin-top: 10px; + border-left: 0px; + border-right: 0px; + padding-left: 0px; + padding-right: 0px; + display: none; + background-color: black; + color: white; + font-family: 'Lucida Console', Monaco, monospace; + outline: none; + } + </style> + <link rel="stylesheet" href="game.css" /> + <title>DragonRuby Game Toolkit Tutorial</title> + </head> + <body id='toplevel'> + <div class="emscripten_border" id='borderdiv'> + <input id="game-input" autocomplete="off" /> + <canvas class="game emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas> + </div> + <br/> + <textarea style="display: none;" id="output" rows="8"></textarea> + + <div class="emscripten" id="status"></div> + <div class="emscripten" id='progressdiv'> + <progress value="0" max="100" id="progress"></progress> + </div> + + <script type='text/javascript' src='dragonruby-html5-loader.js'></script> + </body> +</html> diff --git a/deploy_template/CHANGELOG.txt b/deploy_template/CHANGELOG.txt index 9bde121..cf22fc9 100644 --- a/deploy_template/CHANGELOG.txt +++ b/deploy_template/CHANGELOG.txt @@ -1,3 +1,261 @@ += 1.14 = + + * [Support] Better HTML5 template. Additional JS events added to + handle loss of keyboard input within an iframe. + * [Bugfix] `args.outputs.screenshots` regression fixed. + * [Docs] Added documentation for a few more Numeric methods. + * [Samples] Brand new advanced sample app: 99_sample_sprite_animation_creator. + The sample app uses `args.outputs.screenshots` and `render_targets` heavily along with + in memory queues as a means to consolidate events coming from + different parts of the app. + + += 1.13 = + + * [API] Sprite angle now accepts fractional degrees. + * [Samples] Better font added to LOWREZJAM 2020 template. + * [API] Added `args.outputs[RENDER_TARGET_NAME]` as an alias to + `args.render_target(RENDER_TARGET_NAME)`. Either of the following will work: + + ```ruby + def tick args + if args.state.tick_count == 1 + args.render_target(:camera).width = 100 + args.render_target(:camera).height = 100 + args.render_target(:camera).solids << [0, 0, 50, 50, 255, 0, 0] + end + + if args.state.tick_count > 0 + args.outputs.sprites << { x: 0, + y: 0, + w: 500, + h: 500, + source_x: 0, + source_y: 0, + source_w: 50, + source_h: 50, + path: :camera } + end + end + + $gtk.reset + ``` + + Is the same as: + + ```ruby + def tick args + if args.state.tick_count == 1 + args.outputs[:camera].width = 100 + args.outputs[:camera].height = 100 + args.outputs[:camera].solids << [0, 0, 50, 50, 255, 0, 0] + end + + if args.state.tick_count > 0 + args.outputs.sprites << { x: 0, + y: 0, + w: 500, + h: 500, + source_x: 0, + source_y: 0, + source_w: 50, + source_h: 50, + path: :camera } + end + end + + $gtk.reset + ``` + += 1.12 = + + * [Samples] LOWREZ Jam sample app reworked in preparation for LOWREZ + Jam 2020 (starts on August 1st so hurry and join). + * [Docs] Docs added for GTK::Mouse, you can access them via the + Console by typing `GTK::Mouse.docs` or `$gtk.args.inputs.mouse.docs`. + * [MacOS] Updated minimum OS support to include MacOS 10.9+. + += 1.11 = + + * [Bugfix] Fixed error in docs_search "TERM". + += 1.10 = + + * [Support] Documentation infrastructure added (take a look at docs/docs.html). Bring up the DragonRuby Console and: + + To search docs you can type `docs_search "SEARCH TERM"` + + If you want to get fancy you can provide a `lambda` to filter documentation: + + docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") } + + * [Bugfix] Fixed sprite rendering issues with source_(x|y|w|h) properties on sprites. + * [Support] Removed double buffering of game if framerate drops below 60 fps. + * [Support] Console now supports mouse wheel scrolling. + * [Support] One time notifications have less noise/easier to read. + * [Bugfix] Rogue ~app/main.rb~ directory will no longer be created if you run a sample app. + += 1.9 = + + * [Bugfix] HTTP on windows should now work, for real this time. + * [Bugfix] Non-720p render targets now use correct coordinate system. + += 1.8 = + + * [Experimental] Added the ability to control the logical game size. You can use cli + arguments to set it. Example ultra-wide support would be: + `./dragonruby --window_width 3840 --window_height 1080` + * [Bugfix] HTTP on windows should now work. + * [Bugfix] `even?` and `odd?` return the correct result for Fixnum. + * [Bugfix] args.intputs.mouse_wheel now reports the delta change in x and y correctly. + * [Bugfix] Improved analog joystick accuracy when converting to percentages. + * [Support] Incorporated pull request from https://github.com/kfischer-okarin that adds + autocompletion to the Console. This is the PR: + - https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/commit/da0fdcfbd2bd9739fe056eb646920df79a32954c + - https://github.com/DragonRuby/dragonruby-game-toolkit-contrib/commit/99305ca79118fa0704c8681f4019738b8c7a500d + += 1.7 = + + * [BREAKING] args.inputs.mouse.wheel.point is gone. Use args.inputs.mouse.x + and .y if you need cursor position. + * [BREAKING] args.inputs.mouse.wheel.x and .y now represent the amount the + mousewheel/trackpad has moved since the last tick and not the mouse cursor + position. Use args.inputs.mouse.x and .y if you need cursor position. + += 1.6 = + + * [API] Sprite now supports source_(x|y|w|h). These properties are consistent with the origin + being in the bottom left. The existing properties tile_(x|y|w|h) assumes that origin 0, 0 is in the top left. + The code below will render the same sprite (in their respective coordinate systems): + + # using tile_(x|y|w|h) properties + args.outputs.sprites << { x: 0, + y: 0, + w: 1280, + h: 100, + path: :block, + tile_x: 0, + tile_y: 720 - 100, + tile_w: 1280, + tile_h: 100 } + + is equivalent to: + + # using source_(x|y|w|h) properties + args.outputs.sprites << { x: 0, + y: 0, + w: 1280, + h: 100, + path: :block, + source_x: 0, + source_y: 0, + source_w: 1280, + source_h: 100 } + + Note: if you provide both tile_(x|y|w|h) and source_(x|y|w|h). The values of tile_ will "win" so as not to + break existing code out there. + * [Bugfix] Updated require to remove duplicate requires of the same file (or files that have recently been required). + * [Bugfix] Strict entities of different types/names serialize and deserialize correctly. + * [Samples] Updated render targets sample app to show two render targets with transparencies. + * [API] No really, render targets now have a transparent background and respect opacity. + += 1.5 = + + * [API] Added $gtk.show_cursor and $gtk.hide_cursor to show and hide the mouse cursor. The + function only needs to be called once. EG: args.gtk.hide_cursor if args.state.tick_count == 0. + * [Samples] Jam Craft 2020 sample app updated to have more comments and demonstrate a custom + mouse cursor. + += 1.4 = + + * [Bugfix] Adding $gtk.reset at the bottom of main.rb will no longer cause an infinite loop. + * [Samples] Sample app added for Jam Craft 2020. + += 1.3 = + + * [Bugfix] Adding $gtk.reset at the bottom of main.rb will no longer cause an infinite loop. + * [Samples] Better instructions added to various sample apps. + += 1.2 = + + * [Bugfix] Top-level require statements within main.rb will load before + invoking the rest of the code in main.rb. + * [Samples] Better keyboard input sample app. + * [Samples] New sample app that shows how to use Numeric#ease_spline. + * [Bugfix] Fixed "FFI::Draw cannot be serialized" error message. + += 1.1 = + + * [Bugfix] Fixed exception associated with providing serialization related help. + * [Bugfix] Fixed comments on how to run tests from CLI. + * [Support] More helpful global variables added. Here's a list: + - $gtk + - $console + - $args + - $state + - $tests + - $record + - $replay + * [API] inputs.keyboard.key_(down|held|up).any? and inputs.keyboard.key_(down|held|up).all? + added. + * [Support] Recording gameplay and replaying streamlined a bit more. GIVE THE + REPLAY FEATURE A SHOT! IT'S AWESOME!! Bring up the console and run: $record.start SEED_NUMBER. + * [Support] Bringing up the console will stop a replay if one is running. + += 1.0 = + + * [News] DragonRuby Game Toolkit turns 1.0. Happy birthday! + * [Bugfix] args.state.new_entity_strict serializes and deserializes correctly now. + * [BREAKING] Entity#hash has been renamed to Entity#as_hash so as not to redefine + Object#hash. This is a "private" method so you probably don't have to worry about + anything breaking on your end. + * [BREAKING] gtk.save_state and gtk.load_state have been replaced with gtk.serialize_state + and gtk.deserialize_state (helpful error messages have been added). + * [Support] Console can now render sprites (this is still in its early stages). Try + $gtk.console.addsprite(w: 50, h: 50, path: "some_path.png"). + * [API] Render targets now have a transparent background and respect opacity. + * [API] Render targets can be cached/programatically created once and reused. + * [Samples] A new render target sample app has been created to show how to cache them. + * [Samples] Easing sample app reworked/simplified. + * [Support] GTK will keep a backup of your source file changes under the tmp directory. + One day this feature will save your ass. + += 20200301 = + + * [Samples] Added sample app that shows how you can draw a cubic bezier curves. + * [Support] Keyup event prints key and raw_key to the console. + * [Support] Circumflex now opens the console. + += 20200227 = + + * [Bugfix] Game will now auto restart in the event of a syntax error. + * [Samples] Sample app added to show how to use a sprite sheet for sprite animations: + 09_sprite_animation_using_tile_sheet. + * [Samples] Sample app added to show how to use a tile sheet for a roguelike: + 20_roguelike_starting_point_two. + * [Samples] Example code added to show how sort an array with a custom sort block: + 00_intermediate_ruby_primer/07_powerful_arrays.txt + * [OSS] The following files have been open sourced at https://github.com/DragonRuby/dragonruby-game-toolkit-contrib: + - modified: dragon/args.rb + - new file: dragon/assert.rb + - new file: dragon/attr_gtk.rb + - modified: dragon/console.rb + - new file: dragon/docs.rb + - new file: dragon/geometry.rb + - new file: dragon/help.rb + - modified: dragon/index.rb + - modified: dragon/inputs.rb + - new file: dragon/log.rb + - new file: dragon/numeric.rb + - new file: dragon/string.rb + - new file: dragon/tests.rb + - new file: dragon/trace.rb + * [Support] Added isometric placeholder sprites. + * [Support] Added $gtk.reset_sprite 'path' to refresh a sprite from + the file system (while the game is running). Future releases will + automatically auto load sprites but you can use this to reload them + on demand. + = 20200225 = * [Bugfix] Fixed macOS compatibility back to Mac OS X 10.9 or so. @@ -22,9 +280,8 @@ = 20200217 = * [Bugfix] `dragonruby-publish` would only build html5. It now builds - all of the platforms again. Ryan "The Juggernaut" Gordon has given Amir - a warning and has told him to be more careful releasing. Amir cackled - in defiance. + all of the platforms again. Ryan has given Amir a warning and has told him + to be more careful releasing. Amir cackled in defiance. = 20200213 = @@ -87,7 +344,7 @@ http. * [Support] [Samples] Added a sample app that shows how create collision detection associated with constraint points against - a ramp. This sample app also demostrates the use of `gtk.slowmo!` + a ramp. This sample app also demonstrates the use of `gtk.slowmo!` which you can use the slow down the tick execution of your game to see things frame by frame (still experimental). * [Support] Added sprites to default template folder. The sprites @@ -165,7 +422,7 @@ * [Samples] Added sample app that shows how trace can be used within a class. * [Support] Added $gtk.log_level. Valid values are :on, - :off. When the value is set to :on, GTK log mesages will show up + :off. When the value is set to :on, GTK log messages will show up in the DragonRuby Console *AND* be written to logs/log.txt. When the value is set to :off, GTK log messages will *NOT* show up in the console, but will *STILL* be written to logs/log.txt @@ -306,7 +563,7 @@ * [Samples] New sample app called 02_collisions_02_moving_objects has been added. * [Support] Previous console messages are subdued if unhandled exception is resolved. This removes visual confusion if another exception is thrown (easier to determine what the current exception is). - * [Support] Added api documentation about thruthy_keys for keyboards and controllers. + * [Support] Added api documentation about truthy_keys for keyboards and controllers. * [API] [Experimental] Hashes now quack like render primitives. For example some_hash[:x] is the same as some_hash.x and can be interchangeable with some_array.x (this is a work in progress so there may be some geometric/collision apis that aren't covered). @@ -316,7 +573,7 @@ loops, and arrays. Special thanks to @raulrita (https://www.twitch.tv/raulrita) for live streaming and bringing light to these enhancements. * [Support] `puts` statements that begin with "====" are rendered as teal in the Console. This - provides a visual seperation that will help with print line debugging. + provides a visual separation that will help with print line debugging. * [OSS] The DragonRuby Game Toolkit Console has been open sourced under an MIT license. You can find it here: https://github.com/DragonRuby/dragonruby-game-toolkit-contrib @@ -325,9 +582,9 @@ * [Support] The mygame directory now contains a documentation folder that provides high level APIs for the engine (it's a work in progress, but a good starting point). * [Samples] A sample app called "hash primitives" has been added that shows how you can use a Hash - to render a primitive. This will make specifying sprite's advanced properites much easier. + to render a primitive. This will make specifying sprite's advanced properties much easier. * [Samples] The sprite limits sample app shows how you can ducktype a class and render it as a sprite. - Doing this is a tiny bit more work, but there is a huge perfomance benefit. + Doing this is a tiny bit more work, but there is a huge performance benefit. * [Bugfix] Internal limits total textures/render targets/fonts is removed. * [BREAKING] args.dragon has been deprecated, you must now use the new property args.gtk. * [BREAKING] args.game has been deprecated, you must now use the new property args.state. @@ -390,7 +647,7 @@ = release-20190731 = - * [Bugfix] Fixed bug in dragon ruby console returning evalued value. + * [Bugfix] Fixed bug in DragonRuby console returning evaled value. * [Support] Updated collisions sample app with comments. * [Support] Added comments for sprite animation sample app. * [Support] dragonruby-publish will look for your game in the @@ -472,9 +729,9 @@ * [API] A new entity type has been introduced and is accessible via `args.state.new_entity_strict` the usage of StrictEntity over OpenEntity (`args.state.new_entity`) yield significantly faster property access. The downside is that `args.state.new_entity_strict` requires - you to define all properties upfront within the implicit block. You will recieve + you to define all properties upfront within the implicit block. You will receive an exception if you attempt to access a property that hasn't be - pre-defined. For usage info and preformance differences, take a look at the Sprite Limit + pre-defined. For usage info and performance differences, take a look at the Sprite Limit sample app. * [Support] Exception messages have been significantly improved. Hashes and Type .to_s information is well formatted. "stack too deep" exceptions resolved. @@ -484,7 +741,7 @@ * [Support] Framerate warnings wait 10 seconds before calculating the moving average. If your framerates begin to drop, consider using `args.state.new_entity_static` for game structures that have been fleshed out. - * [Performance] Rendering of primitives is can support over twice as many sprites at 60 fps (see Sprit Limits + * [Performance] Rendering of primitives is can support over twice as many sprites at 60 fps (see Sprite Limits sample app for demonstration). * [Support] Headless testing has been added. Take a look at the Basic Gorillas sample app to see how headless testing can help you dial into frame-by-frame problems within your game. @@ -507,7 +764,7 @@ args.outputs.sprites << create_sprite(x: 0, y: 0, w: 100, h: 100, vflip: true) ``` - We're still chewing on the API above before it get's integrated + We're still chewing on the API above before it gets integrated into GTK proper. * [API] "Superscript Two" can be used to bring up the DragonRuby Console. People with international keyboards (which don't have a ~ @@ -597,11 +854,11 @@ course of Ruby the programming language. * [Sample] The composition of primitives in DragonRuby GTK are incredibly flexible. A sample app called "Fluid Primitives" has - been beed added to show this flexibility. + been added to show this flexibility. * [MacOS] [Linux] [Windows] If your screen resolution is below 720p, the game will start at a smaller (but still aspect-correct) resolution. * [Sample] Sample added showing `intersects_rect?` collision - tollerances as a topdown level (similar to what's + tolerances as a topdown level (similar to what's in Zelda for the NES). = release-20190516 = @@ -675,7 +932,7 @@ `notepad.exe`. * [Packaging] Default icon added to `mygame`. * [Samples] Reworked `doomwipe` (render targets tech demo) sample app so that - it's less eratic before the effect is revealed. + it's less erratic before the effect is revealed. * [Windows] Fixed bug where rendering would stop on Windows if the screen was resized. * [Size] Deleted files that don't need to be packaged with DragonRuby GTK. diff --git a/deploy_template/mygame/app/main.rb b/deploy_template/mygame/app/main.rb index a7d9ad6..5683cc2 100644 --- a/deploy_template/mygame/app/main.rb +++ b/deploy_template/mygame/app/main.rb @@ -1,6 +1,5 @@ def tick args args.outputs.labels << [ 580, 500, 'Hello World!' ] - args.outputs.labels << [ 475, 150, '(Consider reading README.txt now.)' ] + args.outputs.labels << [ 640, 460, 'Go to docs/docs.html and read it!', 5, 1 ] args.outputs.sprites << [ 576, 310, 128, 101, 'dragonruby.png' ] end - diff --git a/deploy_template/mygame/app/tests.rb b/deploy_template/mygame/app/tests.rb index a60c8be..db71ff6 100644 --- a/deploy_template/mygame/app/tests.rb +++ b/deploy_template/mygame/app/tests.rb @@ -4,7 +4,7 @@ # Here is an example test and game -# To run the test: ./dragonruby mygame --eval tests.rb --no-tick +# To run the test: ./dragonruby mygame --eval app/tests.rb --no-tick class MySuperHappyFunGame attr_gtk diff --git a/deploy_template/mygame/sprites/border-black.png b/deploy_template/mygame/sprites/border-black.png Binary files differnew file mode 100644 index 0000000..c9d0bad --- /dev/null +++ b/deploy_template/mygame/sprites/border-black.png diff --git a/deploy_template/mygame/sprites/dragon-0.png b/deploy_template/mygame/sprites/dragon-0.png Binary files differnew file mode 100644 index 0000000..fb179af --- /dev/null +++ b/deploy_template/mygame/sprites/dragon-0.png diff --git a/deploy_template/mygame/sprites/dragon-1.png b/deploy_template/mygame/sprites/dragon-1.png Binary files differnew file mode 100644 index 0000000..8cfe531 --- /dev/null +++ b/deploy_template/mygame/sprites/dragon-1.png diff --git a/deploy_template/mygame/sprites/dragon-2.png b/deploy_template/mygame/sprites/dragon-2.png Binary files differnew file mode 100644 index 0000000..cb462e1 --- /dev/null +++ b/deploy_template/mygame/sprites/dragon-2.png diff --git a/deploy_template/mygame/sprites/dragon-3.png b/deploy_template/mygame/sprites/dragon-3.png Binary files differnew file mode 100644 index 0000000..04c4977 --- /dev/null +++ b/deploy_template/mygame/sprites/dragon-3.png diff --git a/deploy_template/mygame/sprites/dragon-4.png b/deploy_template/mygame/sprites/dragon-4.png Binary files differnew file mode 100644 index 0000000..b29fa3d --- /dev/null +++ b/deploy_template/mygame/sprites/dragon-4.png diff --git a/deploy_template/mygame/sprites/dragon-5.png b/deploy_template/mygame/sprites/dragon-5.png Binary files differnew file mode 100644 index 0000000..99f4e74 --- /dev/null +++ b/deploy_template/mygame/sprites/dragon-5.png diff --git a/deploy_template/mygame/sprites/explosion-0.png b/deploy_template/mygame/sprites/explosion-0.png Binary files differnew file mode 100644 index 0000000..f48636f --- /dev/null +++ b/deploy_template/mygame/sprites/explosion-0.png diff --git a/deploy_template/mygame/sprites/explosion-1.png b/deploy_template/mygame/sprites/explosion-1.png Binary files differnew file mode 100644 index 0000000..b4018d9 --- /dev/null +++ b/deploy_template/mygame/sprites/explosion-1.png diff --git a/deploy_template/mygame/sprites/explosion-2.png b/deploy_template/mygame/sprites/explosion-2.png Binary files differnew file mode 100644 index 0000000..3abaedd --- /dev/null +++ b/deploy_template/mygame/sprites/explosion-2.png diff --git a/deploy_template/mygame/sprites/explosion-3.png b/deploy_template/mygame/sprites/explosion-3.png Binary files differnew file mode 100644 index 0000000..fe94a5a --- /dev/null +++ b/deploy_template/mygame/sprites/explosion-3.png diff --git a/deploy_template/mygame/sprites/explosion-4.png b/deploy_template/mygame/sprites/explosion-4.png Binary files differnew file mode 100644 index 0000000..ed04237 --- /dev/null +++ b/deploy_template/mygame/sprites/explosion-4.png diff --git a/deploy_template/mygame/sprites/explosion-5.png b/deploy_template/mygame/sprites/explosion-5.png Binary files differnew file mode 100644 index 0000000..2cd8f06 --- /dev/null +++ b/deploy_template/mygame/sprites/explosion-5.png diff --git a/deploy_template/mygame/sprites/explosion-6.png b/deploy_template/mygame/sprites/explosion-6.png Binary files differnew file mode 100644 index 0000000..e55909c --- /dev/null +++ b/deploy_template/mygame/sprites/explosion-6.png diff --git a/deploy_template/mygame/sprites/explosion-sheet.png b/deploy_template/mygame/sprites/explosion-sheet.png Binary files differnew file mode 100644 index 0000000..8559a5c --- /dev/null +++ b/deploy_template/mygame/sprites/explosion-sheet.png diff --git a/deploy_template/mygame/sprites/star.png b/deploy_template/mygame/sprites/star.png Binary files differnew file mode 100644 index 0000000..e0ee0f9 --- /dev/null +++ b/deploy_template/mygame/sprites/star.png diff --git a/docs/docs.css b/docs/docs.css new file mode 100644 index 0000000..25cc677 --- /dev/null +++ b/docs/docs.css @@ -0,0 +1,120 @@ +body { + padding-left: 25px; + padding-right: 25px; + padding-bottom: 50px; + max-width: 920px; + margin-left: auto; + margin-right: auto; + font-size: 16px; + font-family: 'Helvetica', 'Arial', sans-serif; + line-height: 1.5; + font-weight: 300; + background-color: #FFFFFF; + color: #111111; +} + +a { + color: #0077CC; + text-decoration: none; +} + +a:visited { + color: #4A6B82; +} + +.brand { + font-size: 25px; + color: black !important; +} + +.page-link { + margin-right: 15px; +} + +h1 { + font-size: 26px; + border-bottom: solid 1px silver; +} + +h2 { + font-size: 22px; + border-bottom: solid 1px silver; +} + +h3 { + font-size: 18px; + border-bottom: solid 1px silver; +} + +img { + padding: 2px; + max-width: 640px; + max-height: 320px; + border: solid 1px silver; + display: block; + margin-left: auto; + margin-right: auto; +} + +hr { + border: 0; + height: 2px; + margin:18px 0; + position:relative; + background: -moz-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 10%, rgba(0,0,0,0.65) 50%, rgba(0,0,0,0) 90%, rgba(0,0,0,0) 100%); + background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(0,0,0,0)), color-stop(10%,rgba(0,0,0,0)), color-stop(50%,rgba(0,0,0,0.65)), color-stop(90%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0))); + background: -webkit-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 10%,rgba(0,0,0,0.65) 50%,rgba(0,0,0,0) 90%,rgba(0,0,0,0) 100%); + background: -o-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 10%,rgba(0,0,0,0.65) 50%,rgba(0,0,0,0) 90%,rgba(0,0,0,0) 100%); + background: -ms-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 10%,rgba(0,0,0,0.65) 50%,rgba(0,0,0,0) 90%,rgba(0,0,0,0) 100%); + background: linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 10%,rgba(0,0,0,0.65) 50%,rgba(0,0,0,0) 90%,rgba(0,0,0,0) 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#00000000',GradientType=1 ); +} + +hr:before { + content: ""; + display: block; + border-top: solid 1px #f9f9f9; + width: 100%; + height: 1px; + position: absolute; + top: 50%; + z-index: 1; +} + +pre { + border: solid 1px silver; + padding: 10px; + font-size: 14px; + white-space: pre-wrap; + white-space: -moz-pre-wrap; + white-space: -pre-wrap; + white-space: -o-pre-wrap; + word-wrap: break-word; +} + +code { + padding-left: 2px; + padding-right: 2px; + padding-top: 1px; + padding-bottom: 1px; + background-color: #f0f0f0; + border-radius: 5px; +} + +iframe { + max-width: 100%; + display: block; + margin: 0 auto; +} + +.wordwrap { + white-space: pre-wrap; + white-space: -moz-pre-wrap; + white-space: -pre-wrap; + white-space: -o-pre-wrap; + word-wrap: break-word; +} + +blockquote { + font-style: italic; +} diff --git a/docs/docs.html b/docs/docs.html new file mode 100644 index 0000000..b92e9f8 --- /dev/null +++ b/docs/docs.html @@ -0,0 +1,1570 @@ +<html> + <head> + <title>DragonRuby Game Toolkit Documentation</title> + <link href="docs.css" rel="stylesheet" type="text/css" media="all"> + <script src="docs.js"></script> + </head> + <body> + <div id='toc'> + <h1>Table Of Contents</h1> +<ul> +<li><a href='#--dragonruby-game-toolkit-live-docs'>DragonRuby Game Toolkit Live Docs</a></li> +<li><a href='#--hello-world'>Hello World</a></li> +<li><a href='#--join-the-discord-and-subscribe-to-the-news-letter'>Join the Discord and Subscribe to the News Letter</a></li> +<li><a href='#--watch-some-intro-videos'>Watch Some Intro Videos</a></li> +<li><a href='#--getting-started-tutorial'>Getting Started Tutorial</a></li> +<li><a href='#--deploying-to-itch.io'>Deploying To Itch.io</a></li> +<li><a href='#--how-to-determine-what-frame-you-are-on'>How To Determine What Frame You Are On</a></li> +<li><a href='#--how-to-get-current-framerate'>How To Get Current Framerate</a></li> +<li><a href='#--how-to-render-a-sprite-using-an-array'>How To Render A Sprite Using An Array</a></li> +<li><a href='#--more-sprite-properties-as-an-array'>More Sprite Properties As An Array</a></li> +<li><a href='#--different-sprite-representations'>Different Sprite Representations</a></li> +<li><a href='#--how-to-render-a-label'>How To Render A Label</a></li> +<li><a href='#--a-colored-label'>A Colored Label</a></li> +<li><a href='#--extended-label-properties'>Extended Label Properties</a></li> +<li><a href='#--rendering-a-label-as-a--hash-'>Rendering A Label As A <code>Hash</code></a></li> +<li><a href='#--getting-the-size-of-a-piece-of-text'>Getting The Size Of A Piece Of Text</a></li> +<li><a href='#--how-to-play-a-sound'>How To Play A Sound</a></li> +<li><a href='#--using--args.state--to-store-your-game-state'>Using <code>args.state</code> To Store Your Game State</a></li> +<li><a href='#--frequently-asked-questions,-comments,-and-concerns'>Frequently Asked Questions, Comments, and Concerns</a></li> +<li><a href='#--docs---gtk--runtime-'><code>GTK::Runtime</code></a></li> +<li><a href='#--docs---gtk--runtime#reset-'><code>GTK::Runtime#reset</code></a></li> +<li><a href='#--docs---gtk--runtime#calcstringbox-'><code>GTK::Runtime#calcstringbox</code></a></li> +<li><a href='#--docs---array-'><code>Array</code></a></li> +<li><a href='#--docs---array#map-'><code>Array#map</code></a></li> +<li><a href='#--docs---array#each-'><code>Array#each</code></a></li> +<li><a href='#--docs---array#reject_nil-'><code>Array#reject_nil</code></a></li> +<li><a href='#--docs---array#reject_false-'><code>Array#reject_false</code></a></li> +<li><a href='#--docs---array#product-'><code>Array#product</code></a></li> +<li><a href='#--docs---array#map_2d-'><code>Array#map_2d</code></a></li> +<li><a href='#--docs---array#include_any?-'><code>Array#include_any?</code></a></li> +<li><a href='#--docs---array#any_intersect_rect?-'><code>Array#any_intersect_rect?</code></a></li> +<li><a href='#--docs---gtk--outputs-'><code>GTK::Outputs</code></a></li> +<li><a href='#--docs---gtk--outputs#solids-'><code>GTK::Outputs#solids</code></a></li> +<li><a href='#--docs---gtk--outputs#borders-'><code>GTK::Outputs#borders</code></a></li> +<li><a href='#--docs---gtk--mouse-'><code>GTK::Mouse</code></a></li> +<li><a href='#--docs---gtk--mousepoint-'><code>GTK::MousePoint</code></a></li> +<li><a href='#--docs---gtk--openentity-'><code>GTK::OpenEntity</code></a></li> +<li><a href='#--docs---gtk--openentity#as_hash-'><code>GTK::OpenEntity#as_hash</code></a></li> +<li><a href='#--docs---numeric#frame_index-'><code>Numeric#frame_index</code></a></li> +<li><a href='#--docs---numeric#elapsed_time-'><code>Numeric#elapsed_time</code></a></li> +<li><a href='#--docs---numeric#elapsed?-'><code>Numeric#elapsed?</code></a></li> +<li><a href='#--docs---numeric#created?-'><code>Numeric#created?</code></a></li> +<li><a href='#--docs---kernel-'><code>Kernel</code></a></li> +<li><a href='#--docs---kernel--tick_count-'><code>Kernel::tick_count</code></a></li> +<li><a href='#--docs---kernel--global_tick_count-'><code>Kernel::global_tick_count</code></a></li> +</ul> + </div> + <div id='content'> + <h1 id='--dragonruby-game-toolkit-live-docs'>DragonRuby Game Toolkit Live Docs</h1> +<p> +The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game. +</p> +<p> +To search docs you can type <code>docs_search "SEARCH TERM"</code> or if you want to get fancy you can provide a <code>lambda</code> to filter documentation: +</p> +<pre>docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") } +</pre> +<p> +<img src='docs_search.gif'></img> +</p> +<h1 id='--hello-world'>Hello World</h1> +<p> +Welcome to DragonRuby Game Toolkit. Take the steps below to get started. +</p> +<h1 id='--join-the-discord-and-subscribe-to-the-news-letter'>Join the Discord and Subscribe to the News Letter</h1> +<p> +Our Discord channel is <a href='http://discord.dragonruby.org'>http://discord.dragonruby.org</a>. +</p> +<p> +The News Letter will keep you in the loop with regards to current DragonRuby Events: <a href='http://dragonrubydispatch.com'>http://dragonrubydispatch.com</a>. +</p> +<p> +Those who use DragonRuby are called Dragon Riders. This identity is incredibly important to us. When someone asks you: +</p> +<blockquote> +<p> +What game engine do you use? +</p> +</blockquote> +<p> +Reply with: +</p> +<blockquote> +<p> +I am a Dragon Rider. +</p> +</blockquote> +<h1 id='--watch-some-intro-videos'>Watch Some Intro Videos</h1> +<p> +Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them: +</p> +<ol> +<li> Beginner Introduction to DragonRuby Game Toolkit: <a href='https://youtu.be/ixw7TJhU08E'>https://youtu.be/ixw7TJhU08E</a></li> +<li> Intermediate Introduction to Ruby Syntax: <a href='https://youtu.be/HG-XRZ5Ppgc'>https://youtu.be/HG-XRZ5Ppgc</a></li> +<li> Intermediate Introduction to Arrays in Ruby: <a href='https://youtu.be/N72sEYFRqfo'>https://youtu.be/N72sEYFRqfo</a></li> +</ol> +<p> +The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one. +</p> +<p> +You may also want to try this free course provided at <a href='http://dragonruby.school'>http://dragonruby.school</a>. +</p> +<h1 id='--getting-started-tutorial'>Getting Started Tutorial</h1> +<p> +This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: <a href='https://en.wikipedia.org/wiki/Ryan_C._Gordon'>https://en.wikipedia.org/wiki/Ryan_C._Gordon</a>). +</p> +<h2>Introduction</h2> +<p> +Welcome! +</p> +<p> +Here's just a little push to get you started if you're new to programming or game development. +</p> +<p> +If you want to write a game, it's no different than writing any other program for any other framework: there are a few simple rules that might be new to you, but more or less programming is programming no matter what you are building. +</p> +<p> +Did you not know that? Did you think you couldn't write a game because you're a "web guy" or you're writing Java at a desk job? Stop letting people tell you that you can't, because you already have everything you need. +</p> +<p> +Here, we're going to be programming in a language called "Ruby." In the interest of full disclosure, I (Ryan Gordon) wrote the C parts of this toolkit and Ruby looks a little strange to me (Amir Rajan wrote the Ruby parts, discounting the parts I mangled), but I'm going to walk you through the basics because we're all learning together, and if you mostly think of yourself as someone that writes C (or C++, C#, Objective-C), PHP, or Java, then you're only a step behind me right now. +</p> +<h2>Prerequisites</h2> +<p> +Here's the most important thing you should know: Ruby lets you do some complicated things really easily, and you can learn that stuff later. I'm going to show you one or two cool tricks, but that's all. +</p> +<p> +Do you know what an if statement is? A for-loop? An array? That's all you'll need to start. +</p> +<h2>The Game Loop</h2> +<p> +Ok, here are few rules with regards to game development with GTK: +</p> +<ul> +<li>Your game is all going to happen under one function ...</li> +<li>that runs 60 times a second ...</li> +<li>and has to tell the computer what to draw each time.</li> +</ul> +<p> +That's an entire video game in one run-on sentence. +</p> +<p> +Here's that function. You're going to want to put this in mygame/app/main.rb, because that's where we'll look for it by default. Load it up in your favorite text editor. +</p> +<pre>def tick args + args.outputs.labels << [580, 400, 'Hello World!'] +end +</pre> +<p> +Now run <code>dragonruby</code> ...did you get a window with "Hello World!" written in it? Good, you're officially a game developer! +</p> +<h2>Breakdown Of The <code>tick</code> Method</h2> +<p> +<code>mygame/app/main.rb</code>, is where the Ruby source code is located. This looks a little strange, so I'll break it down line by line. In Ruby, a '#' character starts a single-line comment, so I'll talk about this inline. +</p> +<pre># This "def"ines a function, named "tick," which takes a single argument +# named "args". DragonRuby looks for this function and calls it every +# frame, 60 times a second. "args" is a magic structure with lots of +# information in it. You can set variables in there for your own game state, +# and every frame it will updated if keys are pressed, joysticks moved, +# mice clicked, etc. +def tick args + + # One of the things in "args" is the "outputs" object that your game uses + # to draw things. Afraid of rendering APIs? No problem. In DragonRuby, + # you use arrays to draw things and we figure out the details. + # If you want to draw text on the screen, you give it an array (the thing + # in the [ brackets ]), with an X and Y coordinate and the text to draw. + # The "<<" thing says "append this array onto the list of them at + # args.outputs.labels) + args.outputs.labels << [580, 400, 'Hello World!'] +end +</pre> +<p> +Once your <code>tick</code> function finishes, we look at all the arrays you made and figure out how to draw it. You don't need to know about graphics APIs. You're just setting up some arrays! DragonRuby clears out these arrays every frame, so you just need to add what you need _right now_ each time. +</p> +<h2>Rendering A Sprite</h2> +<p> +Now let's spice this up a little. +</p> +<p> +We're going to add some graphics. Each 2D image in DragonRuby is called a "sprite," and to use them, you just make sure they exist in a reasonable file format (png, jpg, gif, bmp, etc) and specify them by filename. The first time you use one, DragonRuby will load it and keep it in video memory for fast access in the future. If you use a filename that doesn't exist, you get a fun checkerboard pattern! +</p> +<p> +There's a "dragonruby.png" file included, just to get you started. Let's have it draw every frame with our text: +</p> +<pre>def tick args + args.outputs.labels << [580, 400, 'Hello World!'] + args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png'] +end +</pre> +<p> +(Pro Tip: you don't have to restart DragonRuby to test your changes; when you save main.rb, DragonRuby will notice and reload your program.) +</p> +<p> +That <code>.sprites</code> line says "add a sprite to the list of sprites we're drawing, and draw it at position (576, 100) at a size of 128x101 pixels". You can find the image to draw at dragonruby.png. +</p> +<h2>Coordinate System and Virtual Canvas</h2> +<p> +Quick note about coordinates: (0, 0) is the bottom left corner of the screen, and positive numbers go up and to the right. This is more "geometrically correct," even if it's not how you remember doing 2D graphics, but we chose this for a simpler reason: when you're making Super Mario Brothers and you want Mario to jump, you should be able to add to Mario's y position as he goes up and subtract as he falls. It makes things easier to understand. +</p> +<p> +Also: your game screen is _always_ 1280x720 pixels. If you resize the window, we will scale and letterbox everything appropriately, so you never have to worry about different resolutions. +</p> +<p> +Ok, now we have an image on the screen, let's animate it: +</p> +<pre>def tick args + args.state.rotation ||= 0 + args.outputs.labels << [580, 400, 'Hello World!' ] + args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation] + args.state.rotation -= 1 +end +</pre> +<p> +Now you can see that this function is getting called a lot! +</p> +<h2>Game State</h2> +<p> +Here's a fun Ruby thing: <code>args.state.rotation ||= 0</code> is shorthand for "if args.state.rotation isn't initialized, set it to zero." It's a nice way to embed your initialization code right next to where you need the variable. +</p> +<p> +<code>args.state</code> is a place you can hang your own data and have it survive past the life of the function call. In this case, the current rotation of our sprite, which is happily spinning at 60 frames per second. If you don't specify rotation (or alpha, or color modulation, or a source rectangle, etc), DragonRuby picks a reasonable default, and the array is ordered by the most likely things you need to tell us: position, size, name. +</p> +<h2>There Is No Delta Time</h2> +<p> +One thing we decided to do in DragonRuby is not make you worry about delta time: your function runs at 60 frames per second (about 16 milliseconds) and that's that. Having to worry about framerate is something massive triple-AAA games do, but for fun little 2D games? You'd have to work really hard to not hit 60fps. All your drawing is happening on a GPU designed to run Fortnite quickly; it can definitely handle this. +</p> +<p> +Since we didn't make you worry about delta time, you can just move the rotation by 1 every time and it works without you having to keep track of time and math. Want it to move faster? Subtract 2. +</p> +<h2>Handling User Input</h2> +<p> +Now, let's move that image around. +</p> +<pre>def tick args + args.state.rotation ||= 0 + args.state.x ||= 576 + args.state.y ||= 100 + + if args.inputs.mouse.click + args.state.x = args.inputs.mouse.click.point.x - 64 + args.state.y = args.inputs.mouse.click.point.y - 50 + end + + args.outputs.labels << [580, 400, 'Hello World!'] + args.outputs.sprites << [args.state.x, + args.state.y, + 128, + 101, + 'dragonruby.png', + args.state.rotation] + + args.state.rotation -= 1 +end +</pre> +<p> +Everywhere you click your mouse, the image moves there. We set a default location for it with <code>args.state.x ||= 576</code>, and then we change those variables when we see the mouse button in action. You can get at the keyboard and game controllers in similar ways. +</p> +<h2>Coding On A Raspberry Pi</h2> +<p> +We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we believe it _should_ work on any model with comparable specs. +</p> +<p> +If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- like one frame every few seconds--then there's likely a simple fix. +</p> +<p> +You're probably running a desktop environment: menus, apps, web browsers, etc. This is okay! Launch the terminal app and type: +</p> +<pre>do raspi-config +</pre> +<p> +It'll ask you for your password (if you don't know, try "raspberry"), and then give you a menu of options. Find your way to "Advanced Options", then "GL Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is also listed there. Save and reboot. In theory, this should fix the problem. +</p> +<p> +If you're _still_ having problems and have a Raspberry Pi 2 or better, go back to raspi-config and head over to "Advanced Options", "Memory split," and give the GPU 256 megabytes. You might be able to avoid this for simple games, as this takes RAM away from the system and reserves it for graphics. You can also try 128 megabytes as a gentler option. +</p> +<p> +Note that you can also run DragonRuby without X11 at all: if you run it from a virtual terminal it will render fullscreen and won't need the "Full KMS" option. This might be attractive if you want to use it as a game console sort of thing, or develop over ssh, or launch it from RetroPie, etc. +</p> +<h2>Conclusion</h2> +<p> +There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to <code>args.output</code> anymore. +</p> +<h2>IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!</h2> +<p> +Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app. +</p> +<ol> +<li> 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render <code>solid</code>s, animated <code>sprite</code>s, <code>label</code>s.</li> +<li> 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language.</li> +<li> 01_api_01_labels: Various ways to render <code>label</code>s.</li> +<li> 01_api_02_lines: Various ways to render <code>line</code>s.</li> +<li> 01_api_03_rects: Sample app shows various ways to render <code>solid</code>s and <code>border</code>s.</li> +<li> 01_api_04_sprites: Sample app shows various ways to render <code>sprite</code>s.</li> +<li> 01_api_05_keyboard: Hows how to get keyboard input from the user.</li> +<li> 01_api_06_mouse: Hows how to get mouse mouse position.</li> +<li> 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection.</li> +<li> 01_api_08_rect_to_rect: Hit detection/collision between two rectangles.</li> +<li> 01_api_10_controller: Interaction with a USB/Bluetooth controller.</li> +<li> 01_api_99_tech_demo: All the different render primitives along with using <code>render_targets</code>.</li> +<li> 02_collision_01_simple: Collision detection with dynamically moving bodies.</li> +<li> 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input.</li> +<li> 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system).</li> +<li> 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated.</li> +<li> 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated.</li> +<li> 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input.</li> +<li> 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player.</li> +<li> 04_sounds: How to play sounds and work with buttons.</li> +<li> 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player.</li> +<li> 05_mouse_move_paint_app: Represents a simple paint app.</li> +<li> 05_mouse_move_tile_editor: A starting point for a tile editor.</li> +<li> 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left.</li> +<li> 07_render_targets: Shows a powerful concept called <code>render_target</code>s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera).</li> +<li> 07_render_targets_advanced: Advanced usage of <code>render_target</code>s.</li> +<li> 08_platformer_collisions: Axis aligned collision along with platformer physics.</li> +<li> 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game.</li> +<li> 08_platformer_jumping_inertia: Jump physics and how inertia affects collision.</li> +<li> 09_controller_analog_usage_advanced_sprites: Extended properties of a <code>sprite</code> and how to change the rotation anchor point and render a subset/tile of a sprite.</li> +<li> 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet.</li> +<li> 10_save_load_game: Save and load game data.</li> +<li> 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type.</li> +<li> 11_hash_primitives: How primitives can be represented using a <code>Hash</code>.</li> +<li> 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen.</li> +<li> 12_top_down_area: How to render a top down map and how to manage collision of a player.</li> +<li> 13_01_easing_functions: How to use lerping functions to define animations/movement.</li> +<li> 13_02_cubic_bezier: How to create a bezier curve using lines.</li> +<li> 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation.</li> +<li> 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions.</li> +<li> 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen.</li> +<li> 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using <code>static</code> output collections (which are updated by reference as opposed to by value).</li> +<li> 15_collision_limits: How many collisions can be processed across many primitives.</li> +<li> 18_moddable_game: How you can make a game where content is authored by the player (modding support).</li> +<li> 19_lowrez_jam: How to use <code>render_targets</code> to create a low resolution game.</li> +<li> 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight.</li> +<li> 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet.</li> +<li> 21_mailbox_usage: How to do interprocess communication.</li> +<li> 22_trace_debugging: Debugging techniques and tracing execution through your game.</li> +<li> 22_trace_debugging_classes: Debugging techniques and tracing execution through your game.</li> +<li> 23_hexagonal_grid: How to make a tactical grid/map made of hexagons.</li> +<li> 23_isometric_grid: How to make a tactical grid/map made of isometric sprites.</li> +<li> 24_http_example: How to make http requests.</li> +<li> 25_3d_experiment_01_square: How to create 3D objects.</li> +<li> 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor.</li> +<li> 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation.</li> +<li> 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration.</li> +<li> 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia.</li> +<li> 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping.</li> +<li> 99_sample_game_pong: Reference implementation of pong.</li> +<li> 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game.</li> +<li> 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics.</li> +<li> 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions.</li> +<li> 99_sample_snakemoji: Shows that Ruby supports coding with emojis.</li> +<li> 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API.</li> +</ol> +<h1 id='--deploying-to-itch.io'>Deploying To Itch.io</h1> +<p> +Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel! +</p> +<h2>Creating Your Game Landing Page</h2> +<p> +Log into Itch.io and go to <a href='https://itch.io/game/new'>https://itch.io/game/new</a>. +</p> +<ul> +<li>Title: Give your game a Title. This value represents your `gametitle`.</li> +<li>Project URL: Set your project url. This value represents your `gameid`.</li> +<li>Classification: Keep this as Game.</li> +<li>Kind of Project: Select HTML from the drop down list. Don't worry, + the HTML project type _also supports binary downloads_.</li> +<li>Uploads: Skip this section for now.</li> +</ul> +<p> +You can fill out all the other options later. +</p> +<h2>Update Your Game's Metadata</h2> +<p> +Point your text editor at mygame/metadata/game_metadata.txt and make it look like this: +</p> +<p> +NOTE: Remove the <code>#</code> at the beginning of each line. +</p> +<pre>vid=bob +vtitle=Bob The Game Developer +meid=mygame +metitle=My Game +rsion=0.1 +</pre> +<p> +The <code>devid</code> property is the username you use to log into Itch.io. The <code>devtitle</code> is your name or company name (it can contain spaces). The <code>gameid</code> is the Project URL value. The <code>gametitle</code> is the name of your game (it can contain spaces). The <code>version</code> can be any <code>major.minor</code> number format. +</p> +<h2>Building Your Game For Distribution</h2> +<p> +Open up the terminal and run this from the command line: +</p> +<pre>dragonruby-publish --only-package mygame +</pre> +<p> +(if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.) +</p> +<p> +A directory called <code>./build</code> will be created that contains your binaries. You can upload this to Itch.io manually. +</p> +<p> +For the HTML version of your game after you upload it. Check the checkbox labeled "This file will be played in the browser". +</p> +<p> +For subsequent updates you can use an automated deployment to Itch.io: +</p> +<pre>dragonruby-publish mygame +</pre> +<p> +DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it! +</p> +<p> +If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you. +</p> +<h2>DragonRuby's Philosophy</h2> +<p> +The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals. +</p> +<h3>Challenge The Status Quo</h3> +<p> +Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say: +</p> +<blockquote> +<p> +But that's how we've always done it. +</p> +</blockquote> +<p> +It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us. +</p> +<h3>Release Often And Quickly</h3> +<p> +The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly. +</p> +<p> +Stop worrying about everything being pixel perfect. Don't wait until your game is 100% complete. Build your game publicly and iterate. Post in the #show-and-tell channel in the community Discord. You'll find a lot of support and encouragement there. +</p> +<p> +Remember: +</p> +<blockquote> +<p> +Real artists ship. +</p> +</blockquote> +<h3>Sustainable And Ethical Monetization</h3> +<p> +We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between. +</p> +<p> +Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it. +</p> +<h3>Sustainable And Ethical Open Source</h3> +<p> +This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution). +</p> +<p> +So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir. +</p> +<h3>People Over Entities</h3> +<p> +We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby. +</p> +<h3>Building A Game Should Be Fun And Bring Happiness</h3> +<p> +We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine. +</p> +<h3>Real World Application Drives Features</h3> +<p> +We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative. +</p> +<p> +We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work). +</p> +<h1 id='--how-to-determine-what-frame-you-are-on'>How To Determine What Frame You Are On</h1> +<p> +There is a property on <code>state</code> called <code>tick_count</code> that is incremented by DragonRuby every time the <code>tick</code> method is called. The following code renders a label that displays the current <code>tick_count</code>. +</p> +<pre>def tick args + args.outputs.labels << [10, 670, "#{args.state.tick_count}"] +end +</pre> +<h1 id='--how-to-get-current-framerate'>How To Get Current Framerate</h1> +<p> +Current framerate is a top level property on the Game Toolkit Runtime and is accessible via <code>args.gtk.current_framerate</code>. +</p> +<pre>def tick args + args.outputs.labels << [10, 710, "framerate: #{args.gtk.current_framerate.round}"] +end +</pre> +<h1 id='--how-to-render-a-sprite-using-an-array'>How To Render A Sprite Using An Array</h1> +<p> +All file paths should use the forward slash <code>/</code> *not* backslash <code></code>. Game Toolkit includes a number of sprites in the <code>sprites</code> folder (everything about your game is located in the <code>mygame</code> directory). +</p> +<p> +The following code renders a sprite with a <code>width</code> and <code>height</code> of <code>100</code> in the center of the screen. +</p> +<p> +<code>args.outputs.sprites</code> is used to render a sprite. +</p> +<pre>def tick args + args.outputs.sprites << [ + 640 - 50, # X + 360 - 50, # Y + 100, # W + 100, # H + 'sprites/square-blue.png' # PATH + ] +end +</pre> +<h1 id='--more-sprite-properties-as-an-array'>More Sprite Properties As An Array</h1> +<p> +Here are all the properties you can set on a sprite. +</p> +<pre>def tick args + args.outputs.sprites << [ + 100, # X + 100, # Y + 32, # W + 64, # H + 'sprites/square-blue.png', # PATH + 0, # ANGLE + 255, # ALPHA + 0, # RED_SATURATION + 255, # GREEN_SATURATION + 0 # BLUE_SATURATION + ] +end +</pre> +<h1 id='--different-sprite-representations'>Different Sprite Representations</h1> +<p> +Using ordinal positioning can get a little unruly given so many properties you have control over. +</p> +<p> +You can represent a sprite as a <code>Hash</code>: +</p> +<pre>def tick args + args.outputs.sprites << { + x: 640 - 50, + y: 360 - 50, + w: 100, + h: 100, + path: 'sprites/square-blue.png', + angle: 0, + a: 255, + r: 255, + g: 255, + b: 255, + source_x: 0, + source_y: 0, + source_w: -1, + source_h: -1, + flip_vertically: false, + flip_horizontally: false, + angle_anchor_x: 0.5, + angle_anchor_y: 1.0 + } +end +</pre> +<p> +You can represent a sprite as an <code>object</code>: +</p> +<pre># Create type with ALL sprite properties AND primitive_marker +class Sprite + attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, + :source_x, :source_y, :source_w, :source_h, + :tile_x, :tile_y, :tile_w, :tile_h, + :flip_horizontally, :flip_vertically, + :angle_anchor_x, :angle_anchor_y + + def primitive_marker + :sprite + end +end + +class BlueSquare < Sprite + def initialize opts + @x = opts[:x] + @y = opts[:y] + @w = opts[:w] + @h = opts[:h] + @path = 'sprites/square-blue.png' + end +end + +def tick args + args.outputs.sprites << (BlueSquare.new x: 640 - 50, + y: 360 - 50, + w: 50, + h: 50) +end +</pre> +<h1 id='--how-to-render-a-label'>How To Render A Label</h1> +<p> +<code>args.outputs.labels</code> is used to render labels. +</p> +<p> +Labels are how you display text. This code will go directly inside of the <code>def tick args</code> method. +</p> +<p> +Here is the minimum code: +</p> +<pre>def tick args + # X Y TEXT + args.outputs.labels << [640, 360, "I am a black label."] +end +</pre> +<h1 id='--a-colored-label'>A Colored Label</h1> +<pre>def tick args + # A colored label + # X Y TEXT, RED GREEN BLUE ALPHA + args.outputs.labels << [640, 360, "I am a redish label.", 255, 128, 128, 255] +end +</pre> +<h1 id='--extended-label-properties'>Extended Label Properties</h1> +<pre>def tick args + # A colored label + # X Y TEXT SIZE ALIGNMENT RED GREEN BLUE ALPHA FONT FILE + args.outputs.labels << [ + 640, # X + 360, # Y + "Hello world", # TEXT + 0, # SIZE_ENUM + 1, # ALIGNMENT_ENUM + 0, # RED + 0, # GREEN + 0, # BLUE + 255, # ALPHA + "fonts/coolfont.ttf" # FONT + ] +end +</pre> +<p> +A <code>SIZE_ENUM</code> of <code>0</code> represents "default size". A <code>negative</code> value will decrease the label size. A <code>positive</code> value will increase the label's size. +</p> +<p> +An <code>ALIGNMENT_ENUM</code> of <code>0</code> represents "left aligned". <code>1</code> represents "center aligned". <code>2</code> represents "right aligned". +</p> +<h1 id='--rendering-a-label-as-a--hash-'>Rendering A Label As A <code>Hash</code></h1> +<p> +You can add additional metadata about your game within a label, which requires you to use a `Hash` instead. +</p> +<pre>def tick args + args.outputs.labels << { + x: 200, + y: 550, + text: "dragonruby", + size_enum: 2, + alignment_enum: 1, + r: 155, + g: 50, + b: 50, + a: 255, + font: "fonts/manaspc.ttf", + # You can add any properties you like (this will be ignored/won't cause errors) + game_data_one: "Something", + game_data_two: { + value_1: "value", + value_2: "value two", + a_number: 15 + } + } +end +</pre> +<h1 id='--getting-the-size-of-a-piece-of-text'>Getting The Size Of A Piece Of Text</h1> +<p> +You can get the render size of any string using <code>args.gtk.calcstringbox</code>. +</p> +<pre>def tick args + # TEXT SIZE_ENUM FONT + w, h = args.gtk.calcstringbox("some string", 0, "font.ttf") + + # NOTE: The SIZE_ENUM and FONT are optional arguments. + + # Render a label showing the w and h of the text: + args.outputs.labels << [ + 10, + 710, + # This string uses Ruby's string interpolation literal: #{} + "'some string' has width: #{w}, and height: #{h}." + ] +end +</pre> +<h1 id='--how-to-play-a-sound'>How To Play A Sound</h1> +<p> +Sounds that end <code>.wav</code> will play once: +</p> +<pre>def tick args + # Play a sound every second + if (args.state.tick_count % 60) == 0 + args.outputs.sounds << 'something.wav' + end +end +</pre> +<p> +Sounds that end <code>.ogg</code> is considered background music and will loop: +</p> +<pre>def tick args + # Start a sound loop at the beginning of the game + if args.state.tick_count == 0 + args.outputs.sounds << 'background_music.ogg' + end +end +</pre> +<p> +If you want to play a <code>.ogg</code> once as if it were a sound effect, you can do: +</p> +<pre>def tick args + # Play a sound every second + if (args.state.tick_count % 60) == 0 + args.gtk.queue_sound 'some-ogg.ogg' + end +end +</pre> +<h1 id='--using--args.state--to-store-your-game-state'>Using <code>args.state</code> To Store Your Game State</h1> +<p> +<code>args.state</code> is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of <code>class</code>. +</p> +<p> +To initialize your game state, use the <code>||=</code> operator. Any value on the right side of <code>||=</code> will only be assigned _once_. +</p> +<p> +To assign a value every frame, just use the <code>=</code> operator, but _make sure_ you've initialized a default value. +</p> +<pre>def tick args + # initialize your game state ONCE + args.player.x ||= 0 + args.player.y ||= 0 + args.player.hp ||= 100 + + # increment the x position of the character by one every frame + args.player.x += 1 + + # Render a sprite with a label above the sprite + args.outputs.sprites << [ + args.player.x, + args.player.y, + 32, 32, + "player.png" + ] + + args.outputs.labels << [ + args.player.x, + args.player.y - 50, + args.player.hp + ] +end +</pre> +<h1 id='--frequently-asked-questions,-comments,-and-concerns'>Frequently Asked Questions, Comments, and Concerns</h1> +<p> +Here are questions, comments, and concerns that frequently come up. +</p> +<h2>Frequently Asked Questions</h2> +<h3>What is DragonRuby LLP?</h3> +<p> +DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible. +</p> +<p> +Under DragonRuby LLP, we offer a number of products (with more on the way): +</p> +<ul> +<li>Game Toolkit (GTK): A 2D game engine that is compatible with modern + gaming platforms. [Home Page]() [FAQ Page]()</li> +<li>RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [Home Page]() [FAQ Page]()</li> +<li>Commandline Toolkit (CTK): A zero dependency, zero installation Ruby + environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]()</li> +</ul> +<p> +All of the products above leverage a shared core called DragonRuby. +</p> +<p> +NOTE: From an official branding standpoint each one of the products is suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is _one word, title cased_. +</p> +<p> +NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just sounds really weird. +</p> +<p> +NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh? +</p> +<h3>What is DragonRuby?</h3> +<p> +The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_. +</p> +<h3>Okay... so what is the difference between a language specification and a runtime?</h3> +<p> +A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime." +</p> +<p> +But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby. +</p> +<h3>Okay... what language specification does DragonRuby use then?</h3> +<p> +DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries. +</p> +<h3>So... why another runtime?</h3> +<p> +The elevator pitch is: +</p> +<p> +DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia. +</p> +<h3>What does Multilevel Cross-platform mean?</h3> +<p> +There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally): +</p> +<ul> +<li>Level 1 we leverage a good portion of mRuby.</li> +<li>Level 2 consists of optimizations to mRuby we've made given that our + target platforms are well known.</li> +<li>Level 3 consists of portable C libraries and their Ruby + C-Extensions.</li> +</ul> +<p> +Levels 1 through 3 are fairly commonplace in many runtime implementations (with level 1 being the most portable, and level 3 being the fastest). But the DragonRuby Runtime has taken things a bit further: +</p> +<ul> +<li>Level 4 consists of shared abstractions around hardware I/O and operating + system resources. This level leverages open source and proprietary components within Simple DirectMedia Layer (a low level multimedia component library that has been in active development for 22 years and counting).</li> +<li>Level 5 is a code generation layer which creates metadata that allows + for native interoperability with host runtime libraries. It also includes OS specific message pump orchestrations.</li> +<li>Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This + compiler outputs _very_ fast platform specific bitcode, but only supports a subset of the Ruby language specification.</li> +</ul> +<p> +These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane. +</p> +<h3>Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?</h3> +<p> +DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies. +</p> +<h2>Frequent Comments</h2> +<h3>But Ruby is dead.</h3> +<p> +Let's check the official source for the answer to this question: isrubydead.com: <a href='https://isrubydead.com/'>https://isrubydead.com/</a>. +</p> +<p> +On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny. +</p> +<p> +What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies]. +</p> +<p> +Let's stop making this comment shall we? +</p> +<h3>But Ruby is slow.</h3> +<p> +That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime. +</p> +<h3>Dynamic languages are slow.</h3> +<p> +They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_. +</p> +<p> +Unless you are writing in some form of intermediate representation by hand, your language of choice also suffers this same fallacy of slow. Like, nothing is faster than a low level assembly-like language. So unless you're writing in that, let's stop making this comment. +</p> +<p> +NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^. +</p> +<h2>Frequent Concerns</h2> +<h3>DragonRuby is not open source. That's not right.</h3> +<p> +The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant. +</p> +<p> +We believe in open source very strongly. Parts of DragonRuby are in fact, open source. Just not all of it (for legal reasons, and because the IP we've created has value). And we promise that we are looking for (or creating) ways to _sustainably_ open source everything we do. +</p> +<p> +If you have ideas on how we can do this, email us! +</p> +<p> +If the reason above isn't sufficient, then definitely use something else. +</p> +<h3>DragonRuby is for pay. You should offer a free version.</h3> +<p> +If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products. +</p> +<p> +That being said, we will _never_ put someone out financially. We have income assistance for anyone that can't afford a license to any one of our products. +</p> +<p> +You qualify for a free, unrestricted license to DragonRuby products if any of the following items pertain to you: +</p> +<ul> +<li>Your income is below $2,000.00 (USD) per month.</li> +<li>You are under 18 years of age.</li> +<li>You are a student of any type: traditional public school, home + schooling, college, bootcamp, or online.</li> +<li>You are a teacher, mentor, or parent who wants to teach a kid how to code.</li> +<li>You work/worked in public service or at a charitable organization: + for example public office, army, or any 501(c)(3) organization.</li> +</ul> +<p> +Just contact Amir at [email protected] with a short explanation of your current situation and he'll set you up. No questions asked. +</p> +<h3>But still, you should offer a free version. So I can try it out and see if I like it.</h3> +<p> +You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing. +</p> +<p> +Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so. +</p> +<h3>I still think you should do a free version. Think of all people who would give it a shot.</h3> +<p> +Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers). +</p> +<p> +The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do. +</p> +<h3>What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.</h3> +<p> +That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen. +</p> +<p> +But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license. +</p> +<h1 id='--docs---gtk--runtime-'><code>GTK::Runtime</code></h1> +<p> +The GTK::Runtime class is the core of DragonRuby. It is globally accessible via <code>$gtk</code>. +</p> +<h1 id='--docs---gtk--runtime#reset-'><code>GTK::Runtime#reset</code></h1> +<p> +This function will reset Kernel.tick_count to 0 and will remove all data from args.state. +</p> +<h1 id='--docs---gtk--runtime#calcstringbox-'><code>GTK::Runtime#calcstringbox</code></h1> +<p> +This function returns the width and height of a string. +</p> +<pre>def tick args + args.state.string_size ||= args.gtk.calcstringbox "Hello World" + args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World" +end +</pre> +<h1 id='--docs---array-'><code>Array</code></h1> +<p> +The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit. +</p> +<h1 id='--docs---array#map-'><code>Array#map</code></h1> +<p> +The function given a block returns a new <code>Enumerable</code> of values. +</p> +<p> +Example of using <code>Array#map</code> in conjunction with <code>args.state</code> and <code>args.outputs.sprites</code> to render sprites to the screen. +</p> +<pre>def tick args + # define the colors of the rainbow in ~args.state~ + # as an ~Array~ of ~Hash~es with :order and :name. + # :order will be used to determine render location + # and :name will be used to determine sprite path. + args.state.rainbow_colors ||= [ + { order: 0, name: :red }, + { order: 1, name: :orange }, + { order: 2, name: :yellow }, + { order: 3, name: :green }, + { order: 4, name: :blue }, + { order: 5, name: :indigo }, + { order: 6, name: :violet }, + ] + + # render sprites diagonally to the screen + # with a width and height of 50. + args.outputs + .sprites << args.state + .rainbow_colors + .map do |color| # <-- ~Array#map~ usage + [ + color[:order] * 50, + color[:order] * 50, + 50, + 50, + "sprites/square-#{color[:name]}.png" + ] + end +end +</pre> +<h1 id='--docs---array#each-'><code>Array#each</code></h1> +<p> +The function, given a block, invokes the block for each item in the <code>Array</code>. <code>Array#each</code> is synonymous to foreach constructs in other languages. +</p> +<p> +Example of using <code>Array#each</code> in conjunction with <code>args.state</code> and <code>args.outputs.sprites</code> to render sprites to the screen: +</p> +<pre>def tick args + # define the colors of the rainbow in ~args.state~ + # as an ~Array~ of ~Hash~es with :order and :name. + # :order will be used to determine render location + # and :name will be used to determine sprite path. + args.state.rainbow_colors ||= [ + { order: 0, name: :red }, + { order: 1, name: :orange }, + { order: 2, name: :yellow }, + { order: 3, name: :green }, + { order: 4, name: :blue }, + { order: 5, name: :indigo }, + { order: 6, name: :violet }, + ] + + # render sprites diagonally to the screen + # with a width and height of 50. + args.state + .rainbow_colors + .map do |color| # <-- ~Array#each~ usage + args.outputs.sprites << [ + color[:order] * 50, + color[:order] * 50, + 50, + 50, + "sprites/square-#{color[:name]}.png" + ] + end +end +</pre> +<h1 id='--docs---array#reject_nil-'><code>Array#reject_nil</code></h1> +<p> +Returns an <code>Enumerable</code> rejecting items that are <code>nil</code>, this is an alias for <code>Array#compact</code>: +</p> +<pre>repl do + a = [1, nil, 4, false, :a] + puts a.reject_nil + # => [1, 4, false, :a] + puts a.compact + # => [1, 4, false, :a] +end +</pre> +<h1 id='--docs---array#reject_false-'><code>Array#reject_false</code></h1> +<p> +Returns an `Enumerable` rejecting items that are `nil` or `false`. +</p> +<pre>repl do + a = [1, nil, 4, false, :a] + puts a.reject_false + # => [1, 4, :a] +end +</pre> +<h1 id='--docs---array#product-'><code>Array#product</code></h1> +<p> +Returns all combinations of values between two arrays. +</p> +<p> +Here are some examples of using <code>product</code>. Paste the following code at the bottom of main.rb and save the file to see the results: +</p> +<pre>repl do + a = [0, 1] + puts a.product + # => [[0, 0], [0, 1], [1, 0], [1, 1]] +end +</pre> +<pre>repl do + a = [ 0, 1] + b = [:a, :b] + puts a.product b + # => [[0, :a], [0, :b], [1, :a], [1, :b]] +end +</pre> +<h1 id='--docs---array#map_2d-'><code>Array#map_2d</code></h1> +<p> +Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage. +</p> +<pre>repl do + stage = [ + [:enemy, :empty, :player], + [:empty, :empty, :empty], + [:enemy, :empty, :enemy], + ] + + occupied_tiles = stage.map_2d do |row, col, tile| + if tile == :empty + nil + else + [row, col, tile] + end + end.reject_nil + + puts "Stage:" + puts stage + + puts "Occupied Tiles" + puts occupied_tiles +end +</pre> +<h1 id='--docs---array#include_any?-'><code>Array#include_any?</code></h1> +<p> +Given a collection of items, the function will return <code>true</code> if any of <code>self</code>'s items exists in the collection of items passed in: +</p> +<h1 id='--docs---array#any_intersect_rect?-'><code>Array#any_intersect_rect?</code></h1> +<p> +Assuming the array contains objects that respond to <code>left</code>, <code>right</code>, <code>top</code>, <code>bottom</code>, this method returns <code>true</code> if any of the elements within the array intersect the object being passed in. You are given an optional parameter called <code>tolerance</code> which informs how close to the other rectangles the elements need to be for it to be considered intersecting. +</p> +<p> +The default tolerance is set to <code>0.1</code>, which means that the primitives are not considered intersecting unless they are overlapping by more than <code>0.1</code>. +</p> +<pre>repl do + # Here is a player class that has position and implement + # the ~attr_rect~ contract. + class Player + attr_rect + attr_accessor :x, :y, :w, :h + + def initialize x, y, w, h + @x = x + @y = y + @w = w + @h = h + end + + def serialize + { x: @x, y: @y, w: @w, h: @h } + end + + def inspect + "#{serialize}" + end + + def to_s + "#{serialize}" + end + end + + # Here is a definition of two walls. + walls = [ + [10, 10, 10, 10], + { x: 20, y: 20, w: 10, h: 10 }, + ] + + # Display the walls. + puts "Walls." + puts walls + puts "" + + # Check any_intersect_rect? on player + player = Player.new 30, 20, 10, 10 + puts "Is Player #{player} touching wall?" + puts (walls.any_intersect_rect? player) + # => false + # The value is false because of the default tolerance is 0.1. + # The overlap of the player rect and any of the wall rects is + # less than 0.1 (for those that intersect). + puts "" + + player = Player.new 9, 10, 10, 10 + puts "Is Player #{player} touching wall?" + puts (walls.any_intersect_rect? player) + # => true + puts "" +end +</pre> +<h1 id='--docs---gtk--outputs-'><code>GTK::Outputs</code></h1> +<p> +Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a <code>tick</code> method defined in mygame/app/main.rb +</p> +<pre>def tick args + # code goes here +end +</pre> +<h1 id='--docs---gtk--outputs#solids-'><code>GTK::Outputs#solids</code></h1> +<p> +Add primitives to this collection to render a solid to the screen. +</p> +<h2>Rendering a solid using an Array</h2> +<p> +Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixels tall. +</p> +<pre>def tick args + # X Y WIDTH HEIGHT + args.outputs.solids << [100, 100, 160, 90] +end +</pre> +<h2>Rendering a solid using an Array with colors and alpha</h2> +<p> +The value for the color and alpha is an number between <code>0</code> and <code>255</code>. The alpha property is optional and will be set to <code>255</code> if not specified. +</p> +<p> +Creates a green solid rectangle with an opacity of 50%. +</p> +<pre>def tick args + # X Y WIDTH HEIGHT RED GREEN BLUE ALPHA + args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128] +end +</pre> +<h2>Rendering a solid using a Hash</h2> +<p> +If you want a more readable invocation. You can use the following hash to create a solid. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order. +</p> +<pre>def tick args + args.outputs.solids << { + x: 0, + y: 0, + w: 100, + h: 100, + r: 0, + g: 255, + b: 0, + a: 255 + } +end +</pre> +<h2>Rendering a solid using a Class</h2> +<p> +You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called <code>primitive_marker</code> must be defined on the class. +</p> +<p> +Here is an example: +</p> +<pre># Create type with ALL solid properties AND primitive_marker +class Solid + attr_accessor :x, :y, :w, :h, :r, :g, :b, :a + + def primitive_marker + :solid + end +end + +# Inherit from type +class Square < Solid + # constructor + def initialize x, y, size + self.x = x + self.y = y + self.w = size + self.h = size + end +end + +def tick args + # render solid/border + args.outputs.solids << Square.new(10, 10, 32) +end +</pre> +<h1 id='--docs---gtk--outputs#borders-'><code>GTK::Outputs#borders</code></h1> +<p> +Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids. +</p> +<p> +The only difference between the two primitives is where they are added. +</p> +<p> +Instead of using <code>args.outputs.solids</code>: +</p> +<pre>def tick args + # X Y WIDTH HEIGHT + args.outputs.solids << [100, 100, 160, 90] +end +</pre> +<p> +You have to use <code>args.outputs.borders</code>: +</p> +<pre>def tick args + # X Y WIDTH HEIGHT + args.outputs.borders << [100, 100, 160, 90] +end +</pre> +<h1 id='--docs---gtk--mouse-'><code>GTK::Mouse</code></h1> +<p> +The mouse is accessible via <code>args.inputs.mouse</code>: +</p> +<pre>def tick args + # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse). + args.outputs.labels << [ + 10, + 710, + "The mouse's position is: #{args.inputs.mouse.x} #{args.inputs.mouse.y}." + ] +end +</pre> +<p> +The mouse has the following properties. +</p> +<ul> +<li><code>args.inputs.mouse.x</code>: Returns the x position of the mouse.</li> +<li><code>args.inputs.mouse.y</code>: Returns the y position of the mouse.</li> +<li><code>args.inputs.mouse.moved</code>: Returns true if the mouse moved during the tick.</li> +<li><code>args.inputs.mouse.moved_at</code>: Returns the tick_count (<code>args.state.tick_count</code>) that the mouse was moved at. This property will be <code>nil</code> if the mouse didn't move.</li> +<li><code>args.inputs.mouse.global_moved_at</code>: Returns the global tick_count (<code>Kernel.global_tick_count</code>) that the mouse was moved at. This property will be <code>nil</code> if the mouse didn't move.</li> +<li><code>args.inputs.mouse.click</code>: Returns a <code>GTK::MousePoint</code> for that specific frame (<code>args.state.tick_count</code>) if the mouse button was pressed.</li> +<li><code>args.inputs.mouse.previous_click</code>: Returns a <code>GTK::MousePoint</code> for the previous frame (<code>args.state.tick_count - 1</code>) if the mouse button was pressed.</li> +<li><code>args.inputs.mouse.up</code>: Returns true if for that specific frame (<code>args.state.tick_count</code>) if the mouse button was released.</li> +<li><code>args.inputs.mouse.point</code> | <code>args.inputs.mouse.position</code>: Returns an <code>Array</code> which contains the <code>x</code> and <code>y</code> position of the mouse.</li> +<li><code>args.inputs.mouse.has_focus</code>: Returns true if the game window has the mouse's focus.</li> +<li><code>args.inputs.mouse.wheel</code>: Returns an <code>GTK::OpenEntity</code> that contains an <code>x</code> and <code>y</code> property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be <code>nil</code>.</li> +<li><code>args.inputs.mouse.button_left</code>: Returns true if the left mouse button is down.</li> +<li><code>args.inputs.mouse.button_right</code>: Returns true if the right mouse button is down.</li> +<li><code>args.inputs.mouse.button_middle</code>: Returns true if the middle mouse button is down.</li> +<li><code>args.inputs.mouse.button_bits</code>: Gives the bits for each mouse button and its current state.</li> +</ul> +<h1 id='--docs---gtk--mousepoint-'><code>GTK::MousePoint</code></h1> +<p> +The <code>GTK::MousePoint</code> has the following properties. +</p> +<ul> +<li><code>x</code>: Integer representing the mouse's x.</li> +<li><code>y</code>: Integer representing the mouse's y.</li> +<li><code>point</code>: Array with the <code>x</code> and <code>y</code> values.</li> +<li><code>w</code>: Width of the point that always returns <code>0</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>h</code>: Height of the point that always returns <code>0</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>left</code>: This value is the same as <code>x</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>right</code>: This value is the same as <code>x</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>top</code>: This value is the same as <code>y</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>bottom</code>: This value is the same as <code>y</code> (included so that it can seemlessly work with <code>GTK::Geometry</code> functions).</li> +<li><code>created_at</code>: The tick (<code>args.state.tick_count</code>) that this structure was created.</li> +<li><code>global_created_at</code>: The global tick (<code>Kernel.global_tick_count</code>) that this structure was created.</li> +</ul> +<h1 id='--docs---gtk--openentity-'><code>GTK::OpenEntity</code></h1> +<p> +<code>GTK::OpenEntity</code> is accessible within the DragonRuby's top level <code>tick</code> function via the <code>args.state</code> property. +</p> +<pre>def tick args + args.state.x ||= 100 + args.outputs.labels << [10, 710, "value of x is: #{args.state.x}."] +end +</pre> +<p> +The primary benefit of using <code>args.state</code> as opposed to instance variables is that <code>GTK::OpenEntity</code> allows for arbitrary nesting of properties without the need to create intermediate objects. +</p> +<p> +For example: +</p> +<pre>def tick args + # intermediate player object does not need to be created + args.state.player.x ||= 100 + args.state.player.y ||= 100 + args.outputs.labels << [ + 10, + 710, + "player x, y is:#{args.state.player.x}, #{args.state.player.y}." + ] +end +</pre> +<h1 id='--docs---gtk--openentity#as_hash-'><code>GTK::OpenEntity#as_hash</code></h1> +<p> +Returns a reference to the <code>GTK::OpenEntity</code> as a <code>Hash</code>. This property is useful when you want to treat <code>args.state</code> as a <code>Hash</code> and invoke methods such as <code>Hash#each</code>. +</p> +<p> +Example: +</p> +<pre>def tick args + args.state.x ||= 100 + args.state.y ||= 100 + values = args.state + .as_hash + .map { |k, v| "#{k} #{v}" } + + args.outputs.labels << values.map.with_index do |v, i| + [ + 10, + 710 - (30 * i), + v + ] + end +end +</pre> +<h1 id='--docs---numeric#frame_index-'><code>Numeric#frame_index</code></h1> +<p> +This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value <code>self</code> represents the moment the animation started. +</p> +<p> +<code>frame_index</code> takes three additional parameters: +</p> +<ul> +<li>How many frames exist in the sprite animation.</li> +<li>How long to hold each animation for.</li> +<li>Whether the animation should repeat.</li> +</ul> +<p> +<code>frame_index</code> will return <code>nil</code> if the time for the animation is out of bounds of the parameter specification. +</p> +<p> +Example using variables: +</p> +<pre>def tick args + start_looping_at = 0 + number_of_sprites = 6 + number_of_frames_to_show_each_sprite = 4 + does_sprite_loop = true + + sprite_index = + start_looping_at.frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + sprite_index ||= 0 + + args.outputs.sprites << [ + 640 - 50, + 360 - 50, + 100, + 100, + "sprites/dragon-#{sprite_index}.png" + ] +end +</pre> +<p> +Example using named parameters: +</p> +<pre>def tick args + start_looping_at = 0 + + sprite_index = + start_looping_at.frame_index count: 6, + hold_for: 4, + repeat: true, + tick_count_override: args.state.tick_count + + sprite_index ||= 0 + + args.outputs.sprites << [ + 640 - 50, + 360 - 50, + 100, + 100, + "sprites/dragon-#{sprite_index}.png" + ] +end +</pre> +<h1 id='--docs---numeric#elapsed_time-'><code>Numeric#elapsed_time</code></h1> +<p> +For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`. +</p> +<p> +Here is an example of how elapsed_time can be used. +</p> +<pre>def tick args + args.state.last_click_at ||= 0 + + # record when a mouse click occurs + if args.inputs.mouse.click + args.state.last_click_at = args.state.tick_count + end + + # Use Numeric#elapsed_time to determine how long it's been + if args.state.last_click_at.elapsed_time > 120 + args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."] + end +end +</pre> +<p> +And here is an example where the override parameter is passed in: +</p> +<pre>def tick args + args.state.last_click_at ||= 0 + + # create a state variable that tracks time at half the speed of args.state.tick_count + args.state.simulation_tick = args.state.tick_count.idiv 2 + + # record when a mouse click occurs + if args.inputs.mouse.click + args.state.last_click_at = args.state.simulation_tick + end + + # Use Numeric#elapsed_time to determine how long it's been + if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120 + args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."] + end +end +</pre> +<h1 id='--docs---numeric#elapsed?-'><code>Numeric#elapsed?</code></h1> +<p> +Returns true if <code>Numeric#elapsed_time</code> is greater than the number. An optional parameter can be passed into <code>elapsed?</code> which is added to the number before evaluating whether <code>elapsed?</code> is true. +</p> +<p> +Example usage (no optional parameter): +</p> +<pre>def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + destroy_at: args.state.tick_count + 60 } + args.state.box_queue << { name: :green, + destroy_at: args.state.tick_count + 60 } + args.state.box_queue << { name: :blue, + destroy_at: args.state.tick_count + 120 } + end + + boxes_to_destroy = args.state + .box_queue + .find_all { |b| b[:destroy_at].elapsed? } + + if !boxes_to_destroy.empty? + puts "boxes to destroy count: #{boxes_to_destroy.length}" + end + + boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_destroy +end +</pre> +<p> +Example usage (with optional parameter): +</p> +<pre>def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + create_at: args.state.tick_count + 120, + lifespan: 60 } + args.state.box_queue << { name: :green, + create_at: args.state.tick_count + 120, + lifespan: 60 } + args.state.box_queue << { name: :blue, + create_at: args.state.tick_count + 120, + lifespan: 120 } + end + + # lifespan is passed in as a parameter to ~elapsed?~ + boxes_to_destroy = args.state + .box_queue + .find_all { |b| b[:create_at].elapsed? b[:lifespan] } + + if !boxes_to_destroy.empty? + puts "boxes to destroy count: #{boxes_to_destroy.length}" + end + + boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_destroy +end +</pre> +<h1 id='--docs---numeric#created?-'><code>Numeric#created?</code></h1> +<p> +Returns true if <code>Numeric#elapsed_time == 0</code>. Essentially communicating that number is equal to the current frame. +</p> +<p> +Example usage: +</p> +<pre>def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + create_at: args.state.tick_count + 60 } + end + + boxes_to_spawn_this_frame = args.state + .box_queue + .find_all { |b| b[:create_at].new? } + + boxes_to_spawn_this_frame.each { |b| puts "box #{b} was new? on #{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_spawn_this_frame +end +</pre> +<h1 id='--docs---kernel-'><code>Kernel</code></h1> +<p> +Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick. +</p> +<h1 id='--docs---kernel--tick_count-'><code>Kernel::tick_count</code></h1> +<p> +Returns the current tick of the game. This value is reset if you call $gtk.reset. +</p> +<h1 id='--docs---kernel--global_tick_count-'><code>Kernel::global_tick_count</code></h1> +<p> +Returns the current tick of the application from the point it was started. This value is never reset. +</p> + + </div> + </body> +</html> diff --git a/docs/docs.js b/docs/docs.js new file mode 100644 index 0000000..4c5a69b --- /dev/null +++ b/docs/docs.js @@ -0,0 +1,99 @@ +function all_paragraphs() { + return Array.from(document.querySelectorAll("p")); +} + +function all_pres() { + return Array.from(document.querySelectorAll("pre")); +} + +function all_lists() { + return Array.from(document.querySelectorAll("li")); +} + +function all_anchors() { + return Array.from(document.querySelectorAll("a")); +} + +function all_headers() { + return Array.from([ + Array.from(document.querySelectorAll("h1")), + Array.from(document.querySelectorAll("h2")), + Array.from(document.querySelectorAll("h3")) + ].flat()); +} + +function all_searchable_elements() { + return Array.from([ + all_paragraphs(), + all_pres(), + all_lists(), + all_headers(), + all_anchors() + ].flat()); +} + +function hide_element(element) { + element.style.color = "rgb(0, 0, 0, 0.2)"; +} + +function show_element(element) { + element.style.color = ""; +} + +function show_all_searchable_elements() { + all_searchable_elements().forEach(show_element); +} + +function does_element_has_word(element, word) { + return element.innerText + .toLowerCase() + .includes(word.toLowerCase()); +} + +function perform_search(search_text) { + search_text = search_text || ""; + show_all_searchable_elements(); + var result_count = 0; + document.getElementById('search-count').innerHTML = " "; + if (search_text.length < 3) return; + + var tokens = search_text.split(" "); + + all_searchable_elements().forEach(function (element) { + tokens.forEach(function(word) { + if (does_element_has_word(element, word)) { + result_count += 1; + show_element(element); + } else { + hide_element(element); + } + }); + }); + + document.getElementById('search-count').innerHTML = result_count.toString() + " result(s) found."; +} + +function add_search() { + var search_html = ` + <div style='padding: 10px; border: solid 1px silver; background-color: white;'> + <input placeholder='search' type='text' id='search-term' style='width: 100%; padding: 5px; margin-bottom: 3px;' /> + <div id='search-count'> </div> + </div> +`; + + // create search div + var search_div = document.createElement("div"); + search_div.innerHTML = search_html; + document.body.insertBefore(search_div, document.body.firstChild); + search_div.style.position = 'fixed'; + search_div.style.right = '10px'; + search_div.style.width = '200px'; + + // wire up incremental search + var search_textbox = document.getElementById("search-term"); + search_textbox.onkeydown = function() { perform_search(search_textbox.value); }; +} + +document.addEventListener('DOMContentLoaded', function() { + add_search(); +}, false); diff --git a/docs/docs.txt b/docs/docs.txt new file mode 100644 index 0000000..6b94787 --- /dev/null +++ b/docs/docs.txt @@ -0,0 +1,1785 @@ +* DragonRuby Game Toolkit Live Docs + +The information contained here is all available via the DragonRuby +Console. You can Open the DragonRuby Console by pressing [`] [~] [²] +[^] [º] or [§] within your game. + +To search docs you can type ~docs_search "SEARCH TERM"~ or if you want +to get fancy you can provide a ~lambda~ to filter documentation: + +#+begin_src + docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") } +#+end_src + +[[docs_search.gif]] + +* Hello World + +Welcome to DragonRuby Game Toolkit. Take the steps below to get started. + +* Join the Discord and Subscribe to the News Letter + +Our Discord channel is [[http://discord.dragonruby.org]]. + +The News Letter will keep you in the loop with regards to current +DragonRuby Events: [[http://dragonrubydispatch.com]]. + +Those who use DragonRuby are called Dragon Riders. This identity is +incredibly important to us. When someone asks you: + +#+begin_quote +What game engine do you use? +#+end_quote + +Reply with: + +#+begin_quote +I am a Dragon Rider. +#+end_quote + +* Watch Some Intro Videos + +Each video is only 20 minutes and all of them will fit into a lunch +break. So please watch them: + +1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]] +2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]] +3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]] + +The second and third videos are not required if you are proficient +with Ruby, but *definitely* watch the first one. + +You may also want to try this free course provided at +[[http://dragonruby.school]]. + +* Getting Started Tutorial + +This is a tutorial written by Ryan C Gordon (a Juggernaut in the +industry who has contracted to Valve, Epic, Activision, and +EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]). + +** Introduction + +Welcome! + +Here's just a little push to get you started if you're new to +programming or game development. + +If you want to write a game, it's no different than writing any other +program for any other framework: there are a few simple rules that +might be new to you, but more or less programming is programming no +matter what you are building. + +Did you not know that? Did you think you couldn't write a game because +you're a "web guy" or you're writing Java at a desk job? Stop letting +people tell you that you can't, because you already have everything +you need. + +Here, we're going to be programming in a language called "Ruby." In +the interest of full disclosure, I (Ryan Gordon) wrote the C parts of +this toolkit and Ruby looks a little strange to me (Amir Rajan wrote +the Ruby parts, discounting the parts I mangled), but I'm going to +walk you through the basics because we're all learning together, and +if you mostly think of yourself as someone that writes C (or C++, C#, +Objective-C), PHP, or Java, then you're only a step behind me right +now. + +** Prerequisites + +Here's the most important thing you should know: Ruby lets you do some +complicated things really easily, and you can learn that stuff +later. I'm going to show you one or two cool tricks, but that's all. + +Do you know what an if statement is? A for-loop? An array? That's all +you'll need to start. + +** The Game Loop + +Ok, here are few rules with regards to game development with GTK: + +- Your game is all going to happen under one function ... +- that runs 60 times a second ... +- and has to tell the computer what to draw each time. + +That's an entire video game in one run-on sentence. + +Here's that function. You're going to want to put this in +mygame/app/main.rb, because that's where we'll look for it by +default. Load it up in your favorite text editor. + +#+begin_src ruby + def tick args + args.outputs.labels << [580, 400, 'Hello World!'] + end +#+end_src + +Now run ~dragonruby~ ...did you get a window with "Hello World!" +written in it? Good, you're officially a game developer! + +** Breakdown Of The ~tick~ Method + +~mygame/app/main.rb~, is where the Ruby source code is located. This +looks a little strange, so I'll break it down line by line. In Ruby, a +'#' character starts a single-line comment, so I'll talk about this +inline. + +#+begin_src ruby + # This "def"ines a function, named "tick," which takes a single argument + # named "args". DragonRuby looks for this function and calls it every + # frame, 60 times a second. "args" is a magic structure with lots of + # information in it. You can set variables in there for your own game state, + # and every frame it will updated if keys are pressed, joysticks moved, + # mice clicked, etc. + def tick args + + # One of the things in "args" is the "outputs" object that your game uses + # to draw things. Afraid of rendering APIs? No problem. In DragonRuby, + # you use arrays to draw things and we figure out the details. + # If you want to draw text on the screen, you give it an array (the thing + # in the [ brackets ]), with an X and Y coordinate and the text to draw. + # The "<<" thing says "append this array onto the list of them at + # args.outputs.labels) + args.outputs.labels << [580, 400, 'Hello World!'] + end +#+end_src + +Once your ~tick~ function finishes, we look at all the arrays you made +and figure out how to draw it. You don't need to know about graphics +APIs. You're just setting up some arrays! DragonRuby clears out these +arrays every frame, so you just need to add what you need _right now_ +each time. + +** Rendering A Sprite + +Now let's spice this up a little. + +We're going to add some graphics. Each 2D image in DragonRuby is +called a "sprite," and to use them, you just make sure they exist in a +reasonable file format (png, jpg, gif, bmp, etc) and specify them by +filename. The first time you use one, DragonRuby will load it and keep +it in video memory for fast access in the future. If you use a +filename that doesn't exist, you get a fun checkerboard pattern! + +There's a "dragonruby.png" file included, just to get you +started. Let's have it draw every frame with our text: + +#+begin_src ruby + def tick args + args.outputs.labels << [580, 400, 'Hello World!'] + args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png'] + end +#+end_src + +(Pro Tip: you don't have to restart DragonRuby to test your changes; +when you save main.rb, DragonRuby will notice and reload your +program.) + +That ~.sprites~ line says "add a sprite to the list of sprites we're +drawing, and draw it at position (576, 100) at a size of 128x101 +pixels". You can find the image to draw at dragonruby.png. + +** Coordinate System and Virtual Canvas + +Quick note about coordinates: (0, 0) is the bottom left corner of the +screen, and positive numbers go up and to the right. This is more +"geometrically correct," even if it's not how you remember doing 2D +graphics, but we chose this for a simpler reason: when you're making +Super Mario Brothers and you want Mario to jump, you should be able to +add to Mario's y position as he goes up and subtract as he falls. It +makes things easier to understand. + +Also: your game screen is _always_ 1280x720 pixels. If you resize the +window, we will scale and letterbox everything appropriately, so you +never have to worry about different resolutions. + +Ok, now we have an image on the screen, let's animate it: + +#+begin_src ruby + def tick args + args.state.rotation ||= 0 + args.outputs.labels << [580, 400, 'Hello World!' ] + args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation] + args.state.rotation -= 1 + end +#+end_src + +Now you can see that this function is getting called a lot! + +** Game State + +Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for +"if args.state.rotation isn't initialized, set it to zero." It's a +nice way to embed your initialization code right next to where you +need the variable. + +~args.state~ is a place you can hang your own data and have it survive +past the life of the function call. In this case, the current rotation +of our sprite, which is happily spinning at 60 frames per second. If +you don't specify rotation (or alpha, or color modulation, or a source +rectangle, etc), DragonRuby picks a reasonable default, and the array +is ordered by the most likely things you need to tell us: position, +size, name. + +** There Is No Delta Time + +One thing we decided to do in DragonRuby is not make you worry about +delta time: your function runs at 60 frames per second (about 16 +milliseconds) and that's that. Having to worry about framerate is +something massive triple-AAA games do, but for fun little 2D games? +You'd have to work really hard to not hit 60fps. All your drawing is +happening on a GPU designed to run Fortnite quickly; it can definitely +handle this. + +Since we didn't make you worry about delta time, you can just move the +rotation by 1 every time and it works without you having to keep track +of time and math. Want it to move faster? Subtract 2. + +** Handling User Input + +Now, let's move that image around. + +#+begin_src ruby + def tick args + args.state.rotation ||= 0 + args.state.x ||= 576 + args.state.y ||= 100 + + if args.inputs.mouse.click + args.state.x = args.inputs.mouse.click.point.x - 64 + args.state.y = args.inputs.mouse.click.point.y - 50 + end + + args.outputs.labels << [580, 400, 'Hello World!'] + args.outputs.sprites << [args.state.x, + args.state.y, + 128, + 101, + 'dragonruby.png', + args.state.rotation] + + args.state.rotation -= 1 + end +#+end_src + +Everywhere you click your mouse, the image moves there. We set a +default location for it with ~args.state.x ||= 576~, and then we +change those variables when we see the mouse button in action. You can +get at the keyboard and game controllers in similar ways. + +** Coding On A Raspberry Pi + +We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we +believe it _should_ work on any model with comparable specs. + +If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run +a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- +like one frame every few seconds--then there's likely a simple fix. + +You're probably running a desktop environment: menus, apps, web browsers, +etc. This is okay! Launch the terminal app and type: + +#+begin_src +sudo raspi-config +#+end_src + +It'll ask you for your password (if you don't know, try "raspberry"), and then +give you a menu of options. Find your way to "Advanced Options", then "GL +Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is +also listed there. Save and reboot. In theory, this should fix the problem. + +If you're _still_ having problems and have a Raspberry Pi 2 or better, go back +to raspi-config and head over to "Advanced Options", "Memory split," and give +the GPU 256 megabytes. You might be able to avoid this for simple games, as +this takes RAM away from the system and reserves it for graphics. You can +also try 128 megabytes as a gentler option. + +Note that you can also run DragonRuby without X11 at all: if you run it from +a virtual terminal it will render fullscreen and won't need the "Full KMS" +option. This might be attractive if you want to use it as a game console +sort of thing, or develop over ssh, or launch it from RetroPie, etc. + +** Conclusion + +There is a lot more you can do with DragonRuby, but now you've already +got just about everything you need to make a simple game. After all, +even the most fancy games are just creating objects and moving them +around. Experiment a little. Add a few more things and have them +interact in small ways. Want something to go away? Just don't add it +to ~args.output~ anymore. + +** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!! + +Now that you've completed the Hello World tutorial. Head over to the +`samples` directory. It is very very important that you study the +sample apps thoroughly! Go through them in order. Here is a short +description of each sample app. + +1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s. +2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language. +3. 01_api_01_labels: Various ways to render ~label~s. +4. 01_api_02_lines: Various ways to render ~line~s. +5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s. +6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s. +7. 01_api_05_keyboard: Hows how to get keyboard input from the user. +8. 01_api_06_mouse: Hows how to get mouse mouse position. +9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection. +10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles. +11. 01_api_10_controller: Interaction with a USB/Bluetooth controller. +12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~. +13. 02_collision_01_simple: Collision detection with dynamically moving bodies. +14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input. +15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system). +16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated. +17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated. +18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input. +19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player. +20. 04_sounds: How to play sounds and work with buttons. +21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player. +22. 05_mouse_move_paint_app: Represents a simple paint app. +23. 05_mouse_move_tile_editor: A starting point for a tile editor. +24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left. +25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera). +26. 07_render_targets_advanced: Advanced usage of ~render_target~s. +27. 08_platformer_collisions: Axis aligned collision along with platformer physics. +28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game. +29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision. +30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite. +31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet. +32. 10_save_load_game: Save and load game data. +33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type. +34. 11_hash_primitives: How primitives can be represented using a ~Hash~. +35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen. +36. 12_top_down_area: How to render a top down map and how to manage collision of a player. +37. 13_01_easing_functions: How to use lerping functions to define animations/movement. +38. 13_02_cubic_bezier: How to create a bezier curve using lines. +39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation. +40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions. +41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen. +42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value). +43. 15_collision_limits: How many collisions can be processed across many primitives. +44. 18_moddable_game: How you can make a game where content is authored by the player (modding support). +45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game. +46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight. +47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet. +48. 21_mailbox_usage: How to do interprocess communication. +49. 22_trace_debugging: Debugging techniques and tracing execution through your game. +50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game. +51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons. +52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites. +53. 24_http_example: How to make http requests. +54. 25_3d_experiment_01_square: How to create 3D objects. +55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor. +56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation. +57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration. +58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia. +59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping. +60. 99_sample_game_pong: Reference implementation of pong. +61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game. +62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics. +63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions. +64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis. +65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API. + + + +* Deploying To Itch.io + +Once you've built your game, you're all set to deploy! Good luck in +your game dev journey and if you get stuck, come to the Discord +channel! + +** Creating Your Game Landing Page + +Log into Itch.io and go to [[https://itch.io/game/new]]. + +- Title: Give your game a Title. This value represents your `gametitle`. +- Project URL: Set your project url. This value represents your `gameid`. +- Classification: Keep this as Game. +- Kind of Project: Select HTML from the drop down list. Don't worry, + the HTML project type _also supports binary downloads_. +- Uploads: Skip this section for now. + +You can fill out all the other options later. + +** Update Your Game's Metadata + +Point your text editor at mygame/metadata/game_metadata.txt and +make it look like this: + +NOTE: Remove the ~#~ at the beginning of each line. + +#+begin_src +devid=bob +devtitle=Bob The Game Developer +gameid=mygame +gametitle=My Game +version=0.1 +#+end_src + +The ~devid~ property is the username you use to log into Itch.io. +The ~devtitle~ is your name or company name (it can contain spaces). +The ~gameid~ is the Project URL value. +The ~gametitle~ is the name of your game (it can contain spaces). +The ~version~ can be any ~major.minor~ number format. + +** Building Your Game For Distribution + +Open up the terminal and run this from the command line: + +#+begin_src +./dragonruby-publish --only-package mygame +#+end_src + +(if you're on Windows, don't put the "./" on the front. That's a Mac and +Linux thing.) + +A directory called ~./build~ will be created that contains your +binaries. You can upload this to Itch.io manually. + +For the HTML version of your game after you upload it. Check the checkbox labeled +"This file will be played in the browser". + +For subsequent updates you can use an automated deployment to Itch.io: + +#+begin_src +./dragonruby-publish mygame +#+end_src + +DragonRuby will package _and publish_ your game to itch.io! Tell your +friends to go to your game's very own webpage and buy it! + +If you make changes to your game, just re-run dragonruby-publish and it'll +update the downloads for you. + +** DragonRuby's Philosophy + +The following tenants of DragonRuby are what set us apart from other +game engines. Given that Game Toolkit is a relatively new engine, +there are definitely features that are missing. So having a big check +list of "all the cool things" is not this engine's forte. This is +compensated with a strong commitment to the following principals. + +*** Challenge The Status Quo + +Game engines of today are in a local maximum and don't take into +consideration the challenges of this day and age. Unity and GameMaker +specifically rot your brain. It's not sufficient to say: + +#+begin_quote +But that's how we've always done it. +#+end_quote + +It's a hard pill to swallow, but forget blindly accepted best +practices and try to figure out the underlying motivation for a +specific approach to game development. Collaborate with us. + +*** Release Often And Quickly + +The biggest mistake game devs make is spending too much time in +isolation building their game. Release something, however small, and +release it quickly. + +Stop worrying about everything being pixel perfect. Don't wait until +your game is 100% complete. Build your game publicly and +iterate. Post in the #show-and-tell channel in the community Discord. +You'll find a lot of support and encouragement there. + +Remember: + +#+begin_quote +Real artists ship. +#+end_quote + +*** Sustainable And Ethical Monetization + +We all aspire to put food on the table doing what we love. Whether it +is building games, writing tools to support game development, or +anything in between. + +Charge a fair amount of money for the things you create. It's expected +and encouraged within the community. Give what you create away for +free to those that can't afford it. + +*** Sustainable And Ethical Open Source + +This goes hand in hand with sustainable and ethical monetization. The +current state of open source is not sustainable. There is an immense +amount of contributor burnout. Users of open source expect everything +to be free, and few give back. This is a problem we want to fix (we're +still trying to figure out the best solution). + +So, don't be "that guy" in the Discord that says "DragonRuby should be +free and open source!" You will be personally flogged by Amir. + +*** People Over Entities + +We prioritize the endorsement of real people over faceless +entities. This game engine, and other products we create, are not +insignificant line items of a large company. And you aren't a generic +"commodity" or "corporate resource". So be active in the community +Discord and you'll reap the benefits as more devs use DragonRuby. + +*** Building A Game Should Be Fun And Bring Happiness + +We will prioritize the removal of pain. The aesthetics of Ruby make it +such a joy to work with, and we want to capture that within the +engine. + +*** Real World Application Drives Features + +We are bombarded by marketing speak day in and day out. We don't do +that here. There are things that are really great in the engine, and +things that need a lot of work. Collaborate with us so we can help you +reach your goals. Ask for features you actually need as opposed to +anything speculative. + +We want DragonRuby to *actually* help you build the game you +want to build (as opposed to sell you something piece of demoware that +doesn't work). + +* How To Determine What Frame You Are On + +There is a property on ~state~ called ~tick_count~ that is incremented +by DragonRuby every time the ~tick~ method is called. The following +code renders a label that displays the current ~tick_count~. + +#+begin_src ruby + def tick args + args.outputs.labels << [10, 670, "#{args.state.tick_count}"] + end +#+end_src + +* How To Get Current Framerate + +Current framerate is a top level property on the Game Toolkit Runtime +and is accessible via ~args.gtk.current_framerate~. + +#+begin_src ruby + def tick args + args.outputs.labels << [10, 710, "framerate: #{args.gtk.current_framerate.round}"] + end +#+end_src + +* How To Render A Sprite Using An Array + +All file paths should use the forward slash ~/~ *not* backslash +~~. Game Toolkit includes a number of sprites in the ~sprites~ +folder (everything about your game is located in the ~mygame~ directory). + +The following code renders a sprite with a ~width~ and ~height~ of +~100~ in the center of the screen. + +~args.outputs.sprites~ is used to render a sprite. + +#+begin_src ruby + def tick args + args.outputs.sprites << [ + 640 - 50, # X + 360 - 50, # Y + 100, # W + 100, # H + 'sprites/square-blue.png' # PATH + ] + end +#+end_src + +* More Sprite Properties As An Array + +Here are all the properties you can set on a sprite. + +#+begin_src ruby + def tick args + args.outputs.sprites << [ + 100, # X + 100, # Y + 32, # W + 64, # H + 'sprites/square-blue.png', # PATH + 0, # ANGLE + 255, # ALPHA + 0, # RED_SATURATION + 255, # GREEN_SATURATION + 0 # BLUE_SATURATION + ] + end +#+end_src + +* Different Sprite Representations + +Using ordinal positioning can get a little unruly given so many +properties you have control over. + +You can represent a sprite as a ~Hash~: + +#+begin_src ruby + def tick args + args.outputs.sprites << { + x: 640 - 50, + y: 360 - 50, + w: 100, + h: 100, + path: 'sprites/square-blue.png', + angle: 0, + a: 255, + r: 255, + g: 255, + b: 255, + source_x: 0, + source_y: 0, + source_w: -1, + source_h: -1, + flip_vertically: false, + flip_horizontally: false, + angle_anchor_x: 0.5, + angle_anchor_y: 1.0 + } + end +#+end_src + +You can represent a sprite as an ~object~: + +#+begin_src ruby + # Create type with ALL sprite properties AND primitive_marker + class Sprite + attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, + :source_x, :source_y, :source_w, :source_h, + :tile_x, :tile_y, :tile_w, :tile_h, + :flip_horizontally, :flip_vertically, + :angle_anchor_x, :angle_anchor_y + + def primitive_marker + :sprite + end + end + + class BlueSquare < Sprite + def initialize opts + @x = opts[:x] + @y = opts[:y] + @w = opts[:w] + @h = opts[:h] + @path = 'sprites/square-blue.png' + end + end + + def tick args + args.outputs.sprites << (BlueSquare.new x: 640 - 50, + y: 360 - 50, + w: 50, + h: 50) + end +#+end_src + +* How To Render A Label + +~args.outputs.labels~ is used to render labels. + +Labels are how you display text. This code will go directly inside of +the ~def tick args~ method. + +Here is the minimum code: + +#+begin_src + def tick args + # X Y TEXT + args.outputs.labels << [640, 360, "I am a black label."] + end +#+end_src + +* A Colored Label + +#+begin_src + def tick args + # A colored label + # X Y TEXT, RED GREEN BLUE ALPHA + args.outputs.labels << [640, 360, "I am a redish label.", 255, 128, 128, 255] + end +#+end_src + +* Extended Label Properties + +#+begin_src + def tick args + # A colored label + # X Y TEXT SIZE ALIGNMENT RED GREEN BLUE ALPHA FONT FILE + args.outputs.labels << [ + 640, # X + 360, # Y + "Hello world", # TEXT + 0, # SIZE_ENUM + 1, # ALIGNMENT_ENUM + 0, # RED + 0, # GREEN + 0, # BLUE + 255, # ALPHA + "fonts/coolfont.ttf" # FONT + ] + end +#+end_src + +A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value +will decrease the label size. A ~positive~ value will increase the +label's size. + +An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents +"center aligned". ~2~ represents "right aligned". + +* Rendering A Label As A ~Hash~ + +You can add additional metadata about your game within a label, which requires you to use a `Hash` instead. + +#+begin_src + def tick args + args.outputs.labels << { + x: 200, + y: 550, + text: "dragonruby", + size_enum: 2, + alignment_enum: 1, + r: 155, + g: 50, + b: 50, + a: 255, + font: "fonts/manaspc.ttf", + # You can add any properties you like (this will be ignored/won't cause errors) + game_data_one: "Something", + game_data_two: { + value_1: "value", + value_2: "value two", + a_number: 15 + } + } + end +#+end_src + +* Getting The Size Of A Piece Of Text + +You can get the render size of any string using ~args.gtk.calcstringbox~. + +#+begin_src ruby + def tick args + # TEXT SIZE_ENUM FONT + w, h = args.gtk.calcstringbox("some string", 0, "font.ttf") + + # NOTE: The SIZE_ENUM and FONT are optional arguments. + + # Render a label showing the w and h of the text: + args.outputs.labels << [ + 10, + 710, + # This string uses Ruby's string interpolation literal: #{} + "'some string' has width: #{w}, and height: #{h}." + ] + end +#+end_src + +* How To Play A Sound + +Sounds that end ~.wav~ will play once: + +#+begin_src ruby + def tick args + # Play a sound every second + if (args.state.tick_count % 60) == 0 + args.outputs.sounds << 'something.wav' + end + end +#+end_src + +Sounds that end ~.ogg~ is considered background music and will loop: + +#+begin_src ruby + def tick args + # Start a sound loop at the beginning of the game + if args.state.tick_count == 0 + args.outputs.sounds << 'background_music.ogg' + end + end +#+end_src + +If you want to play a ~.ogg~ once as if it were a sound effect, you can do: + +#+begin_src ruby + def tick args + # Play a sound every second + if (args.state.tick_count % 60) == 0 + args.gtk.queue_sound 'some-ogg.ogg' + end + end +#+end_src + +* Using ~args.state~ To Store Your Game State + +~args.state~ is a open data structure that allows you to define +properties that are arbitrarily nested. You don't need to define any kind of +~class~. + +To initialize your game state, use the ~||=~ operator. Any value on +the right side of ~||=~ will only be assigned _once_. + +To assign a value every frame, just use the ~=~ operator, but _make +sure_ you've initialized a default value. + +#+begin_src + def tick args + # initialize your game state ONCE + args.player.x ||= 0 + args.player.y ||= 0 + args.player.hp ||= 100 + + # increment the x position of the character by one every frame + args.player.x += 1 + + # Render a sprite with a label above the sprite + args.outputs.sprites << [ + args.player.x, + args.player.y, + 32, 32, + "player.png" + ] + + args.outputs.labels << [ + args.player.x, + args.player.y - 50, + args.player.hp + ] + end +#+end_src + +* Frequently Asked Questions, Comments, and Concerns + +Here are questions, comments, and concerns that frequently come +up. + +** Frequently Asked Questions + +*** What is DragonRuby LLP? + +DragonRuby LLP is a partnership of four devs who came together +with the goal of bringing the aesthetics and joy of Ruby, everywhere possible. + +Under DragonRuby LLP, we offer a number of products (with more on the +way): + +- Game Toolkit (GTK): A 2D game engine that is compatible with modern + gaming platforms. [Home Page]() [FAQ Page]() +- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [Home Page]() [FAQ Page]() +- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby + environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]() + +All of the products above leverage a shared core called DragonRuby. + +NOTE: From an official branding standpoint each one of the products is +suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is +_one word, title cased_. + +NOTE: We leave the "A DragonRuby LLP Product" off of this one because +that just sounds really weird. + +NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass +identifier huh? + +*** What is DragonRuby? + +The response to this question requires a few subparts. First we need +to clarify some terms. Specifically _language specification_ vs _runtime_. + +*** Okay... so what is the difference between a language specification and a runtime? + +A runtime is an _implementation_ of a language specification. When +people say "Ruby," they are usually referring to "the Ruby 3.0+ language +specification implemented via the CRuby/MRI Runtime." + +But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, +and (last but certainly not least) DragonRuby. + +*** Okay... what language specification does DragonRuby use then? + +DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's +syntax is Ruby 2.x compatible, but also contains semantic changes that help +it natively interface with platform specific libraries. + +*** So... why another runtime? + +The elevator pitch is: + +DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" +within the runtime allows us to target platforms no other Ruby can +target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo +Switch, PS4, Xbox, and Scadia. + +*** What does Multilevel Cross-platform mean? + +There are complexities associated with targeting all the platforms we +support. Because of this, the runtime had to be architected in such a +way that new platforms could be easily added (which lead to us partitioning the +runtime internally): + +- Level 1 we leverage a good portion of mRuby. +- Level 2 consists of optimizations to mRuby we've made given that our + target platforms are well known. +- Level 3 consists of portable C libraries and their Ruby + C-Extensions. + +Levels 1 through 3 are fairly commonplace in many runtime +implementations (with level 1 being the most portable, and level 3 +being the fastest). But the DragonRuby Runtime has taken things a +bit further: + +- Level 4 consists of shared abstractions around hardware I/O and operating + system resources. This level leverages open source and proprietary + components within Simple DirectMedia Layer (a low level multimedia + component library that has been in active development for 22 years + and counting). + +- Level 5 is a code generation layer which creates metadata that allows + for native interoperability with host runtime libraries. It also + includes OS specific message pump orchestrations. + +- Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This + compiler outputs _very_ fast platform specific bitcode, but only + supports a subset of the Ruby language specification. + +These levels allow us to stay up to date with open source +implementations of Ruby; provide fast, native code execution +on proprietary platforms; ensure good separation between these two +worlds; and provides a means to add new platforms without going insane. + +*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? + +DragonRuby is a Ruby runtime implementation that takes all the lessons +we've learned from MRI/CRuby, and merges it with the latest and greatest +compiler and OSS technologies. + +** Frequent Comments + +*** But Ruby is dead. + +Let's check the official source for the answer to this question: +isrubydead.com: [[https://isrubydead.com/]]. + +On a more serious note, Ruby's _quantity_ levels aren't what they used +to be. And that's totally fine. Every one chases the new and shiny. + +What really matters is _quality/maturity_. Here is the latest (StackOverflow +Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies]. + +Let's stop making this comment shall we? + +*** But Ruby is slow. + +That doesn't make any sense. A language specification can't be +slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd +have to talk about which runtime. + +*** Dynamic languages are slow. + +They are certainly slower than statically compiled languages. With the +processing power and compiler optimizations we have today, +dynamic languages like Ruby are _fast enough_. + +Unless you are writing in some form of intermediate representation by hand, +your language of choice also suffers this same fallacy of slow. Like, nothing is +faster than a low level assembly-like language. So unless you're +writing in that, let's stop making this comment. + +NOTE: If you _are_ hand writing LLVM IR, we are always open to +bringing on new partners with such a skill set. Email us ^_^. + +** Frequent Concerns + +*** DragonRuby is not open source. That's not right. + +The current state of open source is unsustainable. Contributors work +for free, most all open source repositories are severely under-staffed, +and burnout from core members is rampant. + +We believe in open source very strongly. Parts of DragonRuby are +in fact, open source. Just not all of it (for legal reasons, and +because the IP we've created has value). And we promise that we are +looking for (or creating) ways to _sustainably_ open source everything we do. + +If you have ideas on how we can do this, email us! + +If the reason above isn't sufficient, then definitely use something else. + +*** DragonRuby is for pay. You should offer a free version. + +If you can afford to pay for DragonRuby, you should (and will). We don't go +around telling writers that they should give us their books for free, +and only require payment if we read the entire thing. It's time we stop asking that +of software products. + +That being said, we will _never_ put someone out financially. We have +income assistance for anyone that can't afford a license to any one of +our products. + +You qualify for a free, unrestricted license to DragonRuby products if +any of the following items pertain to you: + +- Your income is below $2,000.00 (USD) per month. +- You are under 18 years of age. +- You are a student of any type: traditional public school, home + schooling, college, bootcamp, or online. +- You are a teacher, mentor, or parent who wants to teach a kid how to code. +- You work/worked in public service or at a charitable organization: + for example public office, army, or any 501(c)(3) organization. + +Just contact Amir at [email protected] with a short +explanation of your current situation and he'll set you up. No +questions asked. + +*** But still, you should offer a free version. So I can try it out and see if I like it. + +You can try our [web-based sandbox environment](). But it won't do the +runtime justice. Or just come to our [Slack]() or [Discord]() channel +and ask questions. We'd be happy to have a one on one video chat with +you and show off all the cool stuff we're doing. + +Seriously just buy it. Get a refund if you don't like it. We make it +stupid easy to do so. + +*** I still think you should do a free version. Think of all people who would give it a shot. + +Free isn't a sustainable financial model. We don't want to spam your +email. We don't want to collect usage data off of you either. We just +want to provide quality toolchains to quality developers (as opposed +to a large quantity of developers). + +The people that pay for DragonRuby and make an effort to understand it are the +ones we want to build a community around, partner with, and collaborate +with. So having that small monetary wall deters entitled individuals +that don't value the same things we do. + +*** What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent. + +That won't happen if the development world stop asking for free stuff +and non-trivially compensate open source developers. Look, we want to be +able to work on the stuff we love, every day of our lives. And we'll go +to great lengths to make that happen. + +But, in the event that sad day comes, our partnership bylaws state that +_all_ DragonRuby IP that can be legally open sourced, will be released +under a permissive license. + +* DOCS: ~GTK::Runtime~ +The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~. + +* DOCS: ~GTK::Runtime#reset~ +This function will reset Kernel.tick_count to 0 and will remove all data from args.state. + +* DOCS: ~GTK::Runtime#calcstringbox~ +This function returns the width and height of a string. + +#+begin_src ruby + def tick args + args.state.string_size ||= args.gtk.calcstringbox "Hello World" + args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World" + end +#+end_src + +* DOCS: ~Array~ + +The Array class has been extend to provide methods that +will help in common game development tasks. Array is one of the most +powerful classes in Ruby and a very fundamental component of Game Toolkit. + + +* DOCS: ~Array#map~ + +The function given a block returns a new ~Enumerable~ of values. + +Example of using ~Array#map~ in conjunction with ~args.state~ and +~args.outputs.sprites~ to render sprites to the screen. + +#+begin_src + def tick args + # define the colors of the rainbow in ~args.state~ + # as an ~Array~ of ~Hash~es with :order and :name. + # :order will be used to determine render location + # and :name will be used to determine sprite path. + args.state.rainbow_colors ||= [ + { order: 0, name: :red }, + { order: 1, name: :orange }, + { order: 2, name: :yellow }, + { order: 3, name: :green }, + { order: 4, name: :blue }, + { order: 5, name: :indigo }, + { order: 6, name: :violet }, + ] + + # render sprites diagonally to the screen + # with a width and height of 50. + args.outputs + .sprites << args.state + .rainbow_colors + .map do |color| # <-- ~Array#map~ usage + [ + color[:order] * 50, + color[:order] * 50, + 50, + 50, + "sprites/square-#{color[:name]}.png" + ] + end + end +#+end_src + + +* DOCS: ~Array#each~ + +The function, given a block, invokes the block for each item in the +~Array~. ~Array#each~ is synonymous to foreach constructs in other languages. + +Example of using ~Array#each~ in conjunction with ~args.state~ and +~args.outputs.sprites~ to render sprites to the screen: + +#+begin_src + def tick args + # define the colors of the rainbow in ~args.state~ + # as an ~Array~ of ~Hash~es with :order and :name. + # :order will be used to determine render location + # and :name will be used to determine sprite path. + args.state.rainbow_colors ||= [ + { order: 0, name: :red }, + { order: 1, name: :orange }, + { order: 2, name: :yellow }, + { order: 3, name: :green }, + { order: 4, name: :blue }, + { order: 5, name: :indigo }, + { order: 6, name: :violet }, + ] + + # render sprites diagonally to the screen + # with a width and height of 50. + args.state + .rainbow_colors + .map do |color| # <-- ~Array#each~ usage + args.outputs.sprites << [ + color[:order] * 50, + color[:order] * 50, + 50, + 50, + "sprites/square-#{color[:name]}.png" + ] + end + end +#+end_src + + +* DOCS: ~Array#reject_nil~ + +Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias +for ~Array#compact~: + +#+begin_src + repl do + a = [1, nil, 4, false, :a] + puts a.reject_nil + # => [1, 4, false, :a] + puts a.compact + # => [1, 4, false, :a] + end +#+end_src + + +* DOCS: ~Array#reject_false~ + +Returns an `Enumerable` rejecting items that are `nil` or `false`. + +#+begin_src + repl do + a = [1, nil, 4, false, :a] + puts a.reject_false + # => [1, 4, :a] + end +#+end_src + + +* DOCS: ~Array#product~ + +Returns all combinations of values between two arrays. + +Here are some examples of using ~product~. Paste the +following code at the bottom of main.rb and save +the file to see the results: + +#+begin_src + repl do + a = [0, 1] + puts a.product + # => [[0, 0], [0, 1], [1, 0], [1, 1]] + end +#+end_src + +#+begin_src + repl do + a = [ 0, 1] + b = [:a, :b] + puts a.product b + # => [[0, :a], [0, :b], [1, :a], [1, :b]] + end +#+end_src + + +* DOCS: ~Array#map_2d~ + +Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. +A 2D array is a common way to store data/layout for a stage. + +#+begin_src + repl do + stage = [ + [:enemy, :empty, :player], + [:empty, :empty, :empty], + [:enemy, :empty, :enemy], + ] + + occupied_tiles = stage.map_2d do |row, col, tile| + if tile == :empty + nil + else + [row, col, tile] + end + end.reject_nil + + puts "Stage:" + puts stage + + puts "Occupied Tiles" + puts occupied_tiles + end +#+end_src + + +* DOCS: ~Array#include_any?~ + +Given a collection of items, the function will return +~true~ if any of ~self~'s items exists in the collection of items passed in: + + +* DOCS: ~Array#any_intersect_rect?~ + +Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, +this method returns ~true~ if any of the elements within +the array intersect the object being passed in. You are given an optional +parameter called ~tolerance~ which informs how close to the other rectangles +the elements need to be for it to be considered intersecting. + +The default tolerance is set to ~0.1~, which means that the primitives are not +considered intersecting unless they are overlapping by more than ~0.1~. + +#+begin_src + repl do + # Here is a player class that has position and implement + # the ~attr_rect~ contract. + class Player + attr_rect + attr_accessor :x, :y, :w, :h + + def initialize x, y, w, h + @x = x + @y = y + @w = w + @h = h + end + + def serialize + { x: @x, y: @y, w: @w, h: @h } + end + + def inspect + "#{serialize}" + end + + def to_s + "#{serialize}" + end + end + + # Here is a definition of two walls. + walls = [ + [10, 10, 10, 10], + { x: 20, y: 20, w: 10, h: 10 }, + ] + + # Display the walls. + puts "Walls." + puts walls + puts "" + + # Check any_intersect_rect? on player + player = Player.new 30, 20, 10, 10 + puts "Is Player #{player} touching wall?" + puts (walls.any_intersect_rect? player) + # => false + # The value is false because of the default tolerance is 0.1. + # The overlap of the player rect and any of the wall rects is + # less than 0.1 (for those that intersect). + puts "" + + player = Player.new 9, 10, 10, 10 + puts "Is Player #{player} touching wall?" + puts (walls.any_intersect_rect? player) + # => true + puts "" + end +#+end_src + + +* DOCS: ~GTK::Outputs~ + +Outputs is how you render primitives to the screen. The minimal setup for +rendering something to the screen is via a ~tick~ method defined in +mygame/app/main.rb + +#+begin_src + def tick args + # code goes here + end +#+end_src + + +* DOCS: ~GTK::Outputs#solids~ + +Add primitives to this collection to render a solid to the screen. + +** Rendering a solid using an Array + +Creates a solid black rectangle located at 100, 100. 160 pixels +wide and 90 pixels tall. + +#+begin_src + def tick args + # X Y WIDTH HEIGHT + args.outputs.solids << [100, 100, 160, 90] + end +#+end_src + +** Rendering a solid using an Array with colors and alpha + +The value for the color and alpha is an number between ~0~ and ~255~. The +alpha property is optional and will be set to ~255~ if not specified. + +Creates a green solid rectangle with an opacity of 50%. + +#+begin_src + def tick args + # X Y WIDTH HEIGHT RED GREEN BLUE ALPHA + args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128] + end +#+end_src + +** Rendering a solid using a Hash + +If you want a more readable invocation. You can use the following hash to create a solid. +Any parameters that are not specified will be given a default value. The keys of the hash can +be provided in any order. + +#+begin_src + def tick args + args.outputs.solids << { + x: 0, + y: 0, + w: 100, + h: 100, + r: 0, + g: 255, + b: 0, + a: 255 + } + end +#+end_src + +** Rendering a solid using a Class + +You can also create a class with solid/border properties and render it as a primitive. +ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ +must be defined on the class. + +Here is an example: + +#+begin_src + # Create type with ALL solid properties AND primitive_marker + class Solid + attr_accessor :x, :y, :w, :h, :r, :g, :b, :a + + def primitive_marker + :solid + end + end + + # Inherit from type + class Square < Solid + # constructor + def initialize x, y, size + self.x = x + self.y = y + self.w = size + self.h = size + end + end + + def tick args + # render solid/border + args.outputs.solids << Square.new(10, 10, 32) + end +#+end_src + + +* DOCS: ~GTK::Outputs#borders~ + +Add primitives to this collection to render an unfilled solid to the screen. Take a look at the +documentation for Outputs#solids. + +The only difference between the two primitives is where they are added. + +Instead of using ~args.outputs.solids~: + +#+begin_src + def tick args + # X Y WIDTH HEIGHT + args.outputs.solids << [100, 100, 160, 90] + end +#+end_src + +You have to use ~args.outputs.borders~: + +#+begin_src + def tick args + # X Y WIDTH HEIGHT + args.outputs.borders << [100, 100, 160, 90] + end +#+end_src + + +* DOCS: ~GTK::Mouse~ + +The mouse is accessible via ~args.inputs.mouse~: + +#+begin_src ruby + def tick args + # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse). + args.outputs.labels << [ + 10, + 710, + "The mouse's position is: #{args.inputs.mouse.x} #{args.inputs.mouse.y}." + ] + end +#+end_src + +The mouse has the following properties. + +- ~args.inputs.mouse.x~: Returns the x position of the mouse. +- ~args.inputs.mouse.y~: Returns the y position of the mouse. +- ~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick. +- ~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move. +- ~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move. +- ~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed. +- ~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed. +- ~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released. +- ~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse. +- ~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus. +- ~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~. +- ~args.inputs.mouse.button_left~: Returns true if the left mouse button is down. +- ~args.inputs.mouse.button_right~: Returns true if the right mouse button is down. +- ~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down. +- ~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state. + +* DOCS: ~GTK::MousePoint~ + +The ~GTK::MousePoint~ has the following properties. + +- ~x~: Integer representing the mouse's x. +- ~y~: Integer representing the mouse's y. +- ~point~: Array with the ~x~ and ~y~ values. +- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~created_at~: The tick (~args.state.tick_count~) that this structure was created. +- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created. + + +* DOCS: ~GTK::OpenEntity~ + +~GTK::OpenEntity~ is accessible within the DragonRuby's top level +~tick~ function via the ~args.state~ property. + +#+begin_src + def tick args + args.state.x ||= 100 + args.outputs.labels << [10, 710, "value of x is: #{args.state.x}."] + end +#+end_src + +The primary benefit of using ~args.state~ as opposed to instance +variables is that ~GTK::OpenEntity~ allows for arbitrary nesting +of properties without the need to create intermediate objects. + +For example: + +#+begin_src + def tick args + # intermediate player object does not need to be created + args.state.player.x ||= 100 + args.state.player.y ||= 100 + args.outputs.labels << [ + 10, + 710, + "player x, y is:#{args.state.player.x}, #{args.state.player.y}." + ] + end +#+end_src + + +* DOCS: ~GTK::OpenEntity#as_hash~ + +Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This +property is useful when you want to treat ~args.state~ as a ~Hash~ and +invoke methods such as ~Hash#each~. + +Example: + +#+begin_src + def tick args + args.state.x ||= 100 + args.state.y ||= 100 + values = args.state + .as_hash + .map { |k, v| "#{k} #{v}" } + + args.outputs.labels << values.map.with_index do |v, i| + [ + 10, + 710 - (30 * i), + v + ] + end + end +#+end_src + + +* DOCS: ~Numeric#frame_index~ + +This function is helpful for determining the index of frame-by-frame + sprite animation. The numeric value ~self~ represents the moment the + animation started. + +~frame_index~ takes three additional parameters: + +- How many frames exist in the sprite animation. +- How long to hold each animation for. +- Whether the animation should repeat. + +~frame_index~ will return ~nil~ if the time for the animation is out +of bounds of the parameter specification. + +Example using variables: + +#+begin_src ruby + def tick args + start_looping_at = 0 + number_of_sprites = 6 + number_of_frames_to_show_each_sprite = 4 + does_sprite_loop = true + + sprite_index = + start_looping_at.frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + sprite_index ||= 0 + + args.outputs.sprites << [ + 640 - 50, + 360 - 50, + 100, + 100, + "sprites/dragon-#{sprite_index}.png" + ] + end +#+end_src + +Example using named parameters: + +#+begin_src ruby + def tick args + start_looping_at = 0 + + sprite_index = + start_looping_at.frame_index count: 6, + hold_for: 4, + repeat: true, + tick_count_override: args.state.tick_count + + sprite_index ||= 0 + + args.outputs.sprites << [ + 640 - 50, + 360 - 50, + 100, + 100, + "sprites/dragon-#{sprite_index}.png" + ] + end +#+end_src + + +* DOCS: ~Numeric#elapsed_time~ +For a given number, the elapsed frames since that number is returned. +`Kernel.tick_count` is used to determine how many frames have elapsed. +An optional numeric argument can be passed in which will be used instead +of `Kernel.tick_count`. + +Here is an example of how elapsed_time can be used. + +#+begin_src ruby + def tick args + args.state.last_click_at ||= 0 + + # record when a mouse click occurs + if args.inputs.mouse.click + args.state.last_click_at = args.state.tick_count + end + + # Use Numeric#elapsed_time to determine how long it's been + if args.state.last_click_at.elapsed_time > 120 + args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."] + end + end +#+end_src + +And here is an example where the override parameter is passed in: + +#+begin_src ruby + def tick args + args.state.last_click_at ||= 0 + + # create a state variable that tracks time at half the speed of args.state.tick_count + args.state.simulation_tick = args.state.tick_count.idiv 2 + + # record when a mouse click occurs + if args.inputs.mouse.click + args.state.last_click_at = args.state.simulation_tick + end + + # Use Numeric#elapsed_time to determine how long it's been + if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120 + args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."] + end + end +#+end_src + + +* DOCS: ~Numeric#elapsed?~ +Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be +passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true. + +Example usage (no optional parameter): + +#+begin_src ruby + def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + destroy_at: args.state.tick_count + 60 } + args.state.box_queue << { name: :green, + destroy_at: args.state.tick_count + 60 } + args.state.box_queue << { name: :blue, + destroy_at: args.state.tick_count + 120 } + end + + boxes_to_destroy = args.state + .box_queue + .find_all { |b| b[:destroy_at].elapsed? } + + if !boxes_to_destroy.empty? + puts "boxes to destroy count: #{boxes_to_destroy.length}" + end + + boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_destroy + end +#+end_src + +Example usage (with optional parameter): + +#+begin_src ruby + def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + create_at: args.state.tick_count + 120, + lifespan: 60 } + args.state.box_queue << { name: :green, + create_at: args.state.tick_count + 120, + lifespan: 60 } + args.state.box_queue << { name: :blue, + create_at: args.state.tick_count + 120, + lifespan: 120 } + end + + # lifespan is passed in as a parameter to ~elapsed?~ + boxes_to_destroy = args.state + .box_queue + .find_all { |b| b[:create_at].elapsed? b[:lifespan] } + + if !boxes_to_destroy.empty? + puts "boxes to destroy count: #{boxes_to_destroy.length}" + end + + boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_destroy + end +#+end_src + + +* DOCS: ~Numeric#created?~ +Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that +number is equal to the current frame. + +Example usage: + +#+begin_src ruby + def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + create_at: args.state.tick_count + 60 } + end + + boxes_to_spawn_this_frame = args.state + .box_queue + .find_all { |b| b[:create_at].new? } + + boxes_to_spawn_this_frame.each { |b| puts "box #{b} was new? on #{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_spawn_this_frame + end +#+end_src + +* DOCS: ~Kernel~ + +Kernel in the DragonRuby Runtime has patches for how standard out is handled and also +contains a unit of time in games called a tick. + + +* DOCS: ~Kernel::tick_count~ + +Returns the current tick of the game. This value is reset if you call $gtk.reset. + + +* DOCS: ~Kernel::global_tick_count~ + +Returns the current tick of the application from the point it was started. This value is never reset. + + diff --git a/docs/docs_search.gif b/docs/docs_search.gif Binary files differnew file mode 100644 index 0000000..78168b4 --- /dev/null +++ b/docs/docs_search.gif diff --git a/docs/parse_log.txt b/docs/parse_log.txt new file mode 100644 index 0000000..4b8486f --- /dev/null +++ b/docs/parse_log.txt @@ -0,0 +1,9523 @@ +* Processing True Lines +** Processing line: ~* DragonRuby Game Toolkit Live Docs~ +- Header detected. +*** True Line Result + +*** True Line Result +* DragonRuby Game Toolkit Live Docs +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The information contained here is all available via the DragonRuby~ +** Processing line: ~Console. You can Open the DragonRuby Console by pressing [`] [~] [²]~ +** Processing line: ~[^] [º] or [§] within your game.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game. +** Processing line: ~To search docs you can type ~docs_search "SEARCH TERM"~ or if you want~ +** Processing line: ~to get fancy you can provide a ~lambda~ to filter documentation:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +To search docs you can type ~docs_search "SEARCH TERM"~ or if you want to get fancy you can provide a ~lambda~ to filter documentation: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") }~ +- Inside source: true +*** True Line Result + docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") } +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~[[docs_search.gif]]~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +[[docs_search.gif]] +** Processing line: ~* Hello World~ +- Header detected. +*** True Line Result + +*** True Line Result +* Hello World +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Welcome to DragonRuby Game Toolkit. Take the steps below to get started.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Welcome to DragonRuby Game Toolkit. Take the steps below to get started. +** Processing line: ~* Join the Discord and Subscribe to the News Letter~ +- Header detected. +*** True Line Result + +*** True Line Result +* Join the Discord and Subscribe to the News Letter +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Our Discord channel is [[http://discord.dragonruby.org]].~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Our Discord channel is [[http://discord.dragonruby.org]]. +** Processing line: ~The News Letter will keep you in the loop with regards to current~ +** Processing line: ~DragonRuby Events: [[http://dragonrubydispatch.com]].~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The News Letter will keep you in the loop with regards to current DragonRuby Events: [[http://dragonrubydispatch.com]]. +** Processing line: ~Those who use DragonRuby are called Dragon Riders. This identity is~ +** Processing line: ~incredibly important to us. When someone asks you:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Those who use DragonRuby are called Dragon Riders. This identity is incredibly important to us. When someone asks you: +** Processing line: ~#+begin_quote~ +- Line was identified as a literal block. +*** True Line Result + +*** True Line Result +#+begin_quote +** Processing line: ~What game engine do you use?~ +** Processing line: ~#+end_quote~ +- Line was identified as a literal block. +*** True Line Result +What game engine do you use? +*** True Line Result +#+end_quote +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Reply with:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Reply with: +** Processing line: ~#+begin_quote~ +- Line was identified as a literal block. +*** True Line Result + +*** True Line Result +#+begin_quote +** Processing line: ~I am a Dragon Rider.~ +** Processing line: ~#+end_quote~ +- Line was identified as a literal block. +*** True Line Result +I am a Dragon Rider. +*** True Line Result +#+end_quote +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Watch Some Intro Videos~ +- Header detected. +*** True Line Result + +*** True Line Result +* Watch Some Intro Videos +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Each video is only 20 minutes and all of them will fit into a lunch~ +** Processing line: ~break. So please watch them:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them: +** Processing line: ~1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ +- Line was identified as a start of a list. +*** True Line Result + +** Processing line: ~2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ +- Line was identified as a continuation of a list. +*** True Line Result +1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]] +** Processing line: ~3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ +- Line was identified as a continuation of a list. +*** True Line Result +2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]] +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]] +** Processing line: ~The second and third videos are not required if you are proficient~ +** Processing line: ~with Ruby, but *definitely* watch the first one.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one. +** Processing line: ~You may also want to try this free course provided at~ +** Processing line: ~[[http://dragonruby.school]].~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You may also want to try this free course provided at [[http://dragonruby.school]]. +** Processing line: ~* Getting Started Tutorial~ +- Header detected. +*** True Line Result + +*** True Line Result +* Getting Started Tutorial +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~This is a tutorial written by Ryan C Gordon (a Juggernaut in the~ +** Processing line: ~industry who has contracted to Valve, Epic, Activision, and~ +** Processing line: ~EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]).~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]). +** Processing line: ~** Introduction~ +- Header detected. +*** True Line Result + +*** True Line Result +** Introduction +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Welcome!~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Welcome! +** Processing line: ~Here's just a little push to get you started if you're new to~ +** Processing line: ~programming or game development.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here's just a little push to get you started if you're new to programming or game development. +** Processing line: ~If you want to write a game, it's no different than writing any other~ +** Processing line: ~program for any other framework: there are a few simple rules that~ +** Processing line: ~might be new to you, but more or less programming is programming no~ +** Processing line: ~matter what you are building.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you want to write a game, it's no different than writing any other program for any other framework: there are a few simple rules that might be new to you, but more or less programming is programming no matter what you are building. +** Processing line: ~Did you not know that? Did you think you couldn't write a game because~ +** Processing line: ~you're a "web guy" or you're writing Java at a desk job? Stop letting~ +** Processing line: ~people tell you that you can't, because you already have everything~ +** Processing line: ~you need.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Did you not know that? Did you think you couldn't write a game because you're a "web guy" or you're writing Java at a desk job? Stop letting people tell you that you can't, because you already have everything you need. +** Processing line: ~Here, we're going to be programming in a language called "Ruby." In~ +** Processing line: ~the interest of full disclosure, I (Ryan Gordon) wrote the C parts of~ +** Processing line: ~this toolkit and Ruby looks a little strange to me (Amir Rajan wrote~ +** Processing line: ~the Ruby parts, discounting the parts I mangled), but I'm going to~ +** Processing line: ~walk you through the basics because we're all learning together, and~ +** Processing line: ~if you mostly think of yourself as someone that writes C (or C++, C#,~ +** Processing line: ~Objective-C), PHP, or Java, then you're only a step behind me right~ +** Processing line: ~now.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here, we're going to be programming in a language called "Ruby." In the interest of full disclosure, I (Ryan Gordon) wrote the C parts of this toolkit and Ruby looks a little strange to me (Amir Rajan wrote the Ruby parts, discounting the parts I mangled), but I'm going to walk you through the basics because we're all learning together, and if you mostly think of yourself as someone that writes C (or C++, C#, Objective-C), PHP, or Java, then you're only a step behind me right now. +** Processing line: ~** Prerequisites~ +- Header detected. +*** True Line Result + +*** True Line Result +** Prerequisites +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Here's the most important thing you should know: Ruby lets you do some~ +** Processing line: ~complicated things really easily, and you can learn that stuff~ +** Processing line: ~later. I'm going to show you one or two cool tricks, but that's all.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here's the most important thing you should know: Ruby lets you do some complicated things really easily, and you can learn that stuff later. I'm going to show you one or two cool tricks, but that's all. +** Processing line: ~Do you know what an if statement is? A for-loop? An array? That's all~ +** Processing line: ~you'll need to start.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Do you know what an if statement is? A for-loop? An array? That's all you'll need to start. +** Processing line: ~** The Game Loop~ +- Header detected. +*** True Line Result + +*** True Line Result +** The Game Loop +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Ok, here are few rules with regards to game development with GTK:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Ok, here are few rules with regards to game development with GTK: +** Processing line: ~- Your game is all going to happen under one function ...~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~- that runs 60 times a second ...~ +- Line was identified as a list. +*** True Line Result +- Your game is all going to happen under one function ... +** Processing line: ~- and has to tell the computer what to draw each time.~ +- Line was identified as a list. +*** True Line Result +- that runs 60 times a second ... +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- and has to tell the computer what to draw each time. +** Processing line: ~That's an entire video game in one run-on sentence.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +That's an entire video game in one run-on sentence. +** Processing line: ~Here's that function. You're going to want to put this in~ +** Processing line: ~mygame/app/main.rb, because that's where we'll look for it by~ +** Processing line: ~default. Load it up in your favorite text editor.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here's that function. You're going to want to put this in mygame/app/main.rb, because that's where we'll look for it by default. Load it up in your favorite text editor. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +- Inside source: true +*** True Line Result + args.outputs.labels << [580, 400, 'Hello World!'] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Now run ~dragonruby~ ...did you get a window with "Hello World!"~ +** Processing line: ~written in it? Good, you're officially a game developer!~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Now run ~dragonruby~ ...did you get a window with "Hello World!" written in it? Good, you're officially a game developer! +** Processing line: ~** Breakdown Of The ~tick~ Method~ +- Header detected. +*** True Line Result + +*** True Line Result +** Breakdown Of The ~tick~ Method +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~mygame/app/main.rb~, is where the Ruby source code is located. This~ +** Processing line: ~looks a little strange, so I'll break it down line by line. In Ruby, a~ +** Processing line: ~'#' character starts a single-line comment, so I'll talk about this~ +** Processing line: ~inline.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~mygame/app/main.rb~, is where the Ruby source code is located. This looks a little strange, so I'll break it down line by line. In Ruby, a '#' character starts a single-line comment, so I'll talk about this inline. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # This "def"ines a function, named "tick," which takes a single argument~ +- Inside source: true +*** True Line Result + # This "def"ines a function, named "tick," which takes a single argument +** Processing line: ~ # named "args". DragonRuby looks for this function and calls it every~ +- Inside source: true +*** True Line Result + # named "args". DragonRuby looks for this function and calls it every +** Processing line: ~ # frame, 60 times a second. "args" is a magic structure with lots of~ +- Inside source: true +*** True Line Result + # frame, 60 times a second. "args" is a magic structure with lots of +** Processing line: ~ # information in it. You can set variables in there for your own game state,~ +- Inside source: true +*** True Line Result + # information in it. You can set variables in there for your own game state, +** Processing line: ~ # and every frame it will updated if keys are pressed, joysticks moved,~ +- Inside source: true +*** True Line Result + # and every frame it will updated if keys are pressed, joysticks moved, +** Processing line: ~ # mice clicked, etc.~ +- Inside source: true +*** True Line Result + # mice clicked, etc. +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # One of the things in "args" is the "outputs" object that your game uses~ +- Inside source: true +*** True Line Result + # One of the things in "args" is the "outputs" object that your game uses +** Processing line: ~ # to draw things. Afraid of rendering APIs? No problem. In DragonRuby,~ +- Inside source: true +*** True Line Result + # to draw things. Afraid of rendering APIs? No problem. In DragonRuby, +** Processing line: ~ # you use arrays to draw things and we figure out the details.~ +- Inside source: true +*** True Line Result + # you use arrays to draw things and we figure out the details. +** Processing line: ~ # If you want to draw text on the screen, you give it an array (the thing~ +- Inside source: true +*** True Line Result + # If you want to draw text on the screen, you give it an array (the thing +** Processing line: ~ # in the [ brackets ]), with an X and Y coordinate and the text to draw.~ +- Inside source: true +*** True Line Result + # in the [ brackets ]), with an X and Y coordinate and the text to draw. +** Processing line: ~ # The "<<" thing says "append this array onto the list of them at~ +- Inside source: true +*** True Line Result + # The "<<" thing says "append this array onto the list of them at +** Processing line: ~ # args.outputs.labels)~ +- Inside source: true +*** True Line Result + # args.outputs.labels) +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +- Inside source: true +*** True Line Result + args.outputs.labels << [580, 400, 'Hello World!'] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Once your ~tick~ function finishes, we look at all the arrays you made~ +** Processing line: ~and figure out how to draw it. You don't need to know about graphics~ +** Processing line: ~APIs. You're just setting up some arrays! DragonRuby clears out these~ +** Processing line: ~arrays every frame, so you just need to add what you need _right now_~ +** Processing line: ~each time.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Once your ~tick~ function finishes, we look at all the arrays you made and figure out how to draw it. You don't need to know about graphics APIs. You're just setting up some arrays! DragonRuby clears out these arrays every frame, so you just need to add what you need _right now_ each time. +** Processing line: ~** Rendering A Sprite~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering A Sprite +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Now let's spice this up a little.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Now let's spice this up a little. +** Processing line: ~We're going to add some graphics. Each 2D image in DragonRuby is~ +** Processing line: ~called a "sprite," and to use them, you just make sure they exist in a~ +** Processing line: ~reasonable file format (png, jpg, gif, bmp, etc) and specify them by~ +** Processing line: ~filename. The first time you use one, DragonRuby will load it and keep~ +** Processing line: ~it in video memory for fast access in the future. If you use a~ +** Processing line: ~filename that doesn't exist, you get a fun checkerboard pattern!~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +We're going to add some graphics. Each 2D image in DragonRuby is called a "sprite," and to use them, you just make sure they exist in a reasonable file format (png, jpg, gif, bmp, etc) and specify them by filename. The first time you use one, DragonRuby will load it and keep it in video memory for fast access in the future. If you use a filename that doesn't exist, you get a fun checkerboard pattern! +** Processing line: ~There's a "dragonruby.png" file included, just to get you~ +** Processing line: ~started. Let's have it draw every frame with our text:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +There's a "dragonruby.png" file included, just to get you started. Let's have it draw every frame with our text: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +- Inside source: true +*** True Line Result + args.outputs.labels << [580, 400, 'Hello World!'] +** Processing line: ~ args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png']~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png'] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~(Pro Tip: you don't have to restart DragonRuby to test your changes;~ +** Processing line: ~when you save main.rb, DragonRuby will notice and reload your~ +** Processing line: ~program.)~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +(Pro Tip: you don't have to restart DragonRuby to test your changes; when you save main.rb, DragonRuby will notice and reload your program.) +** Processing line: ~That ~.sprites~ line says "add a sprite to the list of sprites we're~ +** Processing line: ~drawing, and draw it at position (576, 100) at a size of 128x101~ +** Processing line: ~pixels". You can find the image to draw at dragonruby.png.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +That ~.sprites~ line says "add a sprite to the list of sprites we're drawing, and draw it at position (576, 100) at a size of 128x101 pixels". You can find the image to draw at dragonruby.png. +** Processing line: ~** Coordinate System and Virtual Canvas~ +- Header detected. +*** True Line Result + +*** True Line Result +** Coordinate System and Virtual Canvas +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Quick note about coordinates: (0, 0) is the bottom left corner of the~ +** Processing line: ~screen, and positive numbers go up and to the right. This is more~ +** Processing line: ~"geometrically correct," even if it's not how you remember doing 2D~ +** Processing line: ~graphics, but we chose this for a simpler reason: when you're making~ +** Processing line: ~Super Mario Brothers and you want Mario to jump, you should be able to~ +** Processing line: ~add to Mario's y position as he goes up and subtract as he falls. It~ +** Processing line: ~makes things easier to understand.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Quick note about coordinates: (0, 0) is the bottom left corner of the screen, and positive numbers go up and to the right. This is more "geometrically correct," even if it's not how you remember doing 2D graphics, but we chose this for a simpler reason: when you're making Super Mario Brothers and you want Mario to jump, you should be able to add to Mario's y position as he goes up and subtract as he falls. It makes things easier to understand. +** Processing line: ~Also: your game screen is _always_ 1280x720 pixels. If you resize the~ +** Processing line: ~window, we will scale and letterbox everything appropriately, so you~ +** Processing line: ~never have to worry about different resolutions.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Also: your game screen is _always_ 1280x720 pixels. If you resize the window, we will scale and letterbox everything appropriately, so you never have to worry about different resolutions. +** Processing line: ~Ok, now we have an image on the screen, let's animate it:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Ok, now we have an image on the screen, let's animate it: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.rotation ||= 0~ +- Inside source: true +*** True Line Result + args.state.rotation ||= 0 +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!' ]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [580, 400, 'Hello World!' ] +** Processing line: ~ args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation]~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation] +** Processing line: ~ args.state.rotation -= 1~ +- Inside source: true +*** True Line Result + args.state.rotation -= 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Now you can see that this function is getting called a lot!~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Now you can see that this function is getting called a lot! +** Processing line: ~** Game State~ +- Header detected. +*** True Line Result + +*** True Line Result +** Game State +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for~ +** Processing line: ~"if args.state.rotation isn't initialized, set it to zero." It's a~ +** Processing line: ~nice way to embed your initialization code right next to where you~ +** Processing line: ~need the variable.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for "if args.state.rotation isn't initialized, set it to zero." It's a nice way to embed your initialization code right next to where you need the variable. +** Processing line: ~~args.state~ is a place you can hang your own data and have it survive~ +** Processing line: ~past the life of the function call. In this case, the current rotation~ +** Processing line: ~of our sprite, which is happily spinning at 60 frames per second. If~ +** Processing line: ~you don't specify rotation (or alpha, or color modulation, or a source~ +** Processing line: ~rectangle, etc), DragonRuby picks a reasonable default, and the array~ +** Processing line: ~is ordered by the most likely things you need to tell us: position,~ +** Processing line: ~size, name.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~args.state~ is a place you can hang your own data and have it survive past the life of the function call. In this case, the current rotation of our sprite, which is happily spinning at 60 frames per second. If you don't specify rotation (or alpha, or color modulation, or a source rectangle, etc), DragonRuby picks a reasonable default, and the array is ordered by the most likely things you need to tell us: position, size, name. +** Processing line: ~** There Is No Delta Time~ +- Header detected. +*** True Line Result + +*** True Line Result +** There Is No Delta Time +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~One thing we decided to do in DragonRuby is not make you worry about~ +** Processing line: ~delta time: your function runs at 60 frames per second (about 16~ +** Processing line: ~milliseconds) and that's that. Having to worry about framerate is~ +** Processing line: ~something massive triple-AAA games do, but for fun little 2D games?~ +** Processing line: ~You'd have to work really hard to not hit 60fps. All your drawing is~ +** Processing line: ~happening on a GPU designed to run Fortnite quickly; it can definitely~ +** Processing line: ~handle this.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +One thing we decided to do in DragonRuby is not make you worry about delta time: your function runs at 60 frames per second (about 16 milliseconds) and that's that. Having to worry about framerate is something massive triple-AAA games do, but for fun little 2D games? You'd have to work really hard to not hit 60fps. All your drawing is happening on a GPU designed to run Fortnite quickly; it can definitely handle this. +** Processing line: ~Since we didn't make you worry about delta time, you can just move the~ +** Processing line: ~rotation by 1 every time and it works without you having to keep track~ +** Processing line: ~of time and math. Want it to move faster? Subtract 2.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Since we didn't make you worry about delta time, you can just move the rotation by 1 every time and it works without you having to keep track of time and math. Want it to move faster? Subtract 2. +** Processing line: ~** Handling User Input~ +- Header detected. +*** True Line Result + +*** True Line Result +** Handling User Input +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Now, let's move that image around.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Now, let's move that image around. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.rotation ||= 0~ +- Inside source: true +*** True Line Result + args.state.rotation ||= 0 +** Processing line: ~ args.state.x ||= 576~ +- Inside source: true +*** True Line Result + args.state.x ||= 576 +** Processing line: ~ args.state.y ||= 100~ +- Inside source: true +*** True Line Result + args.state.y ||= 100 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.inputs.mouse.click~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click +** Processing line: ~ args.state.x = args.inputs.mouse.click.point.x - 64~ +- Inside source: true +*** True Line Result + args.state.x = args.inputs.mouse.click.point.x - 64 +** Processing line: ~ args.state.y = args.inputs.mouse.click.point.y - 50~ +- Inside source: true +*** True Line Result + args.state.y = args.inputs.mouse.click.point.y - 50 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +- Inside source: true +*** True Line Result + args.outputs.labels << [580, 400, 'Hello World!'] +** Processing line: ~ args.outputs.sprites << [args.state.x,~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [args.state.x, +** Processing line: ~ args.state.y,~ +- Inside source: true +*** True Line Result + args.state.y, +** Processing line: ~ 128,~ +- Inside source: true +*** True Line Result + 128, +** Processing line: ~ 101,~ +- Inside source: true +*** True Line Result + 101, +** Processing line: ~ 'dragonruby.png',~ +- Inside source: true +*** True Line Result + 'dragonruby.png', +** Processing line: ~ args.state.rotation]~ +- Inside source: true +*** True Line Result + args.state.rotation] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.rotation -= 1~ +- Inside source: true +*** True Line Result + args.state.rotation -= 1 +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Everywhere you click your mouse, the image moves there. We set a~ +** Processing line: ~default location for it with ~args.state.x ||= 576~, and then we~ +** Processing line: ~change those variables when we see the mouse button in action. You can~ +** Processing line: ~get at the keyboard and game controllers in similar ways.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Everywhere you click your mouse, the image moves there. We set a default location for it with ~args.state.x ||= 576~, and then we change those variables when we see the mouse button in action. You can get at the keyboard and game controllers in similar ways. +** Processing line: ~** Coding On A Raspberry Pi~ +- Header detected. +*** True Line Result + +*** True Line Result +** Coding On A Raspberry Pi +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we~ +** Processing line: ~believe it _should_ work on any model with comparable specs.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we believe it _should_ work on any model with comparable specs. +** Processing line: ~If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run~ +** Processing line: ~a game made with the Toolkit on a Raspberry Pi, and it's really really slow--~ +** Processing line: ~like one frame every few seconds--then there's likely a simple fix.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- like one frame every few seconds--then there's likely a simple fix. +** Processing line: ~You're probably running a desktop environment: menus, apps, web browsers,~ +** Processing line: ~etc. This is okay! Launch the terminal app and type:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You're probably running a desktop environment: menus, apps, web browsers, etc. This is okay! Launch the terminal app and type: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~sudo raspi-config~ +- Inside source: true +*** True Line Result +sudo raspi-config +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~It'll ask you for your password (if you don't know, try "raspberry"), and then~ +** Processing line: ~give you a menu of options. Find your way to "Advanced Options", then "GL~ +** Processing line: ~Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is~ +** Processing line: ~also listed there. Save and reboot. In theory, this should fix the problem.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +It'll ask you for your password (if you don't know, try "raspberry"), and then give you a menu of options. Find your way to "Advanced Options", then "GL Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is also listed there. Save and reboot. In theory, this should fix the problem. +** Processing line: ~If you're _still_ having problems and have a Raspberry Pi 2 or better, go back~ +** Processing line: ~to raspi-config and head over to "Advanced Options", "Memory split," and give~ +** Processing line: ~the GPU 256 megabytes. You might be able to avoid this for simple games, as~ +** Processing line: ~this takes RAM away from the system and reserves it for graphics. You can~ +** Processing line: ~also try 128 megabytes as a gentler option.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you're _still_ having problems and have a Raspberry Pi 2 or better, go back to raspi-config and head over to "Advanced Options", "Memory split," and give the GPU 256 megabytes. You might be able to avoid this for simple games, as this takes RAM away from the system and reserves it for graphics. You can also try 128 megabytes as a gentler option. +** Processing line: ~Note that you can also run DragonRuby without X11 at all: if you run it from~ +** Processing line: ~a virtual terminal it will render fullscreen and won't need the "Full KMS"~ +** Processing line: ~option. This might be attractive if you want to use it as a game console~ +** Processing line: ~sort of thing, or develop over ssh, or launch it from RetroPie, etc.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Note that you can also run DragonRuby without X11 at all: if you run it from a virtual terminal it will render fullscreen and won't need the "Full KMS" option. This might be attractive if you want to use it as a game console sort of thing, or develop over ssh, or launch it from RetroPie, etc. +** Processing line: ~** Conclusion~ +- Header detected. +*** True Line Result + +*** True Line Result +** Conclusion +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~There is a lot more you can do with DragonRuby, but now you've already~ +** Processing line: ~got just about everything you need to make a simple game. After all,~ +** Processing line: ~even the most fancy games are just creating objects and moving them~ +** Processing line: ~around. Experiment a little. Add a few more things and have them~ +** Processing line: ~interact in small ways. Want something to go away? Just don't add it~ +** Processing line: ~to ~args.output~ anymore.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore. +** Processing line: ~** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!~ +- Header detected. +*** True Line Result + +*** True Line Result +** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!! +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Now that you've completed the Hello World tutorial. Head over to the~ +** Processing line: ~`samples` directory. It is very very important that you study the~ +** Processing line: ~sample apps thoroughly! Go through them in order. Here is a short~ +** Processing line: ~description of each sample app.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app. +** Processing line: ~1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s.~ +- Line was identified as a start of a list. +*** True Line Result + +** Processing line: ~2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language.~ +- Line was identified as a continuation of a list. +*** True Line Result +1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s. +** Processing line: ~3. 01_api_01_labels: Various ways to render ~label~s.~ +- Line was identified as a continuation of a list. +*** True Line Result +2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language. +** Processing line: ~4. 01_api_02_lines: Various ways to render ~line~s.~ +- Line was identified as a continuation of a list. +*** True Line Result +3. 01_api_01_labels: Various ways to render ~label~s. +** Processing line: ~5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s.~ +- Line was identified as a continuation of a list. +*** True Line Result +4. 01_api_02_lines: Various ways to render ~line~s. +** Processing line: ~6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s.~ +- Line was identified as a continuation of a list. +*** True Line Result +5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s. +** Processing line: ~7. 01_api_05_keyboard: Hows how to get keyboard input from the user.~ +- Line was identified as a continuation of a list. +*** True Line Result +6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s. +** Processing line: ~8. 01_api_06_mouse: Hows how to get mouse mouse position.~ +- Line was identified as a continuation of a list. +*** True Line Result +7. 01_api_05_keyboard: Hows how to get keyboard input from the user. +** Processing line: ~9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection.~ +- Line was identified as a continuation of a list. +*** True Line Result +8. 01_api_06_mouse: Hows how to get mouse mouse position. +** Processing line: ~10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles.~ +- Line was identified as a continuation of a list. +*** True Line Result +9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection. +** Processing line: ~11. 01_api_10_controller: Interaction with a USB/Bluetooth controller.~ +- Line was identified as a continuation of a list. +*** True Line Result +10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles. +** Processing line: ~12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~.~ +- Line was identified as a continuation of a list. +*** True Line Result +11. 01_api_10_controller: Interaction with a USB/Bluetooth controller. +** Processing line: ~13. 02_collision_01_simple: Collision detection with dynamically moving bodies.~ +- Line was identified as a continuation of a list. +*** True Line Result +12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~. +** Processing line: ~14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input.~ +- Line was identified as a continuation of a list. +*** True Line Result +13. 02_collision_01_simple: Collision detection with dynamically moving bodies. +** Processing line: ~15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system).~ +- Line was identified as a continuation of a list. +*** True Line Result +14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input. +** Processing line: ~16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated.~ +- Line was identified as a continuation of a list. +*** True Line Result +15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system). +** Processing line: ~17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated.~ +- Line was identified as a continuation of a list. +*** True Line Result +16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated. +** Processing line: ~18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input.~ +- Line was identified as a continuation of a list. +*** True Line Result +17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated. +** Processing line: ~19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player.~ +- Line was identified as a continuation of a list. +*** True Line Result +18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input. +** Processing line: ~20. 04_sounds: How to play sounds and work with buttons.~ +- Line was identified as a continuation of a list. +*** True Line Result +19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player. +** Processing line: ~21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player.~ +- Line was identified as a continuation of a list. +*** True Line Result +20. 04_sounds: How to play sounds and work with buttons. +** Processing line: ~22. 05_mouse_move_paint_app: Represents a simple paint app.~ +- Line was identified as a continuation of a list. +*** True Line Result +21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player. +** Processing line: ~23. 05_mouse_move_tile_editor: A starting point for a tile editor.~ +- Line was identified as a continuation of a list. +*** True Line Result +22. 05_mouse_move_paint_app: Represents a simple paint app. +** Processing line: ~24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left.~ +- Line was identified as a continuation of a list. +*** True Line Result +23. 05_mouse_move_tile_editor: A starting point for a tile editor. +** Processing line: ~25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera).~ +- Line was identified as a continuation of a list. +*** True Line Result +24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left. +** Processing line: ~26. 07_render_targets_advanced: Advanced usage of ~render_target~s.~ +- Line was identified as a continuation of a list. +*** True Line Result +25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera). +** Processing line: ~27. 08_platformer_collisions: Axis aligned collision along with platformer physics.~ +- Line was identified as a continuation of a list. +*** True Line Result +26. 07_render_targets_advanced: Advanced usage of ~render_target~s. +** Processing line: ~28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game.~ +- Line was identified as a continuation of a list. +*** True Line Result +27. 08_platformer_collisions: Axis aligned collision along with platformer physics. +** Processing line: ~29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision.~ +- Line was identified as a continuation of a list. +*** True Line Result +28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game. +** Processing line: ~30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite.~ +- Line was identified as a continuation of a list. +*** True Line Result +29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision. +** Processing line: ~31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet.~ +- Line was identified as a continuation of a list. +*** True Line Result +30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite. +** Processing line: ~32. 10_save_load_game: Save and load game data.~ +- Line was identified as a continuation of a list. +*** True Line Result +31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet. +** Processing line: ~33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type.~ +- Line was identified as a continuation of a list. +*** True Line Result +32. 10_save_load_game: Save and load game data. +** Processing line: ~34. 11_hash_primitives: How primitives can be represented using a ~Hash~.~ +- Line was identified as a continuation of a list. +*** True Line Result +33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type. +** Processing line: ~35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen.~ +- Line was identified as a continuation of a list. +*** True Line Result +34. 11_hash_primitives: How primitives can be represented using a ~Hash~. +** Processing line: ~36. 12_top_down_area: How to render a top down map and how to manage collision of a player.~ +- Line was identified as a continuation of a list. +*** True Line Result +35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen. +** Processing line: ~37. 13_01_easing_functions: How to use lerping functions to define animations/movement.~ +- Line was identified as a continuation of a list. +*** True Line Result +36. 12_top_down_area: How to render a top down map and how to manage collision of a player. +** Processing line: ~38. 13_02_cubic_bezier: How to create a bezier curve using lines.~ +- Line was identified as a continuation of a list. +*** True Line Result +37. 13_01_easing_functions: How to use lerping functions to define animations/movement. +** Processing line: ~39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation.~ +- Line was identified as a continuation of a list. +*** True Line Result +38. 13_02_cubic_bezier: How to create a bezier curve using lines. +** Processing line: ~40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions.~ +- Line was identified as a continuation of a list. +*** True Line Result +39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation. +** Processing line: ~41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen.~ +- Line was identified as a continuation of a list. +*** True Line Result +40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions. +** Processing line: ~42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value).~ +- Line was identified as a continuation of a list. +*** True Line Result +41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen. +** Processing line: ~43. 15_collision_limits: How many collisions can be processed across many primitives.~ +- Line was identified as a continuation of a list. +*** True Line Result +42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value). +** Processing line: ~44. 18_moddable_game: How you can make a game where content is authored by the player (modding support).~ +- Line was identified as a continuation of a list. +*** True Line Result +43. 15_collision_limits: How many collisions can be processed across many primitives. +** Processing line: ~45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game.~ +- Line was identified as a continuation of a list. +*** True Line Result +44. 18_moddable_game: How you can make a game where content is authored by the player (modding support). +** Processing line: ~46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight.~ +- Line was identified as a continuation of a list. +*** True Line Result +45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game. +** Processing line: ~47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet.~ +- Line was identified as a continuation of a list. +*** True Line Result +46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight. +** Processing line: ~48. 21_mailbox_usage: How to do interprocess communication.~ +- Line was identified as a continuation of a list. +*** True Line Result +47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet. +** Processing line: ~49. 22_trace_debugging: Debugging techniques and tracing execution through your game.~ +- Line was identified as a continuation of a list. +*** True Line Result +48. 21_mailbox_usage: How to do interprocess communication. +** Processing line: ~50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game.~ +- Line was identified as a continuation of a list. +*** True Line Result +49. 22_trace_debugging: Debugging techniques and tracing execution through your game. +** Processing line: ~51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons.~ +- Line was identified as a continuation of a list. +*** True Line Result +50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game. +** Processing line: ~52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites.~ +- Line was identified as a continuation of a list. +*** True Line Result +51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons. +** Processing line: ~53. 24_http_example: How to make http requests.~ +- Line was identified as a continuation of a list. +*** True Line Result +52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites. +** Processing line: ~54. 25_3d_experiment_01_square: How to create 3D objects.~ +- Line was identified as a continuation of a list. +*** True Line Result +53. 24_http_example: How to make http requests. +** Processing line: ~55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor.~ +- Line was identified as a continuation of a list. +*** True Line Result +54. 25_3d_experiment_01_square: How to create 3D objects. +** Processing line: ~56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation.~ +- Line was identified as a continuation of a list. +*** True Line Result +55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor. +** Processing line: ~57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration.~ +- Line was identified as a continuation of a list. +*** True Line Result +56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation. +** Processing line: ~58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia.~ +- Line was identified as a continuation of a list. +*** True Line Result +57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration. +** Processing line: ~59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping.~ +- Line was identified as a continuation of a list. +*** True Line Result +58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia. +** Processing line: ~60. 99_sample_game_pong: Reference implementation of pong.~ +- Line was identified as a continuation of a list. +*** True Line Result +59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping. +** Processing line: ~61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game.~ +- Line was identified as a continuation of a list. +*** True Line Result +60. 99_sample_game_pong: Reference implementation of pong. +** Processing line: ~62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics.~ +- Line was identified as a continuation of a list. +*** True Line Result +61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game. +** Processing line: ~63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions.~ +- Line was identified as a continuation of a list. +*** True Line Result +62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics. +** Processing line: ~64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis.~ +- Line was identified as a continuation of a list. +*** True Line Result +63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions. +** Processing line: ~65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API.~ +- Line was identified as a continuation of a list. +*** True Line Result +64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Deploying To Itch.io~ +- Header detected. +*** True Line Result + +*** True Line Result +* Deploying To Itch.io +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Once you've built your game, you're all set to deploy! Good luck in~ +** Processing line: ~your game dev journey and if you get stuck, come to the Discord~ +** Processing line: ~channel!~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel! +** Processing line: ~** Creating Your Game Landing Page~ +- Header detected. +*** True Line Result + +*** True Line Result +** Creating Your Game Landing Page +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Log into Itch.io and go to [[https://itch.io/game/new]].~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Log into Itch.io and go to [[https://itch.io/game/new]]. +** Processing line: ~- Title: Give your game a Title. This value represents your `gametitle`.~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~- Project URL: Set your project url. This value represents your `gameid`.~ +- Line was identified as a list. +*** True Line Result +- Title: Give your game a Title. This value represents your `gametitle`. +** Processing line: ~- Classification: Keep this as Game.~ +- Line was identified as a list. +*** True Line Result +- Project URL: Set your project url. This value represents your `gameid`. +** Processing line: ~- Kind of Project: Select HTML from the drop down list. Don't worry,~ +- Line was identified as a list. +*** True Line Result +- Classification: Keep this as Game. +** Processing line: ~ the HTML project type _also supports binary downloads_.~ +** Processing line: ~- Uploads: Skip this section for now.~ +- Line was identified as a list. +*** True Line Result +- Kind of Project: Select HTML from the drop down list. Don't worry, + the HTML project type _also supports binary downloads_. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- Uploads: Skip this section for now. +** Processing line: ~You can fill out all the other options later.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can fill out all the other options later. +** Processing line: ~** Update Your Game's Metadata~ +- Header detected. +*** True Line Result + +*** True Line Result +** Update Your Game's Metadata +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Point your text editor at mygame/metadata/game_metadata.txt and~ +** Processing line: ~make it look like this:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Point your text editor at mygame/metadata/game_metadata.txt and make it look like this: +** Processing line: ~NOTE: Remove the ~#~ at the beginning of each line.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +NOTE: Remove the ~#~ at the beginning of each line. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~devid=bob~ +- Inside source: true +*** True Line Result +devid=bob +** Processing line: ~devtitle=Bob The Game Developer~ +- Inside source: true +*** True Line Result +devtitle=Bob The Game Developer +** Processing line: ~gameid=mygame~ +- Inside source: true +*** True Line Result +gameid=mygame +** Processing line: ~gametitle=My Game~ +- Inside source: true +*** True Line Result +gametitle=My Game +** Processing line: ~version=0.1~ +- Inside source: true +*** True Line Result +version=0.1 +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The ~devid~ property is the username you use to log into Itch.io.~ +** Processing line: ~The ~devtitle~ is your name or company name (it can contain spaces).~ +** Processing line: ~The ~gameid~ is the Project URL value.~ +** Processing line: ~The ~gametitle~ is the name of your game (it can contain spaces).~ +** Processing line: ~The ~version~ can be any ~major.minor~ number format.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The ~devid~ property is the username you use to log into Itch.io. The ~devtitle~ is your name or company name (it can contain spaces). The ~gameid~ is the Project URL value. The ~gametitle~ is the name of your game (it can contain spaces). The ~version~ can be any ~major.minor~ number format. +** Processing line: ~** Building Your Game For Distribution~ +- Header detected. +*** True Line Result + +*** True Line Result +** Building Your Game For Distribution +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Open up the terminal and run this from the command line:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Open up the terminal and run this from the command line: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~./dragonruby-publish --only-package mygame~ +- Inside source: true +*** True Line Result +./dragonruby-publish --only-package mygame +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~(if you're on Windows, don't put the "./" on the front. That's a Mac and~ +** Processing line: ~Linux thing.)~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +(if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.) +** Processing line: ~A directory called ~./build~ will be created that contains your~ +** Processing line: ~binaries. You can upload this to Itch.io manually.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +A directory called ~./build~ will be created that contains your binaries. You can upload this to Itch.io manually. +** Processing line: ~For the HTML version of your game after you upload it. Check the checkbox labeled~ +** Processing line: ~"This file will be played in the browser".~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +For the HTML version of your game after you upload it. Check the checkbox labeled "This file will be played in the browser". +** Processing line: ~For subsequent updates you can use an automated deployment to Itch.io:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +For subsequent updates you can use an automated deployment to Itch.io: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~./dragonruby-publish mygame~ +- Inside source: true +*** True Line Result +./dragonruby-publish mygame +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~DragonRuby will package _and publish_ your game to itch.io! Tell your~ +** Processing line: ~friends to go to your game's very own webpage and buy it!~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it! +** Processing line: ~If you make changes to your game, just re-run dragonruby-publish and it'll~ +** Processing line: ~update the downloads for you.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you. +** Processing line: ~** DragonRuby's Philosophy~ +- Header detected. +*** True Line Result + +*** True Line Result +** DragonRuby's Philosophy +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The following tenants of DragonRuby are what set us apart from other~ +** Processing line: ~game engines. Given that Game Toolkit is a relatively new engine,~ +** Processing line: ~there are definitely features that are missing. So having a big check~ +** Processing line: ~list of "all the cool things" is not this engine's forte. This is~ +** Processing line: ~compensated with a strong commitment to the following principals.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals. +** Processing line: ~*** Challenge The Status Quo~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Challenge The Status Quo +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Game engines of today are in a local maximum and don't take into~ +** Processing line: ~consideration the challenges of this day and age. Unity and GameMaker~ +** Processing line: ~specifically rot your brain. It's not sufficient to say:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say: +** Processing line: ~#+begin_quote~ +- Line was identified as a literal block. +*** True Line Result + +*** True Line Result +#+begin_quote +** Processing line: ~But that's how we've always done it.~ +** Processing line: ~#+end_quote~ +- Line was identified as a literal block. +*** True Line Result +But that's how we've always done it. +*** True Line Result +#+end_quote +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~It's a hard pill to swallow, but forget blindly accepted best~ +** Processing line: ~practices and try to figure out the underlying motivation for a~ +** Processing line: ~specific approach to game development. Collaborate with us.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us. +** Processing line: ~*** Release Often And Quickly~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Release Often And Quickly +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The biggest mistake game devs make is spending too much time in~ +** Processing line: ~isolation building their game. Release something, however small, and~ +** Processing line: ~release it quickly.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly. +** Processing line: ~Stop worrying about everything being pixel perfect. Don't wait until~ +** Processing line: ~your game is 100% complete. Build your game publicly and~ +** Processing line: ~iterate. Post in the #show-and-tell channel in the community Discord.~ +** Processing line: ~You'll find a lot of support and encouragement there.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Stop worrying about everything being pixel perfect. Don't wait until your game is 100% complete. Build your game publicly and iterate. Post in the #show-and-tell channel in the community Discord. You'll find a lot of support and encouragement there. +** Processing line: ~Remember:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Remember: +** Processing line: ~#+begin_quote~ +- Line was identified as a literal block. +*** True Line Result + +*** True Line Result +#+begin_quote +** Processing line: ~Real artists ship.~ +** Processing line: ~#+end_quote~ +- Line was identified as a literal block. +*** True Line Result +Real artists ship. +*** True Line Result +#+end_quote +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** Sustainable And Ethical Monetization~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Sustainable And Ethical Monetization +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~We all aspire to put food on the table doing what we love. Whether it~ +** Processing line: ~is building games, writing tools to support game development, or~ +** Processing line: ~anything in between.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between. +** Processing line: ~Charge a fair amount of money for the things you create. It's expected~ +** Processing line: ~and encouraged within the community. Give what you create away for~ +** Processing line: ~free to those that can't afford it.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it. +** Processing line: ~*** Sustainable And Ethical Open Source~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Sustainable And Ethical Open Source +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~This goes hand in hand with sustainable and ethical monetization. The~ +** Processing line: ~current state of open source is not sustainable. There is an immense~ +** Processing line: ~amount of contributor burnout. Users of open source expect everything~ +** Processing line: ~to be free, and few give back. This is a problem we want to fix (we're~ +** Processing line: ~still trying to figure out the best solution).~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution). +** Processing line: ~So, don't be "that guy" in the Discord that says "DragonRuby should be~ +** Processing line: ~free and open source!" You will be personally flogged by Amir.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir. +** Processing line: ~*** People Over Entities~ +- Header detected. +*** True Line Result + +*** True Line Result +*** People Over Entities +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~We prioritize the endorsement of real people over faceless~ +** Processing line: ~entities. This game engine, and other products we create, are not~ +** Processing line: ~insignificant line items of a large company. And you aren't a generic~ +** Processing line: ~"commodity" or "corporate resource". So be active in the community~ +** Processing line: ~Discord and you'll reap the benefits as more devs use DragonRuby.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby. +** Processing line: ~*** Building A Game Should Be Fun And Bring Happiness~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Building A Game Should Be Fun And Bring Happiness +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~We will prioritize the removal of pain. The aesthetics of Ruby make it~ +** Processing line: ~such a joy to work with, and we want to capture that within the~ +** Processing line: ~engine.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine. +** Processing line: ~*** Real World Application Drives Features~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Real World Application Drives Features +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~We are bombarded by marketing speak day in and day out. We don't do~ +** Processing line: ~that here. There are things that are really great in the engine, and~ +** Processing line: ~things that need a lot of work. Collaborate with us so we can help you~ +** Processing line: ~reach your goals. Ask for features you actually need as opposed to~ +** Processing line: ~anything speculative.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative. +** Processing line: ~We want DragonRuby to *actually* help you build the game you~ +** Processing line: ~want to build (as opposed to sell you something piece of demoware that~ +** Processing line: ~doesn't work).~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work). +** Processing line: ~* How To Determine What Frame You Are On~ +- Header detected. +*** True Line Result + +*** True Line Result +* How To Determine What Frame You Are On +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~There is a property on ~state~ called ~tick_count~ that is incremented~ +** Processing line: ~by DragonRuby every time the ~tick~ method is called. The following~ +** Processing line: ~code renders a label that displays the current ~tick_count~.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +There is a property on ~state~ called ~tick_count~ that is incremented by DragonRuby every time the ~tick~ method is called. The following code renders a label that displays the current ~tick_count~. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.labels << [10, 670, "#{args.state.tick_count}"]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [10, 670, "#{args.state.tick_count}"] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* How To Get Current Framerate~ +- Header detected. +*** True Line Result + +*** True Line Result +* How To Get Current Framerate +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Current framerate is a top level property on the Game Toolkit Runtime~ +** Processing line: ~and is accessible via ~args.gtk.current_framerate~.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Current framerate is a top level property on the Game Toolkit Runtime and is accessible via ~args.gtk.current_framerate~. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.labels << [10, 710, "framerate: #{args.gtk.current_framerate.round}"]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [10, 710, "framerate: #{args.gtk.current_framerate.round}"] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* How To Render A Sprite Using An Array~ +- Header detected. +*** True Line Result + +*** True Line Result +* How To Render A Sprite Using An Array +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~All file paths should use the forward slash ~/~ *not* backslash~ +** Processing line: ~~~. Game Toolkit includes a number of sprites in the ~sprites~~ +** Processing line: ~folder (everything about your game is located in the ~mygame~ directory).~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +All file paths should use the forward slash ~/~ *not* backslash ~~. Game Toolkit includes a number of sprites in the ~sprites~ folder (everything about your game is located in the ~mygame~ directory). +** Processing line: ~The following code renders a sprite with a ~width~ and ~height~ of~ +** Processing line: ~~100~ in the center of the screen.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The following code renders a sprite with a ~width~ and ~height~ of ~100~ in the center of the screen. +** Processing line: ~~args.outputs.sprites~ is used to render a sprite.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~args.outputs.sprites~ is used to render a sprite. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.sprites << [~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [ +** Processing line: ~ 640 - 50, # X~ +- Inside source: true +*** True Line Result + 640 - 50, # X +** Processing line: ~ 360 - 50, # Y~ +- Inside source: true +*** True Line Result + 360 - 50, # Y +** Processing line: ~ 100, # W~ +- Inside source: true +*** True Line Result + 100, # W +** Processing line: ~ 100, # H~ +- Inside source: true +*** True Line Result + 100, # H +** Processing line: ~ 'sprites/square-blue.png' # PATH~ +- Inside source: true +*** True Line Result + 'sprites/square-blue.png' # PATH +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* More Sprite Properties As An Array~ +- Header detected. +*** True Line Result + +*** True Line Result +* More Sprite Properties As An Array +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Here are all the properties you can set on a sprite.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here are all the properties you can set on a sprite. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.sprites << [~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [ +** Processing line: ~ 100, # X~ +- Inside source: true +*** True Line Result + 100, # X +** Processing line: ~ 100, # Y~ +- Inside source: true +*** True Line Result + 100, # Y +** Processing line: ~ 32, # W~ +- Inside source: true +*** True Line Result + 32, # W +** Processing line: ~ 64, # H~ +- Inside source: true +*** True Line Result + 64, # H +** Processing line: ~ 'sprites/square-blue.png', # PATH~ +- Inside source: true +*** True Line Result + 'sprites/square-blue.png', # PATH +** Processing line: ~ 0, # ANGLE~ +- Inside source: true +*** True Line Result + 0, # ANGLE +** Processing line: ~ 255, # ALPHA~ +- Inside source: true +*** True Line Result + 255, # ALPHA +** Processing line: ~ 0, # RED_SATURATION~ +- Inside source: true +*** True Line Result + 0, # RED_SATURATION +** Processing line: ~ 255, # GREEN_SATURATION~ +- Inside source: true +*** True Line Result + 255, # GREEN_SATURATION +** Processing line: ~ 0 # BLUE_SATURATION~ +- Inside source: true +*** True Line Result + 0 # BLUE_SATURATION +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Different Sprite Representations~ +- Header detected. +*** True Line Result + +*** True Line Result +* Different Sprite Representations +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Using ordinal positioning can get a little unruly given so many~ +** Processing line: ~properties you have control over.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Using ordinal positioning can get a little unruly given so many properties you have control over. +** Processing line: ~You can represent a sprite as a ~Hash~:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can represent a sprite as a ~Hash~: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.sprites << {~ +- Inside source: true +*** True Line Result + args.outputs.sprites << { +** Processing line: ~ x: 640 - 50,~ +- Inside source: true +*** True Line Result + x: 640 - 50, +** Processing line: ~ y: 360 - 50,~ +- Inside source: true +*** True Line Result + y: 360 - 50, +** Processing line: ~ w: 100,~ +- Inside source: true +*** True Line Result + w: 100, +** Processing line: ~ h: 100,~ +- Inside source: true +*** True Line Result + h: 100, +** Processing line: ~ path: 'sprites/square-blue.png',~ +- Inside source: true +*** True Line Result + path: 'sprites/square-blue.png', +** Processing line: ~ angle: 0,~ +- Inside source: true +*** True Line Result + angle: 0, +** Processing line: ~ a: 255,~ +- Inside source: true +*** True Line Result + a: 255, +** Processing line: ~ r: 255,~ +- Inside source: true +*** True Line Result + r: 255, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 255,~ +- Inside source: true +*** True Line Result + b: 255, +** Processing line: ~ source_x: 0,~ +- Inside source: true +*** True Line Result + source_x: 0, +** Processing line: ~ source_y: 0,~ +- Inside source: true +*** True Line Result + source_y: 0, +** Processing line: ~ source_w: -1,~ +- Inside source: true +*** True Line Result + source_w: -1, +** Processing line: ~ source_h: -1,~ +- Inside source: true +*** True Line Result + source_h: -1, +** Processing line: ~ flip_vertically: false,~ +- Inside source: true +*** True Line Result + flip_vertically: false, +** Processing line: ~ flip_horizontally: false,~ +- Inside source: true +*** True Line Result + flip_horizontally: false, +** Processing line: ~ angle_anchor_x: 0.5,~ +- Inside source: true +*** True Line Result + angle_anchor_x: 0.5, +** Processing line: ~ angle_anchor_y: 1.0~ +- Inside source: true +*** True Line Result + angle_anchor_y: 1.0 +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You can represent a sprite as an ~object~:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can represent a sprite as an ~object~: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ # Create type with ALL sprite properties AND primitive_marker~ +- Inside source: true +*** True Line Result + # Create type with ALL sprite properties AND primitive_marker +** Processing line: ~ class Sprite~ +- Inside source: true +*** True Line Result + class Sprite +** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b,~ +- Inside source: true +*** True Line Result + attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, +** Processing line: ~ :source_x, :source_y, :source_w, :source_h,~ +- Inside source: true +*** True Line Result + :source_x, :source_y, :source_w, :source_h, +** Processing line: ~ :tile_x, :tile_y, :tile_w, :tile_h,~ +- Inside source: true +*** True Line Result + :tile_x, :tile_y, :tile_w, :tile_h, +** Processing line: ~ :flip_horizontally, :flip_vertically,~ +- Inside source: true +*** True Line Result + :flip_horizontally, :flip_vertically, +** Processing line: ~ :angle_anchor_x, :angle_anchor_y~ +- Inside source: true +*** True Line Result + :angle_anchor_x, :angle_anchor_y +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def primitive_marker~ +- Inside source: true +*** True Line Result + def primitive_marker +** Processing line: ~ :sprite~ +- Inside source: true +*** True Line Result + :sprite +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ class BlueSquare < Sprite~ +- Inside source: true +*** True Line Result + class BlueSquare < Sprite +** Processing line: ~ def initialize opts~ +- Inside source: true +*** True Line Result + def initialize opts +** Processing line: ~ @x = opts[:x]~ +- Inside source: true +*** True Line Result + @x = opts[:x] +** Processing line: ~ @y = opts[:y]~ +- Inside source: true +*** True Line Result + @y = opts[:y] +** Processing line: ~ @w = opts[:w]~ +- Inside source: true +*** True Line Result + @w = opts[:w] +** Processing line: ~ @h = opts[:h]~ +- Inside source: true +*** True Line Result + @h = opts[:h] +** Processing line: ~ @path = 'sprites/square-blue.png'~ +- Inside source: true +*** True Line Result + @path = 'sprites/square-blue.png' +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.sprites << (BlueSquare.new x: 640 - 50,~ +- Inside source: true +*** True Line Result + args.outputs.sprites << (BlueSquare.new x: 640 - 50, +** Processing line: ~ y: 360 - 50,~ +- Inside source: true +*** True Line Result + y: 360 - 50, +** Processing line: ~ w: 50,~ +- Inside source: true +*** True Line Result + w: 50, +** Processing line: ~ h: 50)~ +- Inside source: true +*** True Line Result + h: 50) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* How To Render A Label~ +- Header detected. +*** True Line Result + +*** True Line Result +* How To Render A Label +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~args.outputs.labels~ is used to render labels.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~args.outputs.labels~ is used to render labels. +** Processing line: ~Labels are how you display text. This code will go directly inside of~ +** Processing line: ~the ~def tick args~ method.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Labels are how you display text. This code will go directly inside of the ~def tick args~ method. +** Processing line: ~Here is the minimum code:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here is the minimum code: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # X Y TEXT~ +- Inside source: true +*** True Line Result + # X Y TEXT +** Processing line: ~ args.outputs.labels << [640, 360, "I am a black label."]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [640, 360, "I am a black label."] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* A Colored Label~ +- Header detected. +*** True Line Result + +*** True Line Result +* A Colored Label +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # A colored label~ +- Inside source: true +*** True Line Result + # A colored label +** Processing line: ~ # X Y TEXT, RED GREEN BLUE ALPHA~ +- Inside source: true +*** True Line Result + # X Y TEXT, RED GREEN BLUE ALPHA +** Processing line: ~ args.outputs.labels << [640, 360, "I am a redish label.", 255, 128, 128, 255]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [640, 360, "I am a redish label.", 255, 128, 128, 255] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Extended Label Properties~ +- Header detected. +*** True Line Result + +*** True Line Result +* Extended Label Properties +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # A colored label~ +- Inside source: true +*** True Line Result + # A colored label +** Processing line: ~ # X Y TEXT SIZE ALIGNMENT RED GREEN BLUE ALPHA FONT FILE~ +- Inside source: true +*** True Line Result + # X Y TEXT SIZE ALIGNMENT RED GREEN BLUE ALPHA FONT FILE +** Processing line: ~ args.outputs.labels << [~ +- Inside source: true +*** True Line Result + args.outputs.labels << [ +** Processing line: ~ 640, # X~ +- Inside source: true +*** True Line Result + 640, # X +** Processing line: ~ 360, # Y~ +- Inside source: true +*** True Line Result + 360, # Y +** Processing line: ~ "Hello world", # TEXT~ +- Inside source: true +*** True Line Result + "Hello world", # TEXT +** Processing line: ~ 0, # SIZE_ENUM~ +- Inside source: true +*** True Line Result + 0, # SIZE_ENUM +** Processing line: ~ 1, # ALIGNMENT_ENUM~ +- Inside source: true +*** True Line Result + 1, # ALIGNMENT_ENUM +** Processing line: ~ 0, # RED~ +- Inside source: true +*** True Line Result + 0, # RED +** Processing line: ~ 0, # GREEN~ +- Inside source: true +*** True Line Result + 0, # GREEN +** Processing line: ~ 0, # BLUE~ +- Inside source: true +*** True Line Result + 0, # BLUE +** Processing line: ~ 255, # ALPHA~ +- Inside source: true +*** True Line Result + 255, # ALPHA +** Processing line: ~ "fonts/coolfont.ttf" # FONT~ +- Inside source: true +*** True Line Result + "fonts/coolfont.ttf" # FONT +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value~ +** Processing line: ~will decrease the label size. A ~positive~ value will increase the~ +** Processing line: ~label's size.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value will decrease the label size. A ~positive~ value will increase the label's size. +** Processing line: ~An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents~ +** Processing line: ~"center aligned". ~2~ represents "right aligned".~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents "center aligned". ~2~ represents "right aligned". +** Processing line: ~* Rendering A Label As A ~Hash~~ +- Header detected. +*** True Line Result + +*** True Line Result +* Rendering A Label As A ~Hash~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You can add additional metadata about your game within a label, which requires you to use a `Hash` instead.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can add additional metadata about your game within a label, which requires you to use a `Hash` instead. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.labels << {~ +- Inside source: true +*** True Line Result + args.outputs.labels << { +** Processing line: ~ x: 200,~ +- Inside source: true +*** True Line Result + x: 200, +** Processing line: ~ y: 550,~ +- Inside source: true +*** True Line Result + y: 550, +** Processing line: ~ text: "dragonruby",~ +- Inside source: true +*** True Line Result + text: "dragonruby", +** Processing line: ~ size_enum: 2,~ +- Inside source: true +*** True Line Result + size_enum: 2, +** Processing line: ~ alignment_enum: 1,~ +- Inside source: true +*** True Line Result + alignment_enum: 1, +** Processing line: ~ r: 155,~ +- Inside source: true +*** True Line Result + r: 155, +** Processing line: ~ g: 50,~ +- Inside source: true +*** True Line Result + g: 50, +** Processing line: ~ b: 50,~ +- Inside source: true +*** True Line Result + b: 50, +** Processing line: ~ a: 255,~ +- Inside source: true +*** True Line Result + a: 255, +** Processing line: ~ font: "fonts/manaspc.ttf",~ +- Inside source: true +*** True Line Result + font: "fonts/manaspc.ttf", +** Processing line: ~ # You can add any properties you like (this will be ignored/won't cause errors)~ +- Inside source: true +*** True Line Result + # You can add any properties you like (this will be ignored/won't cause errors) +** Processing line: ~ game_data_one: "Something",~ +- Inside source: true +*** True Line Result + game_data_one: "Something", +** Processing line: ~ game_data_two: {~ +- Inside source: true +*** True Line Result + game_data_two: { +** Processing line: ~ value_1: "value",~ +- Inside source: true +*** True Line Result + value_1: "value", +** Processing line: ~ value_2: "value two",~ +- Inside source: true +*** True Line Result + value_2: "value two", +** Processing line: ~ a_number: 15~ +- Inside source: true +*** True Line Result + a_number: 15 +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Getting The Size Of A Piece Of Text~ +- Header detected. +*** True Line Result + +*** True Line Result +* Getting The Size Of A Piece Of Text +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You can get the render size of any string using ~args.gtk.calcstringbox~.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can get the render size of any string using ~args.gtk.calcstringbox~. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # TEXT SIZE_ENUM FONT~ +- Inside source: true +*** True Line Result + # TEXT SIZE_ENUM FONT +** Processing line: ~ w, h = args.gtk.calcstringbox("some string", 0, "font.ttf")~ +- Inside source: true +*** True Line Result + w, h = args.gtk.calcstringbox("some string", 0, "font.ttf") +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # NOTE: The SIZE_ENUM and FONT are optional arguments.~ +- Inside source: true +*** True Line Result + # NOTE: The SIZE_ENUM and FONT are optional arguments. +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Render a label showing the w and h of the text:~ +- Inside source: true +*** True Line Result + # Render a label showing the w and h of the text: +** Processing line: ~ args.outputs.labels << [~ +- Inside source: true +*** True Line Result + args.outputs.labels << [ +** Processing line: ~ 10,~ +- Inside source: true +*** True Line Result + 10, +** Processing line: ~ 710,~ +- Inside source: true +*** True Line Result + 710, +** Processing line: ~ # This string uses Ruby's string interpolation literal: #{}~ +- Inside source: true +*** True Line Result + # This string uses Ruby's string interpolation literal: #{} +** Processing line: ~ "'some string' has width: #{w}, and height: #{h}."~ +- Inside source: true +*** True Line Result + "'some string' has width: #{w}, and height: #{h}." +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* How To Play A Sound~ +- Header detected. +*** True Line Result + +*** True Line Result +* How To Play A Sound +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Sounds that end ~.wav~ will play once:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Sounds that end ~.wav~ will play once: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # Play a sound every second~ +- Inside source: true +*** True Line Result + # Play a sound every second +** Processing line: ~ if (args.state.tick_count % 60) == 0~ +- Inside source: true +*** True Line Result + if (args.state.tick_count % 60) == 0 +** Processing line: ~ args.outputs.sounds << 'something.wav'~ +- Inside source: true +*** True Line Result + args.outputs.sounds << 'something.wav' +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Sounds that end ~.ogg~ is considered background music and will loop:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Sounds that end ~.ogg~ is considered background music and will loop: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # Start a sound loop at the beginning of the game~ +- Inside source: true +*** True Line Result + # Start a sound loop at the beginning of the game +** Processing line: ~ if args.state.tick_count == 0~ +- Inside source: true +*** True Line Result + if args.state.tick_count == 0 +** Processing line: ~ args.outputs.sounds << 'background_music.ogg'~ +- Inside source: true +*** True Line Result + args.outputs.sounds << 'background_music.ogg' +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~If you want to play a ~.ogg~ once as if it were a sound effect, you can do:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you want to play a ~.ogg~ once as if it were a sound effect, you can do: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # Play a sound every second~ +- Inside source: true +*** True Line Result + # Play a sound every second +** Processing line: ~ if (args.state.tick_count % 60) == 0~ +- Inside source: true +*** True Line Result + if (args.state.tick_count % 60) == 0 +** Processing line: ~ args.gtk.queue_sound 'some-ogg.ogg'~ +- Inside source: true +*** True Line Result + args.gtk.queue_sound 'some-ogg.ogg' +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Using ~args.state~ To Store Your Game State~ +- Header detected. +*** True Line Result + +*** True Line Result +* Using ~args.state~ To Store Your Game State +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~args.state~ is a open data structure that allows you to define~ +** Processing line: ~properties that are arbitrarily nested. You don't need to define any kind of~ +** Processing line: ~~class~.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~args.state~ is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of ~class~. +** Processing line: ~To initialize your game state, use the ~||=~ operator. Any value on~ +** Processing line: ~the right side of ~||=~ will only be assigned _once_.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +To initialize your game state, use the ~||=~ operator. Any value on the right side of ~||=~ will only be assigned _once_. +** Processing line: ~To assign a value every frame, just use the ~=~ operator, but _make~ +** Processing line: ~sure_ you've initialized a default value.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +To assign a value every frame, just use the ~=~ operator, but _make sure_ you've initialized a default value. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # initialize your game state ONCE~ +- Inside source: true +*** True Line Result + # initialize your game state ONCE +** Processing line: ~ args.player.x ||= 0~ +- Inside source: true +*** True Line Result + args.player.x ||= 0 +** Processing line: ~ args.player.y ||= 0~ +- Inside source: true +*** True Line Result + args.player.y ||= 0 +** Processing line: ~ args.player.hp ||= 100~ +- Inside source: true +*** True Line Result + args.player.hp ||= 100 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # increment the x position of the character by one every frame~ +- Inside source: true +*** True Line Result + # increment the x position of the character by one every frame +** Processing line: ~ args.player.x += 1~ +- Inside source: true +*** True Line Result + args.player.x += 1 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Render a sprite with a label above the sprite~ +- Inside source: true +*** True Line Result + # Render a sprite with a label above the sprite +** Processing line: ~ args.outputs.sprites << [~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [ +** Processing line: ~ args.player.x,~ +- Inside source: true +*** True Line Result + args.player.x, +** Processing line: ~ args.player.y,~ +- Inside source: true +*** True Line Result + args.player.y, +** Processing line: ~ 32, 32,~ +- Inside source: true +*** True Line Result + 32, 32, +** Processing line: ~ "player.png"~ +- Inside source: true +*** True Line Result + "player.png" +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.labels << [~ +- Inside source: true +*** True Line Result + args.outputs.labels << [ +** Processing line: ~ args.player.x,~ +- Inside source: true +*** True Line Result + args.player.x, +** Processing line: ~ args.player.y - 50,~ +- Inside source: true +*** True Line Result + args.player.y - 50, +** Processing line: ~ args.player.hp~ +- Inside source: true +*** True Line Result + args.player.hp +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* Frequently Asked Questions, Comments, and Concerns~ +- Header detected. +*** True Line Result + +*** True Line Result +* Frequently Asked Questions, Comments, and Concerns +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Here are questions, comments, and concerns that frequently come~ +** Processing line: ~up.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here are questions, comments, and concerns that frequently come up. +** Processing line: ~** Frequently Asked Questions~ +- Header detected. +*** True Line Result + +*** True Line Result +** Frequently Asked Questions +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** What is DragonRuby LLP?~ +- Header detected. +*** True Line Result + +*** True Line Result +*** What is DragonRuby LLP? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~DragonRuby LLP is a partnership of four devs who came together~ +** Processing line: ~with the goal of bringing the aesthetics and joy of Ruby, everywhere possible.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible. +** Processing line: ~Under DragonRuby LLP, we offer a number of products (with more on the~ +** Processing line: ~way):~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Under DragonRuby LLP, we offer a number of products (with more on the way): +** Processing line: ~- Game Toolkit (GTK): A 2D game engine that is compatible with modern~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~ gaming platforms. [Home Page]() [FAQ Page]()~ +** Processing line: ~- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile~ +- Line was identified as a list. +*** True Line Result +- Game Toolkit (GTK): A 2D game engine that is compatible with modern + gaming platforms. [Home Page]() [FAQ Page]() +** Processing line: ~ apps. [Home Page]() [FAQ Page]()~ +** Processing line: ~- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby~ +- Line was identified as a list. +*** True Line Result +- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [Home Page]() [FAQ Page]() +** Processing line: ~ environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]()~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby + environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]() +** Processing line: ~All of the products above leverage a shared core called DragonRuby.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +All of the products above leverage a shared core called DragonRuby. +** Processing line: ~NOTE: From an official branding standpoint each one of the products is~ +** Processing line: ~suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is~ +** Processing line: ~_one word, title cased_.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +NOTE: From an official branding standpoint each one of the products is suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is _one word, title cased_. +** Processing line: ~NOTE: We leave the "A DragonRuby LLP Product" off of this one because~ +** Processing line: ~that just sounds really weird.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just sounds really weird. +** Processing line: ~NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass~ +** Processing line: ~identifier huh?~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh? +** Processing line: ~*** What is DragonRuby?~ +- Header detected. +*** True Line Result + +*** True Line Result +*** What is DragonRuby? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The response to this question requires a few subparts. First we need~ +** Processing line: ~to clarify some terms. Specifically _language specification_ vs _runtime_.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_. +** Processing line: ~*** Okay... so what is the difference between a language specification and a runtime?~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Okay... so what is the difference between a language specification and a runtime? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~A runtime is an _implementation_ of a language specification. When~ +** Processing line: ~people say "Ruby," they are usually referring to "the Ruby 3.0+ language~ +** Processing line: ~specification implemented via the CRuby/MRI Runtime."~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime." +** Processing line: ~But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke,~ +** Processing line: ~and (last but certainly not least) DragonRuby.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby. +** Processing line: ~*** Okay... what language specification does DragonRuby use then?~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Okay... what language specification does DragonRuby use then? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's~ +** Processing line: ~syntax is Ruby 2.x compatible, but also contains semantic changes that help~ +** Processing line: ~it natively interface with platform specific libraries.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries. +** Processing line: ~*** So... why another runtime?~ +- Header detected. +*** True Line Result + +*** True Line Result +*** So... why another runtime? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The elevator pitch is:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The elevator pitch is: +** Processing line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels"~ +** Processing line: ~within the runtime allows us to target platforms no other Ruby can~ +** Processing line: ~target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo~ +** Processing line: ~Switch, PS4, Xbox, and Scadia.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia. +** Processing line: ~*** What does Multilevel Cross-platform mean?~ +- Header detected. +*** True Line Result + +*** True Line Result +*** What does Multilevel Cross-platform mean? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~There are complexities associated with targeting all the platforms we~ +** Processing line: ~support. Because of this, the runtime had to be architected in such a~ +** Processing line: ~way that new platforms could be easily added (which lead to us partitioning the~ +** Processing line: ~runtime internally):~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally): +** Processing line: ~- Level 1 we leverage a good portion of mRuby.~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~- Level 2 consists of optimizations to mRuby we've made given that our~ +- Line was identified as a list. +*** True Line Result +- Level 1 we leverage a good portion of mRuby. +** Processing line: ~ target platforms are well known.~ +** Processing line: ~- Level 3 consists of portable C libraries and their Ruby~ +- Line was identified as a list. +*** True Line Result +- Level 2 consists of optimizations to mRuby we've made given that our + target platforms are well known. +** Processing line: ~ C-Extensions.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- Level 3 consists of portable C libraries and their Ruby + C-Extensions. +** Processing line: ~Levels 1 through 3 are fairly commonplace in many runtime~ +** Processing line: ~implementations (with level 1 being the most portable, and level 3~ +** Processing line: ~being the fastest). But the DragonRuby Runtime has taken things a~ +** Processing line: ~bit further:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Levels 1 through 3 are fairly commonplace in many runtime implementations (with level 1 being the most portable, and level 3 being the fastest). But the DragonRuby Runtime has taken things a bit further: +** Processing line: ~- Level 4 consists of shared abstractions around hardware I/O and operating~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~ system resources. This level leverages open source and proprietary~ +** Processing line: ~ components within Simple DirectMedia Layer (a low level multimedia~ +** Processing line: ~ component library that has been in active development for 22 years~ +** Processing line: ~ and counting).~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- Level 4 consists of shared abstractions around hardware I/O and operating + system resources. This level leverages open source and proprietary components within Simple DirectMedia Layer (a low level multimedia component library that has been in active development for 22 years and counting). +** Processing line: ~- Level 5 is a code generation layer which creates metadata that allows~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~ for native interoperability with host runtime libraries. It also~ +** Processing line: ~ includes OS specific message pump orchestrations.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- Level 5 is a code generation layer which creates metadata that allows + for native interoperability with host runtime libraries. It also includes OS specific message pump orchestrations. +** Processing line: ~- Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~ compiler outputs _very_ fast platform specific bitcode, but only~ +** Processing line: ~ supports a subset of the Ruby language specification.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This + compiler outputs _very_ fast platform specific bitcode, but only supports a subset of the Ruby language specification. +** Processing line: ~These levels allow us to stay up to date with open source~ +** Processing line: ~implementations of Ruby; provide fast, native code execution~ +** Processing line: ~on proprietary platforms; ensure good separation between these two~ +** Processing line: ~worlds; and provides a means to add new platforms without going insane.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane. +** Processing line: ~*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~DragonRuby is a Ruby runtime implementation that takes all the lessons~ +** Processing line: ~we've learned from MRI/CRuby, and merges it with the latest and greatest~ +** Processing line: ~compiler and OSS technologies.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies. +** Processing line: ~** Frequent Comments~ +- Header detected. +*** True Line Result + +*** True Line Result +** Frequent Comments +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** But Ruby is dead.~ +- Header detected. +*** True Line Result + +*** True Line Result +*** But Ruby is dead. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Let's check the official source for the answer to this question:~ +** Processing line: ~isrubydead.com: [[https://isrubydead.com/]].~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]]. +** Processing line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used~ +** Processing line: ~to be. And that's totally fine. Every one chases the new and shiny.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny. +** Processing line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow~ +** Processing line: ~Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies]. +** Processing line: ~Let's stop making this comment shall we?~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Let's stop making this comment shall we? +** Processing line: ~*** But Ruby is slow.~ +- Header detected. +*** True Line Result + +*** True Line Result +*** But Ruby is slow. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~That doesn't make any sense. A language specification can't be~ +** Processing line: ~slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd~ +** Processing line: ~have to talk about which runtime.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime. +** Processing line: ~*** Dynamic languages are slow.~ +- Header detected. +*** True Line Result + +*** True Line Result +*** Dynamic languages are slow. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~They are certainly slower than statically compiled languages. With the~ +** Processing line: ~processing power and compiler optimizations we have today,~ +** Processing line: ~dynamic languages like Ruby are _fast enough_.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_. +** Processing line: ~Unless you are writing in some form of intermediate representation by hand,~ +** Processing line: ~your language of choice also suffers this same fallacy of slow. Like, nothing is~ +** Processing line: ~faster than a low level assembly-like language. So unless you're~ +** Processing line: ~writing in that, let's stop making this comment.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Unless you are writing in some form of intermediate representation by hand, your language of choice also suffers this same fallacy of slow. Like, nothing is faster than a low level assembly-like language. So unless you're writing in that, let's stop making this comment. +** Processing line: ~NOTE: If you _are_ hand writing LLVM IR, we are always open to~ +** Processing line: ~bringing on new partners with such a skill set. Email us ^_^.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^. +** Processing line: ~** Frequent Concerns~ +- Header detected. +*** True Line Result + +*** True Line Result +** Frequent Concerns +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~*** DragonRuby is not open source. That's not right.~ +- Header detected. +*** True Line Result + +*** True Line Result +*** DragonRuby is not open source. That's not right. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The current state of open source is unsustainable. Contributors work~ +** Processing line: ~for free, most all open source repositories are severely under-staffed,~ +** Processing line: ~and burnout from core members is rampant.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant. +** Processing line: ~We believe in open source very strongly. Parts of DragonRuby are~ +** Processing line: ~in fact, open source. Just not all of it (for legal reasons, and~ +** Processing line: ~because the IP we've created has value). And we promise that we are~ +** Processing line: ~looking for (or creating) ways to _sustainably_ open source everything we do.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +We believe in open source very strongly. Parts of DragonRuby are in fact, open source. Just not all of it (for legal reasons, and because the IP we've created has value). And we promise that we are looking for (or creating) ways to _sustainably_ open source everything we do. +** Processing line: ~If you have ideas on how we can do this, email us!~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you have ideas on how we can do this, email us! +** Processing line: ~If the reason above isn't sufficient, then definitely use something else.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If the reason above isn't sufficient, then definitely use something else. +** Processing line: ~*** DragonRuby is for pay. You should offer a free version.~ +- Header detected. +*** True Line Result + +*** True Line Result +*** DragonRuby is for pay. You should offer a free version. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~If you can afford to pay for DragonRuby, you should (and will). We don't go~ +** Processing line: ~around telling writers that they should give us their books for free,~ +** Processing line: ~and only require payment if we read the entire thing. It's time we stop asking that~ +** Processing line: ~of software products.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products. +** Processing line: ~That being said, we will _never_ put someone out financially. We have~ +** Processing line: ~income assistance for anyone that can't afford a license to any one of~ +** Processing line: ~our products.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +That being said, we will _never_ put someone out financially. We have income assistance for anyone that can't afford a license to any one of our products. +** Processing line: ~You qualify for a free, unrestricted license to DragonRuby products if~ +** Processing line: ~any of the following items pertain to you:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You qualify for a free, unrestricted license to DragonRuby products if any of the following items pertain to you: +** Processing line: ~- Your income is below $2,000.00 (USD) per month.~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~- You are under 18 years of age.~ +- Line was identified as a list. +*** True Line Result +- Your income is below $2,000.00 (USD) per month. +** Processing line: ~- You are a student of any type: traditional public school, home~ +- Line was identified as a list. +*** True Line Result +- You are under 18 years of age. +** Processing line: ~ schooling, college, bootcamp, or online.~ +** Processing line: ~- You are a teacher, mentor, or parent who wants to teach a kid how to code.~ +- Line was identified as a list. +*** True Line Result +- You are a student of any type: traditional public school, home + schooling, college, bootcamp, or online. +** Processing line: ~- You work/worked in public service or at a charitable organization:~ +- Line was identified as a list. +*** True Line Result +- You are a teacher, mentor, or parent who wants to teach a kid how to code. +** Processing line: ~ for example public office, army, or any 501(c)(3) organization.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- You work/worked in public service or at a charitable organization: + for example public office, army, or any 501(c)(3) organization. +** Processing line: ~Just contact Amir at [email protected] with a short~ +** Processing line: ~explanation of your current situation and he'll set you up. No~ +** Processing line: ~questions asked.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Just contact Amir at [email protected] with a short explanation of your current situation and he'll set you up. No questions asked. +** Processing line: ~*** But still, you should offer a free version. So I can try it out and see if I like it.~ +- Header detected. +*** True Line Result + +*** True Line Result +*** But still, you should offer a free version. So I can try it out and see if I like it. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You can try our [web-based sandbox environment](). But it won't do the~ +** Processing line: ~runtime justice. Or just come to our [Slack]() or [Discord]() channel~ +** Processing line: ~and ask questions. We'd be happy to have a one on one video chat with~ +** Processing line: ~you and show off all the cool stuff we're doing.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing. +** Processing line: ~Seriously just buy it. Get a refund if you don't like it. We make it~ +** Processing line: ~stupid easy to do so.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so. +** Processing line: ~*** I still think you should do a free version. Think of all people who would give it a shot.~ +- Header detected. +*** True Line Result + +*** True Line Result +*** I still think you should do a free version. Think of all people who would give it a shot. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Free isn't a sustainable financial model. We don't want to spam your~ +** Processing line: ~email. We don't want to collect usage data off of you either. We just~ +** Processing line: ~want to provide quality toolchains to quality developers (as opposed~ +** Processing line: ~to a large quantity of developers).~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers). +** Processing line: ~The people that pay for DragonRuby and make an effort to understand it are the~ +** Processing line: ~ones we want to build a community around, partner with, and collaborate~ +** Processing line: ~with. So having that small monetary wall deters entitled individuals~ +** Processing line: ~that don't value the same things we do.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do. +** Processing line: ~*** What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ +- Header detected. +*** True Line Result + +*** True Line Result +*** What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~That won't happen if the development world stop asking for free stuff~ +** Processing line: ~and non-trivially compensate open source developers. Look, we want to be~ +** Processing line: ~able to work on the stuff we love, every day of our lives. And we'll go~ +** Processing line: ~to great lengths to make that happen.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen. +** Processing line: ~But, in the event that sad day comes, our partnership bylaws state that~ +** Processing line: ~_all_ DragonRuby IP that can be legally open sourced, will be released~ +** Processing line: ~under a permissive license.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license. +** Processing line: ~* DOCS: ~GTK::Runtime~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Runtime~ +** Processing line: ~The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~. +** Processing line: ~* DOCS: ~GTK::Runtime#reset~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Runtime#reset~ +** Processing line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +This function will reset Kernel.tick_count to 0 and will remove all data from args.state. +** Processing line: ~* DOCS: ~GTK::Runtime#calcstringbox~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Runtime#calcstringbox~ +** Processing line: ~This function returns the width and height of a string.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +This function returns the width and height of a string. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.string_size ||= args.gtk.calcstringbox "Hello World"~ +- Inside source: true +*** True Line Result + args.state.string_size ||= args.gtk.calcstringbox "Hello World" +** Processing line: ~ args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World"~ +- Inside source: true +*** True Line Result + args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The Array class has been extend to provide methods that~ +** Processing line: ~will help in common game development tasks. Array is one of the most~ +** Processing line: ~powerful classes in Ruby and a very fundamental component of Game Toolkit.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array#map~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array#map~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The function given a block returns a new ~Enumerable~ of values.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The function given a block returns a new ~Enumerable~ of values. +** Processing line: ~Example of using ~Array#map~ in conjunction with ~args.state~ and~ +** Processing line: ~~args.outputs.sprites~ to render sprites to the screen.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Example of using ~Array#map~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # define the colors of the rainbow in ~args.state~~ +- Inside source: true +*** True Line Result + # define the colors of the rainbow in ~args.state~ +** Processing line: ~ # as an ~Array~ of ~Hash~es with :order and :name.~ +- Inside source: true +*** True Line Result + # as an ~Array~ of ~Hash~es with :order and :name. +** Processing line: ~ # :order will be used to determine render location~ +- Inside source: true +*** True Line Result + # :order will be used to determine render location +** Processing line: ~ # and :name will be used to determine sprite path.~ +- Inside source: true +*** True Line Result + # and :name will be used to determine sprite path. +** Processing line: ~ args.state.rainbow_colors ||= [~ +- Inside source: true +*** True Line Result + args.state.rainbow_colors ||= [ +** Processing line: ~ { order: 0, name: :red },~ +- Inside source: true +*** True Line Result + { order: 0, name: :red }, +** Processing line: ~ { order: 1, name: :orange },~ +- Inside source: true +*** True Line Result + { order: 1, name: :orange }, +** Processing line: ~ { order: 2, name: :yellow },~ +- Inside source: true +*** True Line Result + { order: 2, name: :yellow }, +** Processing line: ~ { order: 3, name: :green },~ +- Inside source: true +*** True Line Result + { order: 3, name: :green }, +** Processing line: ~ { order: 4, name: :blue },~ +- Inside source: true +*** True Line Result + { order: 4, name: :blue }, +** Processing line: ~ { order: 5, name: :indigo },~ +- Inside source: true +*** True Line Result + { order: 5, name: :indigo }, +** Processing line: ~ { order: 6, name: :violet },~ +- Inside source: true +*** True Line Result + { order: 6, name: :violet }, +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render sprites diagonally to the screen~ +- Inside source: true +*** True Line Result + # render sprites diagonally to the screen +** Processing line: ~ # with a width and height of 50.~ +- Inside source: true +*** True Line Result + # with a width and height of 50. +** Processing line: ~ args.outputs~ +- Inside source: true +*** True Line Result + args.outputs +** Processing line: ~ .sprites << args.state~ +- Inside source: true +*** True Line Result + .sprites << args.state +** Processing line: ~ .rainbow_colors~ +- Inside source: true +*** True Line Result + .rainbow_colors +** Processing line: ~ .map do |color| # <-- ~Array#map~ usage~ +- Inside source: true +*** True Line Result + .map do |color| # <-- ~Array#map~ usage +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ color[:order] * 50,~ +- Inside source: true +*** True Line Result + color[:order] * 50, +** Processing line: ~ color[:order] * 50,~ +- Inside source: true +*** True Line Result + color[:order] * 50, +** Processing line: ~ 50,~ +- Inside source: true +*** True Line Result + 50, +** Processing line: ~ 50,~ +- Inside source: true +*** True Line Result + 50, +** Processing line: ~ "sprites/square-#{color[:name]}.png"~ +- Inside source: true +*** True Line Result + "sprites/square-#{color[:name]}.png" +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array#each~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array#each~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The function, given a block, invokes the block for each item in the~ +** Processing line: ~~Array~. ~Array#each~ is synonymous to foreach constructs in other languages.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The function, given a block, invokes the block for each item in the ~Array~. ~Array#each~ is synonymous to foreach constructs in other languages. +** Processing line: ~Example of using ~Array#each~ in conjunction with ~args.state~ and~ +** Processing line: ~~args.outputs.sprites~ to render sprites to the screen:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Example of using ~Array#each~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # define the colors of the rainbow in ~args.state~~ +- Inside source: true +*** True Line Result + # define the colors of the rainbow in ~args.state~ +** Processing line: ~ # as an ~Array~ of ~Hash~es with :order and :name.~ +- Inside source: true +*** True Line Result + # as an ~Array~ of ~Hash~es with :order and :name. +** Processing line: ~ # :order will be used to determine render location~ +- Inside source: true +*** True Line Result + # :order will be used to determine render location +** Processing line: ~ # and :name will be used to determine sprite path.~ +- Inside source: true +*** True Line Result + # and :name will be used to determine sprite path. +** Processing line: ~ args.state.rainbow_colors ||= [~ +- Inside source: true +*** True Line Result + args.state.rainbow_colors ||= [ +** Processing line: ~ { order: 0, name: :red },~ +- Inside source: true +*** True Line Result + { order: 0, name: :red }, +** Processing line: ~ { order: 1, name: :orange },~ +- Inside source: true +*** True Line Result + { order: 1, name: :orange }, +** Processing line: ~ { order: 2, name: :yellow },~ +- Inside source: true +*** True Line Result + { order: 2, name: :yellow }, +** Processing line: ~ { order: 3, name: :green },~ +- Inside source: true +*** True Line Result + { order: 3, name: :green }, +** Processing line: ~ { order: 4, name: :blue },~ +- Inside source: true +*** True Line Result + { order: 4, name: :blue }, +** Processing line: ~ { order: 5, name: :indigo },~ +- Inside source: true +*** True Line Result + { order: 5, name: :indigo }, +** Processing line: ~ { order: 6, name: :violet },~ +- Inside source: true +*** True Line Result + { order: 6, name: :violet }, +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # render sprites diagonally to the screen~ +- Inside source: true +*** True Line Result + # render sprites diagonally to the screen +** Processing line: ~ # with a width and height of 50.~ +- Inside source: true +*** True Line Result + # with a width and height of 50. +** Processing line: ~ args.state~ +- Inside source: true +*** True Line Result + args.state +** Processing line: ~ .rainbow_colors~ +- Inside source: true +*** True Line Result + .rainbow_colors +** Processing line: ~ .map do |color| # <-- ~Array#each~ usage~ +- Inside source: true +*** True Line Result + .map do |color| # <-- ~Array#each~ usage +** Processing line: ~ args.outputs.sprites << [~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [ +** Processing line: ~ color[:order] * 50,~ +- Inside source: true +*** True Line Result + color[:order] * 50, +** Processing line: ~ color[:order] * 50,~ +- Inside source: true +*** True Line Result + color[:order] * 50, +** Processing line: ~ 50,~ +- Inside source: true +*** True Line Result + 50, +** Processing line: ~ 50,~ +- Inside source: true +*** True Line Result + 50, +** Processing line: ~ "sprites/square-#{color[:name]}.png"~ +- Inside source: true +*** True Line Result + "sprites/square-#{color[:name]}.png" +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array#reject_nil~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array#reject_nil~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias~ +** Processing line: ~for ~Array#compact~:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias for ~Array#compact~: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ a = [1, nil, 4, false, :a]~ +- Inside source: true +*** True Line Result + a = [1, nil, 4, false, :a] +** Processing line: ~ puts a.reject_nil~ +- Inside source: true +*** True Line Result + puts a.reject_nil +** Processing line: ~ # => [1, 4, false, :a]~ +- Inside source: true +*** True Line Result + # => [1, 4, false, :a] +** Processing line: ~ puts a.compact~ +- Inside source: true +*** True Line Result + puts a.compact +** Processing line: ~ # => [1, 4, false, :a]~ +- Inside source: true +*** True Line Result + # => [1, 4, false, :a] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array#reject_false~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array#reject_false~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Returns an `Enumerable` rejecting items that are `nil` or `false`.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Returns an `Enumerable` rejecting items that are `nil` or `false`. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ a = [1, nil, 4, false, :a]~ +- Inside source: true +*** True Line Result + a = [1, nil, 4, false, :a] +** Processing line: ~ puts a.reject_false~ +- Inside source: true +*** True Line Result + puts a.reject_false +** Processing line: ~ # => [1, 4, :a]~ +- Inside source: true +*** True Line Result + # => [1, 4, :a] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array#product~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array#product~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Returns all combinations of values between two arrays.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Returns all combinations of values between two arrays. +** Processing line: ~Here are some examples of using ~product~. Paste the~ +** Processing line: ~following code at the bottom of main.rb and save~ +** Processing line: ~the file to see the results:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here are some examples of using ~product~. Paste the following code at the bottom of main.rb and save the file to see the results: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ a = [0, 1]~ +- Inside source: true +*** True Line Result + a = [0, 1] +** Processing line: ~ puts a.product~ +- Inside source: true +*** True Line Result + puts a.product +** Processing line: ~ # => [[0, 0], [0, 1], [1, 0], [1, 1]]~ +- Inside source: true +*** True Line Result + # => [[0, 0], [0, 1], [1, 0], [1, 1]] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ a = [ 0, 1]~ +- Inside source: true +*** True Line Result + a = [ 0, 1] +** Processing line: ~ b = [:a, :b]~ +- Inside source: true +*** True Line Result + b = [:a, :b] +** Processing line: ~ puts a.product b~ +- Inside source: true +*** True Line Result + puts a.product b +** Processing line: ~ # => [[0, :a], [0, :b], [1, :a], [1, :b]]~ +- Inside source: true +*** True Line Result + # => [[0, :a], [0, :b], [1, :a], [1, :b]] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array#map_2d~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array#map_2d~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block.~ +** Processing line: ~A 2D array is a common way to store data/layout for a stage.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ stage = [~ +- Inside source: true +*** True Line Result + stage = [ +** Processing line: ~ [:enemy, :empty, :player],~ +- Inside source: true +*** True Line Result + [:enemy, :empty, :player], +** Processing line: ~ [:empty, :empty, :empty],~ +- Inside source: true +*** True Line Result + [:empty, :empty, :empty], +** Processing line: ~ [:enemy, :empty, :enemy],~ +- Inside source: true +*** True Line Result + [:enemy, :empty, :enemy], +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ occupied_tiles = stage.map_2d do |row, col, tile|~ +- Inside source: true +*** True Line Result + occupied_tiles = stage.map_2d do |row, col, tile| +** Processing line: ~ if tile == :empty~ +- Inside source: true +*** True Line Result + if tile == :empty +** Processing line: ~ nil~ +- Inside source: true +*** True Line Result + nil +** Processing line: ~ else~ +- Inside source: true +*** True Line Result + else +** Processing line: ~ [row, col, tile]~ +- Inside source: true +*** True Line Result + [row, col, tile] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end.reject_nil~ +- Inside source: true +*** True Line Result + end.reject_nil +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ puts "Stage:"~ +- Inside source: true +*** True Line Result + puts "Stage:" +** Processing line: ~ puts stage~ +- Inside source: true +*** True Line Result + puts stage +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ puts "Occupied Tiles"~ +- Inside source: true +*** True Line Result + puts "Occupied Tiles" +** Processing line: ~ puts occupied_tiles~ +- Inside source: true +*** True Line Result + puts occupied_tiles +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array#include_any?~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array#include_any?~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Given a collection of items, the function will return~ +** Processing line: ~~true~ if any of ~self~'s items exists in the collection of items passed in:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Given a collection of items, the function will return ~true~ if any of ~self~'s items exists in the collection of items passed in: +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Array#any_intersect_rect?~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Array#any_intersect_rect?~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~,~ +** Processing line: ~this method returns ~true~ if any of the elements within~ +** Processing line: ~the array intersect the object being passed in. You are given an optional~ +** Processing line: ~parameter called ~tolerance~ which informs how close to the other rectangles~ +** Processing line: ~the elements need to be for it to be considered intersecting.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, this method returns ~true~ if any of the elements within the array intersect the object being passed in. You are given an optional parameter called ~tolerance~ which informs how close to the other rectangles the elements need to be for it to be considered intersecting. +** Processing line: ~The default tolerance is set to ~0.1~, which means that the primitives are not~ +** Processing line: ~considered intersecting unless they are overlapping by more than ~0.1~.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The default tolerance is set to ~0.1~, which means that the primitives are not considered intersecting unless they are overlapping by more than ~0.1~. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ repl do~ +- Inside source: true +*** True Line Result + repl do +** Processing line: ~ # Here is a player class that has position and implement~ +- Inside source: true +*** True Line Result + # Here is a player class that has position and implement +** Processing line: ~ # the ~attr_rect~ contract.~ +- Inside source: true +*** True Line Result + # the ~attr_rect~ contract. +** Processing line: ~ class Player~ +- Inside source: true +*** True Line Result + class Player +** Processing line: ~ attr_rect~ +- Inside source: true +*** True Line Result + attr_rect +** Processing line: ~ attr_accessor :x, :y, :w, :h~ +- Inside source: true +*** True Line Result + attr_accessor :x, :y, :w, :h +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def initialize x, y, w, h~ +- Inside source: true +*** True Line Result + def initialize x, y, w, h +** Processing line: ~ @x = x~ +- Inside source: true +*** True Line Result + @x = x +** Processing line: ~ @y = y~ +- Inside source: true +*** True Line Result + @y = y +** Processing line: ~ @w = w~ +- Inside source: true +*** True Line Result + @w = w +** Processing line: ~ @h = h~ +- Inside source: true +*** True Line Result + @h = h +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def serialize~ +- Inside source: true +*** True Line Result + def serialize +** Processing line: ~ { x: @x, y: @y, w: @w, h: @h }~ +- Inside source: true +*** True Line Result + { x: @x, y: @y, w: @w, h: @h } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def inspect~ +- Inside source: true +*** True Line Result + def inspect +** Processing line: ~ "#{serialize}"~ +- Inside source: true +*** True Line Result + "#{serialize}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def to_s~ +- Inside source: true +*** True Line Result + def to_s +** Processing line: ~ "#{serialize}"~ +- Inside source: true +*** True Line Result + "#{serialize}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Here is a definition of two walls.~ +- Inside source: true +*** True Line Result + # Here is a definition of two walls. +** Processing line: ~ walls = [~ +- Inside source: true +*** True Line Result + walls = [ +** Processing line: ~ [10, 10, 10, 10],~ +- Inside source: true +*** True Line Result + [10, 10, 10, 10], +** Processing line: ~ { x: 20, y: 20, w: 10, h: 10 },~ +- Inside source: true +*** True Line Result + { x: 20, y: 20, w: 10, h: 10 }, +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Display the walls.~ +- Inside source: true +*** True Line Result + # Display the walls. +** Processing line: ~ puts "Walls."~ +- Inside source: true +*** True Line Result + puts "Walls." +** Processing line: ~ puts walls~ +- Inside source: true +*** True Line Result + puts walls +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Check any_intersect_rect? on player~ +- Inside source: true +*** True Line Result + # Check any_intersect_rect? on player +** Processing line: ~ player = Player.new 30, 20, 10, 10~ +- Inside source: true +*** True Line Result + player = Player.new 30, 20, 10, 10 +** Processing line: ~ puts "Is Player #{player} touching wall?"~ +- Inside source: true +*** True Line Result + puts "Is Player #{player} touching wall?" +** Processing line: ~ puts (walls.any_intersect_rect? player)~ +- Inside source: true +*** True Line Result + puts (walls.any_intersect_rect? player) +** Processing line: ~ # => false~ +- Inside source: true +*** True Line Result + # => false +** Processing line: ~ # The value is false because of the default tolerance is 0.1.~ +- Inside source: true +*** True Line Result + # The value is false because of the default tolerance is 0.1. +** Processing line: ~ # The overlap of the player rect and any of the wall rects is~ +- Inside source: true +*** True Line Result + # The overlap of the player rect and any of the wall rects is +** Processing line: ~ # less than 0.1 (for those that intersect).~ +- Inside source: true +*** True Line Result + # less than 0.1 (for those that intersect). +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ player = Player.new 9, 10, 10, 10~ +- Inside source: true +*** True Line Result + player = Player.new 9, 10, 10, 10 +** Processing line: ~ puts "Is Player #{player} touching wall?"~ +- Inside source: true +*** True Line Result + puts "Is Player #{player} touching wall?" +** Processing line: ~ puts (walls.any_intersect_rect? player)~ +- Inside source: true +*** True Line Result + puts (walls.any_intersect_rect? player) +** Processing line: ~ # => true~ +- Inside source: true +*** True Line Result + # => true +** Processing line: ~ puts ""~ +- Inside source: true +*** True Line Result + puts "" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~GTK::Outputs~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Outputs~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Outputs is how you render primitives to the screen. The minimal setup for~ +** Processing line: ~rendering something to the screen is via a ~tick~ method defined in~ +** Processing line: ~mygame/app/main.rb~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a ~tick~ method defined in mygame/app/main.rb +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # code goes here~ +- Inside source: true +*** True Line Result + # code goes here +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~GTK::Outputs#solids~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Outputs#solids~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Add primitives to this collection to render a solid to the screen.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Add primitives to this collection to render a solid to the screen. +** Processing line: ~** Rendering a solid using an Array~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering a solid using an Array +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Creates a solid black rectangle located at 100, 100. 160 pixels~ +** Processing line: ~wide and 90 pixels tall.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixels tall. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # X Y WIDTH HEIGHT~ +- Inside source: true +*** True Line Result + # X Y WIDTH HEIGHT +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90]~ +- Inside source: true +*** True Line Result + args.outputs.solids << [100, 100, 160, 90] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~** Rendering a solid using an Array with colors and alpha~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering a solid using an Array with colors and alpha +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The value for the color and alpha is an number between ~0~ and ~255~. The~ +** Processing line: ~alpha property is optional and will be set to ~255~ if not specified.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified. +** Processing line: ~Creates a green solid rectangle with an opacity of 50%.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Creates a green solid rectangle with an opacity of 50%. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # X Y WIDTH HEIGHT RED GREEN BLUE ALPHA~ +- Inside source: true +*** True Line Result + # X Y WIDTH HEIGHT RED GREEN BLUE ALPHA +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128]~ +- Inside source: true +*** True Line Result + args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~** Rendering a solid using a Hash~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering a solid using a Hash +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~If you want a more readable invocation. You can use the following hash to create a solid.~ +** Processing line: ~Any parameters that are not specified will be given a default value. The keys of the hash can~ +** Processing line: ~be provided in any order.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +If you want a more readable invocation. You can use the following hash to create a solid. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.outputs.solids << {~ +- Inside source: true +*** True Line Result + args.outputs.solids << { +** Processing line: ~ x: 0,~ +- Inside source: true +*** True Line Result + x: 0, +** Processing line: ~ y: 0,~ +- Inside source: true +*** True Line Result + y: 0, +** Processing line: ~ w: 100,~ +- Inside source: true +*** True Line Result + w: 100, +** Processing line: ~ h: 100,~ +- Inside source: true +*** True Line Result + h: 100, +** Processing line: ~ r: 0,~ +- Inside source: true +*** True Line Result + r: 0, +** Processing line: ~ g: 255,~ +- Inside source: true +*** True Line Result + g: 255, +** Processing line: ~ b: 0,~ +- Inside source: true +*** True Line Result + b: 0, +** Processing line: ~ a: 255~ +- Inside source: true +*** True Line Result + a: 255 +** Processing line: ~ }~ +- Inside source: true +*** True Line Result + } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~** Rendering a solid using a Class~ +- Header detected. +*** True Line Result + +*** True Line Result +** Rendering a solid using a Class +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You can also create a class with solid/border properties and render it as a primitive.~ +** Processing line: ~ALL properties must on the class. *Additionally*, a method called ~primitive_marker~~ +** Processing line: ~must be defined on the class.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class. +** Processing line: ~Here is an example:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here is an example: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ # Create type with ALL solid properties AND primitive_marker~ +- Inside source: true +*** True Line Result + # Create type with ALL solid properties AND primitive_marker +** Processing line: ~ class Solid~ +- Inside source: true +*** True Line Result + class Solid +** Processing line: ~ attr_accessor :x, :y, :w, :h, :r, :g, :b, :a~ +- Inside source: true +*** True Line Result + attr_accessor :x, :y, :w, :h, :r, :g, :b, :a +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def primitive_marker~ +- Inside source: true +*** True Line Result + def primitive_marker +** Processing line: ~ :solid~ +- Inside source: true +*** True Line Result + :solid +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Inherit from type~ +- Inside source: true +*** True Line Result + # Inherit from type +** Processing line: ~ class Square < Solid~ +- Inside source: true +*** True Line Result + class Square < Solid +** Processing line: ~ # constructor~ +- Inside source: true +*** True Line Result + # constructor +** Processing line: ~ def initialize x, y, size~ +- Inside source: true +*** True Line Result + def initialize x, y, size +** Processing line: ~ self.x = x~ +- Inside source: true +*** True Line Result + self.x = x +** Processing line: ~ self.y = y~ +- Inside source: true +*** True Line Result + self.y = y +** Processing line: ~ self.w = size~ +- Inside source: true +*** True Line Result + self.w = size +** Processing line: ~ self.h = size~ +- Inside source: true +*** True Line Result + self.h = size +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # render solid/border~ +- Inside source: true +*** True Line Result + # render solid/border +** Processing line: ~ args.outputs.solids << Square.new(10, 10, 32)~ +- Inside source: true +*** True Line Result + args.outputs.solids << Square.new(10, 10, 32) +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~GTK::Outputs#borders~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Outputs#borders~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Add primitives to this collection to render an unfilled solid to the screen. Take a look at the~ +** Processing line: ~documentation for Outputs#solids.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids. +** Processing line: ~The only difference between the two primitives is where they are added.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The only difference between the two primitives is where they are added. +** Processing line: ~Instead of using ~args.outputs.solids~:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Instead of using ~args.outputs.solids~: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # X Y WIDTH HEIGHT~ +- Inside source: true +*** True Line Result + # X Y WIDTH HEIGHT +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90]~ +- Inside source: true +*** True Line Result + args.outputs.solids << [100, 100, 160, 90] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~You have to use ~args.outputs.borders~:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +You have to use ~args.outputs.borders~: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # X Y WIDTH HEIGHT~ +- Inside source: true +*** True Line Result + # X Y WIDTH HEIGHT +** Processing line: ~ args.outputs.borders << [100, 100, 160, 90]~ +- Inside source: true +*** True Line Result + args.outputs.borders << [100, 100, 160, 90] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~GTK::Mouse~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::Mouse~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The mouse is accessible via ~args.inputs.mouse~:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The mouse is accessible via ~args.inputs.mouse~: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse).~ +- Inside source: true +*** True Line Result + # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse). +** Processing line: ~ args.outputs.labels << [~ +- Inside source: true +*** True Line Result + args.outputs.labels << [ +** Processing line: ~ 10,~ +- Inside source: true +*** True Line Result + 10, +** Processing line: ~ 710,~ +- Inside source: true +*** True Line Result + 710, +** Processing line: ~ "The mouse's position is: #{args.inputs.mouse.x} #{args.inputs.mouse.y}."~ +- Inside source: true +*** True Line Result + "The mouse's position is: #{args.inputs.mouse.x} #{args.inputs.mouse.y}." +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The mouse has the following properties.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The mouse has the following properties. +** Processing line: ~- ~args.inputs.mouse.x~: Returns the x position of the mouse.~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~- ~args.inputs.mouse.y~: Returns the y position of the mouse.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.x~: Returns the x position of the mouse. +** Processing line: ~- ~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.y~: Returns the y position of the mouse. +** Processing line: ~- ~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick. +** Processing line: ~- ~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move. +** Processing line: ~- ~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move. +** Processing line: ~- ~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed. +** Processing line: ~- ~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed. +** Processing line: ~- ~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released. +** Processing line: ~- ~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse. +** Processing line: ~- ~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus. +** Processing line: ~- ~args.inputs.mouse.button_left~: Returns true if the left mouse button is down.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~. +** Processing line: ~- ~args.inputs.mouse.button_right~: Returns true if the right mouse button is down.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.button_left~: Returns true if the left mouse button is down. +** Processing line: ~- ~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.button_right~: Returns true if the right mouse button is down. +** Processing line: ~- ~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state.~ +- Line was identified as a list. +*** True Line Result +- ~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- ~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state. +** Processing line: ~* DOCS: ~GTK::MousePoint~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::MousePoint~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The ~GTK::MousePoint~ has the following properties.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The ~GTK::MousePoint~ has the following properties. +** Processing line: ~- ~x~: Integer representing the mouse's x.~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~- ~y~: Integer representing the mouse's y.~ +- Line was identified as a list. +*** True Line Result +- ~x~: Integer representing the mouse's x. +** Processing line: ~- ~point~: Array with the ~x~ and ~y~ values.~ +- Line was identified as a list. +*** True Line Result +- ~y~: Integer representing the mouse's y. +** Processing line: ~- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line was identified as a list. +*** True Line Result +- ~point~: Array with the ~x~ and ~y~ values. +** Processing line: ~- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line was identified as a list. +*** True Line Result +- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line was identified as a list. +*** True Line Result +- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line was identified as a list. +*** True Line Result +- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line was identified as a list. +*** True Line Result +- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line was identified as a list. +*** True Line Result +- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~created_at~: The tick (~args.state.tick_count~) that this structure was created.~ +- Line was identified as a list. +*** True Line Result +- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +** Processing line: ~- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.~ +- Line was identified as a list. +*** True Line Result +- ~created_at~: The tick (~args.state.tick_count~) that this structure was created. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~GTK::OpenEntity~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::OpenEntity~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~GTK::OpenEntity~ is accessible within the DragonRuby's top level~ +** Processing line: ~~tick~ function via the ~args.state~ property.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~GTK::OpenEntity~ is accessible within the DragonRuby's top level ~tick~ function via the ~args.state~ property. +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.x ||= 100~ +- Inside source: true +*** True Line Result + args.state.x ||= 100 +** Processing line: ~ args.outputs.labels << [10, 710, "value of x is: #{args.state.x}."]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [10, 710, "value of x is: #{args.state.x}."] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~The primary benefit of using ~args.state~ as opposed to instance~ +** Processing line: ~variables is that ~GTK::OpenEntity~ allows for arbitrary nesting~ +** Processing line: ~of properties without the need to create intermediate objects.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +The primary benefit of using ~args.state~ as opposed to instance variables is that ~GTK::OpenEntity~ allows for arbitrary nesting of properties without the need to create intermediate objects. +** Processing line: ~For example:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +For example: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ # intermediate player object does not need to be created~ +- Inside source: true +*** True Line Result + # intermediate player object does not need to be created +** Processing line: ~ args.state.player.x ||= 100~ +- Inside source: true +*** True Line Result + args.state.player.x ||= 100 +** Processing line: ~ args.state.player.y ||= 100~ +- Inside source: true +*** True Line Result + args.state.player.y ||= 100 +** Processing line: ~ args.outputs.labels << [~ +- Inside source: true +*** True Line Result + args.outputs.labels << [ +** Processing line: ~ 10,~ +- Inside source: true +*** True Line Result + 10, +** Processing line: ~ 710,~ +- Inside source: true +*** True Line Result + 710, +** Processing line: ~ "player x, y is:#{args.state.player.x}, #{args.state.player.y}."~ +- Inside source: true +*** True Line Result + "player x, y is:#{args.state.player.x}, #{args.state.player.y}." +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~GTK::OpenEntity#as_hash~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~GTK::OpenEntity#as_hash~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This~ +** Processing line: ~property is useful when you want to treat ~args.state~ as a ~Hash~ and~ +** Processing line: ~invoke methods such as ~Hash#each~.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This property is useful when you want to treat ~args.state~ as a ~Hash~ and invoke methods such as ~Hash#each~. +** Processing line: ~Example:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Example: +** Processing line: ~#+begin_src~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.x ||= 100~ +- Inside source: true +*** True Line Result + args.state.x ||= 100 +** Processing line: ~ args.state.y ||= 100~ +- Inside source: true +*** True Line Result + args.state.y ||= 100 +** Processing line: ~ values = args.state~ +- Inside source: true +*** True Line Result + values = args.state +** Processing line: ~ .as_hash~ +- Inside source: true +*** True Line Result + .as_hash +** Processing line: ~ .map { |k, v| "#{k} #{v}" }~ +- Inside source: true +*** True Line Result + .map { |k, v| "#{k} #{v}" } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.labels << values.map.with_index do |v, i|~ +- Inside source: true +*** True Line Result + args.outputs.labels << values.map.with_index do |v, i| +** Processing line: ~ [~ +- Inside source: true +*** True Line Result + [ +** Processing line: ~ 10,~ +- Inside source: true +*** True Line Result + 10, +** Processing line: ~ 710 - (30 * i),~ +- Inside source: true +*** True Line Result + 710 - (30 * i), +** Processing line: ~ v~ +- Inside source: true +*** True Line Result + v +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Numeric#frame_index~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Numeric#frame_index~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~This function is helpful for determining the index of frame-by-frame~ +** Processing line: ~ sprite animation. The numeric value ~self~ represents the moment the~ +** Processing line: ~ animation started.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value ~self~ represents the moment the animation started. +** Processing line: ~~frame_index~ takes three additional parameters:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~frame_index~ takes three additional parameters: +** Processing line: ~- How many frames exist in the sprite animation.~ +- Line was identified as a list. +*** True Line Result + +** Processing line: ~- How long to hold each animation for.~ +- Line was identified as a list. +*** True Line Result +- How many frames exist in the sprite animation. +** Processing line: ~- Whether the animation should repeat.~ +- Line was identified as a list. +*** True Line Result +- How long to hold each animation for. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +- Whether the animation should repeat. +** Processing line: ~~frame_index~ will return ~nil~ if the time for the animation is out~ +** Processing line: ~of bounds of the parameter specification.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +~frame_index~ will return ~nil~ if the time for the animation is out of bounds of the parameter specification. +** Processing line: ~Example using variables:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Example using variables: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ start_looping_at = 0~ +- Inside source: true +*** True Line Result + start_looping_at = 0 +** Processing line: ~ number_of_sprites = 6~ +- Inside source: true +*** True Line Result + number_of_sprites = 6 +** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ +- Inside source: true +*** True Line Result + number_of_frames_to_show_each_sprite = 4 +** Processing line: ~ does_sprite_loop = true~ +- Inside source: true +*** True Line Result + does_sprite_loop = true +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ sprite_index =~ +- Inside source: true +*** True Line Result + sprite_index = +** Processing line: ~ start_looping_at.frame_index number_of_sprites,~ +- Inside source: true +*** True Line Result + start_looping_at.frame_index number_of_sprites, +** Processing line: ~ number_of_frames_to_show_each_sprite,~ +- Inside source: true +*** True Line Result + number_of_frames_to_show_each_sprite, +** Processing line: ~ does_sprite_loop~ +- Inside source: true +*** True Line Result + does_sprite_loop +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ sprite_index ||= 0~ +- Inside source: true +*** True Line Result + sprite_index ||= 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.sprites << [~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [ +** Processing line: ~ 640 - 50,~ +- Inside source: true +*** True Line Result + 640 - 50, +** Processing line: ~ 360 - 50,~ +- Inside source: true +*** True Line Result + 360 - 50, +** Processing line: ~ 100,~ +- Inside source: true +*** True Line Result + 100, +** Processing line: ~ 100,~ +- Inside source: true +*** True Line Result + 100, +** Processing line: ~ "sprites/dragon-#{sprite_index}.png"~ +- Inside source: true +*** True Line Result + "sprites/dragon-#{sprite_index}.png" +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Example using named parameters:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Example using named parameters: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ start_looping_at = 0~ +- Inside source: true +*** True Line Result + start_looping_at = 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ sprite_index =~ +- Inside source: true +*** True Line Result + sprite_index = +** Processing line: ~ start_looping_at.frame_index count: 6,~ +- Inside source: true +*** True Line Result + start_looping_at.frame_index count: 6, +** Processing line: ~ hold_for: 4,~ +- Inside source: true +*** True Line Result + hold_for: 4, +** Processing line: ~ repeat: true,~ +- Inside source: true +*** True Line Result + repeat: true, +** Processing line: ~ tick_count_override: args.state.tick_count~ +- Inside source: true +*** True Line Result + tick_count_override: args.state.tick_count +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ sprite_index ||= 0~ +- Inside source: true +*** True Line Result + sprite_index ||= 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.outputs.sprites << [~ +- Inside source: true +*** True Line Result + args.outputs.sprites << [ +** Processing line: ~ 640 - 50,~ +- Inside source: true +*** True Line Result + 640 - 50, +** Processing line: ~ 360 - 50,~ +- Inside source: true +*** True Line Result + 360 - 50, +** Processing line: ~ 100,~ +- Inside source: true +*** True Line Result + 100, +** Processing line: ~ 100,~ +- Inside source: true +*** True Line Result + 100, +** Processing line: ~ "sprites/dragon-#{sprite_index}.png"~ +- Inside source: true +*** True Line Result + "sprites/dragon-#{sprite_index}.png" +** Processing line: ~ ]~ +- Inside source: true +*** True Line Result + ] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Numeric#elapsed_time~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Numeric#elapsed_time~ +** Processing line: ~For a given number, the elapsed frames since that number is returned.~ +** Processing line: ~`Kernel.tick_count` is used to determine how many frames have elapsed.~ +** Processing line: ~An optional numeric argument can be passed in which will be used instead~ +** Processing line: ~of `Kernel.tick_count`.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`. +** Processing line: ~Here is an example of how elapsed_time can be used.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Here is an example of how elapsed_time can be used. +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.last_click_at ||= 0~ +- Inside source: true +*** True Line Result + args.state.last_click_at ||= 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # record when a mouse click occurs~ +- Inside source: true +*** True Line Result + # record when a mouse click occurs +** Processing line: ~ if args.inputs.mouse.click~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click +** Processing line: ~ args.state.last_click_at = args.state.tick_count~ +- Inside source: true +*** True Line Result + args.state.last_click_at = args.state.tick_count +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Use Numeric#elapsed_time to determine how long it's been~ +- Inside source: true +*** True Line Result + # Use Numeric#elapsed_time to determine how long it's been +** Processing line: ~ if args.state.last_click_at.elapsed_time > 120~ +- Inside source: true +*** True Line Result + if args.state.last_click_at.elapsed_time > 120 +** Processing line: ~ args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~And here is an example where the override parameter is passed in:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +And here is an example where the override parameter is passed in: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.last_click_at ||= 0~ +- Inside source: true +*** True Line Result + args.state.last_click_at ||= 0 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # create a state variable that tracks time at half the speed of args.state.tick_count~ +- Inside source: true +*** True Line Result + # create a state variable that tracks time at half the speed of args.state.tick_count +** Processing line: ~ args.state.simulation_tick = args.state.tick_count.idiv 2~ +- Inside source: true +*** True Line Result + args.state.simulation_tick = args.state.tick_count.idiv 2 +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # record when a mouse click occurs~ +- Inside source: true +*** True Line Result + # record when a mouse click occurs +** Processing line: ~ if args.inputs.mouse.click~ +- Inside source: true +*** True Line Result + if args.inputs.mouse.click +** Processing line: ~ args.state.last_click_at = args.state.simulation_tick~ +- Inside source: true +*** True Line Result + args.state.last_click_at = args.state.simulation_tick +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # Use Numeric#elapsed_time to determine how long it's been~ +- Inside source: true +*** True Line Result + # Use Numeric#elapsed_time to determine how long it's been +** Processing line: ~ if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120~ +- Inside source: true +*** True Line Result + if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120 +** Processing line: ~ args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."]~ +- Inside source: true +*** True Line Result + args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."] +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Numeric#elapsed?~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Numeric#elapsed?~ +** Processing line: ~Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be~ +** Processing line: ~passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true. +** Processing line: ~Example usage (no optional parameter):~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Example usage (no optional parameter): +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.box_queue ||= []~ +- Inside source: true +*** True Line Result + args.state.box_queue ||= [] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.box_queue.empty?~ +- Inside source: true +*** True Line Result + if args.state.box_queue.empty? +** Processing line: ~ args.state.box_queue << { name: :red,~ +- Inside source: true +*** True Line Result + args.state.box_queue << { name: :red, +** Processing line: ~ destroy_at: args.state.tick_count + 60 }~ +- Inside source: true +*** True Line Result + destroy_at: args.state.tick_count + 60 } +** Processing line: ~ args.state.box_queue << { name: :green,~ +- Inside source: true +*** True Line Result + args.state.box_queue << { name: :green, +** Processing line: ~ destroy_at: args.state.tick_count + 60 }~ +- Inside source: true +*** True Line Result + destroy_at: args.state.tick_count + 60 } +** Processing line: ~ args.state.box_queue << { name: :blue,~ +- Inside source: true +*** True Line Result + args.state.box_queue << { name: :blue, +** Processing line: ~ destroy_at: args.state.tick_count + 120 }~ +- Inside source: true +*** True Line Result + destroy_at: args.state.tick_count + 120 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ boxes_to_destroy = args.state~ +- Inside source: true +*** True Line Result + boxes_to_destroy = args.state +** Processing line: ~ .box_queue~ +- Inside source: true +*** True Line Result + .box_queue +** Processing line: ~ .find_all { |b| b[:destroy_at].elapsed? }~ +- Inside source: true +*** True Line Result + .find_all { |b| b[:destroy_at].elapsed? } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if !boxes_to_destroy.empty?~ +- Inside source: true +*** True Line Result + if !boxes_to_destroy.empty? +** Processing line: ~ puts "boxes to destroy count: #{boxes_to_destroy.length}"~ +- Inside source: true +*** True Line Result + puts "boxes to destroy count: #{boxes_to_destroy.length}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." }~ +- Inside source: true +*** True Line Result + boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.box_queue -= boxes_to_destroy~ +- Inside source: true +*** True Line Result + args.state.box_queue -= boxes_to_destroy +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Example usage (with optional parameter):~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Example usage (with optional parameter): +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.box_queue ||= []~ +- Inside source: true +*** True Line Result + args.state.box_queue ||= [] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.box_queue.empty?~ +- Inside source: true +*** True Line Result + if args.state.box_queue.empty? +** Processing line: ~ args.state.box_queue << { name: :red,~ +- Inside source: true +*** True Line Result + args.state.box_queue << { name: :red, +** Processing line: ~ create_at: args.state.tick_count + 120,~ +- Inside source: true +*** True Line Result + create_at: args.state.tick_count + 120, +** Processing line: ~ lifespan: 60 }~ +- Inside source: true +*** True Line Result + lifespan: 60 } +** Processing line: ~ args.state.box_queue << { name: :green,~ +- Inside source: true +*** True Line Result + args.state.box_queue << { name: :green, +** Processing line: ~ create_at: args.state.tick_count + 120,~ +- Inside source: true +*** True Line Result + create_at: args.state.tick_count + 120, +** Processing line: ~ lifespan: 60 }~ +- Inside source: true +*** True Line Result + lifespan: 60 } +** Processing line: ~ args.state.box_queue << { name: :blue,~ +- Inside source: true +*** True Line Result + args.state.box_queue << { name: :blue, +** Processing line: ~ create_at: args.state.tick_count + 120,~ +- Inside source: true +*** True Line Result + create_at: args.state.tick_count + 120, +** Processing line: ~ lifespan: 120 }~ +- Inside source: true +*** True Line Result + lifespan: 120 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ # lifespan is passed in as a parameter to ~elapsed?~~ +- Inside source: true +*** True Line Result + # lifespan is passed in as a parameter to ~elapsed?~ +** Processing line: ~ boxes_to_destroy = args.state~ +- Inside source: true +*** True Line Result + boxes_to_destroy = args.state +** Processing line: ~ .box_queue~ +- Inside source: true +*** True Line Result + .box_queue +** Processing line: ~ .find_all { |b| b[:create_at].elapsed? b[:lifespan] }~ +- Inside source: true +*** True Line Result + .find_all { |b| b[:create_at].elapsed? b[:lifespan] } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if !boxes_to_destroy.empty?~ +- Inside source: true +*** True Line Result + if !boxes_to_destroy.empty? +** Processing line: ~ puts "boxes to destroy count: #{boxes_to_destroy.length}"~ +- Inside source: true +*** True Line Result + puts "boxes to destroy count: #{boxes_to_destroy.length}" +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." }~ +- Inside source: true +*** True Line Result + boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.box_queue -= boxes_to_destroy~ +- Inside source: true +*** True Line Result + args.state.box_queue -= boxes_to_destroy +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Numeric#created?~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Numeric#created?~ +** Processing line: ~Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that~ +** Processing line: ~number is equal to the current frame.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that number is equal to the current frame. +** Processing line: ~Example usage:~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Example usage: +** Processing line: ~#+begin_src ruby~ +- Line was identified as the beginning of a code block. +*** True Line Result + +*** True Line Result +#+begin_src ruby +** Processing line: ~ def tick args~ +- Inside source: true +*** True Line Result + def tick args +** Processing line: ~ args.state.box_queue ||= []~ +- Inside source: true +*** True Line Result + args.state.box_queue ||= [] +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ if args.state.box_queue.empty?~ +- Inside source: true +*** True Line Result + if args.state.box_queue.empty? +** Processing line: ~ args.state.box_queue << { name: :red,~ +- Inside source: true +*** True Line Result + args.state.box_queue << { name: :red, +** Processing line: ~ create_at: args.state.tick_count + 60 }~ +- Inside source: true +*** True Line Result + create_at: args.state.tick_count + 60 } +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ boxes_to_spawn_this_frame = args.state~ +- Inside source: true +*** True Line Result + boxes_to_spawn_this_frame = args.state +** Processing line: ~ .box_queue~ +- Inside source: true +*** True Line Result + .box_queue +** Processing line: ~ .find_all { |b| b[:create_at].new? }~ +- Inside source: true +*** True Line Result + .find_all { |b| b[:create_at].new? } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ boxes_to_spawn_this_frame.each { |b| puts "box #{b} was new? on #{args.state.tick_count}." }~ +- Inside source: true +*** True Line Result + boxes_to_spawn_this_frame.each { |b| puts "box #{b} was new? on #{args.state.tick_count}." } +** Processing line: ~~ +- Inside source: true +*** True Line Result + +** Processing line: ~ args.state.box_queue -= boxes_to_spawn_this_frame~ +- Inside source: true +*** True Line Result + args.state.box_queue -= boxes_to_spawn_this_frame +** Processing line: ~ end~ +- Inside source: true +*** True Line Result + end +** Processing line: ~#+end_src~ +- Line was identified as the end of a code block. +*** True Line Result +#+end_src +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Kernel~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Kernel~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Kernel in the DragonRuby Runtime has patches for how standard out is handled and also~ +** Processing line: ~contains a unit of time in games called a tick.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Kernel::tick_count~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Kernel::tick_count~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Returns the current tick of the game. This value is reset if you call $gtk.reset.~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result +Returns the current tick of the game. This value is reset if you call $gtk.reset. +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~* DOCS: ~Kernel::global_tick_count~~ +- Header detected. +*** True Line Result + +*** True Line Result +* DOCS: ~Kernel::global_tick_count~ +** Processing line: ~~ +- End of paragraph detected. +*** True Line Result + +** Processing line: ~Returns the current tick of the application from the point it was started. This value is never reset.~ +* Processing Html Given True Lines +** Processing line: ~* DragonRuby Game Toolkit Live Docs~ +- H1 detected. +- Formatting line: ~DragonRuby Game Toolkit Live Docs~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game.~ +- P detected. +- Formatting line: ~The information contained here is all available via the DragonRuby Console. You can Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§] within your game.~ +- Line's tilde count is: 1 +- Line contains link marker: false +** Processing line: ~To search docs you can type ~docs_search "SEARCH TERM"~ or if you want to get fancy you can provide a ~lambda~ to filter documentation:~ +- P detected. +- Formatting line: ~To search docs you can type ~docs_search "SEARCH TERM"~ or if you want to get fancy you can provide a ~lambda~ to filter documentation:~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") }~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~[[docs_search.gif]]~ +- P detected. +- Formatting line: ~[[docs_search.gif]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~~ +** Processing line: ~* Hello World~ +- H1 detected. +- Formatting line: ~Hello World~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Welcome to DragonRuby Game Toolkit. Take the steps below to get started.~ +- P detected. +- Formatting line: ~Welcome to DragonRuby Game Toolkit. Take the steps below to get started.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~* Join the Discord and Subscribe to the News Letter~ +- H1 detected. +- Formatting line: ~Join the Discord and Subscribe to the News Letter~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Our Discord channel is [[http://discord.dragonruby.org]].~ +- P detected. +- Formatting line: ~Our Discord channel is [[http://discord.dragonruby.org]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~The News Letter will keep you in the loop with regards to current DragonRuby Events: [[http://dragonrubydispatch.com]].~ +- P detected. +- Formatting line: ~The News Letter will keep you in the loop with regards to current DragonRuby Events: [[http://dragonrubydispatch.com]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~Those who use DragonRuby are called Dragon Riders. This identity is incredibly important to us. When someone asks you:~ +- P detected. +- Formatting line: ~Those who use DragonRuby are called Dragon Riders. This identity is incredibly important to us. When someone asks you:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_quote~ +- BLOCKQUOTE start detected. +** Processing line: ~What game engine do you use?~ +- P detected. +- Formatting line: ~What game engine do you use?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~#+end_quote~ +- BLOCKQUOTE end detected. +** Processing line: ~~ +** Processing line: ~Reply with:~ +- P detected. +- Formatting line: ~Reply with:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_quote~ +- BLOCKQUOTE start detected. +** Processing line: ~I am a Dragon Rider.~ +- P detected. +- Formatting line: ~I am a Dragon Rider.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~#+end_quote~ +- BLOCKQUOTE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Watch Some Intro Videos~ +- H1 detected. +- Formatting line: ~Watch Some Intro Videos~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them:~ +- P detected. +- Formatting line: ~Each video is only 20 minutes and all of them will fit into a lunch break. So please watch them:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ +- OL start detected. +- LI detected. +- Formatting line: ~ Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ +- LI detected. +- Formatting line: ~ Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ +- LI detected. +- Formatting line: ~ Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]]~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one.~ +- OL end detected. +- P detected. +- Formatting line: ~The second and third videos are not required if you are proficient with Ruby, but *definitely* watch the first one.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You may also want to try this free course provided at [[http://dragonruby.school]].~ +- P detected. +- Formatting line: ~You may also want to try this free course provided at [[http://dragonruby.school]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~~ +** Processing line: ~* Getting Started Tutorial~ +- H1 detected. +- Formatting line: ~Getting Started Tutorial~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]).~ +- P detected. +- Formatting line: ~This is a tutorial written by Ryan C Gordon (a Juggernaut in the industry who has contracted to Valve, Epic, Activision, and EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]).~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~~ +** Processing line: ~** Introduction~ +- H2 detected. +- Formatting line: ~Introduction~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Introduction~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Welcome!~ +- P detected. +- Formatting line: ~Welcome!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here's just a little push to get you started if you're new to programming or game development.~ +- P detected. +- Formatting line: ~Here's just a little push to get you started if you're new to programming or game development.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you want to write a game, it's no different than writing any other program for any other framework: there are a few simple rules that might be new to you, but more or less programming is programming no matter what you are building.~ +- P detected. +- Formatting line: ~If you want to write a game, it's no different than writing any other program for any other framework: there are a few simple rules that might be new to you, but more or less programming is programming no matter what you are building.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Did you not know that? Did you think you couldn't write a game because you're a "web guy" or you're writing Java at a desk job? Stop letting people tell you that you can't, because you already have everything you need.~ +- P detected. +- Formatting line: ~Did you not know that? Did you think you couldn't write a game because you're a "web guy" or you're writing Java at a desk job? Stop letting people tell you that you can't, because you already have everything you need.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here, we're going to be programming in a language called "Ruby." In the interest of full disclosure, I (Ryan Gordon) wrote the C parts of this toolkit and Ruby looks a little strange to me (Amir Rajan wrote the Ruby parts, discounting the parts I mangled), but I'm going to walk you through the basics because we're all learning together, and if you mostly think of yourself as someone that writes C (or C++, C#, Objective-C), PHP, or Java, then you're only a step behind me right now.~ +- P detected. +- Formatting line: ~Here, we're going to be programming in a language called "Ruby." In the interest of full disclosure, I (Ryan Gordon) wrote the C parts of this toolkit and Ruby looks a little strange to me (Amir Rajan wrote the Ruby parts, discounting the parts I mangled), but I'm going to walk you through the basics because we're all learning together, and if you mostly think of yourself as someone that writes C (or C++, C#, Objective-C), PHP, or Java, then you're only a step behind me right now.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Prerequisites~ +- H2 detected. +- Formatting line: ~Prerequisites~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Prerequisites~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Here's the most important thing you should know: Ruby lets you do some complicated things really easily, and you can learn that stuff later. I'm going to show you one or two cool tricks, but that's all.~ +- P detected. +- Formatting line: ~Here's the most important thing you should know: Ruby lets you do some complicated things really easily, and you can learn that stuff later. I'm going to show you one or two cool tricks, but that's all.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Do you know what an if statement is? A for-loop? An array? That's all you'll need to start.~ +- P detected. +- Formatting line: ~Do you know what an if statement is? A for-loop? An array? That's all you'll need to start.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** The Game Loop~ +- H2 detected. +- Formatting line: ~The Game Loop~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~The Game Loop~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Ok, here are few rules with regards to game development with GTK:~ +- P detected. +- Formatting line: ~Ok, here are few rules with regards to game development with GTK:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~- Your game is all going to happen under one function ...~ +- UL start detected. +- LI detected. +- Formatting line: ~Your game is all going to happen under one function ...~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- that runs 60 times a second ...~ +- LI detected. +- Formatting line: ~that runs 60 times a second ...~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- and has to tell the computer what to draw each time.~ +- LI detected. +- Formatting line: ~and has to tell the computer what to draw each time.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~That's an entire video game in one run-on sentence.~ +- UL end detected. +- P detected. +- Formatting line: ~That's an entire video game in one run-on sentence.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here's that function. You're going to want to put this in mygame/app/main.rb, because that's where we'll look for it by default. Load it up in your favorite text editor.~ +- P detected. +- Formatting line: ~Here's that function. You're going to want to put this in mygame/app/main.rb, because that's where we'll look for it by default. Load it up in your favorite text editor.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~Now run ~dragonruby~ ...did you get a window with "Hello World!" written in it? Good, you're officially a game developer!~ +- P detected. +- Formatting line: ~Now run ~dragonruby~ ...did you get a window with "Hello World!" written in it? Good, you're officially a game developer!~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~** Breakdown Of The ~tick~ Method~ +- H2 detected. +- Formatting line: ~Breakdown Of The ~tick~ Method~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +- Formatting line: ~Breakdown Of The ~tick~ Method~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~~mygame/app/main.rb~, is where the Ruby source code is located. This looks a little strange, so I'll break it down line by line. In Ruby, a '#' character starts a single-line comment, so I'll talk about this inline.~ +- P detected. +- Formatting line: ~~mygame/app/main.rb~, is where the Ruby source code is located. This looks a little strange, so I'll break it down line by line. In Ruby, a '#' character starts a single-line comment, so I'll talk about this inline.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # This "def"ines a function, named "tick," which takes a single argument~ +** Processing line: ~ # named "args". DragonRuby looks for this function and calls it every~ +** Processing line: ~ # frame, 60 times a second. "args" is a magic structure with lots of~ +** Processing line: ~ # information in it. You can set variables in there for your own game state,~ +** Processing line: ~ # and every frame it will updated if keys are pressed, joysticks moved,~ +** Processing line: ~ # mice clicked, etc.~ +** Processing line: ~ def tick args~ +** Processing line: ~~ +** Processing line: ~ # One of the things in "args" is the "outputs" object that your game uses~ +** Processing line: ~ # to draw things. Afraid of rendering APIs? No problem. In DragonRuby,~ +** Processing line: ~ # you use arrays to draw things and we figure out the details.~ +** Processing line: ~ # If you want to draw text on the screen, you give it an array (the thing~ +** Processing line: ~ # in the [ brackets ]), with an X and Y coordinate and the text to draw.~ +** Processing line: ~ # The "<<" thing says "append this array onto the list of them at~ +** Processing line: ~ # args.outputs.labels)~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~Once your ~tick~ function finishes, we look at all the arrays you made and figure out how to draw it. You don't need to know about graphics APIs. You're just setting up some arrays! DragonRuby clears out these arrays every frame, so you just need to add what you need _right now_ each time.~ +- P detected. +- Formatting line: ~Once your ~tick~ function finishes, we look at all the arrays you made and figure out how to draw it. You don't need to know about graphics APIs. You're just setting up some arrays! DragonRuby clears out these arrays every frame, so you just need to add what you need _right now_ each time.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~** Rendering A Sprite~ +- H2 detected. +- Formatting line: ~Rendering A Sprite~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Rendering A Sprite~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Now let's spice this up a little.~ +- P detected. +- Formatting line: ~Now let's spice this up a little.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~We're going to add some graphics. Each 2D image in DragonRuby is called a "sprite," and to use them, you just make sure they exist in a reasonable file format (png, jpg, gif, bmp, etc) and specify them by filename. The first time you use one, DragonRuby will load it and keep it in video memory for fast access in the future. If you use a filename that doesn't exist, you get a fun checkerboard pattern!~ +- P detected. +- Formatting line: ~We're going to add some graphics. Each 2D image in DragonRuby is called a "sprite," and to use them, you just make sure they exist in a reasonable file format (png, jpg, gif, bmp, etc) and specify them by filename. The first time you use one, DragonRuby will load it and keep it in video memory for fast access in the future. If you use a filename that doesn't exist, you get a fun checkerboard pattern!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~There's a "dragonruby.png" file included, just to get you started. Let's have it draw every frame with our text:~ +- P detected. +- Formatting line: ~There's a "dragonruby.png" file included, just to get you started. Let's have it draw every frame with our text:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +** Processing line: ~ args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png']~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~(Pro Tip: you don't have to restart DragonRuby to test your changes; when you save main.rb, DragonRuby will notice and reload your program.)~ +- P detected. +- Formatting line: ~(Pro Tip: you don't have to restart DragonRuby to test your changes; when you save main.rb, DragonRuby will notice and reload your program.)~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~That ~.sprites~ line says "add a sprite to the list of sprites we're drawing, and draw it at position (576, 100) at a size of 128x101 pixels". You can find the image to draw at dragonruby.png.~ +- P detected. +- Formatting line: ~That ~.sprites~ line says "add a sprite to the list of sprites we're drawing, and draw it at position (576, 100) at a size of 128x101 pixels". You can find the image to draw at dragonruby.png.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~** Coordinate System and Virtual Canvas~ +- H2 detected. +- Formatting line: ~Coordinate System and Virtual Canvas~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Coordinate System and Virtual Canvas~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Quick note about coordinates: (0, 0) is the bottom left corner of the screen, and positive numbers go up and to the right. This is more "geometrically correct," even if it's not how you remember doing 2D graphics, but we chose this for a simpler reason: when you're making Super Mario Brothers and you want Mario to jump, you should be able to add to Mario's y position as he goes up and subtract as he falls. It makes things easier to understand.~ +- P detected. +- Formatting line: ~Quick note about coordinates: (0, 0) is the bottom left corner of the screen, and positive numbers go up and to the right. This is more "geometrically correct," even if it's not how you remember doing 2D graphics, but we chose this for a simpler reason: when you're making Super Mario Brothers and you want Mario to jump, you should be able to add to Mario's y position as he goes up and subtract as he falls. It makes things easier to understand.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Also: your game screen is _always_ 1280x720 pixels. If you resize the window, we will scale and letterbox everything appropriately, so you never have to worry about different resolutions.~ +- P detected. +- Formatting line: ~Also: your game screen is _always_ 1280x720 pixels. If you resize the window, we will scale and letterbox everything appropriately, so you never have to worry about different resolutions.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Ok, now we have an image on the screen, let's animate it:~ +- P detected. +- Formatting line: ~Ok, now we have an image on the screen, let's animate it:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.rotation ||= 0~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!' ]~ +** Processing line: ~ args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation]~ +** Processing line: ~ args.state.rotation -= 1~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~Now you can see that this function is getting called a lot!~ +- P detected. +- Formatting line: ~Now you can see that this function is getting called a lot!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Game State~ +- H2 detected. +- Formatting line: ~Game State~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Game State~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for "if args.state.rotation isn't initialized, set it to zero." It's a nice way to embed your initialization code right next to where you need the variable.~ +- P detected. +- Formatting line: ~Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for "if args.state.rotation isn't initialized, set it to zero." It's a nice way to embed your initialization code right next to where you need the variable.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~args.state~ is a place you can hang your own data and have it survive past the life of the function call. In this case, the current rotation of our sprite, which is happily spinning at 60 frames per second. If you don't specify rotation (or alpha, or color modulation, or a source rectangle, etc), DragonRuby picks a reasonable default, and the array is ordered by the most likely things you need to tell us: position, size, name.~ +- P detected. +- Formatting line: ~~args.state~ is a place you can hang your own data and have it survive past the life of the function call. In this case, the current rotation of our sprite, which is happily spinning at 60 frames per second. If you don't specify rotation (or alpha, or color modulation, or a source rectangle, etc), DragonRuby picks a reasonable default, and the array is ordered by the most likely things you need to tell us: position, size, name.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~** There Is No Delta Time~ +- H2 detected. +- Formatting line: ~There Is No Delta Time~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~There Is No Delta Time~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~One thing we decided to do in DragonRuby is not make you worry about delta time: your function runs at 60 frames per second (about 16 milliseconds) and that's that. Having to worry about framerate is something massive triple-AAA games do, but for fun little 2D games? You'd have to work really hard to not hit 60fps. All your drawing is happening on a GPU designed to run Fortnite quickly; it can definitely handle this.~ +- P detected. +- Formatting line: ~One thing we decided to do in DragonRuby is not make you worry about delta time: your function runs at 60 frames per second (about 16 milliseconds) and that's that. Having to worry about framerate is something massive triple-AAA games do, but for fun little 2D games? You'd have to work really hard to not hit 60fps. All your drawing is happening on a GPU designed to run Fortnite quickly; it can definitely handle this.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Since we didn't make you worry about delta time, you can just move the rotation by 1 every time and it works without you having to keep track of time and math. Want it to move faster? Subtract 2.~ +- P detected. +- Formatting line: ~Since we didn't make you worry about delta time, you can just move the rotation by 1 every time and it works without you having to keep track of time and math. Want it to move faster? Subtract 2.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Handling User Input~ +- H2 detected. +- Formatting line: ~Handling User Input~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Handling User Input~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Now, let's move that image around.~ +- P detected. +- Formatting line: ~Now, let's move that image around.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.rotation ||= 0~ +** Processing line: ~ args.state.x ||= 576~ +** Processing line: ~ args.state.y ||= 100~ +** Processing line: ~~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.state.x = args.inputs.mouse.click.point.x - 64~ +** Processing line: ~ args.state.y = args.inputs.mouse.click.point.y - 50~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << [580, 400, 'Hello World!']~ +** Processing line: ~ args.outputs.sprites << [args.state.x,~ +** Processing line: ~ args.state.y,~ +** Processing line: ~ 128,~ +** Processing line: ~ 101,~ +** Processing line: ~ 'dragonruby.png',~ +** Processing line: ~ args.state.rotation]~ +** Processing line: ~~ +** Processing line: ~ args.state.rotation -= 1~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~Everywhere you click your mouse, the image moves there. We set a default location for it with ~args.state.x ||= 576~, and then we change those variables when we see the mouse button in action. You can get at the keyboard and game controllers in similar ways.~ +- P detected. +- Formatting line: ~Everywhere you click your mouse, the image moves there. We set a default location for it with ~args.state.x ||= 576~, and then we change those variables when we see the mouse button in action. You can get at the keyboard and game controllers in similar ways.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~** Coding On A Raspberry Pi~ +- H2 detected. +- Formatting line: ~Coding On A Raspberry Pi~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Coding On A Raspberry Pi~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we believe it _should_ work on any model with comparable specs.~ +- P detected. +- Formatting line: ~We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we believe it _should_ work on any model with comparable specs.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- like one frame every few seconds--then there's likely a simple fix.~ +- P detected. +- Formatting line: ~If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- like one frame every few seconds--then there's likely a simple fix.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You're probably running a desktop environment: menus, apps, web browsers, etc. This is okay! Launch the terminal app and type:~ +- P detected. +- Formatting line: ~You're probably running a desktop environment: menus, apps, web browsers, etc. This is okay! Launch the terminal app and type:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~sudo raspi-config~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~It'll ask you for your password (if you don't know, try "raspberry"), and then give you a menu of options. Find your way to "Advanced Options", then "GL Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is also listed there. Save and reboot. In theory, this should fix the problem.~ +- P detected. +- Formatting line: ~It'll ask you for your password (if you don't know, try "raspberry"), and then give you a menu of options. Find your way to "Advanced Options", then "GL Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is also listed there. Save and reboot. In theory, this should fix the problem.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you're _still_ having problems and have a Raspberry Pi 2 or better, go back to raspi-config and head over to "Advanced Options", "Memory split," and give the GPU 256 megabytes. You might be able to avoid this for simple games, as this takes RAM away from the system and reserves it for graphics. You can also try 128 megabytes as a gentler option.~ +- P detected. +- Formatting line: ~If you're _still_ having problems and have a Raspberry Pi 2 or better, go back to raspi-config and head over to "Advanced Options", "Memory split," and give the GPU 256 megabytes. You might be able to avoid this for simple games, as this takes RAM away from the system and reserves it for graphics. You can also try 128 megabytes as a gentler option.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Note that you can also run DragonRuby without X11 at all: if you run it from a virtual terminal it will render fullscreen and won't need the "Full KMS" option. This might be attractive if you want to use it as a game console sort of thing, or develop over ssh, or launch it from RetroPie, etc.~ +- P detected. +- Formatting line: ~Note that you can also run DragonRuby without X11 at all: if you run it from a virtual terminal it will render fullscreen and won't need the "Full KMS" option. This might be attractive if you want to use it as a game console sort of thing, or develop over ssh, or launch it from RetroPie, etc.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Conclusion~ +- H2 detected. +- Formatting line: ~Conclusion~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Conclusion~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore.~ +- P detected. +- Formatting line: ~There is a lot more you can do with DragonRuby, but now you've already got just about everything you need to make a simple game. After all, even the most fancy games are just creating objects and moving them around. Experiment a little. Add a few more things and have them interact in small ways. Want something to go away? Just don't add it to ~args.output~ anymore.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!~ +- H2 detected. +- Formatting line: ~IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app.~ +- P detected. +- Formatting line: ~Now that you've completed the Hello World tutorial. Head over to the `samples` directory. It is very very important that you study the sample apps thoroughly! Go through them in order. Here is a short description of each sample app.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s.~ +- OL start detected. +- LI detected. +- Formatting line: ~ 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language.~ +- LI detected. +- Formatting line: ~ 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~3. 01_api_01_labels: Various ways to render ~label~s.~ +- LI detected. +- Formatting line: ~ 01_api_01_labels: Various ways to render ~label~s.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~4. 01_api_02_lines: Various ways to render ~line~s.~ +- LI detected. +- Formatting line: ~ 01_api_02_lines: Various ways to render ~line~s.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s.~ +- LI detected. +- Formatting line: ~ 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s.~ +- LI detected. +- Formatting line: ~ 01_api_04_sprites: Sample app shows various ways to render ~sprite~s.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~7. 01_api_05_keyboard: Hows how to get keyboard input from the user.~ +- LI detected. +- Formatting line: ~ 01_api_05_keyboard: Hows how to get keyboard input from the user.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~8. 01_api_06_mouse: Hows how to get mouse mouse position.~ +- LI detected. +- Formatting line: ~ 01_api_06_mouse: Hows how to get mouse mouse position.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection.~ +- LI detected. +- Formatting line: ~ 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles.~ +- LI detected. +- Formatting line: ~ 01_api_08_rect_to_rect: Hit detection/collision between two rectangles.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~11. 01_api_10_controller: Interaction with a USB/Bluetooth controller.~ +- LI detected. +- Formatting line: ~ 01_api_10_controller: Interaction with a USB/Bluetooth controller.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~.~ +- LI detected. +- Formatting line: ~ 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~13. 02_collision_01_simple: Collision detection with dynamically moving bodies.~ +- LI detected. +- Formatting line: ~ 02_collision_01_simple: Collision detection with dynamically moving bodies.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input.~ +- LI detected. +- Formatting line: ~ 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system).~ +- LI detected. +- Formatting line: ~ 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated.~ +- LI detected. +- Formatting line: ~ 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated.~ +- LI detected. +- Formatting line: ~ 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input.~ +- LI detected. +- Formatting line: ~ 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player.~ +- LI detected. +- Formatting line: ~ 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~20. 04_sounds: How to play sounds and work with buttons.~ +- LI detected. +- Formatting line: ~ 04_sounds: How to play sounds and work with buttons.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player.~ +- LI detected. +- Formatting line: ~ 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~22. 05_mouse_move_paint_app: Represents a simple paint app.~ +- LI detected. +- Formatting line: ~ 05_mouse_move_paint_app: Represents a simple paint app.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~23. 05_mouse_move_tile_editor: A starting point for a tile editor.~ +- LI detected. +- Formatting line: ~ 05_mouse_move_tile_editor: A starting point for a tile editor.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left.~ +- LI detected. +- Formatting line: ~ 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera).~ +- LI detected. +- Formatting line: ~ 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera).~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~26. 07_render_targets_advanced: Advanced usage of ~render_target~s.~ +- LI detected. +- Formatting line: ~ 07_render_targets_advanced: Advanced usage of ~render_target~s.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~27. 08_platformer_collisions: Axis aligned collision along with platformer physics.~ +- LI detected. +- Formatting line: ~ 08_platformer_collisions: Axis aligned collision along with platformer physics.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game.~ +- LI detected. +- Formatting line: ~ 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision.~ +- LI detected. +- Formatting line: ~ 08_platformer_jumping_inertia: Jump physics and how inertia affects collision.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite.~ +- LI detected. +- Formatting line: ~ 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet.~ +- LI detected. +- Formatting line: ~ 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~32. 10_save_load_game: Save and load game data.~ +- LI detected. +- Formatting line: ~ 10_save_load_game: Save and load game data.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type.~ +- LI detected. +- Formatting line: ~ 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~34. 11_hash_primitives: How primitives can be represented using a ~Hash~.~ +- LI detected. +- Formatting line: ~ 11_hash_primitives: How primitives can be represented using a ~Hash~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen.~ +- LI detected. +- Formatting line: ~ 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~36. 12_top_down_area: How to render a top down map and how to manage collision of a player.~ +- LI detected. +- Formatting line: ~ 12_top_down_area: How to render a top down map and how to manage collision of a player.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~37. 13_01_easing_functions: How to use lerping functions to define animations/movement.~ +- LI detected. +- Formatting line: ~ 13_01_easing_functions: How to use lerping functions to define animations/movement.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~38. 13_02_cubic_bezier: How to create a bezier curve using lines.~ +- LI detected. +- Formatting line: ~ 13_02_cubic_bezier: How to create a bezier curve using lines.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation.~ +- LI detected. +- Formatting line: ~ 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions.~ +- LI detected. +- Formatting line: ~ 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen.~ +- LI detected. +- Formatting line: ~ 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value).~ +- LI detected. +- Formatting line: ~ 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value).~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~43. 15_collision_limits: How many collisions can be processed across many primitives.~ +- LI detected. +- Formatting line: ~ 15_collision_limits: How many collisions can be processed across many primitives.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~44. 18_moddable_game: How you can make a game where content is authored by the player (modding support).~ +- LI detected. +- Formatting line: ~ 18_moddable_game: How you can make a game where content is authored by the player (modding support).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game.~ +- LI detected. +- Formatting line: ~ 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight.~ +- LI detected. +- Formatting line: ~ 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet.~ +- LI detected. +- Formatting line: ~ 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~48. 21_mailbox_usage: How to do interprocess communication.~ +- LI detected. +- Formatting line: ~ 21_mailbox_usage: How to do interprocess communication.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~49. 22_trace_debugging: Debugging techniques and tracing execution through your game.~ +- LI detected. +- Formatting line: ~ 22_trace_debugging: Debugging techniques and tracing execution through your game.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game.~ +- LI detected. +- Formatting line: ~ 22_trace_debugging_classes: Debugging techniques and tracing execution through your game.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons.~ +- LI detected. +- Formatting line: ~ 23_hexagonal_grid: How to make a tactical grid/map made of hexagons.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites.~ +- LI detected. +- Formatting line: ~ 23_isometric_grid: How to make a tactical grid/map made of isometric sprites.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~53. 24_http_example: How to make http requests.~ +- LI detected. +- Formatting line: ~ 24_http_example: How to make http requests.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~54. 25_3d_experiment_01_square: How to create 3D objects.~ +- LI detected. +- Formatting line: ~ 25_3d_experiment_01_square: How to create 3D objects.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor.~ +- LI detected. +- Formatting line: ~ 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation.~ +- LI detected. +- Formatting line: ~ 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration.~ +- LI detected. +- Formatting line: ~ 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia.~ +- LI detected. +- Formatting line: ~ 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping.~ +- LI detected. +- Formatting line: ~ 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~60. 99_sample_game_pong: Reference implementation of pong.~ +- LI detected. +- Formatting line: ~ 99_sample_game_pong: Reference implementation of pong.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game.~ +- LI detected. +- Formatting line: ~ 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics.~ +- LI detected. +- Formatting line: ~ 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions.~ +- LI detected. +- Formatting line: ~ 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis.~ +- LI detected. +- Formatting line: ~ 99_sample_snakemoji: Shows that Ruby supports coding with emojis.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API.~ +- LI detected. +- Formatting line: ~ 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Deploying To Itch.io~ +- H1 detected. +- Formatting line: ~Deploying To Itch.io~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel!~ +- P detected. +- Formatting line: ~Once you've built your game, you're all set to deploy! Good luck in your game dev journey and if you get stuck, come to the Discord channel!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Creating Your Game Landing Page~ +- H2 detected. +- Formatting line: ~Creating Your Game Landing Page~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Creating Your Game Landing Page~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Log into Itch.io and go to [[https://itch.io/game/new]].~ +- P detected. +- Formatting line: ~Log into Itch.io and go to [[https://itch.io/game/new]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~~ +** Processing line: ~- Title: Give your game a Title. This value represents your `gametitle`.~ +- UL start detected. +- LI detected. +- Formatting line: ~Title: Give your game a Title. This value represents your `gametitle`.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Project URL: Set your project url. This value represents your `gameid`.~ +- LI detected. +- Formatting line: ~Project URL: Set your project url. This value represents your `gameid`.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Classification: Keep this as Game.~ +- LI detected. +- Formatting line: ~Classification: Keep this as Game.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Kind of Project: Select HTML from the drop down list. Don't worry, + the HTML project type _also supports binary downloads_.~ +- LI detected. +- Formatting line: ~Kind of Project: Select HTML from the drop down list. Don't worry, + the HTML project type _also supports binary downloads_.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Uploads: Skip this section for now.~ +- LI detected. +- Formatting line: ~Uploads: Skip this section for now.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You can fill out all the other options later.~ +- UL end detected. +- P detected. +- Formatting line: ~You can fill out all the other options later.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Update Your Game's Metadata~ +- H2 detected. +- Formatting line: ~Update Your Game's Metadata~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Update Your Game's Metadata~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Point your text editor at mygame/metadata/game_metadata.txt and make it look like this:~ +- P detected. +- Formatting line: ~Point your text editor at mygame/metadata/game_metadata.txt and make it look like this:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: Remove the ~#~ at the beginning of each line.~ +- P detected. +- Formatting line: ~NOTE: Remove the ~#~ at the beginning of each line.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~devid=bob~ +** Processing line: ~devtitle=Bob The Game Developer~ +** Processing line: ~gameid=mygame~ +** Processing line: ~gametitle=My Game~ +** Processing line: ~version=0.1~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~The ~devid~ property is the username you use to log into Itch.io. The ~devtitle~ is your name or company name (it can contain spaces). The ~gameid~ is the Project URL value. The ~gametitle~ is the name of your game (it can contain spaces). The ~version~ can be any ~major.minor~ number format.~ +- P detected. +- Formatting line: ~The ~devid~ property is the username you use to log into Itch.io. The ~devtitle~ is your name or company name (it can contain spaces). The ~gameid~ is the Project URL value. The ~gametitle~ is the name of your game (it can contain spaces). The ~version~ can be any ~major.minor~ number format.~ +- Line's tilde count is: 12 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~** Building Your Game For Distribution~ +- H2 detected. +- Formatting line: ~Building Your Game For Distribution~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Building Your Game For Distribution~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Open up the terminal and run this from the command line:~ +- P detected. +- Formatting line: ~Open up the terminal and run this from the command line:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~./dragonruby-publish --only-package mygame~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~(if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.)~ +- P detected. +- Formatting line: ~(if you're on Windows, don't put the "./" on the front. That's a Mac and Linux thing.)~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~A directory called ~./build~ will be created that contains your binaries. You can upload this to Itch.io manually.~ +- P detected. +- Formatting line: ~A directory called ~./build~ will be created that contains your binaries. You can upload this to Itch.io manually.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~For the HTML version of your game after you upload it. Check the checkbox labeled "This file will be played in the browser".~ +- P detected. +- Formatting line: ~For the HTML version of your game after you upload it. Check the checkbox labeled "This file will be played in the browser".~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~For subsequent updates you can use an automated deployment to Itch.io:~ +- P detected. +- Formatting line: ~For subsequent updates you can use an automated deployment to Itch.io:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~./dragonruby-publish mygame~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it!~ +- P detected. +- Formatting line: ~DragonRuby will package _and publish_ your game to itch.io! Tell your friends to go to your game's very own webpage and buy it!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you.~ +- P detected. +- Formatting line: ~If you make changes to your game, just re-run dragonruby-publish and it'll update the downloads for you.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** DragonRuby's Philosophy~ +- H2 detected. +- Formatting line: ~DragonRuby's Philosophy~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~DragonRuby's Philosophy~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.~ +- P detected. +- Formatting line: ~The following tenants of DragonRuby are what set us apart from other game engines. Given that Game Toolkit is a relatively new engine, there are definitely features that are missing. So having a big check list of "all the cool things" is not this engine's forte. This is compensated with a strong commitment to the following principals.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Challenge The Status Quo~ +- H3 detected. +- Formatting line: ~Challenge The Status Quo~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Challenge The Status Quo~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say:~ +- P detected. +- Formatting line: ~Game engines of today are in a local maximum and don't take into consideration the challenges of this day and age. Unity and GameMaker specifically rot your brain. It's not sufficient to say:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_quote~ +- BLOCKQUOTE start detected. +** Processing line: ~But that's how we've always done it.~ +- P detected. +- Formatting line: ~But that's how we've always done it.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~#+end_quote~ +- BLOCKQUOTE end detected. +** Processing line: ~~ +** Processing line: ~It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us.~ +- P detected. +- Formatting line: ~It's a hard pill to swallow, but forget blindly accepted best practices and try to figure out the underlying motivation for a specific approach to game development. Collaborate with us.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Release Often And Quickly~ +- H3 detected. +- Formatting line: ~Release Often And Quickly~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Release Often And Quickly~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly.~ +- P detected. +- Formatting line: ~The biggest mistake game devs make is spending too much time in isolation building their game. Release something, however small, and release it quickly.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Stop worrying about everything being pixel perfect. Don't wait until your game is 100% complete. Build your game publicly and iterate. Post in the #show-and-tell channel in the community Discord. You'll find a lot of support and encouragement there.~ +- P detected. +- Formatting line: ~Stop worrying about everything being pixel perfect. Don't wait until your game is 100% complete. Build your game publicly and iterate. Post in the #show-and-tell channel in the community Discord. You'll find a lot of support and encouragement there.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Remember:~ +- P detected. +- Formatting line: ~Remember:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_quote~ +- BLOCKQUOTE start detected. +** Processing line: ~Real artists ship.~ +- P detected. +- Formatting line: ~Real artists ship.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~#+end_quote~ +- BLOCKQUOTE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** Sustainable And Ethical Monetization~ +- H3 detected. +- Formatting line: ~Sustainable And Ethical Monetization~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Sustainable And Ethical Monetization~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between.~ +- P detected. +- Formatting line: ~We all aspire to put food on the table doing what we love. Whether it is building games, writing tools to support game development, or anything in between.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it.~ +- P detected. +- Formatting line: ~Charge a fair amount of money for the things you create. It's expected and encouraged within the community. Give what you create away for free to those that can't afford it.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Sustainable And Ethical Open Source~ +- H3 detected. +- Formatting line: ~Sustainable And Ethical Open Source~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Sustainable And Ethical Open Source~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution).~ +- P detected. +- Formatting line: ~This goes hand in hand with sustainable and ethical monetization. The current state of open source is not sustainable. There is an immense amount of contributor burnout. Users of open source expect everything to be free, and few give back. This is a problem we want to fix (we're still trying to figure out the best solution).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir.~ +- P detected. +- Formatting line: ~So, don't be "that guy" in the Discord that says "DragonRuby should be free and open source!" You will be personally flogged by Amir.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** People Over Entities~ +- H3 detected. +- Formatting line: ~People Over Entities~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~People Over Entities~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby.~ +- P detected. +- Formatting line: ~We prioritize the endorsement of real people over faceless entities. This game engine, and other products we create, are not insignificant line items of a large company. And you aren't a generic "commodity" or "corporate resource". So be active in the community Discord and you'll reap the benefits as more devs use DragonRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Building A Game Should Be Fun And Bring Happiness~ +- H3 detected. +- Formatting line: ~Building A Game Should Be Fun And Bring Happiness~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Building A Game Should Be Fun And Bring Happiness~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine.~ +- P detected. +- Formatting line: ~We will prioritize the removal of pain. The aesthetics of Ruby make it such a joy to work with, and we want to capture that within the engine.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Real World Application Drives Features~ +- H3 detected. +- Formatting line: ~Real World Application Drives Features~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Real World Application Drives Features~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative.~ +- P detected. +- Formatting line: ~We are bombarded by marketing speak day in and day out. We don't do that here. There are things that are really great in the engine, and things that need a lot of work. Collaborate with us so we can help you reach your goals. Ask for features you actually need as opposed to anything speculative.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work).~ +- P detected. +- Formatting line: ~We want DragonRuby to *actually* help you build the game you want to build (as opposed to sell you something piece of demoware that doesn't work).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~* How To Determine What Frame You Are On~ +- H1 detected. +- Formatting line: ~How To Determine What Frame You Are On~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~There is a property on ~state~ called ~tick_count~ that is incremented by DragonRuby every time the ~tick~ method is called. The following code renders a label that displays the current ~tick_count~.~ +- P detected. +- Formatting line: ~There is a property on ~state~ called ~tick_count~ that is incremented by DragonRuby every time the ~tick~ method is called. The following code renders a label that displays the current ~tick_count~.~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [10, 670, "#{args.state.tick_count}"]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* How To Get Current Framerate~ +- H1 detected. +- Formatting line: ~How To Get Current Framerate~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Current framerate is a top level property on the Game Toolkit Runtime and is accessible via ~args.gtk.current_framerate~.~ +- P detected. +- Formatting line: ~Current framerate is a top level property on the Game Toolkit Runtime and is accessible via ~args.gtk.current_framerate~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << [10, 710, "framerate: #{args.gtk.current_framerate.round}"]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* How To Render A Sprite Using An Array~ +- H1 detected. +- Formatting line: ~How To Render A Sprite Using An Array~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~All file paths should use the forward slash ~/~ *not* backslash ~~. Game Toolkit includes a number of sprites in the ~sprites~ folder (everything about your game is located in the ~mygame~ directory).~ +- P detected. +- Formatting line: ~All file paths should use the forward slash ~/~ *not* backslash ~~. Game Toolkit includes a number of sprites in the ~sprites~ folder (everything about your game is located in the ~mygame~ directory).~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. +** Processing line: ~The following code renders a sprite with a ~width~ and ~height~ of ~100~ in the center of the screen.~ +- P detected. +- Formatting line: ~The following code renders a sprite with a ~width~ and ~height~ of ~100~ in the center of the screen.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~args.outputs.sprites~ is used to render a sprite.~ +- P detected. +- Formatting line: ~~args.outputs.sprites~ is used to render a sprite.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ 640 - 50, # X~ +** Processing line: ~ 360 - 50, # Y~ +** Processing line: ~ 100, # W~ +** Processing line: ~ 100, # H~ +** Processing line: ~ 'sprites/square-blue.png' # PATH~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* More Sprite Properties As An Array~ +- H1 detected. +- Formatting line: ~More Sprite Properties As An Array~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Here are all the properties you can set on a sprite.~ +- P detected. +- Formatting line: ~Here are all the properties you can set on a sprite.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ 100, # X~ +** Processing line: ~ 100, # Y~ +** Processing line: ~ 32, # W~ +** Processing line: ~ 64, # H~ +** Processing line: ~ 'sprites/square-blue.png', # PATH~ +** Processing line: ~ 0, # ANGLE~ +** Processing line: ~ 255, # ALPHA~ +** Processing line: ~ 0, # RED_SATURATION~ +** Processing line: ~ 255, # GREEN_SATURATION~ +** Processing line: ~ 0 # BLUE_SATURATION~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Different Sprite Representations~ +- H1 detected. +- Formatting line: ~Different Sprite Representations~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Using ordinal positioning can get a little unruly given so many properties you have control over.~ +- P detected. +- Formatting line: ~Using ordinal positioning can get a little unruly given so many properties you have control over.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You can represent a sprite as a ~Hash~:~ +- P detected. +- Formatting line: ~You can represent a sprite as a ~Hash~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.sprites << {~ +** Processing line: ~ x: 640 - 50,~ +** Processing line: ~ y: 360 - 50,~ +** Processing line: ~ w: 100,~ +** Processing line: ~ h: 100,~ +** Processing line: ~ path: 'sprites/square-blue.png',~ +** Processing line: ~ angle: 0,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ r: 255,~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 255,~ +** Processing line: ~ source_x: 0,~ +** Processing line: ~ source_y: 0,~ +** Processing line: ~ source_w: -1,~ +** Processing line: ~ source_h: -1,~ +** Processing line: ~ flip_vertically: false,~ +** Processing line: ~ flip_horizontally: false,~ +** Processing line: ~ angle_anchor_x: 0.5,~ +** Processing line: ~ angle_anchor_y: 1.0~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~You can represent a sprite as an ~object~:~ +- P detected. +- Formatting line: ~You can represent a sprite as an ~object~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ # Create type with ALL sprite properties AND primitive_marker~ +** Processing line: ~ class Sprite~ +** Processing line: ~ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b,~ +** Processing line: ~ :source_x, :source_y, :source_w, :source_h,~ +** Processing line: ~ :tile_x, :tile_y, :tile_w, :tile_h,~ +** Processing line: ~ :flip_horizontally, :flip_vertically,~ +** Processing line: ~ :angle_anchor_x, :angle_anchor_y~ +** Processing line: ~~ +** Processing line: ~ def primitive_marker~ +** Processing line: ~ :sprite~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ class BlueSquare < Sprite~ +** Processing line: ~ def initialize opts~ +** Processing line: ~ @x = opts[:x]~ +** Processing line: ~ @y = opts[:y]~ +** Processing line: ~ @w = opts[:w]~ +** Processing line: ~ @h = opts[:h]~ +** Processing line: ~ @path = 'sprites/square-blue.png'~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.sprites << (BlueSquare.new x: 640 - 50,~ +** Processing line: ~ y: 360 - 50,~ +** Processing line: ~ w: 50,~ +** Processing line: ~ h: 50)~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* How To Render A Label~ +- H1 detected. +- Formatting line: ~How To Render A Label~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~args.outputs.labels~ is used to render labels.~ +- P detected. +- Formatting line: ~~args.outputs.labels~ is used to render labels.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Labels are how you display text. This code will go directly inside of the ~def tick args~ method.~ +- P detected. +- Formatting line: ~Labels are how you display text. This code will go directly inside of the ~def tick args~ method.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Here is the minimum code:~ +- P detected. +- Formatting line: ~Here is the minimum code:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y TEXT~ +** Processing line: ~ args.outputs.labels << [640, 360, "I am a black label."]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* A Colored Label~ +- H1 detected. +- Formatting line: ~A Colored Label~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # A colored label~ +** Processing line: ~ # X Y TEXT, RED GREEN BLUE ALPHA~ +** Processing line: ~ args.outputs.labels << [640, 360, "I am a redish label.", 255, 128, 128, 255]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Extended Label Properties~ +- H1 detected. +- Formatting line: ~Extended Label Properties~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # A colored label~ +** Processing line: ~ # X Y TEXT SIZE ALIGNMENT RED GREEN BLUE ALPHA FONT FILE~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ 640, # X~ +** Processing line: ~ 360, # Y~ +** Processing line: ~ "Hello world", # TEXT~ +** Processing line: ~ 0, # SIZE_ENUM~ +** Processing line: ~ 1, # ALIGNMENT_ENUM~ +** Processing line: ~ 0, # RED~ +** Processing line: ~ 0, # GREEN~ +** Processing line: ~ 0, # BLUE~ +** Processing line: ~ 255, # ALPHA~ +** Processing line: ~ "fonts/coolfont.ttf" # FONT~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value will decrease the label size. A ~positive~ value will increase the label's size.~ +- P detected. +- Formatting line: ~A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value will decrease the label size. A ~positive~ value will increase the label's size.~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. +** Processing line: ~An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents "center aligned". ~2~ represents "right aligned".~ +- P detected. +- Formatting line: ~An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents "center aligned". ~2~ represents "right aligned".~ +- Line's tilde count is: 8 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~* Rendering A Label As A ~Hash~~ +- H1 detected. +- Formatting line: ~Rendering A Label As A ~Hash~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~You can add additional metadata about your game within a label, which requires you to use a `Hash` instead.~ +- P detected. +- Formatting line: ~You can add additional metadata about your game within a label, which requires you to use a `Hash` instead.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.labels << {~ +** Processing line: ~ x: 200,~ +** Processing line: ~ y: 550,~ +** Processing line: ~ text: "dragonruby",~ +** Processing line: ~ size_enum: 2,~ +** Processing line: ~ alignment_enum: 1,~ +** Processing line: ~ r: 155,~ +** Processing line: ~ g: 50,~ +** Processing line: ~ b: 50,~ +** Processing line: ~ a: 255,~ +** Processing line: ~ font: "fonts/manaspc.ttf",~ +** Processing line: ~ # You can add any properties you like (this will be ignored/won't cause errors)~ +** Processing line: ~ game_data_one: "Something",~ +** Processing line: ~ game_data_two: {~ +** Processing line: ~ value_1: "value",~ +** Processing line: ~ value_2: "value two",~ +** Processing line: ~ a_number: 15~ +** Processing line: ~ }~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Getting The Size Of A Piece Of Text~ +- H1 detected. +- Formatting line: ~Getting The Size Of A Piece Of Text~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~You can get the render size of any string using ~args.gtk.calcstringbox~.~ +- P detected. +- Formatting line: ~You can get the render size of any string using ~args.gtk.calcstringbox~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # TEXT SIZE_ENUM FONT~ +** Processing line: ~ w, h = args.gtk.calcstringbox("some string", 0, "font.ttf")~ +** Processing line: ~~ +** Processing line: ~ # NOTE: The SIZE_ENUM and FONT are optional arguments.~ +** Processing line: ~~ +** Processing line: ~ # Render a label showing the w and h of the text:~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ 10,~ +** Processing line: ~ 710,~ +** Processing line: ~ # This string uses Ruby's string interpolation literal: #{}~ +** Processing line: ~ "'some string' has width: #{w}, and height: #{h}."~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* How To Play A Sound~ +- H1 detected. +- Formatting line: ~How To Play A Sound~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Sounds that end ~.wav~ will play once:~ +- P detected. +- Formatting line: ~Sounds that end ~.wav~ will play once:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # Play a sound every second~ +** Processing line: ~ if (args.state.tick_count % 60) == 0~ +** Processing line: ~ args.outputs.sounds << 'something.wav'~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~Sounds that end ~.ogg~ is considered background music and will loop:~ +- P detected. +- Formatting line: ~Sounds that end ~.ogg~ is considered background music and will loop:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # Start a sound loop at the beginning of the game~ +** Processing line: ~ if args.state.tick_count == 0~ +** Processing line: ~ args.outputs.sounds << 'background_music.ogg'~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~If you want to play a ~.ogg~ once as if it were a sound effect, you can do:~ +- P detected. +- Formatting line: ~If you want to play a ~.ogg~ once as if it were a sound effect, you can do:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # Play a sound every second~ +** Processing line: ~ if (args.state.tick_count % 60) == 0~ +** Processing line: ~ args.gtk.queue_sound 'some-ogg.ogg'~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Using ~args.state~ To Store Your Game State~ +- H1 detected. +- Formatting line: ~Using ~args.state~ To Store Your Game State~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~~args.state~ is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of ~class~.~ +- P detected. +- Formatting line: ~~args.state~ is a open data structure that allows you to define properties that are arbitrarily nested. You don't need to define any kind of ~class~.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~To initialize your game state, use the ~||=~ operator. Any value on the right side of ~||=~ will only be assigned _once_.~ +- P detected. +- Formatting line: ~To initialize your game state, use the ~||=~ operator. Any value on the right side of ~||=~ will only be assigned _once_.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~To assign a value every frame, just use the ~=~ operator, but _make sure_ you've initialized a default value.~ +- P detected. +- Formatting line: ~To assign a value every frame, just use the ~=~ operator, but _make sure_ you've initialized a default value.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # initialize your game state ONCE~ +** Processing line: ~ args.player.x ||= 0~ +** Processing line: ~ args.player.y ||= 0~ +** Processing line: ~ args.player.hp ||= 100~ +** Processing line: ~~ +** Processing line: ~ # increment the x position of the character by one every frame~ +** Processing line: ~ args.player.x += 1~ +** Processing line: ~~ +** Processing line: ~ # Render a sprite with a label above the sprite~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ args.player.x,~ +** Processing line: ~ args.player.y,~ +** Processing line: ~ 32, 32,~ +** Processing line: ~ "player.png"~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ args.player.x,~ +** Processing line: ~ args.player.y - 50,~ +** Processing line: ~ args.player.hp~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* Frequently Asked Questions, Comments, and Concerns~ +- H1 detected. +- Formatting line: ~Frequently Asked Questions, Comments, and Concerns~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Here are questions, comments, and concerns that frequently come up.~ +- P detected. +- Formatting line: ~Here are questions, comments, and concerns that frequently come up.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Frequently Asked Questions~ +- H2 detected. +- Formatting line: ~Frequently Asked Questions~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Frequently Asked Questions~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** What is DragonRuby LLP?~ +- H3 detected. +- Formatting line: ~What is DragonRuby LLP?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~What is DragonRuby LLP?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible.~ +- P detected. +- Formatting line: ~DragonRuby LLP is a partnership of four devs who came together with the goal of bringing the aesthetics and joy of Ruby, everywhere possible.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Under DragonRuby LLP, we offer a number of products (with more on the way):~ +- P detected. +- Formatting line: ~Under DragonRuby LLP, we offer a number of products (with more on the way):~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~- Game Toolkit (GTK): A 2D game engine that is compatible with modern + gaming platforms. [Home Page]() [FAQ Page]()~ +- UL start detected. +- LI detected. +- Formatting line: ~Game Toolkit (GTK): A 2D game engine that is compatible with modern + gaming platforms. [Home Page]() [FAQ Page]()~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [Home Page]() [FAQ Page]()~ +- LI detected. +- Formatting line: ~RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [Home Page]() [FAQ Page]()~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby + environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]()~ +- LI detected. +- Formatting line: ~Commandline Toolkit (CTK): A zero dependency, zero installation Ruby + environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]()~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~All of the products above leverage a shared core called DragonRuby.~ +- UL end detected. +- P detected. +- Formatting line: ~All of the products above leverage a shared core called DragonRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: From an official branding standpoint each one of the products is suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is _one word, title cased_.~ +- P detected. +- Formatting line: ~NOTE: From an official branding standpoint each one of the products is suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is _one word, title cased_.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just sounds really weird.~ +- P detected. +- Formatting line: ~NOTE: We leave the "A DragonRuby LLP Product" off of this one because that just sounds really weird.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh?~ +- P detected. +- Formatting line: ~NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass identifier huh?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** What is DragonRuby?~ +- H3 detected. +- Formatting line: ~What is DragonRuby?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~What is DragonRuby?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_.~ +- P detected. +- Formatting line: ~The response to this question requires a few subparts. First we need to clarify some terms. Specifically _language specification_ vs _runtime_.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Okay... so what is the difference between a language specification and a runtime?~ +- H3 detected. +- Formatting line: ~Okay... so what is the difference between a language specification and a runtime?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Okay... so what is the difference between a language specification and a runtime?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime."~ +- P detected. +- Formatting line: ~A runtime is an _implementation_ of a language specification. When people say "Ruby," they are usually referring to "the Ruby 3.0+ language specification implemented via the CRuby/MRI Runtime."~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby.~ +- P detected. +- Formatting line: ~But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, and (last but certainly not least) DragonRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Okay... what language specification does DragonRuby use then?~ +- H3 detected. +- Formatting line: ~Okay... what language specification does DragonRuby use then?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Okay... what language specification does DragonRuby use then?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries.~ +- P detected. +- Formatting line: ~DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's syntax is Ruby 2.x compatible, but also contains semantic changes that help it natively interface with platform specific libraries.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** So... why another runtime?~ +- H3 detected. +- Formatting line: ~So... why another runtime?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~So... why another runtime?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~The elevator pitch is:~ +- P detected. +- Formatting line: ~The elevator pitch is:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.~ +- P detected. +- Formatting line: ~DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" within the runtime allows us to target platforms no other Ruby can target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo Switch, PS4, Xbox, and Scadia.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** What does Multilevel Cross-platform mean?~ +- H3 detected. +- Formatting line: ~What does Multilevel Cross-platform mean?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~What does Multilevel Cross-platform mean?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally):~ +- P detected. +- Formatting line: ~There are complexities associated with targeting all the platforms we support. Because of this, the runtime had to be architected in such a way that new platforms could be easily added (which lead to us partitioning the runtime internally):~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~- Level 1 we leverage a good portion of mRuby.~ +- UL start detected. +- LI detected. +- Formatting line: ~Level 1 we leverage a good portion of mRuby.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Level 2 consists of optimizations to mRuby we've made given that our + target platforms are well known.~ +- LI detected. +- Formatting line: ~Level 2 consists of optimizations to mRuby we've made given that our + target platforms are well known.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Level 3 consists of portable C libraries and their Ruby + C-Extensions.~ +- LI detected. +- Formatting line: ~Level 3 consists of portable C libraries and their Ruby + C-Extensions.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Levels 1 through 3 are fairly commonplace in many runtime implementations (with level 1 being the most portable, and level 3 being the fastest). But the DragonRuby Runtime has taken things a bit further:~ +- UL end detected. +- P detected. +- Formatting line: ~Levels 1 through 3 are fairly commonplace in many runtime implementations (with level 1 being the most portable, and level 3 being the fastest). But the DragonRuby Runtime has taken things a bit further:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~- Level 4 consists of shared abstractions around hardware I/O and operating + system resources. This level leverages open source and proprietary components within Simple DirectMedia Layer (a low level multimedia component library that has been in active development for 22 years and counting).~ +- UL start detected. +- LI detected. +- Formatting line: ~Level 4 consists of shared abstractions around hardware I/O and operating + system resources. This level leverages open source and proprietary components within Simple DirectMedia Layer (a low level multimedia component library that has been in active development for 22 years and counting).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~- Level 5 is a code generation layer which creates metadata that allows + for native interoperability with host runtime libraries. It also includes OS specific message pump orchestrations.~ +- LI detected. +- Formatting line: ~Level 5 is a code generation layer which creates metadata that allows + for native interoperability with host runtime libraries. It also includes OS specific message pump orchestrations.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~- Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This + compiler outputs _very_ fast platform specific bitcode, but only supports a subset of the Ruby language specification.~ +- LI detected. +- Formatting line: ~Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This + compiler outputs _very_ fast platform specific bitcode, but only supports a subset of the Ruby language specification.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane.~ +- UL end detected. +- P detected. +- Formatting line: ~These levels allow us to stay up to date with open source implementations of Ruby; provide fast, native code execution on proprietary platforms; ensure good separation between these two worlds; and provides a means to add new platforms without going insane.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ +- H3 detected. +- Formatting line: ~Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies.~ +- P detected. +- Formatting line: ~DragonRuby is a Ruby runtime implementation that takes all the lessons we've learned from MRI/CRuby, and merges it with the latest and greatest compiler and OSS technologies.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Frequent Comments~ +- H2 detected. +- Formatting line: ~Frequent Comments~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Frequent Comments~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** But Ruby is dead.~ +- H3 detected. +- Formatting line: ~But Ruby is dead.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~But Ruby is dead.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]].~ +- P detected. +- Formatting line: ~Let's check the official source for the answer to this question: isrubydead.com: [[https://isrubydead.com/]].~ +- Line's tilde count is: 0 +- Line contains link marker: true +- LINK detected. +** Processing line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny.~ +- P detected. +- Formatting line: ~On a more serious note, Ruby's _quantity_ levels aren't what they used to be. And that's totally fine. Every one chases the new and shiny.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ +- P detected. +- Formatting line: ~What really matters is _quality/maturity_. Here is the latest (StackOverflow Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies].~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Let's stop making this comment shall we?~ +- P detected. +- Formatting line: ~Let's stop making this comment shall we?~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** But Ruby is slow.~ +- H3 detected. +- Formatting line: ~But Ruby is slow.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~But Ruby is slow.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime.~ +- P detected. +- Formatting line: ~That doesn't make any sense. A language specification can't be slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd have to talk about which runtime.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** Dynamic languages are slow.~ +- H3 detected. +- Formatting line: ~Dynamic languages are slow.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Dynamic languages are slow.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_.~ +- P detected. +- Formatting line: ~They are certainly slower than statically compiled languages. With the processing power and compiler optimizations we have today, dynamic languages like Ruby are _fast enough_.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Unless you are writing in some form of intermediate representation by hand, your language of choice also suffers this same fallacy of slow. Like, nothing is faster than a low level assembly-like language. So unless you're writing in that, let's stop making this comment.~ +- P detected. +- Formatting line: ~Unless you are writing in some form of intermediate representation by hand, your language of choice also suffers this same fallacy of slow. Like, nothing is faster than a low level assembly-like language. So unless you're writing in that, let's stop making this comment.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^.~ +- P detected. +- Formatting line: ~NOTE: If you _are_ hand writing LLVM IR, we are always open to bringing on new partners with such a skill set. Email us ^_^.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Frequent Concerns~ +- H2 detected. +- Formatting line: ~Frequent Concerns~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Frequent Concerns~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~*** DragonRuby is not open source. That's not right.~ +- H3 detected. +- Formatting line: ~DragonRuby is not open source. That's not right.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~DragonRuby is not open source. That's not right.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant.~ +- P detected. +- Formatting line: ~The current state of open source is unsustainable. Contributors work for free, most all open source repositories are severely under-staffed, and burnout from core members is rampant.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~We believe in open source very strongly. Parts of DragonRuby are in fact, open source. Just not all of it (for legal reasons, and because the IP we've created has value). And we promise that we are looking for (or creating) ways to _sustainably_ open source everything we do.~ +- P detected. +- Formatting line: ~We believe in open source very strongly. Parts of DragonRuby are in fact, open source. Just not all of it (for legal reasons, and because the IP we've created has value). And we promise that we are looking for (or creating) ways to _sustainably_ open source everything we do.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If you have ideas on how we can do this, email us!~ +- P detected. +- Formatting line: ~If you have ideas on how we can do this, email us!~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~If the reason above isn't sufficient, then definitely use something else.~ +- P detected. +- Formatting line: ~If the reason above isn't sufficient, then definitely use something else.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** DragonRuby is for pay. You should offer a free version.~ +- H3 detected. +- Formatting line: ~DragonRuby is for pay. You should offer a free version.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~DragonRuby is for pay. You should offer a free version.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products.~ +- P detected. +- Formatting line: ~If you can afford to pay for DragonRuby, you should (and will). We don't go around telling writers that they should give us their books for free, and only require payment if we read the entire thing. It's time we stop asking that of software products.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~That being said, we will _never_ put someone out financially. We have income assistance for anyone that can't afford a license to any one of our products.~ +- P detected. +- Formatting line: ~That being said, we will _never_ put someone out financially. We have income assistance for anyone that can't afford a license to any one of our products.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~You qualify for a free, unrestricted license to DragonRuby products if any of the following items pertain to you:~ +- P detected. +- Formatting line: ~You qualify for a free, unrestricted license to DragonRuby products if any of the following items pertain to you:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~- Your income is below $2,000.00 (USD) per month.~ +- UL start detected. +- LI detected. +- Formatting line: ~Your income is below $2,000.00 (USD) per month.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- You are under 18 years of age.~ +- LI detected. +- Formatting line: ~You are under 18 years of age.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- You are a student of any type: traditional public school, home + schooling, college, bootcamp, or online.~ +- LI detected. +- Formatting line: ~You are a student of any type: traditional public school, home + schooling, college, bootcamp, or online.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- You are a teacher, mentor, or parent who wants to teach a kid how to code.~ +- LI detected. +- Formatting line: ~You are a teacher, mentor, or parent who wants to teach a kid how to code.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- You work/worked in public service or at a charitable organization: + for example public office, army, or any 501(c)(3) organization.~ +- LI detected. +- Formatting line: ~You work/worked in public service or at a charitable organization: + for example public office, army, or any 501(c)(3) organization.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Just contact Amir at [email protected] with a short explanation of your current situation and he'll set you up. No questions asked.~ +- UL end detected. +- P detected. +- Formatting line: ~Just contact Amir at [email protected] with a short explanation of your current situation and he'll set you up. No questions asked.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** But still, you should offer a free version. So I can try it out and see if I like it.~ +- H3 detected. +- Formatting line: ~But still, you should offer a free version. So I can try it out and see if I like it.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~But still, you should offer a free version. So I can try it out and see if I like it.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ +- P detected. +- Formatting line: ~You can try our [web-based sandbox environment](). But it won't do the runtime justice. Or just come to our [Slack]() or [Discord]() channel and ask questions. We'd be happy to have a one on one video chat with you and show off all the cool stuff we're doing.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so.~ +- P detected. +- Formatting line: ~Seriously just buy it. Get a refund if you don't like it. We make it stupid easy to do so.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** I still think you should do a free version. Think of all people who would give it a shot.~ +- H3 detected. +- Formatting line: ~I still think you should do a free version. Think of all people who would give it a shot.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~I still think you should do a free version. Think of all people who would give it a shot.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers).~ +- P detected. +- Formatting line: ~Free isn't a sustainable financial model. We don't want to spam your email. We don't want to collect usage data off of you either. We just want to provide quality toolchains to quality developers (as opposed to a large quantity of developers).~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do.~ +- P detected. +- Formatting line: ~The people that pay for DragonRuby and make an effort to understand it are the ones we want to build a community around, partner with, and collaborate with. So having that small monetary wall deters entitled individuals that don't value the same things we do.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~*** What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ +- H3 detected. +- Formatting line: ~What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen.~ +- P detected. +- Formatting line: ~That won't happen if the development world stop asking for free stuff and non-trivially compensate open source developers. Look, we want to be able to work on the stuff we love, every day of our lives. And we'll go to great lengths to make that happen.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license.~ +- P detected. +- Formatting line: ~But, in the event that sad day comes, our partnership bylaws state that _all_ DragonRuby IP that can be legally open sourced, will be released under a permissive license.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Runtime~~ +- H1 detected. +- Formatting line: ~~GTK::Runtime~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~.~ +- P detected. +- Formatting line: ~The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Runtime#reset~~ +- H1 detected. +- Formatting line: ~~GTK::Runtime#reset~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ +- P detected. +- Formatting line: ~This function will reset Kernel.tick_count to 0 and will remove all data from args.state.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Runtime#calcstringbox~~ +- H1 detected. +- Formatting line: ~~GTK::Runtime#calcstringbox~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~This function returns the width and height of a string.~ +- P detected. +- Formatting line: ~This function returns the width and height of a string.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.string_size ||= args.gtk.calcstringbox "Hello World"~ +** Processing line: ~ args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World"~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array~~ +- H1 detected. +- Formatting line: ~~Array~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit.~ +- P detected. +- Formatting line: ~The Array class has been extend to provide methods that will help in common game development tasks. Array is one of the most powerful classes in Ruby and a very fundamental component of Game Toolkit.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#map~~ +- H1 detected. +- Formatting line: ~~Array#map~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~The function given a block returns a new ~Enumerable~ of values.~ +- P detected. +- Formatting line: ~The function given a block returns a new ~Enumerable~ of values.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example of using ~Array#map~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen.~ +- P detected. +- Formatting line: ~Example of using ~Array#map~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # define the colors of the rainbow in ~args.state~~ +** Processing line: ~ # as an ~Array~ of ~Hash~es with :order and :name.~ +** Processing line: ~ # :order will be used to determine render location~ +** Processing line: ~ # and :name will be used to determine sprite path.~ +** Processing line: ~ args.state.rainbow_colors ||= [~ +** Processing line: ~ { order: 0, name: :red },~ +** Processing line: ~ { order: 1, name: :orange },~ +** Processing line: ~ { order: 2, name: :yellow },~ +** Processing line: ~ { order: 3, name: :green },~ +** Processing line: ~ { order: 4, name: :blue },~ +** Processing line: ~ { order: 5, name: :indigo },~ +** Processing line: ~ { order: 6, name: :violet },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ # render sprites diagonally to the screen~ +** Processing line: ~ # with a width and height of 50.~ +** Processing line: ~ args.outputs~ +** Processing line: ~ .sprites << args.state~ +** Processing line: ~ .rainbow_colors~ +** Processing line: ~ .map do |color| # <-- ~Array#map~ usage~ +** Processing line: ~ [~ +** Processing line: ~ color[:order] * 50,~ +** Processing line: ~ color[:order] * 50,~ +** Processing line: ~ 50,~ +** Processing line: ~ 50,~ +** Processing line: ~ "sprites/square-#{color[:name]}.png"~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#each~~ +- H1 detected. +- Formatting line: ~~Array#each~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~The function, given a block, invokes the block for each item in the ~Array~. ~Array#each~ is synonymous to foreach constructs in other languages.~ +- P detected. +- Formatting line: ~The function, given a block, invokes the block for each item in the ~Array~. ~Array#each~ is synonymous to foreach constructs in other languages.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example of using ~Array#each~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen:~ +- P detected. +- Formatting line: ~Example of using ~Array#each~ in conjunction with ~args.state~ and ~args.outputs.sprites~ to render sprites to the screen:~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # define the colors of the rainbow in ~args.state~~ +** Processing line: ~ # as an ~Array~ of ~Hash~es with :order and :name.~ +** Processing line: ~ # :order will be used to determine render location~ +** Processing line: ~ # and :name will be used to determine sprite path.~ +** Processing line: ~ args.state.rainbow_colors ||= [~ +** Processing line: ~ { order: 0, name: :red },~ +** Processing line: ~ { order: 1, name: :orange },~ +** Processing line: ~ { order: 2, name: :yellow },~ +** Processing line: ~ { order: 3, name: :green },~ +** Processing line: ~ { order: 4, name: :blue },~ +** Processing line: ~ { order: 5, name: :indigo },~ +** Processing line: ~ { order: 6, name: :violet },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ # render sprites diagonally to the screen~ +** Processing line: ~ # with a width and height of 50.~ +** Processing line: ~ args.state~ +** Processing line: ~ .rainbow_colors~ +** Processing line: ~ .map do |color| # <-- ~Array#each~ usage~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ color[:order] * 50,~ +** Processing line: ~ color[:order] * 50,~ +** Processing line: ~ 50,~ +** Processing line: ~ 50,~ +** Processing line: ~ "sprites/square-#{color[:name]}.png"~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#reject_nil~~ +- H1 detected. +- Formatting line: ~~Array#reject_nil~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias for ~Array#compact~:~ +- P detected. +- Formatting line: ~Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias for ~Array#compact~:~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ a = [1, nil, 4, false, :a]~ +** Processing line: ~ puts a.reject_nil~ +** Processing line: ~ # => [1, 4, false, :a]~ +** Processing line: ~ puts a.compact~ +** Processing line: ~ # => [1, 4, false, :a]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#reject_false~~ +- H1 detected. +- Formatting line: ~~Array#reject_false~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Returns an `Enumerable` rejecting items that are `nil` or `false`.~ +- P detected. +- Formatting line: ~Returns an `Enumerable` rejecting items that are `nil` or `false`.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ a = [1, nil, 4, false, :a]~ +** Processing line: ~ puts a.reject_false~ +** Processing line: ~ # => [1, 4, :a]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#product~~ +- H1 detected. +- Formatting line: ~~Array#product~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Returns all combinations of values between two arrays.~ +- P detected. +- Formatting line: ~Returns all combinations of values between two arrays.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here are some examples of using ~product~. Paste the following code at the bottom of main.rb and save the file to see the results:~ +- P detected. +- Formatting line: ~Here are some examples of using ~product~. Paste the following code at the bottom of main.rb and save the file to see the results:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ a = [0, 1]~ +** Processing line: ~ puts a.product~ +** Processing line: ~ # => [[0, 0], [0, 1], [1, 0], [1, 1]]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ a = [ 0, 1]~ +** Processing line: ~ b = [:a, :b]~ +** Processing line: ~ puts a.product b~ +** Processing line: ~ # => [[0, :a], [0, :b], [1, :a], [1, :b]]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#map_2d~~ +- H1 detected. +- Formatting line: ~~Array#map_2d~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage.~ +- P detected. +- Formatting line: ~Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. A 2D array is a common way to store data/layout for a stage.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ stage = [~ +** Processing line: ~ [:enemy, :empty, :player],~ +** Processing line: ~ [:empty, :empty, :empty],~ +** Processing line: ~ [:enemy, :empty, :enemy],~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ occupied_tiles = stage.map_2d do |row, col, tile|~ +** Processing line: ~ if tile == :empty~ +** Processing line: ~ nil~ +** Processing line: ~ else~ +** Processing line: ~ [row, col, tile]~ +** Processing line: ~ end~ +** Processing line: ~ end.reject_nil~ +** Processing line: ~~ +** Processing line: ~ puts "Stage:"~ +** Processing line: ~ puts stage~ +** Processing line: ~~ +** Processing line: ~ puts "Occupied Tiles"~ +** Processing line: ~ puts occupied_tiles~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#include_any?~~ +- H1 detected. +- Formatting line: ~~Array#include_any?~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Given a collection of items, the function will return ~true~ if any of ~self~'s items exists in the collection of items passed in:~ +- P detected. +- Formatting line: ~Given a collection of items, the function will return ~true~ if any of ~self~'s items exists in the collection of items passed in:~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Array#any_intersect_rect?~~ +- H1 detected. +- Formatting line: ~~Array#any_intersect_rect?~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, this method returns ~true~ if any of the elements within the array intersect the object being passed in. You are given an optional parameter called ~tolerance~ which informs how close to the other rectangles the elements need to be for it to be considered intersecting.~ +- P detected. +- Formatting line: ~Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, this method returns ~true~ if any of the elements within the array intersect the object being passed in. You are given an optional parameter called ~tolerance~ which informs how close to the other rectangles the elements need to be for it to be considered intersecting.~ +- Line's tilde count is: 12 +- Line contains link marker: false +- CODE detected. +** Processing line: ~The default tolerance is set to ~0.1~, which means that the primitives are not considered intersecting unless they are overlapping by more than ~0.1~.~ +- P detected. +- Formatting line: ~The default tolerance is set to ~0.1~, which means that the primitives are not considered intersecting unless they are overlapping by more than ~0.1~.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ repl do~ +** Processing line: ~ # Here is a player class that has position and implement~ +** Processing line: ~ # the ~attr_rect~ contract.~ +** Processing line: ~ class Player~ +** Processing line: ~ attr_rect~ +** Processing line: ~ attr_accessor :x, :y, :w, :h~ +** Processing line: ~~ +** Processing line: ~ def initialize x, y, w, h~ +** Processing line: ~ @x = x~ +** Processing line: ~ @y = y~ +** Processing line: ~ @w = w~ +** Processing line: ~ @h = h~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def serialize~ +** Processing line: ~ { x: @x, y: @y, w: @w, h: @h }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def inspect~ +** Processing line: ~ "#{serialize}"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def to_s~ +** Processing line: ~ "#{serialize}"~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Here is a definition of two walls.~ +** Processing line: ~ walls = [~ +** Processing line: ~ [10, 10, 10, 10],~ +** Processing line: ~ { x: 20, y: 20, w: 10, h: 10 },~ +** Processing line: ~ ]~ +** Processing line: ~~ +** Processing line: ~ # Display the walls.~ +** Processing line: ~ puts "Walls."~ +** Processing line: ~ puts walls~ +** Processing line: ~ puts ""~ +** Processing line: ~~ +** Processing line: ~ # Check any_intersect_rect? on player~ +** Processing line: ~ player = Player.new 30, 20, 10, 10~ +** Processing line: ~ puts "Is Player #{player} touching wall?"~ +** Processing line: ~ puts (walls.any_intersect_rect? player)~ +** Processing line: ~ # => false~ +** Processing line: ~ # The value is false because of the default tolerance is 0.1.~ +** Processing line: ~ # The overlap of the player rect and any of the wall rects is~ +** Processing line: ~ # less than 0.1 (for those that intersect).~ +** Processing line: ~ puts ""~ +** Processing line: ~~ +** Processing line: ~ player = Player.new 9, 10, 10, 10~ +** Processing line: ~ puts "Is Player #{player} touching wall?"~ +** Processing line: ~ puts (walls.any_intersect_rect? player)~ +** Processing line: ~ # => true~ +** Processing line: ~ puts ""~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Outputs~~ +- H1 detected. +- Formatting line: ~~GTK::Outputs~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a ~tick~ method defined in mygame/app/main.rb~ +- P detected. +- Formatting line: ~Outputs is how you render primitives to the screen. The minimal setup for rendering something to the screen is via a ~tick~ method defined in mygame/app/main.rb~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # code goes here~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Outputs#solids~~ +- H1 detected. +- Formatting line: ~~GTK::Outputs#solids~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Add primitives to this collection to render a solid to the screen.~ +- P detected. +- Formatting line: ~Add primitives to this collection to render a solid to the screen.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~** Rendering a solid using an Array~ +- H2 detected. +- Formatting line: ~Rendering a solid using an Array~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Rendering a solid using an Array~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixels tall.~ +- P detected. +- Formatting line: ~Creates a solid black rectangle located at 100, 100. 160 pixels wide and 90 pixels tall.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT~ +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~** Rendering a solid using an Array with colors and alpha~ +- H2 detected. +- Formatting line: ~Rendering a solid using an Array with colors and alpha~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Rendering a solid using an Array with colors and alpha~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ +- P detected. +- Formatting line: ~The value for the color and alpha is an number between ~0~ and ~255~. The alpha property is optional and will be set to ~255~ if not specified.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Creates a green solid rectangle with an opacity of 50%.~ +- P detected. +- Formatting line: ~Creates a green solid rectangle with an opacity of 50%.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT RED GREEN BLUE ALPHA~ +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~** Rendering a solid using a Hash~ +- H2 detected. +- Formatting line: ~Rendering a solid using a Hash~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Rendering a solid using a Hash~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~If you want a more readable invocation. You can use the following hash to create a solid. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order.~ +- P detected. +- Formatting line: ~If you want a more readable invocation. You can use the following hash to create a solid. Any parameters that are not specified will be given a default value. The keys of the hash can be provided in any order.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.outputs.solids << {~ +** Processing line: ~ x: 0,~ +** Processing line: ~ y: 0,~ +** Processing line: ~ w: 100,~ +** Processing line: ~ h: 100,~ +** Processing line: ~ r: 0,~ +** Processing line: ~ g: 255,~ +** Processing line: ~ b: 0,~ +** Processing line: ~ a: 255~ +** Processing line: ~ }~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~** Rendering a solid using a Class~ +- H2 detected. +- Formatting line: ~Rendering a solid using a Class~ +- Line's tilde count is: 0 +- Line contains link marker: false +- Formatting line: ~Rendering a solid using a Class~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ +- P detected. +- Formatting line: ~You can also create a class with solid/border properties and render it as a primitive. ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ must be defined on the class.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Here is an example:~ +- P detected. +- Formatting line: ~Here is an example:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ # Create type with ALL solid properties AND primitive_marker~ +** Processing line: ~ class Solid~ +** Processing line: ~ attr_accessor :x, :y, :w, :h, :r, :g, :b, :a~ +** Processing line: ~~ +** Processing line: ~ def primitive_marker~ +** Processing line: ~ :solid~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Inherit from type~ +** Processing line: ~ class Square < Solid~ +** Processing line: ~ # constructor~ +** Processing line: ~ def initialize x, y, size~ +** Processing line: ~ self.x = x~ +** Processing line: ~ self.y = y~ +** Processing line: ~ self.w = size~ +** Processing line: ~ self.h = size~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ def tick args~ +** Processing line: ~ # render solid/border~ +** Processing line: ~ args.outputs.solids << Square.new(10, 10, 32)~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Outputs#borders~~ +- H1 detected. +- Formatting line: ~~GTK::Outputs#borders~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids.~ +- P detected. +- Formatting line: ~Add primitives to this collection to render an unfilled solid to the screen. Take a look at the documentation for Outputs#solids.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~The only difference between the two primitives is where they are added.~ +- P detected. +- Formatting line: ~The only difference between the two primitives is where they are added.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Instead of using ~args.outputs.solids~:~ +- P detected. +- Formatting line: ~Instead of using ~args.outputs.solids~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT~ +** Processing line: ~ args.outputs.solids << [100, 100, 160, 90]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~You have to use ~args.outputs.borders~:~ +- P detected. +- Formatting line: ~You have to use ~args.outputs.borders~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # X Y WIDTH HEIGHT~ +** Processing line: ~ args.outputs.borders << [100, 100, 160, 90]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::Mouse~~ +- H1 detected. +- Formatting line: ~~GTK::Mouse~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~The mouse is accessible via ~args.inputs.mouse~:~ +- P detected. +- Formatting line: ~The mouse is accessible via ~args.inputs.mouse~:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse).~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ 10,~ +** Processing line: ~ 710,~ +** Processing line: ~ "The mouse's position is: #{args.inputs.mouse.x} #{args.inputs.mouse.y}."~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~The mouse has the following properties.~ +- P detected. +- Formatting line: ~The mouse has the following properties.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~- ~args.inputs.mouse.x~: Returns the x position of the mouse.~ +- UL start detected. +- LI detected. +- Formatting line: ~~args.inputs.mouse.x~: Returns the x position of the mouse.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.y~: Returns the y position of the mouse.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.y~: Returns the y position of the mouse.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse.~ +- Line's tilde count is: 10 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~.~ +- Line's tilde count is: 10 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.button_left~: Returns true if the left mouse button is down.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.button_left~: Returns true if the left mouse button is down.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.button_right~: Returns true if the right mouse button is down.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.button_right~: Returns true if the right mouse button is down.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state.~ +- LI detected. +- Formatting line: ~~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::MousePoint~~ +- H1 detected. +- Formatting line: ~~GTK::MousePoint~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~The ~GTK::MousePoint~ has the following properties.~ +- P detected. +- Formatting line: ~The ~GTK::MousePoint~ has the following properties.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~- ~x~: Integer representing the mouse's x.~ +- UL start detected. +- LI detected. +- Formatting line: ~~x~: Integer representing the mouse's x.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~y~: Integer representing the mouse's y.~ +- LI detected. +- Formatting line: ~~y~: Integer representing the mouse's y.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~point~: Array with the ~x~ and ~y~ values.~ +- LI detected. +- Formatting line: ~~point~: Array with the ~x~ and ~y~ values.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Formatting line: ~~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Formatting line: ~~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Formatting line: ~~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Formatting line: ~~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Formatting line: ~~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- LI detected. +- Formatting line: ~~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions).~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~created_at~: The tick (~args.state.tick_count~) that this structure was created.~ +- LI detected. +- Formatting line: ~~created_at~: The tick (~args.state.tick_count~) that this structure was created.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.~ +- LI detected. +- Formatting line: ~~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::OpenEntity~~ +- H1 detected. +- Formatting line: ~~GTK::OpenEntity~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~~GTK::OpenEntity~ is accessible within the DragonRuby's top level ~tick~ function via the ~args.state~ property.~ +- P detected. +- Formatting line: ~~GTK::OpenEntity~ is accessible within the DragonRuby's top level ~tick~ function via the ~args.state~ property.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.x ||= 100~ +** Processing line: ~ args.outputs.labels << [10, 710, "value of x is: #{args.state.x}."]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~The primary benefit of using ~args.state~ as opposed to instance variables is that ~GTK::OpenEntity~ allows for arbitrary nesting of properties without the need to create intermediate objects.~ +- P detected. +- Formatting line: ~The primary benefit of using ~args.state~ as opposed to instance variables is that ~GTK::OpenEntity~ allows for arbitrary nesting of properties without the need to create intermediate objects.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~For example:~ +- P detected. +- Formatting line: ~For example:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ # intermediate player object does not need to be created~ +** Processing line: ~ args.state.player.x ||= 100~ +** Processing line: ~ args.state.player.y ||= 100~ +** Processing line: ~ args.outputs.labels << [~ +** Processing line: ~ 10,~ +** Processing line: ~ 710,~ +** Processing line: ~ "player x, y is:#{args.state.player.x}, #{args.state.player.y}."~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~GTK::OpenEntity#as_hash~~ +- H1 detected. +- Formatting line: ~~GTK::OpenEntity#as_hash~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This property is useful when you want to treat ~args.state~ as a ~Hash~ and invoke methods such as ~Hash#each~.~ +- P detected. +- Formatting line: ~Returns a reference to the ~GTK::OpenEntity~ as a ~Hash~. This property is useful when you want to treat ~args.state~ as a ~Hash~ and invoke methods such as ~Hash#each~.~ +- Line's tilde count is: 10 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example:~ +- P detected. +- Formatting line: ~Example:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.x ||= 100~ +** Processing line: ~ args.state.y ||= 100~ +** Processing line: ~ values = args.state~ +** Processing line: ~ .as_hash~ +** Processing line: ~ .map { |k, v| "#{k} #{v}" }~ +** Processing line: ~~ +** Processing line: ~ args.outputs.labels << values.map.with_index do |v, i|~ +** Processing line: ~ [~ +** Processing line: ~ 10,~ +** Processing line: ~ 710 - (30 * i),~ +** Processing line: ~ v~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Numeric#frame_index~~ +- H1 detected. +- Formatting line: ~~Numeric#frame_index~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value ~self~ represents the moment the animation started.~ +- P detected. +- Formatting line: ~This function is helpful for determining the index of frame-by-frame sprite animation. The numeric value ~self~ represents the moment the animation started.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~frame_index~ takes three additional parameters:~ +- P detected. +- Formatting line: ~~frame_index~ takes three additional parameters:~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~- How many frames exist in the sprite animation.~ +- UL start detected. +- LI detected. +- Formatting line: ~How many frames exist in the sprite animation.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- How long to hold each animation for.~ +- LI detected. +- Formatting line: ~How long to hold each animation for.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~- Whether the animation should repeat.~ +- LI detected. +- Formatting line: ~Whether the animation should repeat.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~frame_index~ will return ~nil~ if the time for the animation is out of bounds of the parameter specification.~ +- UL end detected. +- P detected. +- Formatting line: ~~frame_index~ will return ~nil~ if the time for the animation is out of bounds of the parameter specification.~ +- Line's tilde count is: 4 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example using variables:~ +- P detected. +- Formatting line: ~Example using variables:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ start_looping_at = 0~ +** Processing line: ~ number_of_sprites = 6~ +** Processing line: ~ number_of_frames_to_show_each_sprite = 4~ +** Processing line: ~ does_sprite_loop = true~ +** Processing line: ~~ +** Processing line: ~ sprite_index =~ +** Processing line: ~ start_looping_at.frame_index number_of_sprites,~ +** Processing line: ~ number_of_frames_to_show_each_sprite,~ +** Processing line: ~ does_sprite_loop~ +** Processing line: ~~ +** Processing line: ~ sprite_index ||= 0~ +** Processing line: ~~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ 640 - 50,~ +** Processing line: ~ 360 - 50,~ +** Processing line: ~ 100,~ +** Processing line: ~ 100,~ +** Processing line: ~ "sprites/dragon-#{sprite_index}.png"~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~Example using named parameters:~ +- P detected. +- Formatting line: ~Example using named parameters:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ start_looping_at = 0~ +** Processing line: ~~ +** Processing line: ~ sprite_index =~ +** Processing line: ~ start_looping_at.frame_index count: 6,~ +** Processing line: ~ hold_for: 4,~ +** Processing line: ~ repeat: true,~ +** Processing line: ~ tick_count_override: args.state.tick_count~ +** Processing line: ~~ +** Processing line: ~ sprite_index ||= 0~ +** Processing line: ~~ +** Processing line: ~ args.outputs.sprites << [~ +** Processing line: ~ 640 - 50,~ +** Processing line: ~ 360 - 50,~ +** Processing line: ~ 100,~ +** Processing line: ~ 100,~ +** Processing line: ~ "sprites/dragon-#{sprite_index}.png"~ +** Processing line: ~ ]~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Numeric#elapsed_time~~ +- H1 detected. +- Formatting line: ~~Numeric#elapsed_time~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`.~ +- P detected. +- Formatting line: ~For a given number, the elapsed frames since that number is returned. `Kernel.tick_count` is used to determine how many frames have elapsed. An optional numeric argument can be passed in which will be used instead of `Kernel.tick_count`.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~Here is an example of how elapsed_time can be used.~ +- P detected. +- Formatting line: ~Here is an example of how elapsed_time can be used.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.last_click_at ||= 0~ +** Processing line: ~~ +** Processing line: ~ # record when a mouse click occurs~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.state.last_click_at = args.state.tick_count~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Use Numeric#elapsed_time to determine how long it's been~ +** Processing line: ~ if args.state.last_click_at.elapsed_time > 120~ +** Processing line: ~ args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~And here is an example where the override parameter is passed in:~ +- P detected. +- Formatting line: ~And here is an example where the override parameter is passed in:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.last_click_at ||= 0~ +** Processing line: ~~ +** Processing line: ~ # create a state variable that tracks time at half the speed of args.state.tick_count~ +** Processing line: ~ args.state.simulation_tick = args.state.tick_count.idiv 2~ +** Processing line: ~~ +** Processing line: ~ # record when a mouse click occurs~ +** Processing line: ~ if args.inputs.mouse.click~ +** Processing line: ~ args.state.last_click_at = args.state.simulation_tick~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # Use Numeric#elapsed_time to determine how long it's been~ +** Processing line: ~ if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120~ +** Processing line: ~ args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."]~ +** Processing line: ~ end~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Numeric#elapsed?~~ +- H1 detected. +- Formatting line: ~~Numeric#elapsed?~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true.~ +- P detected. +- Formatting line: ~Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true.~ +- Line's tilde count is: 6 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example usage (no optional parameter):~ +- P detected. +- Formatting line: ~Example usage (no optional parameter):~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.box_queue ||= []~ +** Processing line: ~~ +** Processing line: ~ if args.state.box_queue.empty?~ +** Processing line: ~ args.state.box_queue << { name: :red,~ +** Processing line: ~ destroy_at: args.state.tick_count + 60 }~ +** Processing line: ~ args.state.box_queue << { name: :green,~ +** Processing line: ~ destroy_at: args.state.tick_count + 60 }~ +** Processing line: ~ args.state.box_queue << { name: :blue,~ +** Processing line: ~ destroy_at: args.state.tick_count + 120 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ boxes_to_destroy = args.state~ +** Processing line: ~ .box_queue~ +** Processing line: ~ .find_all { |b| b[:destroy_at].elapsed? }~ +** Processing line: ~~ +** Processing line: ~ if !boxes_to_destroy.empty?~ +** Processing line: ~ puts "boxes to destroy count: #{boxes_to_destroy.length}"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." }~ +** Processing line: ~~ +** Processing line: ~ args.state.box_queue -= boxes_to_destroy~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~Example usage (with optional parameter):~ +- P detected. +- Formatting line: ~Example usage (with optional parameter):~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.box_queue ||= []~ +** Processing line: ~~ +** Processing line: ~ if args.state.box_queue.empty?~ +** Processing line: ~ args.state.box_queue << { name: :red,~ +** Processing line: ~ create_at: args.state.tick_count + 120,~ +** Processing line: ~ lifespan: 60 }~ +** Processing line: ~ args.state.box_queue << { name: :green,~ +** Processing line: ~ create_at: args.state.tick_count + 120,~ +** Processing line: ~ lifespan: 60 }~ +** Processing line: ~ args.state.box_queue << { name: :blue,~ +** Processing line: ~ create_at: args.state.tick_count + 120,~ +** Processing line: ~ lifespan: 120 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ # lifespan is passed in as a parameter to ~elapsed?~~ +** Processing line: ~ boxes_to_destroy = args.state~ +** Processing line: ~ .box_queue~ +** Processing line: ~ .find_all { |b| b[:create_at].elapsed? b[:lifespan] }~ +** Processing line: ~~ +** Processing line: ~ if !boxes_to_destroy.empty?~ +** Processing line: ~ puts "boxes to destroy count: #{boxes_to_destroy.length}"~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ boxes_to_destroy.each { |b| puts "box #{b} was elapsed? on #{args.state.tick_count}." }~ +** Processing line: ~~ +** Processing line: ~ args.state.box_queue -= boxes_to_destroy~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Numeric#created?~~ +- H1 detected. +- Formatting line: ~~Numeric#created?~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that number is equal to the current frame.~ +- P detected. +- Formatting line: ~Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that number is equal to the current frame.~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~Example usage:~ +- P detected. +- Formatting line: ~Example usage:~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~#+begin_src ruby~ +- PRE start detected. +** Processing line: ~ def tick args~ +** Processing line: ~ args.state.box_queue ||= []~ +** Processing line: ~~ +** Processing line: ~ if args.state.box_queue.empty?~ +** Processing line: ~ args.state.box_queue << { name: :red,~ +** Processing line: ~ create_at: args.state.tick_count + 60 }~ +** Processing line: ~ end~ +** Processing line: ~~ +** Processing line: ~ boxes_to_spawn_this_frame = args.state~ +** Processing line: ~ .box_queue~ +** Processing line: ~ .find_all { |b| b[:create_at].new? }~ +** Processing line: ~~ +** Processing line: ~ boxes_to_spawn_this_frame.each { |b| puts "box #{b} was new? on #{args.state.tick_count}." }~ +** Processing line: ~~ +** Processing line: ~ args.state.box_queue -= boxes_to_spawn_this_frame~ +** Processing line: ~ end~ +** Processing line: ~#+end_src~ +- PRE end detected. +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Kernel~~ +- H1 detected. +- Formatting line: ~~Kernel~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick.~ +- P detected. +- Formatting line: ~Kernel in the DragonRuby Runtime has patches for how standard out is handled and also contains a unit of time in games called a tick.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Kernel::tick_count~~ +- H1 detected. +- Formatting line: ~~Kernel::tick_count~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Returns the current tick of the game. This value is reset if you call $gtk.reset.~ +- P detected. +- Formatting line: ~Returns the current tick of the game. This value is reset if you call $gtk.reset.~ +- Line's tilde count is: 0 +- Line contains link marker: false +** Processing line: ~~ +** Processing line: ~~ +** Processing line: ~* DOCS: ~Kernel::global_tick_count~~ +- H1 detected. +- Formatting line: ~~Kernel::global_tick_count~~ +- Line's tilde count is: 2 +- Line contains link marker: false +- CODE detected. +** Processing line: ~~ +** Processing line: ~Returns the current tick of the application from the point it was started. This value is never reset.~ +- P detected. +- Formatting line: ~Returns the current tick of the application from the point it was started. This value is never reset. ~ +- Line's tilde count is: 0 +- Line contains link marker: false
\ No newline at end of file diff --git a/docs/search_results.txt b/docs/search_results.txt new file mode 100644 index 0000000..50311a3 --- /dev/null +++ b/docs/search_results.txt @@ -0,0 +1,71 @@ +* DOCS: ~Numeric#elapsed_time~ +For a given number, the elapsed frames since that number is returned. +`Kernel.tick_count` is used to determine how many frames have elapsed. +An optional numeric argument can be passed in which will be used instead +of `Kernel.tick_count`. + +Here is an example of how elapsed_time can be used. + +#+begin_src ruby + def tick args + args.state.last_click_at ||= 0 + + # record when a mouse click occurs + if args.inputs.mouse.click + args.state.last_click_at = args.state.tick_count + end + + # Use Numeric#elapsed_time to determine how long it's been + if args.state.last_click_at.elapsed_time > 120 + args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."] + end + end +#+end_src + +And here is an example where the override parameter is passed in: + +#+begin_src ruby + def tick args + args.state.last_click_at ||= 0 + + # create a state variable that tracks time at half the speed of args.state.tick_count + args.state.simulation_tick = args.state.tick_count.idiv 2 + + # record when a mouse click occurs + if args.inputs.mouse.click + args.state.last_click_at = args.state.simulation_tick + end + + # Use Numeric#elapsed_time to determine how long it's been + if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120 + args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."] + end + end +#+end_src + + +* DOCS: ~Numeric#created?~ +Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that +number is equal to the current frame. + +Example usage: + +#+begin_src ruby + def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + create_at: args.state.tick_count + 60 } + end + + boxes_to_spawn_this_frame = args.state + .box_queue + .find_all { |b| b[:create_at].new? } + + boxes_to_spawn_this_frame.each { |b| puts "box #{b} was new? on #{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_spawn_this_frame + end +#+end_src + diff --git a/docs/todo/03-solids-and-borders.md b/docs/todo/03-solids-and-borders.md new file mode 100644 index 0000000..0ed2fc9 --- /dev/null +++ b/docs/todo/03-solids-and-borders.md @@ -0,0 +1,126 @@ +# Solids and Borders + +Solids and Borders are great to use as place holders for sprites. + +## Sample Apps Releated to Solid/Borders Usage (ordered by size of codebase increasing) + +- 01_api_03_rects +- 01_api_99_tech_demo (includes recording) +- 02_collisions +- 12_top_down_area (includes recording) +- 99_sample_game_flappy_dragon (includes recording) +- 08_platformer_collisions +- 20_roguelike_starting_point +- 99_sample_game_pong (includes recording) + +## Minimum Code + +Creates a solid black rectangle located at 100, 100. 160 pixels +wide and 90 pixels tall. + +```ruby +# X Y WIDTH HEIGHT +args.outputs.solids << [100, 100, 160, 90] +``` + +Creates an unfilled black-bordered rectangle located at 100, 100. +160 pixels wide and 90 pixels tall. + +```ruby +# X Y WIDTH HEIGHT +args.outputs.borders << [100, 100, 160, 90] +``` + +## RGBA - Colors and Alpha + +The value for the color and alpha is an number between `0` and `255`. The +alpha property is optional and will be set to `255` if not specified. + +Creates a green solid rectangle with an opacity of 50%. + +```ruby +# X Y WIDTH HEIGHT RED GREEN BLUE ALPHA +args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128] +``` + +Creates an unfilled green-bordered rectangle located at 100, 100. +160 pixels wide and 90 pixels tall and an opacity of 50%. + +```ruby +# X Y WIDTH HEIGHT RED GREEN BLUE ALPHA +args.outputs.borders << [100, 100, 160, 90, 0, 255, 0, 128] +``` + +Creates a solid gray rectangle that covers the entire scene. Like a background. +The opacity is excluded because it's 100% opaque (which has a value of 255). + +```ruby +# X Y WIDTH HEIGHT RED GREEN BLUE +args.outputs.solids << [ 0, 0, 1280, 720, 128, 128, 128] +``` + +## Hash (Advanced) + +If you want a more readable invocation. You can use the following hash to create a solid. +Any parameters that are not specified will be given a default value. The keys of the hash can +be provided in any order. + +```ruby +args.outputs.solids << { + x: 0, + y: 0, + w: 100, + h: 100, + r: 0, + g: 255, + b: 0, + a: 255 +} + + +args.outputs.borders << { + x: 0, + y: 0, + w: 100, + h: 100, + r: 0, + g: 255, + b: 0, + a: 255 +} +``` + +## Duck Typing (Advanced) + +You can also create a class with solid/border properties and render it as a primitive. +ALL properties must on the class. ADDITIONALLY, a method called `primitive_marker` +must be defined on the class. + +Here is an example: + +```ruby +# Create type with ALL solid/border properties AND primitive_marker +class Solid (or Border) + attr_accessor :x, :y, :w, :h, :r, :g, :b, :a_x + + def primitive_marker + :solid (or :border) + end +end + +# Inherit from type +class Square < Solid (or Border) + # constructor + def initialize x, y, size + self.x = x + self.y = y + self.w = size + self.h = size + end +end + +# render solid/border + +args.outputs.solids << Square.new(10, 10, 32) +args.outputs.borders << Square.new(10, 10, 32) +``` diff --git a/docs/todo/04-lines.md b/docs/todo/04-lines.md new file mode 100644 index 0000000..03c1abc --- /dev/null +++ b/docs/todo/04-lines.md @@ -0,0 +1,108 @@ +# Lines + +Lines are 1 pixel wide and can be diagonal. + +## Sample Apps Related to Line Usage (ordered by size of codebase increasing) + +- 01_api_02_lines +- 01_api_99_tech_demo (includes recording) +- 06_coordinate_systems (includes recording) +- 19_lowrez_jam_01_hello_world +- 99_sample_game_pong (includes recording) + +## Minimum Code + +Creates a black line from the bottom left corner to the top right corner. + +```ruby +# X1 Y1 X2 Y2 +args.outputs.lines << [ 0, 0, 1280, 720] +``` + +Creates a black vertical line through the center of the scene. + +```ruby +# X1 Y1 X2 Y2 +args.outputs.lines << [ 640, 0, 640, 720] +``` + +Creates a black horizontal line through the center of the scene. + +```ruby +# X1 Y1 X2 Y2 +args.outputs.lines << [ 0, 360, 1280, 360] +``` + +## RGBA - Colors and Alpha + +The value for the color and alpha is an number between `0` and `255`. The +alpha property is optional and will be set to `255` if not specified. + +Creates a green horizontal line through the center of the scene with an opacity of 50%. + +```ruby +# X1 Y1 X2 Y2 RED GREEN BLUE ALPHA +args.outputs.lines << [ 0, 360, 1280, 360, 0, 255, 0, 128] +``` + +Creates a green vertical line through the center of the scene. +The opacity is excluded because it's 100% opaque (which has a value of 255). + +```ruby +# X1 Y1 X2 Y2 RED GREEN BLUE +args.outputs.lines << [ 640, 0, 640, 720, 0, 255, 0] +``` + +## Hash (Advanced) + +If you want a more readable invocation. You can use the following hash to create a line. +Any parameters that are not specified will be given a default value. The keys of the hash can +be provided in any order. + +```ruby +args.outputs.lines << { + x: 0, + y: 0, + x2: 1280, + y2: 720, + r: 0, + g: 255, + b: 0, + a: 255 +} +``` + +## Duck Typing (Advanced) + +You can also create a class with line properties and render it as a primitive. +ALL properties must on the class. ADDITIONALLY, a method called `primitive_marker` +must be defined on the class. + +Here is an example: + +```ruby +# Create type with ALL line properties AND primitive_marker +class Line + attr_accessor :x, :y, :x2, :y2, :r, :g, :b, :a + + def primitive_marker + :line + end +end + +# Inherit from type +class VerticalLine < Line + + # constructor + def initialize x, y, h + self.x = x + self.y = y + self.x2 = x + self.y2 = y + h + end +end + +# render line + +args.outputs.lines << VerticalLine.new(10, 10, 100) +``` diff --git a/docs/todo/05-sprites.md b/docs/todo/05-sprites.md new file mode 100644 index 0000000..e8030ab --- /dev/null +++ b/docs/todo/05-sprites.md @@ -0,0 +1,216 @@ +# Sprites + +Sprites are the most important visual component of a game. + +## Sample Apps Related to Sprite Usage (ordered by size of codebase increasing) + +- 01_api_04_sprites +- 01_api_99_tech_demo (includes recording) +- 02_sprite_animation_and_keyboard_input (includes recording) +- 08_platformer_collisions_metroidvania +- 09_controller_analog_usage_advanced_sprites +- 99_sample_game_basic_gorillas (includes recording) +- 99_sample_game_dueling_starships (includes recording) +- 99_sample_game_flappy_dragon (includes recording) +- 99_sample_game_return_of_serenity + +## Minimum Code + +Sprites need to be under the `mygame` directory. It's recommended that you create a `sprites` folder +to keep things organized. All sprites must be `.png` files + +Here is how you create an sprite with located at 100, 100, that is 32 pixels wide and 64 pixels tall. +In this example the sprite name is `player.png` and is located under a directory `mygame/sprites`. + +```ruby +# X Y WIDTH HEIGHT PATH +args.outputs.sprites << [100, 100, 32, 64, "sprites/player.png"] +``` + +## Rotation / Angle + +Unlike `solids` and `borders`, sprites can be rotated. This is how you rotate a sprite 90 degress. + +Note: All angles in DragonRuby Game Toolkit are represented in degrees (not radians). + +```ruby +# X Y WIDTH HEIGHT PATH ANGLE +args.outputs.sprites << [100, 100, 32, 64, "sprites/player.png", 90] +``` + +## Alpha + +Sprites can also have a transparency associated with them. The transparency value must come after +the angle value and supports a number between 0 and 255. + +This is how you would define a sprite with no rotation, and a 50% transparency. + +```ruby +# X Y WIDTH HEIGHT PATH ANGLE ALPHA +args.outputs.sprites << [100, 100, 32, 64, "sprites/player.png", 0, 128] +``` + +## Color Saturations + +A Sprite's color levels can be changed. The color saturations must come after `angle` and +`alpha` values. + +This is a sprite with no rotation, fully opaque, and with a green tint. + +```ruby +args.outputs.sprites << [100, # X + 100, # Y + 32, # W + 64, # H + "sprites/player.png", # PATH + 0, # ANGLE + 255, # ALPHA + 0, # RED_SATURATION + 255, # GREEN_SATURATION + 0] # BLUE_SATURATION +``` + +## Sprite Sub Division / Tile + +You can render a portion of a sprite (a tile). The sub division of the sprite is denoted as a rectangle +directly related to the original size of the png. + +This is a sprite scaled to 100 pixels where the source rectangle is located at the bottom left corner +within a 32 pixel square. The angle, opacity, and color levels of the tile are unaltered. + +**For these advanced transforms, you should use a `Hash` instead of an `Array`.** + +```ruby +args.outputs.sprites << { + x: 100, + y: 100, + w: 100, + h: 100, + path: "sprites/player.png", + source_x: 0, + source_y: 0, + source_w: 32, + source_h: 32, +} +``` + +## Flipping a Sprite Horizontally and Vertically + +A sprite can be flipped horizontally and vertically. + +This is a sprite that has been flipped horizontally. The sprites's angle, alpha, color saturations, +and source rectangls are unaltered. + +**For these advanced transforms, you should use a `Hash` instead of an `Array`.** + +```ruby +args.outputs.sprites << { + x: 100, + y: 100, + w: 100, + h: 100, + path: "sprites/player.png", + flip_horizontally: true, +} +``` + +This is a sprite that has been flipped vertically. The sprites's angle, alpha, color saturations, +and tile subdivision are unaltered. + +```ruby +args.outputs.sprites << { + x: 100, + y: 100, + w: 100, + h: 100, + path: "sprites/player.png", + flip_vertically: true, +} +``` + +## Rotation Center + +A sprites center of rotation can be altered. + +This is a sprite that has its rotation center set to the top-middle. The sprites's angle, alpha, color saturations, +source rectangle subdivision, and projections are unaltered. + +```ruby +args.outputs.sprites << { + x: 100, + y: 100, + w: 100, + h: 100, + path: "sprites/player.png", + angle: 0, + angle_anchor_x: 0.5, + angle_anchor_y: 1.0 +} +``` + +## Hash + +Here are all of the properites that are available on a sprite Hash. +Any parameters that are not specified will be given a default value. The keys of the hash can +be provided in any order. + +```ruby +args.outputs.sprites << { + x: 100, + y: 100, + w: 100, + h: 100, + path: "sprites/player.png", + angle: 0, + a, 255, + r: 255, + g: 255, + b: 255, + source_x: 0, + source_y: 0, + source_w: -1, + source_h: -1, + flip_vertically: false, + flip_horizontally: false, + angle_anchor_x: 0.5, + angle_anchor_y: 1.0 +} +``` + +## Duck Typing (Advanced) + +You can also create a class with sprite properties and render it as a primitive. +ALL properties must on the class. ADDITIONALLY, a method called `primitive_marker` +must be defined on the class. + +Here is an example: + +```ruby +# Create type with ALL sprite properties AND primitive_marker +class Sprite + attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :source_x, + :source_y, :source_w, :source_h, :flip_horizontally, + :flip_vertically, :angle_anchor_x, :angle_anchor_y + + def primitive_marker + :sprite + end +end + +# Inherit from type +class PlayerSprite < Sprite + + # constructor + def initialize x, y, w, h + self.x = x + self.y = y + self.w = w + self.h = h + self.path = 'sprites/player.png' + end +end + +#render player sprite + +args.outputs.sprites << PlayerSprite.new(10, 10, 32, 64) +``` diff --git a/docs/todo/06-keyboard.md b/docs/todo/06-keyboard.md new file mode 100644 index 0000000..6fbe6d2 --- /dev/null +++ b/docs/todo/06-keyboard.md @@ -0,0 +1,150 @@ +# Keyboard + +Determining if `a` key is in the down state (pressed). This happens once each time the key is pressed: + +``` +if args.inputs.keyboard.key_down.a + puts 'The key is pressed' +end +``` + +Determining if a key is being held. This happens every tick while the key is held down: + +``` +if args.inputs.keyboard.key_held.a + puts 'The key is being held' +end +``` + +Determining if a key is in the down state or is being held: + +``` +if args.inputs.keyboard.a + puts 'The key is pressed or being held' +end +``` + +Determining if a key is in the up state (released). This happens once each time the key is released: + +``` +if args.inputs.keyboard.key_up.a + puts 'The key is released' +end +``` + +# Truthy Keys + +You can access all triggered keys through `truthy_keys` on `keyboard`, `controller_one`, and `controller_two`. + +This is how you would right all keys to a file. The game must be in the foreground and have focus for this data +to be recorded. + +``` +def tick args + [ + [args.inputs.keyboard, :keyboard], + [args.inputs.controller_one, :controller_one], + [args.inputs.controller_two, :controller_two] + ].each do |input, name| + if input.key_down.truthy_keys.length > 0 + args.gtk.write_file("mygame/app/#{name}_key_down_#{args.state.tick_count}", input.key_down.truthy_keys.to_s) + end + end +end +``` + +# List of keys: + +These are the character and associated properities that will +be set to true. + +For example `A => :a, :shift` means that `args.inputs.keyboard.a` +would be true and so would `args.inputs.keyboard.shift` +(if both keys were being held or in the down state). + +``` +A => :a, :shift +B => :b, :shift +C => :c, :shift +D => :d, :shift +E => :e, :shift +F => :f, :shift +G => :g, :shift +H => :h, :shift +I => :i, :shift +J => :j, :shift +K => :k, :shift +L => :l, :shift +M => :m, :shift +N => :n, :shift +O => :o, :shift +P => :p, :shift +Q => :q, :shift +R => :r, :shift +S => :s, :shift +T => :t, :shift +U => :u, :shift +V => :v, :shift +W => :w, :shift +X => :x, :shift +Y => :y, :shift +Z => :z, :shift +! => :exclamation_point +0 => :zero +1 => :one +2 => :two +3 => :three +4 => :four +5 => :five +6 => :six +7 => :seven +8 => :eight +9 => :nine +\b => :backspace +\e => :escape +\r => :enter +\t => :tab +( => :open_round_brace +) => :close_round_brace +{ => :open_curly_brace +} => :close_curly_brace +[ => :open_square_brace +] => :close_square_brace +: => :colon +; => :semicolon += => :equal_sign +- => :hyphen + => :space +$ => :dollar_sign +" => :double_quotation_mark +' => :single_quotation_mark +` => :backtick +~ => :tilde +. => :period +, => :comma +| => :pipe +_ => :underscore +# => :hash ++ => :plus +@ => :at +/ => :forward_slash +\ => :back_slash +* => :asterisk +< => :less_than +> => :greater_than +^ => :greater_than +& => :ampersand +² => :superscript_two +§ => :section_sign +? => :question_mark +% => :percent_sign +º => :ordinal_indicator +right arrow => :right +left arrow => :left +down arrow => :down +up arrow => :up +delete key => :delete +control key => :control +windows key/command key => :meta +alt key => :alt +``` diff --git a/docs/todo/07-mouse.md b/docs/todo/07-mouse.md new file mode 100644 index 0000000..2af8854 --- /dev/null +++ b/docs/todo/07-mouse.md @@ -0,0 +1,48 @@ +# Mouse + +Determining current position of mouse: + +``` +args.inputs.mouse.x +args.inputs.mouse.y +``` + +Determining if the mouse has been clicked, and it's position. Note: +`click` and `down` are aliases for each other. + +``` +if args.inputs.mouse.click + puts "click: #{args.inputs.mouse.click}" + puts "x: #{args.inputs.mouse.click.point.x}" + puts "y: #{args.inputs.mouse.click.point.y}" +end +``` + +Determining if the mouse button has been released: + +``` +if args.inputs.mouse.up + puts "up: #{args.inputs.mouse.up}" + puts "x: #{args.inputs.mouse.up.point.x}" + puts "y: #{args.inputs.mouse.up.point.y}" +end +``` + +Determine which mouse button(s) have been clicked (also works for up): +``` +if args.inputs.mouse.click + puts "left: #{args.inputs.mouse.button_left}" + puts "middle: #{args.inputs.mouse.button_middle}" + puts "right: #{args.inputs.mouse.button_right}" + puts "x1: #{args.inputs.mouse.button_x1}" + puts "x2: #{args.inputs.mouse.button_x2}" +end +``` + +Determine if the mouse wheel is being used and its values for this tick: +``` +if args.inputs.mouse.wheel + puts "The wheel moved #{args.inputs.mouse.wheel.x} left/right" + puts "The wheel moved #{args.inputs.mouse.wheel.y} up/down" +end +``` diff --git a/docs/todo/08-controllers.md b/docs/todo/08-controllers.md new file mode 100644 index 0000000..68bd9c2 --- /dev/null +++ b/docs/todo/08-controllers.md @@ -0,0 +1,86 @@ +# Controllers + +There are two controllers you have access to: + +``` +args.inputs.controller_one +args.inputs.controller_two +``` + +Determining if a key was down: + +``` +if args.inputs.controller_one.key_down.a + puts 'The key was in the down state' +end +``` + +Determining if a key is being held: + +``` +if args.inputs.controller_one.key_held.a + puts 'The key is being held' +end +``` + +Determining if a key is released: + +``` +if args.inputs.controller_one.key_up.a + puts 'The key is being held' +end +``` + +# Truthy Keys + +You can access all triggered keys through `thruthy_keys` on `keyboard`, `controller_one`, and `controller_two`. + +This is how you would write all keys to a file. The game must be in the foreground and have focus for this data +to be recorded. + +``` +def tick args + [ + [args.inputs.keyboard, :keyboard], + [args.inputs.controller_one, :controller_one], + [args.inputs.controller_two, :controller_two] + ].each do |input, name| + if input.key_down.truthy_keys.length > 0 + args.gtk.write_file("mygame/app/#{name}_key_down_#{args.state.tick_count}", input.key_down.truthy_keys.to_s) + end + end +end +``` + +# List of keys: + +``` +args.inputs.controller_one.key_held.up +args.inputs.controller_one.key_held.down +args.inputs.controller_one.key_held.left +args.inputs.controller_one.key_held.right +args.inputs.controller_one.key_held.a +args.inputs.controller_one.key_held.b +args.inputs.controller_one.x +args.inputs.controller_one.y +args.inputs.controller_one.key_held.l1 +args.inputs.controller_one.key_held.r1 +args.inputs.controller_one.key_held.l2 +args.inputs.controller_one.key_held.r2 +args.inputs.controller_one.key_held.l3 +args.inputs.controller_one.key_held.r3 +args.inputs.controller_one.key_held.start +args.inputs.controller_one.key_held.select +args.inputs.controller_one.key_held.directional_up +args.inputs.controller_one.key_held.directional_down +args.inputs.controller_one.key_held.directional_left +args.inputs.controller_one.key_held.directional_right +args.inputs.controller_one.left_analog_x_raw, +args.inputs.controller_one.left_analog_y_raw, +args.inputs.controller_one.left_analog_x_perc, +args.inputs.controller_one.left_analog_y_perc, +args.inputs.controller_one.right_analog_x_raw, +args.inputs.controller_one.right_analog_y_raw, +args.inputs.controller_one.right_analog_x_perc, +args.inputs.controller_one.right_analog_y_perc +``` diff --git a/docs/todo/09-scaling.md b/docs/todo/09-scaling.md new file mode 100644 index 0000000..9f63748 --- /dev/null +++ b/docs/todo/09-scaling.md @@ -0,0 +1,87 @@ +# Scaling + +The general idea is (for example): You'll have `sprite.png` + +- If you are missing `@1080p`, `sprite.png` will be scaled 1.5. +- If you're missing `@1440p`, `sprite.png`. + +And so on. In code, always use `sprite.png` paths withouth the @, and GTK will figure out the right png to use. + +``` ++------------+-------+------+------+------+------+------+------+------+------+ +| Resolution | @Name | Unit | 720 | 1080 | 1440 | 4K | 5K | 6K | 8K | ++------------+-------+-----:+-----:+-----:+-----:+-----:+-----:+-----:+-----:+ +| 1280x720 | 720p | 2px | 1x | - | - | - | - | - | - | +| 1920x1080 | 1080p | 3px | 1.5x | 1x | - | - | - | - | - | +| 2560x1440 | 1440p | 4px | 2x | - | 1x | - | - | - | - | +| 3840x2160 | 4K | 6px | 3x | 2x | - | 1x | - | - | - | +| 5120x2880 | 5K | 8px | 4x | - | 2x | - | 1x | - | - | +| 5760x3240 | 6K | 9px | 4.5x | 3x | - | - | - | 1x | - | +| 7680x4320 | 8K | 12px | 6x | 4x | 3x | 2x | - | - | 1x | ++------------+-------+------+------+------+------+------+------+------+------+ +| 640x360 | 360p | 2px | 0.5x | - | - | - | - | - | - | ++------------+-------+------+------+------+------+------+------+------+------+ +``` + +# Layout Theory (work in progress) + +Where it gets tricky is mobile. The algorithm there would be to find +the nearest pixel perfect resolution and then allow for rendering +outside of the logical canvas, which will be centered in the +screen. `grid.left` in these cases will be a negative number and will +exclude "unsafe" areas (which are only applicable to phones with edge +to edge screens... god help us all if I have to introduce a +`grid.(left|right|top|bottom)_unsafe`). + +## Variables that need to be considered. + +- logical pixel of device +- logical pixels of canvas (720p) +- physical pixel of device + +## Well known aspect ratios + + - 720p + - 1080p + - 1440p + - 4k + - 5k + - 6k + - 8k + +## Laws that support Layout Theory + + - Logical pixels is 720p for a game. + - The logical pixels for the game is centered in the device. + - The logical pixesl is the only safe area for the game. + +## Math + + 1. Take the logical widht and height of the iphone, assume the thinner part is the "9" of the "16:9" aspect ratio. Example: 414 / 896 = 720 / x ... x = 1558 + 2. Determine the scale down from the 720 to the target "9". Example: 720 * x = 414 ... x = .575 + 3. Determine the "other side" of the 16?? : 9 aspect ratio for the target device (which might not be 16). Example: 1280 / 1558 = x / 896 ... x = 736 + 4. And then scale that down. Example: 1558.3 * .575 ... x = 896 + 5. Determine the 16:9 scaled. Example 414 x 736 + 6. Determine the unsafe area. Example: (896 - 736) / 2 = 65 + 7. Verify the math and make sure the aspect ratio makes sense. Example: 1558 / (720 / 9) = 19.5 + 8. Verify result. Example: 9 : 19.5 with 1.75 unsafe on either side = 140 logical pixels on + either side To support iPhone 11 Pro, you must render a game where you render -140 to 1420. 720 x 1280 logical. + +## Scale Table + +The Physical pixels for the iPhone 11 is 1242 X 2688. This is used to determine which texture will be used from the texture atlas. + +``` ++------------+-------+------+------+------+------+------+------+------+------+ +| Resolution | @Name | Unit | 720 | 1080 | 1440 | 4K | 5K | 6K | 8K | ++------------+-------+-----:+-----:+-----:+-----:+-----:+-----:+-----:+-----:+ +| 1280x720 | - | 2px | 1x | - | - | - | - | - | - | +| 1920x1080 | 1080p | 3px | 1.5x | 1x | - | - | - | - | - | +| 2560x1440 | 1440p | 4px | 2x | - | 1x | - | - | - | - | +| 3840x2160 | 4K | 6px | 3x | 2x | - | 1x | - | - | - | +| 5120x2880 | 5K | 8px | 4x | - | 2x | - | 1x | - | - | +| 5760x3240 | 6K | 9px | 4.5x | 3x | - | - | - | 1x | - | +| 7680x4320 | 8K | 12px | 6x | 4x | 3x | 2x | - | - | 1x | ++------------+-------+------+------+------+------+------+------+------+------+ +``` diff --git a/docs/todo/99-todo.md b/docs/todo/99-todo.md new file mode 100644 index 0000000..39c542a --- /dev/null +++ b/docs/todo/99-todo.md @@ -0,0 +1,89 @@ +# Documentation That Needs to be Organized + +## Class macro gtk_args + +Here's how you can use the `gtk_args` class method: + +```ruby +class Game + gtk_args + attr_accessor :current_scene, :other_custom_attrs + + def tick + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.tick +end +``` + +The code above is the similar to: + +```ruby +class Game + attr_accessor :args, :grid, :state, :inputs, :outputs, :gtk, :passes, + :current_scene, :other_custom_attrs + + def tick + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.grid = args.grid + $game.state = args.state + $game.outputs = args.outputs + $game.gtk = args.gtk + $game.passes = args.passes + $game.tick +end +``` + +## Monkey patching the runtime + +You're on your own if you do this :grimacing: + +```ruby +module GTK + class Runtime + alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__) + + def tick_core + __original_tick_core__ + $top_level.oh @args + $top_level.god @args + $top_level.why @args + end + end +end + +def tick args +end + +def oh args +end + +def god args +end + +def why args +end +``` + +## MP3's to Wav converstion script: + +```ruby +`ls .`.each_line.to_a.map do |l| + l = l.strip + if l.end_with? "mp3" + `ffmpeg -i #{l} -acodec pcm_s16le -ar 44100 prep-#{l.split(".")[0]}.wav` + `ffmpeg -y -i prep-#{l.split(".")[0]}.wav -f wav -bitexact -acodec pcm_s16le -ar 44100 -ac 1 #{l.split(".")[0]}.wav` + end +end +``` diff --git a/dragon/args.rb b/dragon/args.rb index 0e6ff6f..38a28b7 100644 --- a/dragon/args.rb +++ b/dragon/args.rb @@ -41,7 +41,7 @@ module GTK # @return [OpenEntity] attr_accessor :state - # Gives you access to the top level DragonRuby runtime. + # Gives you access to the top level DragonRuby runtime. # # @return [Runtime] attr_accessor :runtime @@ -49,20 +49,24 @@ module GTK attr_accessor :passes + attr_accessor :wizards + def initialize runtime, recording @inputs = Inputs.new - @outputs = Outputs.new + @outputs = Outputs.new args: self @passes = [] @state = OpenEntity.new @state.tick_count = -1 @runtime = runtime @recording = recording - @grid = Grid.new runtime.ffi_draw + @grid = Grid.new runtime @render_targets = {} @all_tests = [] @geometry = GTK::Geometry + @wizards = Wizards.new end + # The number of ticks since the start of the game. # # @return [Integer] @@ -89,13 +93,21 @@ module GTK end def clear_render_targets + render_targets_clear + end + + def render_targets_clear @render_targets = {} end + def render_targets + @render_targets + end + def render_target name name = name.to_s if !@render_targets[name] - @render_targets[name] = Outputs.new(target: name, background_color_override: [255, 255, 255, 0]) + @render_targets[name] = Outputs.new(args: self, target: name, background_color_override: [255, 255, 255, 0]) @passes << @render_targets[name] end @render_targets[name] diff --git a/dragon/array_docs.rb b/dragon/array_docs.rb new file mode 100644 index 0000000..93d12a5 --- /dev/null +++ b/dragon/array_docs.rb @@ -0,0 +1,310 @@ +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# array_docs.rb has been released under MIT (*only this file*). + +module ArrayDocs + def docs_method_sort_order + [ + :docs_class, + :docs_map, + :docs_each, + :docs_reject_nil, + :docs_reject_false, + :docs_product, + :docs_map_2d, + :docs_include_any?, + :docs_any_intersect_rect? + ] + end + + def docs_include_any? + <<-S +* DOCS: ~Array#include_any?~ + +Given a collection of items, the function will return +~true~ if any of ~self~'s items exists in the collection of items passed in: + +S + end + + def docs_class + <<-S +* DOCS: ~Array~ + +The Array class has been extend to provide methods that +will help in common game development tasks. Array is one of the most +powerful classes in Ruby and a very fundamental component of Game Toolkit. + +S + end + + def docs_reject_nil + <<-S +* DOCS: ~Array#reject_nil~ + +Returns an ~Enumerable~ rejecting items that are ~nil~, this is an alias +for ~Array#compact~: + +#+begin_src + repl do + a = [1, nil, 4, false, :a] + puts a.reject_nil + # => [1, 4, false, :a] + puts a.compact + # => [1, 4, false, :a] + end +#+end_src + +S + end + + def docs_reject_false + <<-S +* DOCS: ~Array#reject_false~ + +Returns an `Enumerable` rejecting items that are `nil` or `false`. + +#+begin_src + repl do + a = [1, nil, 4, false, :a] + puts a.reject_false + # => [1, 4, :a] + end +#+end_src + +S + end + + def docs_product + <<-S +* DOCS: ~Array#product~ + +Returns all combinations of values between two arrays. + +Here are some examples of using ~product~. Paste the +following code at the bottom of main.rb and save +the file to see the results: + +#+begin_src + repl do + a = [0, 1] + puts a.product + # => [[0, 0], [0, 1], [1, 0], [1, 1]] + end +#+end_src + +#+begin_src + repl do + a = [ 0, 1] + b = [:a, :b] + puts a.product b + # => [[0, :a], [0, :b], [1, :a], [1, :b]] + end +#+end_src + +S + end + + def docs_map_2d + <<-S +* DOCS: ~Array#map_2d~ + +Assuming the array is an array of arrays, Given a block, each 2D array index invoked against the block. +A 2D array is a common way to store data/layout for a stage. + +#+begin_src + repl do + stage = [ + [:enemy, :empty, :player], + [:empty, :empty, :empty], + [:enemy, :empty, :enemy], + ] + + occupied_tiles = stage.map_2d do |row, col, tile| + if tile == :empty + nil + else + [row, col, tile] + end + end.reject_nil + + puts "Stage:" + puts stage + + puts "Occupied Tiles" + puts occupied_tiles + end +#+end_src + +S + end + + def docs_any_intersect_rect? + <<-S +* DOCS: ~Array#any_intersect_rect?~ + +Assuming the array contains objects that respond to ~left~, ~right~, ~top~, ~bottom~, +this method returns ~true~ if any of the elements within +the array intersect the object being passed in. You are given an optional +parameter called ~tolerance~ which informs how close to the other rectangles +the elements need to be for it to be considered intersecting. + +The default tolerance is set to ~0.1~, which means that the primitives are not +considered intersecting unless they are overlapping by more than ~0.1~. + +#+begin_src + repl do + # Here is a player class that has position and implement + # the ~attr_rect~ contract. + class Player + attr_rect + attr_accessor :x, :y, :w, :h + + def initialize x, y, w, h + @x = x + @y = y + @w = w + @h = h + end + + def serialize + { x: @x, y: @y, w: @w, h: @h } + end + + def inspect + "\#{serialize}" + end + + def to_s + "\#{serialize}" + end + end + + # Here is a definition of two walls. + walls = [ + [10, 10, 10, 10], + { x: 20, y: 20, w: 10, h: 10 }, + ] + + # Display the walls. + puts "Walls." + puts walls + puts "" + + # Check any_intersect_rect? on player + player = Player.new 30, 20, 10, 10 + puts "Is Player \#{player} touching wall?" + puts (walls.any_intersect_rect? player) + # => false + # The value is false because of the default tolerance is 0.1. + # The overlap of the player rect and any of the wall rects is + # less than 0.1 (for those that intersect). + puts "" + + player = Player.new 9, 10, 10, 10 + puts "Is Player \#{player} touching wall?" + puts (walls.any_intersect_rect? player) + # => true + puts "" + end +#+end_src + +S + end + + def docs_map + <<-S +* DOCS: ~Array#map~ + +The function given a block returns a new ~Enumerable~ of values. + +Example of using ~Array#map~ in conjunction with ~args.state~ and +~args.outputs.sprites~ to render sprites to the screen. + +#+begin_src + def tick args + # define the colors of the rainbow in ~args.state~ + # as an ~Array~ of ~Hash~es with :order and :name. + # :order will be used to determine render location + # and :name will be used to determine sprite path. + args.state.rainbow_colors ||= [ + { order: 0, name: :red }, + { order: 1, name: :orange }, + { order: 2, name: :yellow }, + { order: 3, name: :green }, + { order: 4, name: :blue }, + { order: 5, name: :indigo }, + { order: 6, name: :violet }, + ] + + # render sprites diagonally to the screen + # with a width and height of 50. + args.outputs + .sprites << args.state + .rainbow_colors + .map do |color| # <-- ~Array#map~ usage + [ + color[:order] * 50, + color[:order] * 50, + 50, + 50, + "sprites/square-\#{color[:name]}.png" + ] + end + end +#+end_src + +S + end + + def docs_each + <<-S +* DOCS: ~Array#each~ + +The function, given a block, invokes the block for each item in the +~Array~. ~Array#each~ is synonymous to foreach constructs in other languages. + +Example of using ~Array#each~ in conjunction with ~args.state~ and +~args.outputs.sprites~ to render sprites to the screen: + +#+begin_src + def tick args + # define the colors of the rainbow in ~args.state~ + # as an ~Array~ of ~Hash~es with :order and :name. + # :order will be used to determine render location + # and :name will be used to determine sprite path. + args.state.rainbow_colors ||= [ + { order: 0, name: :red }, + { order: 1, name: :orange }, + { order: 2, name: :yellow }, + { order: 3, name: :green }, + { order: 4, name: :blue }, + { order: 5, name: :indigo }, + { order: 6, name: :violet }, + ] + + # render sprites diagonally to the screen + # with a width and height of 50. + args.state + .rainbow_colors + .map do |color| # <-- ~Array#each~ usage + args.outputs.sprites << [ + color[:order] * 50, + color[:order] * 50, + 50, + 50, + "sprites/square-\#{color[:name]}.png" + ] + end + end +#+end_src + +S + end +end + +class Array + extend Docs + extend ArrayDocs +end diff --git a/dragon/assert.rb b/dragon/assert.rb index 0eb8c2a..0c26f29 100644 --- a/dragon/assert.rb +++ b/dragon/assert.rb @@ -4,13 +4,57 @@ # assert.rb has been released under MIT (*only this file*). module GTK +=begin +This is a tiny assertion api for the unit testing portion of Game Toolkit. + +@example + +1. Create a file called tests.rb under mygame. +2. Any method that begins with the word test_ will be considered a test. + +def test_this_works args, assert + assert.equal! 1, 1 +end + +3. To run a test, save the file while the game is running. + +@example + +To add an assertion open up this class and write: + +class Assert + def custom_assertion actual, expected, message = nil + # this tell Game Toolkit that an assertion was performed (so that the test isn't marked inconclusive). + @assertion_performed = true + + # perform your custom logic here and rais an exception to denote a failure. + + raise "Some Error. #{message}." + end +end +=end class Assert attr :assertion_performed +=begin +Us this if you are throwing your own exceptions and you want to mark the tests as ran (so that it wont be marked as inconclusive). +=end def ok! @assertion_performed = true end +=begin +Assert if a value is a thruthy value. All assert method take an optional final parameter that is the message to display to the user. + +@example + +def test_does_this_work args, assert + some_result = Person.new + assert.true! some_result + # OR + assert.true! some_result, "Person was not created." +end +=end def true! value, message = nil @assertion_performed = true if !value @@ -20,6 +64,16 @@ module GTK nil end +=begin +Assert if a value is a falsey value. + +@example + +def test_does_this_work args, assert + some_result = nil + assert.false! some_result +end +=end def false! value, message = nil @assertion_performed = true if value @@ -29,16 +83,39 @@ module GTK nil end +=begin +Assert if two values are equal. + +@example + +def test_does_this_work args, assert + a = 1 + b = 1 + assert.equal! a, b +end +=end def equal! actual, expected, message = nil @assertion_performed = true if actual != expected actual_string = "#{actual}#{actual.nil? ? " (nil) " : " " }".strip - message = "actual: #{actual_string} did not equal expected: #{expected}.\n#{message}" + message = "actual:\n#{actual_string} did not equal\nexpected:\n#{expected}.\n#{message}" raise message end nil end +=begin +Assert if a value is explicitly nil (not false). + +@example + +def test_does_this_work args, assert + a = nil + b = false + assert.nil! a # this will pass + assert.nil! b # this will throw an exception. +end +=end def nil! value, message = nil @assertion_performed = true if !value.nil? @@ -47,18 +124,5 @@ module GTK end nil end - - def raises! exception_class, message = nil - @assertion_performed = true - begin - yield - rescue exception_class - return # Success - rescue Exception => e - raise "Expected #{exception_class.name} to be raised but instead #{e.class.name} was raised\n#{message}" - else - raise "Expected #{exception_class.name} to be raised but nothing was raised\n#{message}" - end - end end end diff --git a/dragon/attr_sprite.rb b/dragon/attr_sprite.rb index e47e051..81701ec 100644 --- a/dragon/attr_sprite.rb +++ b/dragon/attr_sprite.rb @@ -3,18 +3,7 @@ # attr_sprite.rb has been released under MIT (*only this file*). # @private -module AttrSprite - include GTK::Geometry - - attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x, - :tile_y, :tile_w, :tile_h, :flip_horizontally, - :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id, - :source_x, :source_y, :source_w, :source_h - - def primitive_marker - :sprite - end - +module AttrRect def left @x end @@ -30,6 +19,20 @@ module AttrSprite def top @y + @h end +end + +module AttrSprite + include AttrRect + include GTK::Geometry + + attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x, + :tile_y, :tile_w, :tile_h, :flip_horizontally, + :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id, + :source_x, :source_y, :source_w, :source_h + + def primitive_marker + :sprite + end def sprite self diff --git a/dragon/console.rb b/dragon/console.rb index 4f2abab..c90755a 100644 --- a/dragon/console.rb +++ b/dragon/console.rb @@ -7,214 +7,18 @@ module GTK class Console - class Color - def initialize(color) - @color = color - @color << 255 if @color.size == 3 - end - - def mult_alpha(alpha_modifier) - Color.new [@color[0], @color[1], @color[2], (@color[3].to_f * alpha_modifier).to_i] - end - - # Support splat operator - def to_a - @color - end - - def to_h - { r: @color[0], g: @color[1], b: @color[2], a: @color[3] } - end - end - - class FontStyle - attr_reader :font, :size_enum, :line_height - - def initialize(font:, size_enum:, line_height:) - @font = font - @size_enum = size_enum - @line_height = line_height - end - - def letter_size - @letter_size ||= $gtk.calcstringbox 'W', size_enum, font - end - - def line_height_px - @line_height_px ||= letter_size.y * line_height - end - - def label(x:, y:, text:, color:, alignment_enum: 0) - { - x: x, - y: y.shift_up(line_height_px), # !!! FIXME: remove .shift_up(line_height_px) when we fix coordinate origin on labels. - text: text, - font: font, - size_enum: size_enum, - alignment_enum: alignment_enum, - **color.to_h, - }.label - end - end - - class Prompt - attr_accessor :current_input_str, :font_style, :console_text_width - - def initialize(font_style:, text_color:, console_text_width:) - @prompt = '-> ' - @current_input_str = '' - @font_style = font_style - @text_color = text_color - @cursor_color = Color.new [187, 21, 6] - @console_text_width = console_text_width - - @last_autocomplete_prefix = nil - @next_candidate_index = 0 - end - - def <<(str) - @current_input_str << str - reset_autocomplete - end - - def backspace - @current_input_str.chop! - reset_autocomplete - end - - def clear - @current_input_str = '' - reset_autocomplete - end - - def autocomplete - if !@last_autocomplete_prefix - @last_autocomplete_prefix = calc_autocomplete_prefix - - puts "* AUTOCOMPLETE CANDIDATES: #{current_input_str}.." - pretty_print_strings_as_table method_candidates(@last_autocomplete_prefix) - else - candidates = method_candidates(@last_autocomplete_prefix) - return if candidates.empty? - - candidate = candidates[@next_candidate_index] - candidate = candidate[0..-2] + " = " if candidate.end_with? '=' - @next_candidate_index += 1 - @next_candidate_index = 0 if @next_candidate_index >= candidates.length - self.current_input_str = display_autocomplete_candidate(candidate) - end - end - - def pretty_print_strings_as_table items - if items.length == 0 - puts <<-S.strip -+--------+ -| (none) | -+--------+ -S - else - # figure out the largest string - string_width = items.sort_by { |c| -c.to_s.length }.first - - # add spacing to each side of the string which represents the cell width - cell_width = string_width.length + 2 - - # add spacing to each side of the cell to represent the column width - column_width = cell_width + 2 - - # determine the max number of columns that can fit on the screen - columns = @console_text_width.idiv column_width - columns = items.length if items.length < columns - - # partition the original list of items into a string to be printed - items.each_slice(columns).each_with_index do |cells, i| - pretty_print_row_seperator string_width, cell_width, column_width, columns - pretty_print_row cells, string_width, cell_width, column_width, columns - end - - pretty_print_row_seperator string_width, cell_width, column_width, columns - end - end - - def pretty_print_row cells, string_width, cell_width, column_width, columns - # if the number of cells doesn't match the number of columns, then pad the array with empty values - cells += (columns - cells.length).map { "" } - - # right align each cell value - formated_row = "|" + cells.map do |c| - "#{" " * (string_width.length - c.length) } #{c} |" - end.join - - # remove seperators between empty values - formated_row = formated_row.gsub(" | ", " ") - - puts formated_row - end - - def pretty_print_row_seperator string_width, cell_width, column_width, columns - # this is a joint: +-------- - column_joint = "+#{"-" * cell_width}" - - # multiple joints create a row seperator: +----+----+ - puts (column_joint * columns) + "+" - end - - def render(args, x:, y:) - args.outputs.reserved << font_style.label(x: x, y: y, text: "#{@prompt}#{current_input_str}", color: @text_color) - args.outputs.reserved << font_style.label(x: x - 2, y: y + 3, text: (" " * (@prompt.length + current_input_str.length)) + "|", color: @cursor_color) - end - - private - - def last_period_index - current_input_str.rindex('.') - end - - def calc_autocomplete_prefix - if last_period_index - current_input_str[(last_period_index + 1)..-1] - else - current_input_str - end - end - - def current_object - return Kernel unless last_period_index - - Kernel.eval(current_input_str[0...last_period_index]) - rescue NameError - nil - end - - def method_candidates(prefix) - current_object.autocomplete_methods.map(&:to_s).select { |m| m.start_with? prefix } - end - - def display_autocomplete_candidate(candidate) - if last_period_index - @current_input_str[0..last_period_index] + candidate.to_s - else - candidate.to_s - end - end - - def reset_autocomplete - @last_autocomplete_prefix = nil - @next_candidate_index = 0 - end - end - attr_accessor :show_reason, :log, :logo, :background_color, :text_color, :animation_duration, :max_log_lines, :max_history, :log, :last_command_errored, :last_command, :error_color, :shown_at, :header_color, :archived_log, :last_log_lines, :last_log_lines_count, :suppress_left_arrow_behavior, :command_set_at, - :toast_ids, - :font_style + :toast_ids, :bottom, + :font_style, :menu def initialize - @font_style = FontStyle.new(font: 'font.ttf', size_enum: 0, line_height: 1.1) + @font_style = FontStyle.new(font: 'font.ttf', size_enum: -1, line_height: 1.1) + @menu = Menu.new self @disabled = false @log_offset = 0 @visible = false @@ -223,6 +27,7 @@ S @log = [ 'Console ready.' ] @max_log_lines = 1000 # I guess...? @max_history = 1000 # I guess...? + @log_invocation_count = 0 @command_history = [] @command_history_index = -1 @nonhistory_input = '' @@ -273,6 +78,7 @@ S end def addsprite obj + @log_invocation_count += 1 obj[:id] ||= "id_#{obj[:path]}_#{Time.now.to_i}".to_sym if @last_line_log_index && @@ -300,6 +106,7 @@ S def addtext obj @last_log_lines_count ||= 1 + @log_invocation_count += 1 str = obj.to_s @@ -484,7 +291,17 @@ S end @last_command_errored = false rescue Exception => e + string_e = "#{e}" @last_command_errored = true + if (string_e.include? "wrong number of arguments") + method_name = (string_e.split ":")[0].gsub "'", "" + results = Kernel.docs_search method_name + if !results.include "* DOCS: No results found." + puts results + log results + end + end + puts "#{e}" log "#{e}" end @@ -539,43 +356,54 @@ S @log_offset = 0 if @log_offset < 0 end - def process_inputs args - if console_toggle_key_down? args - args.inputs.text.clear - toggle - end + def mouse_wheel_scroll args + @inertia ||= 0 - return unless visible? + if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0 + @inertia = 1 + elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0 + @inertia = -1 + end - if !@suppress_left_arrow_behavior && args.inputs.keyboard.key_down.left && current_input_str.strip.length > 0 - log_info "Use repl.rb!", <<-S -The Console is nice for quick commands, but for more complex edits, use repl.rb. + if args.inputs.mouse.click + @inertia = 0 + end -I've written the current command at the top of a file called ./repl.rb (right next to dragonruby(.exe)). Please open the the file and apply additional edits there. -S - if @last_command_written_to_repl_rb != current_input_str - @last_command_written_to_repl_rb = current_input_str - contents = $gtk.read_file 'app/repl.rb' - contents ||= '' - contents = <<-S + contents - -# Remove the x from xrepl to run the command. -xrepl do - #{@last_command_written_to_repl_rb} -end + return if @inertia == 0 -S - $gtk.suppress_hotload = true - $gtk.write_file 'app/repl.rb', contents - $gtk.reload_if_needed 'app/repl.rb', true - $gtk.suppress_hotload = false + if @inertia != 0 + @inertia = (@inertia * 0.7) + if @inertia > 0 + @log_offset -= 1 + elsif @inertia < 0 + @log_offset += 1 end + end - return + if @inertia.abs < 0.01 + @inertia = 0 + end + + if @log_offset > @log.size + @log_offset = @log.size + elsif @log_offset < 0 + @log_offset = 0 end + end + + def process_inputs args + if console_toggle_key_down? args + args.inputs.text.clear + toggle + end + + return unless visible? args.inputs.text.each { |str| prompt << str } args.inputs.text.clear + mouse_wheel_scroll args + + @log_offset = 0 if @log_offset < 0 if args.inputs.keyboard.key_down.enter eval_the_set_command @@ -589,7 +417,7 @@ S end if @command_history_index < (@command_history.length - 1) @command_history_index += 1 - self.current_input_str = @command_history[@command_history_index].clone + self.current_input_str = @command_history[@command_history_index].dup end elsif args.inputs.keyboard.key_down.down if @command_history_index == 0 @@ -598,7 +426,7 @@ S @nonhistory_input = '' elsif @command_history_index > 0 @command_history_index -= 1 - self.current_input_str = @command_history[@command_history_index].clone + self.current_input_str = @command_history[@command_history_index].dup end elsif inputs_scroll_up_full? args scroll_up_full @@ -626,7 +454,7 @@ S def write_primitive_and_return_offset(args, left, y, str, archived: false) if str.is_a?(Hash) padding = 10 - args.outputs.reserved << [left + 10, y - padding * 1.66, str[:w], str[:h], str[:path]].sprite + args.outputs.reserved << [left + 10, y + 5, str[:w], str[:h], str[:path]].sprite return str[:h] + padding else write_line args, left, y, str, archived: archived @@ -641,25 +469,25 @@ S args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color) end + def should_tick? + return false if !@toggled_at + return false if slide_progress == 0 + return false if @disabled + return visible? + end + def render args return if !@toggled_at + return if slide_progress == 0 - if visible? - percent = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip) - else - percent = @toggled_at.global_ease(@animation_duration, :flip, :quint) - end - - return if percent == 0 + @bottom = top - (h * slide_progress) + args.outputs.reserved << [left, @bottom, w, h, *@background_color.mult_alpha(slide_progress)].solid + args.outputs.reserved << [right.shift_left(110), @bottom.shift_up(630), 100, 100, @logo, 0, (80.0 * slide_progress).to_i].sprite - bottom = top - (h * percent) - args.outputs.reserved << [left, bottom, w, h, *@background_color.mult_alpha(percent)].solid - args.outputs.reserved << [right.shift_left(210), bottom.shift_up(540), 200, 200, @logo, 0, (80.0 * percent).to_i].sprite - - y = bottom + 2 # just give us a little padding at the bottom. + y = @bottom + 2 # just give us a little padding at the bottom. prompt.render args, x: left.shift_right(10), y: y y += line_height_px * 1.5 - args.outputs.reserved << line(y: y, color: @text_color.mult_alpha(percent)) + args.outputs.reserved << line(y: y, color: @text_color.mult_alpha(slide_progress)) y += line_height_px.to_f / 2.0 ((@log.size - @log_offset) - 1).downto(0) do |idx| @@ -668,8 +496,8 @@ S break if y > top end - # past log seperator - args.outputs.reserved << line(y: y + line_height_px.half, color: @text_color.mult_alpha(0.25 * percent)) + # past log separator + args.outputs.reserved << line(y: y + line_height_px.half, color: @text_color.mult_alpha(0.25 * slide_progress)) y += line_height_px @@ -682,6 +510,63 @@ S render_log_offset args end + def tick_help args + tick_help_debounce args + alpha_rate = 20 + @render_help_target_alpha ||= 255 + @render_help_current_alpha ||= 255 + @render_help_target_alpha += 4 if @render_help_current_alpha == @render_help_target_alpha + @render_help_current_alpha = (@render_help_current_alpha.towards @render_help_target_alpha, 20) + + @render_help_target_alpha = @render_help_target_alpha.clamp(-255, 255) + @render_help_current_alpha = @render_help_current_alpha.clamp(-255, 255) + + [ + "* Prompt Commands: ", + "You can type any of the following ", + "commands in the command prompt. ", + "** docs: Provides API docs. ", + "** $gtk: Accesses the global runtime.", + "* Shortcut Keys: ", + "** full page up: ctrl + b ", + "** full page down: ctrl + f ", + "** half page up: ctrl + u ", + "** half page down: ctrl + d ", + "** clear prompt: ctrl + g ", + "** up arrow: next command ", + "** down arrow: prev command ", + ].each_with_index do |s, i| + args.outputs.reserved << [args.grid.right - 10, + top - 100 - line_height_px * i * 0.8, + s, -3, 2, 180, 180, 180, (@render_help_current_alpha.clamp 0, 255)].label + end + end + + def tick_help_debounce args + hide_log_alpha = -255 + if hidden? + @render_help_current_alpha = -255 + end + + if prompt.last_input_str_changed + @render_help_target_alpha = hide_log_alpha + end + + if args.inputs.mouse.moved + @render_help_target_alpha = hide_log_alpha + end + + if args.inputs.mouse.wheel + @render_help_target_alpha = hide_log_alpha + end + + if @render_help_last_log_invocation_count != @log_invocation_count + @render_help_target_alpha = hide_log_alpha + end + + @render_help_last_log_invocation_count = @log_invocation_count + end + def render_log_offset args return if @log_offset <= 0 args.outputs.reserved << font_style.label( @@ -735,9 +620,18 @@ S begin return if @disabled render args - calc args process_inputs args + return unless should_tick? + calc args + tick_help args + prompt.tick + menu.tick args rescue Exception => e + begin + puts "#{e}" + puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby." + rescue + end @disabled = true $stdout.puts e $stdout.puts "* FATAL: The GTK::Console console threw an unhandled exception and has been reset. You should report this exception (along with reproduction steps) to DragonRuby." @@ -745,9 +639,23 @@ S end def set_command_with_history_silent command, histories, show_reason = nil - @command_history.concat histories - @command_history << command if @command_history[-1] != command - self.current_input_str = command if @command_set_at != Kernel.global_tick_count + set_command_extended command: command, histories: histories, show_reason: show_reason + end + + def defaults_set_command_extended + { + command: "puts 'Hello World'", + histories: [], + show_reason: nil, + force: false + } + end + + def set_command_extended opts + opts = defaults_set_command_extended.merge opts + @command_history.concat opts[:histories] + @command_history << opts[:command] if @command_history[-1] != opts[:command] + self.current_input_str = opts[:command] if @command_set_at != Kernel.global_tick_count || opts[:force] @command_set_at = Kernel.global_tick_count @command_history_index = -1 save_history @@ -768,6 +676,22 @@ S set_command_with_history_silent command, [], show_reason end + def set_system_command command, show_reason = nil + if $gtk.platform == "Mac OS X" + set_command_silent "$gtk.system \"open #{command}\"" + else + set_command_silent "$gtk.system \"start #{command}\"" + end + end + + def system_command + if $gtk.platform == "Mac OS X" + "open" + else + "start" + end + end + private def w @@ -802,14 +726,24 @@ S log_entry[0] == "|" end - def color_for_log_entry(log_entry) + def include_header_marker? log_entry + return false if log_entry.include? "NOTIFY:" + return false if log_entry.include? "INFO:" + return true if log_entry.include? "DOCS:" + (log_entry.start_with? "* ") || + (log_entry.start_with? "** ") || + (log_entry.start_with? "*** ") + end + def color_for_log_entry(log_entry) if include_row_marker? log_entry @text_color elsif include_error_marker? log_entry @error_color elsif include_subdued_markers? log_entry @text_color.mult_alpha(0.5) + elsif include_header_marker? log_entry + @header_color elsif log_entry.start_with?("====") || log_entry.include?("app") && !log_entry.include?("apple") @header_color else @@ -835,5 +769,15 @@ S @prompt.clear :console_silent_eval end + + def slide_progress + return 0 if !@toggled_at + if visible? + @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint, :flip) + else + @slide_progress = @toggled_at.global_ease(@animation_duration, :flip, :quint) + end + @slide_progress + end end end diff --git a/dragon/console_color.rb b/dragon/console_color.rb new file mode 100644 index 0000000..f5b164d --- /dev/null +++ b/dragon/console_color.rb @@ -0,0 +1,30 @@ +# Copyright 2019 DragonRuby LLC +# MIT License +# console_color.rb has been released under MIT (*only this file*). + +# Contributors outside of DragonRuby who also hold Copyright: +# - Kevin Fischer: https://github.com/kfischer-okarin + +module GTK + class Console + class Color + def initialize(color) + @color = color + @color << 255 if @color.size == 3 + end + + def mult_alpha(alpha_modifier) + Color.new [@color[0], @color[1], @color[2], (@color[3].to_f * alpha_modifier).to_i] + end + + # Support splat operator + def to_a + @color + end + + def to_h + { r: @color[0], g: @color[1], b: @color[2], a: @color[3] } + end + end + end +end diff --git a/dragon/console_font_style.rb b/dragon/console_font_style.rb new file mode 100644 index 0000000..8efab4f --- /dev/null +++ b/dragon/console_font_style.rb @@ -0,0 +1,40 @@ +# Copyright 2019 DragonRuby LLC +# MIT License +# console_font_style.rb has been released under MIT (*only this file*). + +# Contributors outside of DragonRuby who also hold Copyright: +# - Kevin Fischer: https://github.com/kfischer-okarin + +module GTK + class Console + class FontStyle + attr_reader :font, :size_enum, :line_height + + def initialize(font:, size_enum:, line_height:) + @font = font + @size_enum = size_enum + @line_height = line_height + end + + def letter_size + @letter_size ||= $gtk.calcstringbox 'W', size_enum, font + end + + def line_height_px + @line_height_px ||= letter_size.y * line_height + end + + def label(x:, y:, text:, color:, alignment_enum: 0) + { + x: x, + y: y.shift_up(line_height_px), # !!! FIXME: remove .shift_up(line_height_px) when we fix coordinate origin on labels. + text: text, + font: font, + size_enum: size_enum, + alignment_enum: alignment_enum, + **color.to_h, + }.label + end + end + end +end diff --git a/dragon/console_menu.rb b/dragon/console_menu.rb new file mode 100644 index 0000000..e8ce973 --- /dev/null +++ b/dragon/console_menu.rb @@ -0,0 +1,103 @@ +# Copyright 2019 DragonRuby LLC +# MIT License +# console_menu.rb has been released under MIT (*only this file*). + +module GTK + class Console + class Menu + def initialize console + @console = console + end + + def record_clicked + $recording.start 100 + end + + def replay_clicked + $replay.start 'replay.txt' + end + + def reset_clicked + $gtk.reset + end + + def scroll_up_clicked + @console.scroll_up_half + end + + def scroll_down_clicked + @console.scroll_down_half + end + + def close_clicked + @console.hide + end + + def tick args + return unless @console.visible? + + # defaults + @buttons = [ + (button id: :record, row: 0, col: 15, text: "record", method: :record_clicked), + (button id: :replay, row: 0, col: 16, text: "replay", method: :replay_clicked), + (button id: :reset, row: 0, col: 17, text: "reset", method: :reset_clicked), + (button id: :scroll_up, row: 0, col: 18, text: "scroll up", method: :scroll_up_clicked), + (button id: :scroll_down, row: 0, col: 19, text: "scroll down", method: :scroll_down_clicked), + (button id: :close, row: 0, col: 20, text: "close", method: :close_clicked), + ] + + # render + args.outputs.reserved << @buttons.map { |b| b[:primitives] } + + # inputs + if args.inputs.mouse.click + clicked = @buttons.find { |b| args.inputs.mouse.inside_rect? b[:rect] } + if clicked + send clicked[:method] + end + end + end + + def rect_for_layout row, col + col_width = 50 + row_height = 50 + col_margin = 5 + row_margin = 5 + x = (col_margin + (col * col_width) + (col * col_margin)) + y = (row_margin + (row * row_height) + (row * row_margin) + row_height).from_top + { x: x, y: y, w: row_height, h: col_width } + end + + def button args + id, row, col, text, method = args[:id], args[:row], args[:col], args[:text], args[:method] + + font_height = @console.font_style.line_height_px.half + { + id: id, + rect: (rect_for_layout row, col), + method: method + }.let do |entity| + primitives = [] + primitives << entity[:rect].merge(a: 80).solid + primitives << entity[:rect].merge(r: 255, g: 255, b: 255).border + primitives << text.wrapped_lines(5) + .map_with_index do |l, i| + [ + entity[:rect][:x] + entity[:rect][:w].half, + entity[:rect][:y] + entity[:rect][:h].half + font_height - (i * (font_height + 2)), + l, -3, 1, 255, 255, 255 + ] + end.labels + + entity.merge(primitives: primitives) + end + end + + def serialize + { + not_supported: "#{self}" + } + end + end + end +end diff --git a/dragon/console_prompt.rb b/dragon/console_prompt.rb new file mode 100644 index 0000000..aea5df8 --- /dev/null +++ b/dragon/console_prompt.rb @@ -0,0 +1,170 @@ +# Copyright 2019 DragonRuby LLC +# MIT License +# console_prompt.rb has been released under MIT (*only this file*). + +# Contributors outside of DragonRuby who also hold Copyright: +# - Kevin Fischer: https://github.com/kfischer-okarin + +module GTK + class Console + class Prompt + attr_accessor :current_input_str, :font_style, :console_text_width, :last_input_str, :last_input_str_changed + + def initialize(font_style:, text_color:, console_text_width:) + @prompt = '-> ' + @current_input_str = '' + @font_style = font_style + @text_color = text_color + @cursor_color = Color.new [187, 21, 6] + @console_text_width = console_text_width + + @last_autocomplete_prefix = nil + @next_candidate_index = 0 + end + + def <<(str) + @current_input_str << str + @current_input_changed_at = Kernel.global_tick_count + reset_autocomplete + end + + def backspace + @current_input_str.chop! + reset_autocomplete + end + + def clear + @current_input_str = '' + reset_autocomplete + end + + def autocomplete + if !@last_autocomplete_prefix + @last_autocomplete_prefix = calc_autocomplete_prefix + + puts "* AUTOCOMPLETE CANDIDATES: #{current_input_str}.." + pretty_print_strings_as_table method_candidates(@last_autocomplete_prefix) + else + candidates = method_candidates(@last_autocomplete_prefix) + return if candidates.empty? + + candidate = candidates[@next_candidate_index] + candidate = candidate[0..-2] + " = " if candidate.end_with? '=' + @next_candidate_index += 1 + @next_candidate_index = 0 if @next_candidate_index >= candidates.length + self.current_input_str = display_autocomplete_candidate(candidate) + end + end + + def pretty_print_strings_as_table items + if items.length == 0 + puts <<-S.strip ++--------+ +| (none) | ++--------+ +S + else + # figure out the largest string + string_width = items.sort_by { |c| -c.to_s.length }.first + + # add spacing to each side of the string which represents the cell width + cell_width = string_width.length + 2 + + # add spacing to each side of the cell to represent the column width + column_width = cell_width + 2 + + # determine the max number of columns that can fit on the screen + columns = @console_text_width.idiv column_width + columns = items.length if items.length < columns + + # partition the original list of items into a string to be printed + items.each_slice(columns).each_with_index do |cells, i| + pretty_print_row_seperator string_width, cell_width, column_width, columns + pretty_print_row cells, string_width, cell_width, column_width, columns + end + + pretty_print_row_seperator string_width, cell_width, column_width, columns + end + end + + def pretty_print_row cells, string_width, cell_width, column_width, columns + # if the number of cells doesn't match the number of columns, then pad the array with empty values + cells += (columns - cells.length).map { "" } + + # right align each cell value + formated_row = "|" + cells.map do |c| + "#{" " * (string_width.length - c.length) } #{c} |" + end.join + + # remove seperators between empty values + formated_row = formated_row.gsub(" | ", " ") + + puts formated_row + end + + def pretty_print_row_seperator string_width, cell_width, column_width, columns + # this is a joint: +-------- + column_joint = "+#{"-" * cell_width}" + + # multiple joints create a row seperator: +----+----+ + puts (column_joint * columns) + "+" + end + + def render(args, x:, y:) + args.outputs.reserved << font_style.label(x: x, y: y, text: "#{@prompt}#{current_input_str}", color: @text_color) + args.outputs.reserved << font_style.label(x: x - 2, y: y + 3, text: (" " * (@prompt.length + current_input_str.length)) + "|", color: @cursor_color) + end + + def tick + if (@current_input_changed_at) && + (@current_input_changed_at < Kernel.global_tick_count) && + (@last_input_str != @current_input_str) + @last_input_str_changed = true + @last_input_str = "#{@current_input_str}" + @current_input_changed_at = nil + else + @last_input_str_changed = false + end + end + + private + + def last_period_index + current_input_str.rindex('.') + end + + def calc_autocomplete_prefix + if last_period_index + current_input_str[(last_period_index + 1)..-1] + else + current_input_str + end + end + + def current_object + return Kernel unless last_period_index + + Kernel.eval(current_input_str[0...last_period_index]) + rescue NameError + nil + end + + def method_candidates(prefix) + current_object.autocomplete_methods.map(&:to_s).select { |m| m.start_with? prefix } + end + + def display_autocomplete_candidate(candidate) + if last_period_index + @current_input_str[0..last_period_index] + candidate.to_s + else + candidate.to_s + end + end + + def reset_autocomplete + @last_autocomplete_prefix = nil + @next_candidate_index = 0 + end + end + end +end diff --git a/dragon/directional_input_helper_methods.rb b/dragon/directional_input_helper_methods.rb index dcf5f07..0e7c118 100644 --- a/dragon/directional_input_helper_methods.rb +++ b/dragon/directional_input_helper_methods.rb @@ -51,11 +51,11 @@ S # # The possible results are: # - # - `nil` which denotes that no directional input exists. - # - `[ 0, 1]` which denotes that only up is being held/pressed. - # - `[ 0, -1]` which denotes that only down is being held/pressed. - # - `[ 1, 1]` which denotes that right and up are being pressed/held. - # - `[-1, -1]` which denotes that left and down are being pressed/held. + # - ~nil~ which denotes that no directional input exists. + # - ~[ 0, 1]~ which denotes that only up is being held/pressed. + # - ~[ 0, -1]~ which denotes that only down is being held/pressed. + # - ~[ 0.5, 0.5]~ which denotes that right and up are being pressed/held. + # - ~[-0.5, -0.5]~ which denotes that left and down are being pressed/held. # # @gtk def directional_vector diff --git a/dragon/docs.rb b/dragon/docs.rb index b9d3dbf..8f5e8bf 100644 --- a/dragon/docs.rb +++ b/dragon/docs.rb @@ -3,45 +3,578 @@ # MIT License # docs.rb has been released under MIT (*only this file*). -module GTK - class Docs - def map_with_ys +module DocsOrganizer + def self.sort_docs_classes! + $docs_classes.sort! do |l, r| + l_index = (class_sort_order.find_index l) || 50000 + r_index = (class_sort_order.find_index r) || 50000 + l_index = 51000 if l == :docs_classes + r_index = 51000 if r == :docs_classes + l_index <=> r_index + end + end + + def self.reserved_methods + [ + :docs_export_docs!, + :docs_all, + :docs_method_sort_order, + :docs_classes, + :docs_search + ] + end + + def self.class_sort_order + [ + GTK::ReadMe, + GTK::Runtime, + Array, + GTK::Outputs, + GTK::Mouse, + GTK::OpenEntity, + Numeric, + Kernel, + ] + end + + def self.check_class_sort_order + unsorted = $docs_classes.find_all do |klass| + !class_sort_order.include? klass + end + + unsorted.each do |k| + puts <<-S +* WARNING: #{klass.name} is not included in DocsOrganizer::class_sort_order. Please place this +module in it's correct topilogical order. +S + end + + if unsorted.length == 0 puts <<-S -* Numeric#map_with_ys -Numeric#map_with_ys is a helper method that is useful for working with coordinates -or rows with columns. Here is an example usage. +* INFO: Success. All documented classes have a sort order associated with them. +S + end + end + + def self.sort_method_delegate l, r, method_sort_order + l_index = (method_sort_order.find_index l) || 50000 + r_index = (method_sort_order.find_index r) || 50000 + l_index = 51000 if l == :docs_classes + r_index = 51000 if r == :docs_classes + l_index = -51000 if l == :docs_class + r_index = -51000 if r == :docs_class + l_index <=> r_index + end + + def self.find_methods_with_docs klass + klass_method_sort_order = klass.docs_method_sort_order + klass.methods.find_all { |m| m.start_with? 'docs_' } + .reject { |m| reserved_methods.include? m } + .sort do |l, r| + sort_method_delegate l, r, klass_method_sort_order + end + end +end + +module Docs + def self.extended klass + $docs_classes ||= [] + $docs_classes << klass + $docs_classes.uniq! + end + + def docs_method_sort_order + [] + end -Assume you have a grid with 10 rows (xs) and 5 columns (ys). You can generate -an array of hashes with the following form: + def docs_classes + DocsOrganizer.sort_docs_classes! + list = $docs_classes.map { |mod| "** #{mod.name}" }.join "\n" + <<-S + +* DOCS: +Here are the classes that have documentation. You can call the .docs method +on any of these classes: +#{list} +S + end + + def docs_all + docs_methods = DocsOrganizer.find_methods_with_docs(self).map { |d| send d }.join "\n" + <<-S +#{docs_methods} +S + end + + def docs + docs_methods = [DocsOrganizer.find_methods_with_docs(self), :docs_classes].flatten.map { |d| "** #{d}" }.join "\n" + if self == Kernel + <<-S + +* DOCS: #{self.name} +Some Classes in Game Toolkit have a method called docs. You can invoke this +method interactively to see information about functions within the engine. +For example, invoking ~Kernel.docs_tick_count~ will give you documentation +for the Kernel.tick_count method. + +To export all documentation you can use ~Kernel.export_docs!~ (or just ~export_docs!~). + +To search docs you can use Kernel.docs_search (or just `docs_search`) by providing it a search term. +For example: #+begin_src -[ - { x: 0, y: 0, some_data: "A" }, - { x: 0, y: 1, some_data: "A" }, - { x: 0, y: 2, some_data: "A" }, -... - { x: 9, y: 4, some_data: "A" }, -] + docs_search "array find remove nil" #+end_src -Using the following code: +You can do more advanced searches by providing a block: -#+begin_src ruby -array_of_hashes = 10.map_with_ys 5 do |x, y| - { x: x, y: y, some_data: "A" } -end +#+begin_src + docs_search do |entry| + (entry.include? "Array") && (!entry.include? "Enumerable") + end +#+end_src -Take a look at the "hexagon grid" sample app for a real world usage of -this method. +#{docs_methods} +** NOTE: Invoke any of the methods above on #{self.name} to see detailed documentation. +** NOTE: Calling the docs_classes method will give you all classes in Game Toolkit that contain docs. +S + else + <<-S + +* DOCS: #{self.name} +#{docs_methods} +S + end + end + + def self.__docs_search__ words = nil, &block + + end + + def docs_search words = nil, &block + words ||= "" + if words.strip.length != 0 + each_word = words.split(' ').find_all { |w| w.strip.length > 0 } + block = lambda do |entry| + each_word.any? { |w| entry.downcase.include? w.downcase } + end + end + + if !block + return <<-S +* DOCS: How To Search The Docs +To search docs you can use Kernel.docs_search (or just ~docs_search~) by providing it a search term. +For example: + +#+begin_src + docs_search "array find remove nil" +#+end_src + +You can do more advanced searches by providing a block: + +#+begin_src + docs_search do |entry| + (entry.include? "Array") && (!entry.include? "Enumerable") + end #+end_src S end - def method_missing m, *args - puts <<-S -* DOCUMENTATION MISSING: -It looks like docs are missing for :#{m}. Let the @dragonborne know about it in the Discord channel: http://discord.dragonruby.org. + DocsOrganizer.sort_docs_classes! + this_block = block + final_string = "" + if self == Kernel + $docs_classes.each do |k| + DocsOrganizer.find_methods_with_docs(k).each do |m| + s = k.send m + final_string += s + "\n" if block.call s + end + end + else + DocsOrganizer.find_methods_with_docs(self).each do |m| + s = send m + final_string += s + "\n" if block.call s + end + end + + if final_string.strip.length == 0 + final_string = "* DOCS: No results found." + end + + $gtk.write_file "docs/search_results.txt", final_string + log "* INFO: Search results have been written to docs/search_results.txt." + + "\n" + final_string + end + + def __export_docs__! opts = {} + DocsOrganizer.sort_docs_classes! + opts = defaults_export_docs!.merge opts + opts[:methods] = methods_with_docs.reject { |m| m == :docs_classes } if opts[:methods].include? :all + content = opts[:methods].map do |m| + puts "* INFO: Getting docs for #{m}." + (send m).ltrim + "\n" + end.join "\n" + file_path = "docs/#{self.name}.txt" + $gtk.write_file "#{file_path}", content + puts "* INFO: Documentation for #{self.name} has been exported to #{file_path}." + $gtk.console.set_system_command file_path + nil + end + + def export_docs! opts = {} + __export_docs__! opts + end + + def __docs_append_true_line__ true_lines, true_line, parse_log + true_line.rstrip! + parse_log << "*** True Line Result\n#{true_line}" + true_lines << true_line + end + + # may god have mercy on your soul if you try to expand this + def __docs_to_html__ string + parse_log = [] + html_string = <<-S +<html> + <head> + <title>DragonRuby Game Toolkit Documentation</title> + <link href="docs.css" rel="stylesheet" type="text/css" media="all"> + <script src="docs.js"></script> + </head> + <body> + <div id='toc'> + {{toc}} + </div> + <div id='content'> + {{content}} + </div> + </body> +</html> S + + true_lines = [] + current_true_line = "" + + inside_source = false + inside_ordered_list = false + inside_unordered_list = false + + # PARSE TRUE LINES + parse_log << "* Processing True Lines" + string.strip.each_line do |l| + parse_log << "** Processing line: ~#{l.rstrip}~" + if l.start_with? "#+begin_src" + parse_log << "- Line was identified as the beginning of a code block." + inside_source = true + __docs_append_true_line__ true_lines, current_true_line, parse_log + __docs_append_true_line__ true_lines, l, parse_log + elsif l.start_with? "#+end_src" + parse_log << "- Line was identified as the end of a code block." + inside_source = false + __docs_append_true_line__ true_lines, l, parse_log + current_true_line = "" + elsif l.start_with? "#+" + parse_log << "- Line was identified as a literal block." + __docs_append_true_line__ true_lines, current_true_line, parse_log + __docs_append_true_line__ true_lines, l, parse_log + current_true_line = "" + elsif l.start_with? "- " + parse_log << "- Line was identified as a list." + inside_unordered_list = true + __docs_append_true_line__ true_lines, current_true_line, parse_log + current_true_line = l + elsif l.start_with? "1. " + parse_log << "- Line was identified as a start of a list." + inside_ordered_list = true + __docs_append_true_line__ true_lines, current_true_line, parse_log + current_true_line = l + elsif inside_ordered_list && (l[1] == "." || l[2] == "." || l[3] == ".") + parse_log << "- Line was identified as a continuation of a list." + __docs_append_true_line__ true_lines, current_true_line, parse_log + current_true_line = l + elsif inside_source + parse_log << "- Inside source: true" + inside_source = true + __docs_append_true_line__ true_lines, l, parse_log + current_true_line = "" + elsif l.strip.length == 0 + parse_log << "- End of paragraph detected." + inside_ordered_list = false + inside_unordered_list = false + __docs_append_true_line__ true_lines, current_true_line, parse_log + current_true_line = "" + elsif l.start_with? "* " + parse_log << "- Header detected." + __docs_append_true_line__ true_lines, current_true_line, parse_log + __docs_append_true_line__ true_lines, l, parse_log + current_true_line = "" + elsif l.start_with? "** " + parse_log << "- Header detected." + __docs_append_true_line__ true_lines, current_true_line, parse_log + __docs_append_true_line__ true_lines, l, parse_log + current_true_line = "" + elsif l.start_with? "*** " + parse_log << "- Header detected." + __docs_append_true_line__ true_lines, current_true_line, parse_log + __docs_append_true_line__ true_lines, l, parse_log + current_true_line = "" + else + current_true_line += l.rstrip + " " + end + end + + true_lines << current_true_line if current_true_line.length != 0 + + if true_lines[0].strip == "" + true_lines = true_lines[1..-1] end + + toc = "" + content_html = "" + + inside_pre = false + inside_being_src = false + inside_paragraph = false + inside_literal = false + inside_h1 = false + inside_ordered_list = false + inside_ul = false + inside_ol = false + + text_to_id = lambda do |text| + text = text.strip.downcase + text = text.gsub("*", "-") + text = text.gsub("~", "-") + text = text.gsub("[", "-") + text = text.gsub("]", "-") + text = text.gsub(":", "-") + text = text.gsub(" ", "-") + text + end + + close_list_if_needed = lambda do |inside_ul, inside_ol| + begin + result = "" + if inside_ul + result = "</ul>\n" + elsif inside_ol + result = "</ol>\n" + else + result + end + rescue Exception => e + raise "* ERROR in determining close_list_if_needed lambda result. #{e}." + end + end + + inside_ol = false + inside_ul = false + + toc = "<h1>Table Of Contents</h1>\n<ul>\n" + parse_log << "* Processing Html Given True Lines" + true_lines.each do |l| + parse_log << "** Processing line: ~#{l.rstrip}~" + if l.start_with? "* " + parse_log << "- H1 detected." + content_html += close_list_if_needed.call inside_ul, inside_ol + inside_ol = false + inside_ul = false + formatted_html = __docs_line_to_html__ l, parse_log + link_id = text_to_id.call l + toc += "<li><a href='##{link_id}'>#{formatted_html}</a></li>\n" + content_html += "<h1 id='#{link_id}'>#{formatted_html}</h1>\n" + elsif l.start_with? "** " + parse_log << "- H2 detected." + content_html += close_list_if_needed.call inside_ul, inside_ol + inside_ol = false + inside_ul = false + formatted_html = __docs_line_to_html__ l, parse_log + link_id = text_to_id.call l + # toc += "<a href='##{link_id}'>#{formatted_html}</a></br>\n" + content_html += "<h2>#{__docs_line_to_html__ l, parse_log}</h2>\n" + elsif l.start_with? "*** " + parse_log << "- H3 detected." + content_html += close_list_if_needed.call inside_ul, inside_ol + inside_ol = false + inside_ul = false + formatted_html = __docs_line_to_html__ l, parse_log + link_id = text_to_id.call l + # toc += "<a href='##{link_id}'>#{formatted_html}</a></br>\n" + content_html += "<h3>#{__docs_line_to_html__ l, parse_log}</h3>\n" + elsif l.strip.length == 0 && !inside_pre + # do nothing + elsif l.start_with? "#+begin_src" + parse_log << "- PRE start detected." + content_html += close_list_if_needed.call inside_ul, inside_ol + inside_ol = false + inside_ul = false + inside_pre = true + content_html << "<pre>" + elsif l.start_with? "#+end_src" + parse_log << "- PRE end detected." + inside_ol = false + inside_ul = false + inside_pre = false + content_html << "</pre>\n" + elsif l.start_with? "#+begin_quote" + parse_log << "- BLOCKQUOTE start detected." + content_html += close_list_if_needed.call inside_ul, inside_ol + inside_ol = false + inside_ul = false + content_html << "<blockquote>\n" + elsif l.start_with? "#+end_quote" + parse_log << "- BLOCKQUOTE end detected." + content_html << "</blockquote>\n" + elsif (l.start_with? "1. ") && !inside_ol + parse_log << "- OL start detected." + parse_log << "- LI detected." + + inside_ol = true + content_html << "<ol>\n" + + if l.split(".")[0].length == 1 + l = l[2..-1] + elsif l.split(".")[0].length == 2 + l = l[3..-1] + elsif l.split(".")[0].length == 3 + l = l[4..-1] + end + + content_html << "<li>#{__docs_line_to_html__ l, parse_log}</li>\n" + elsif inside_ol && (l[1] == "." || l[2] == "." || l[3] == ".") + parse_log << "- LI detected." + + if l.split(".")[0].length == 1 + l = l[2..-1] + elsif l.split(".")[0].length == 2 + l = l[3..-1] + elsif l.split(".")[0].length == 3 + l = l[4..-1] + end + + content_html << "<li>#{__docs_line_to_html__ l, parse_log}</li>\n" + elsif (l.start_with? "- ") && !inside_ul + parse_log << "- UL start detected." + parse_log << "- LI detected." + + inside_ul = true + content_html << "<ul>\n" + l = l[2..-1] + + content_html << "<li>#{__docs_line_to_html__ l, parse_log}</li>\n" + elsif (l.start_with? "- ") && inside_ul + parse_log << "- LI detected." + + l = l[2..-1] + + content_html << "<li>#{__docs_line_to_html__ l, parse_log}</li>\n" + else + if inside_ul + parse_log << "- UL end detected." + + inside_ul = false + content_html << "</ul>\n" + end + + if inside_ol + parse_log << "- OL end detected." + + inside_ol = false + content_html << "</ol>\n" + end + + if inside_pre + content_html << "#{l.rstrip[2..-1]}\n" + else + parse_log << "- P detected." + + content_html << "<p>\n#{__docs_line_to_html__ l, parse_log}\n</p>\n" + end + end + end + toc += "</ul>" + + final_html = (html_string.gsub "{{toc}}", toc) + final_html = (final_html.gsub "{{content}}", content_html) + + { + original: string, + html: final_html, + parse_log: parse_log + } + rescue Exception => e + $gtk.write_file 'docs/parse_log.txt', (parse_log.join "\n") + raise "* ERROR in Docs::__docs_to_html__. #{e}" + end + + def __docs_line_to_html__ line, parse_log + line = line.gsub "* DOCS: ", "" if line.start_with? "* DOCS: " + line = line.gsub "* ", "" if line.start_with? "* " + line = line.gsub "** ", "" if line.start_with? "** " + line = line.gsub "*** ", "" if line.start_with? "*** " + + tilde_count = line.count "~" + line_has_link_marker = (line.include? "[[") && (line.include? "]]") + parse_log << "- Formatting line: ~#{line}~" + parse_log << "- Line's tilde count is: #{tilde_count}" + parse_log << "- Line contains link marker: #{line_has_link_marker}" + + line_to_format = line.rstrip + + # <code> logic + if tilde_count.even? && tilde_count != 0 + parse_log << "- CODE detected." + temp = line_to_format + line_to_format = "" + in_literal = false + in_code = false + temp.each_char do |c| + if c == "~" && !in_code + in_code = true + line_to_format << "<code>" + elsif c == "~" && in_code + line_to_format << "</code>" + in_code = false + else + line_to_format << c + end + end + end + + # <a> and <img> logic + if line_has_link_marker + line_to_format = line_to_format.gsub "[[", "[" + line_to_format = line_to_format.gsub "]]", "]" + parse_log << "- LINK detected." + temp = line_to_format + line_to_format = "" + in_literal = false + in_link = false + link_url = "" + temp.each_char.with_index do |c, i| + next_c = temp[i + 1] + if !in_link && c == "[" + in_link = true + link_url = "" + elsif in_link && c == "]" + in_link = false + if link_url.end_with? ".gif" + line_to_format << "<img src='#{link_url}'></img>" + else + line_to_format << "<a href='#{link_url}'>#{link_url}</a>" + end + elsif in_link + link_url << c + else + line_to_format << c + end + end + end + + return line_to_format + rescue Exception => e + parse_log << "* ERROR: Failed to parse line: ~#{line}~, #{e}" + return line.rstrip end end diff --git a/dragon/geometry.rb b/dragon/geometry.rb index 67e6a08..607520f 100644 --- a/dragon/geometry.rb +++ b/dragon/geometry.rb @@ -76,6 +76,44 @@ module GTK Geometry.point_inside_circle? self, circle_center_point, radius end + def center_inside_rect other_rect + offset_x = (other_rect.w - w).half + offset_y = (other_rect.h - h).half + new_rect = self.shift_rect(0, 0) + new_rect.x = other_rect.x + offset_x + new_rect.y = other_rect.y + offset_y + new_rect + rescue Exception => e + raise e, <<-S +* ERROR: +center_inside_rect for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +S + end + + def center_inside_rect_y other_rect + offset_y = (other_rect.h - h).half + new_rect = self.shift_rect(0, 0) + new_rect.y = other_rect.y + offset_y + new_rect + rescue Exception => e + raise e, <<-S +* ERROR: +center_inside_rect_y for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +S + end + + def center_inside_rect_x other_rect + offset_x = (other_rect.w - w).half + new_rect = self.shift_rect(0, 0) + new_rect.x = other_rect.x + offset_x + new_rect + rescue Exception => e + raise e, <<-S +* ERROR: +center_inside_rect_x for self #{self} and other_rect #{other_rect}. Failed with exception #{e}. +S + end + # Returns a primitive that is anchored/repositioned based off its retangle. # @gtk def anchor_rect anchor_x, anchor_y @@ -83,13 +121,17 @@ module GTK current_h = self.h delta_x = -1 * (anchor_x * current_w) delta_y = -1 * (anchor_y * current_h) - self.rect_shift(delta_x, delta_y) + self.shift_rect(delta_x, delta_y) end def angle_given_point other_point raise ":angle_given_point has been deprecated use :angle_from instead." end + def distance_to other_point + Geometry.distance(self, other_point) + end + # @gtk def self.shift_line line, x, y if line.is_a?(Array) || line.is_a?(Hash) @@ -189,6 +231,10 @@ S [x, y] end + def self.contract_intersect_rect? + [:left, :right, :top, :bottom] + end + # @gtk def self.intersect_rect? rect_one, rect_two, tolerance = 0.1 return false if rect_one.right - tolerance < rect_two.left + tolerance @@ -197,7 +243,32 @@ S return false if rect_one.bottom + tolerance > rect_two.top - tolerance return true rescue Exception => e - raise e, ":intersect_rect? failed for rect_one: #{rect_one} rect_two: #{rect_two}." + context_help_rect_one = (rect_one.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods] + context_help_rect_two = (rect_two.help_contract_implementation contract_intersect_rect?)[:not_implemented_methods] + context_help = "" + if context_help_rect_one && context_help_rect_one.length > 0 + context_help += <<-S +rect_one needs to implement the following methods: #{context_help_rect_one} + +You may want to try include the ~AttrRect~ module which will give you these methods. +S + end + + if context_help_rect_two && context_help_rect_two.length > 0 + context_help += <<-S +* FAILURE REASON: +rect_two needs to implement the following methods: #{context_help_rect_two} +NOTE: You may want to try include the ~GTK::Geometry~ module which will give you these methods. +S + end + + raise e, <<-S +* ERROR: +:intersect_rect? failed for +- rect_one: #{rect_one} +- rect_two: #{rect_two} +#{context_help} +S end # @gtk diff --git a/dragon/grid.rb b/dragon/grid.rb index e5c21a3..c2a6a43 100644 --- a/dragon/grid.rb +++ b/dragon/grid.rb @@ -60,8 +60,9 @@ module GTK attr_accessor :left_margin, :bottom_margin - def initialize ffi_draw - @ffi_draw = ffi_draw + def initialize runtime + @runtime = runtime + @ffi_draw = runtime.ffi_draw origin_bottom_left! end @@ -109,18 +110,18 @@ module GTK return if @name == :bottom_left @name = :bottom_left @origin_x = 0.0 - @origin_y = $gtk.logical_height + @origin_y = @runtime.logical_height @left = 0.0 - @right = $gtk.logical_width - @top = $gtk.logical_height + @right = @runtime.logical_width + @top = @runtime.logical_height @bottom = 0.0 @left_margin = 0.0 @bottom_margin = 0.0 - @center_x = $gtk.logical_width.half - @center_y = $gtk.logical_height.half - @rect = [@left, @bottom, $gtk.logical_width, $gtk.logical_height].rect + @center_x = @runtime.logical_width.half + @center_y = @runtime.logical_height.half + @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect @center = [@center_x, @center_y].point - @ffi_draw.set_gtk_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION + @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION end # Sets the rendering coordinate system to have its origin in the center. @@ -130,24 +131,24 @@ module GTK def origin_center! return if @name == :center @name = :center - @origin_x = $gtk.logical_width.half - @origin_y = $gtk.logical_height.half - @left = -$gtk.logical_width.half - @right = $gtk.logical_width.half - @top = $gtk.logical_height.half - @bottom = -$gtk.logical_height.half + @origin_x = @runtime.logical_width.half + @origin_y = @runtime.logical_height.half + @left = [email protected]_width.half + @right = @runtime.logical_width.half + @top = @runtime.logical_height.half + @bottom = [email protected]_height.half @center_x = 0.0 @center_y = 0.0 - @rect = [@left, @bottom, $gtk.logical_width, $gtk.logical_height].rect + @rect = [@left, @bottom, @runtime.logical_width, @runtime.logical_height].rect @center = [@center_x, @center_y].point - @ffi_draw.set_gtk_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION + @ffi_draw.set_grid @origin_x, @origin_y, SCREEN_Y_DIRECTION end # The logical width used for rendering. # # @return [Float] def w - $gtk.logical_width + @runtime.logical_width end # Half the logical width used for rendering. @@ -161,7 +162,7 @@ module GTK # # @return [Float] def h - $gtk.logical_height + @runtime.logical_height end # Half the logical height used for rendering. diff --git a/dragon/index.rb b/dragon/index.rb index 5d4639d..26ce512 100644 --- a/dragon/index.rb +++ b/dragon/index.rb @@ -3,21 +3,21 @@ # MIT License # help.rb has been released under MIT (*only this file*). -require 'app/dragon/console.rb' -require 'app/dragon/docs.rb' -require 'app/dragon/help.rb' -require 'app/dragon/log.rb' -require 'app/dragon/geometry.rb' -require 'app/dragon/attr_gtk.rb' -require 'app/dragon/attr_sprite.rb' -require 'app/dragon/string.rb' -require 'app/dragon/numeric.rb' -require 'app/dragon/directional_input_helper_methods.rb' -require 'app/dragon/inputs.rb' -require 'app/dragon/grid.rb' -require 'app/dragon/args.rb' -require 'app/dragon/console.rb' -require 'app/dragon/assert.rb' -require 'app/dragon/tests.rb' -require 'app/dragon/trace.rb' -require 'app/dragon/controller_config.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/console.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/docs.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/help.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/log.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/geometry.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/attr_gtk.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/attr_sprite.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/string.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/numeric.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/directional_input_helper_methods.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/inputs.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/grid.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/args.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/console.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/assert.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/tests.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/trace.rb' +require 'app/dragonruby-game-toolkit-contrib/dragon/controller_config.rb' diff --git a/dragon/inputs.rb b/dragon/inputs.rb index bbf5305..a4ef40f 100644 --- a/dragon/inputs.rb +++ b/dragon/inputs.rb @@ -295,7 +295,7 @@ S return self.send m rescue Exception => e - log_important "#{e}}" + log_important "#{e}" end raise <<-S @@ -476,28 +476,9 @@ module GTK :button_x1, :button_x2, :wheel - # The current click. - # - # @return [MousePoint] - # @gtk attr_accessor :click - - # The previous click. - # - # @return [MousePoint] - # @gtk attr_accessor :previous_click - - # The "x" coordinate. - # - # @return [Integer] - # @gtk attr_accessor :x - - # The "y" coordinate. - # - # @return [Integer] - # @gtk attr_accessor :y def initialize @@ -513,13 +494,14 @@ module GTK clear end - # The "x" and "y" coordinate pair. - # - # @return [[Integer, Integer]] - # @gtk def point [@x, @y].point end + + def inside_rect? rect + point.inside_rect? rect + end + alias_method :position, :point def clear @@ -535,19 +517,14 @@ module GTK @wheel = nil end - # @return [MousePoint] - # @gtk def up @up end - # @return [MousePoint] - # @gtk def down @click end - # @return [Hash] def serialize result = {} @@ -566,10 +543,10 @@ module GTK result end - # @return [String] def to_s serialize.to_s end + alias_method :inspect, :to_s end end diff --git a/dragon/kernel_docs.rb b/dragon/kernel_docs.rb new file mode 100644 index 0000000..00eadf6 --- /dev/null +++ b/dragon/kernel_docs.rb @@ -0,0 +1,74 @@ +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# kernel_docs.rb has been released under MIT (*only this file*). + +module KernelDocs + def docs_method_sort_order + [:docs_class, :docs_tick_count, :docs_global_tick_count] + end + + def docs_class + <<-S +* DOCS: ~Kernel~ + +Kernel in the DragonRuby Runtime has patches for how standard out is handled and also +contains a unit of time in games called a tick. + +S + end + + def docs_tick_count + <<-S +* DOCS: ~Kernel::tick_count~ + +Returns the current tick of the game. This value is reset if you call $gtk.reset. + +S + end + + def docs_global_tick_count + <<-S +* DOCS: ~Kernel::global_tick_count~ + +Returns the current tick of the application from the point it was started. This value is never reset. + +S + end + + def docs_export_docs! + <<-S +* DOCS: ~Kernel::export_docs!~ + +Exports all GTK documentation to txt files and saves them to a docs directory. + +S + end + + def export_docs! + DocsOrganizer.sort_docs_classes! + final_string = "" + $docs_classes.each do |k| + log "* INFO: Retrieving docs for #{k.name}." + final_string += k.docs_all + end + + final_string += "\n" + (($gtk.read_file "docs/source.txt") || "") + + html_parse_result = (__docs_to_html__ final_string) + + $gtk.write_file 'docs/docs.txt', "#{final_string}" + $gtk.write_file 'docs/docs.html', html_parse_result[:html] + $gtk.write_file 'docs/parse_log.txt', (html_parse_result[:parse_log].join "\n") + + log "* INFO: All docs have been exported to docs/docs.txt." + log "* INFO: All docs have been exported to docs/docs.html." + + nil + end +end + +module Kernel + extend Docs + extend KernelDocs +end diff --git a/dragon/log.rb b/dragon/log.rb index 60246e6..b2ee0e1 100644 --- a/dragon/log.rb +++ b/dragon/log.rb @@ -81,6 +81,30 @@ module GTK " end + def self.puts_error *args + args ||= [] + title = args[0] + additional = args[1..-1] || [] + additional = "" if additional.length == 0 + if !title.multiline? && join_lines(additional).multiline? + message = headline "ERROR: #{title}" do + dynamic_block do + additional + end + end + elsif title.multiline? + message = headline "ERROR: " do + dynamic_block do + args + end + end + else + message = "* ERROR: #{title} #{additional}".strip + end + + self.puts message + end + def self.puts_info *args args ||= [] title = args[0] @@ -110,14 +134,14 @@ module GTK @once ||= {} return if @once[id] @once[id] = id + if !$gtk.cli_arguments[:replay] && !$gtk.cli_arguments[:record] + $gtk.notify!("Open the DragonRuby Console by pressing [`] [~] [²] [^] [º] or [§]. [Message ID: #{id}].") + end write_to_log_and_puts "" write_to_log_and_puts "#{message.strip}" write_to_log_and_puts "" write_to_log_and_puts "[Message ID: #{id}]" write_to_log_and_puts "" - return if $gtk.cli_arguments[:replay] - return if $gtk.cli_arguments[:record] - $gtk.notify!("One time notification occurred. [Message ID: #{id}] (Open console for more info.)") end def self.puts_once_info *ids, message @@ -222,6 +246,10 @@ class Object log_with_color XTERM_COLOR[:bright_white], *args end + def log_error *args + GTK::Log.puts_error(*args) + end + def log_info *args GTK::Log.puts_info(*args) end diff --git a/dragon/mouse_docs.rb b/dragon/mouse_docs.rb new file mode 100644 index 0000000..ef4b923 --- /dev/null +++ b/dragon/mouse_docs.rb @@ -0,0 +1,65 @@ +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# mouse_docs.rb has been released under MIT (*only this file*). + +module MouseDocs + def docs_class +<<-S +* DOCS: ~GTK::Mouse~ + +The mouse is accessible via ~args.inputs.mouse~: + +#+begin_src ruby + def tick args + # Rendering a label that shows the mouse's x and y position (via args.inputs.mouse). + args.outputs.labels << [ + 10, + 710, + "The mouse's position is: \#{args.inputs.mouse.x} \#{args.inputs.mouse.y}." + ] + end +#+end_src + +The mouse has the following properties. + +- ~args.inputs.mouse.x~: Returns the x position of the mouse. +- ~args.inputs.mouse.y~: Returns the y position of the mouse. +- ~args.inputs.mouse.moved~: Returns true if the mouse moved during the tick. +- ~args.inputs.mouse.moved_at~: Returns the tick_count (~args.state.tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move. +- ~args.inputs.mouse.global_moved_at~: Returns the global tick_count (~Kernel.global_tick_count~) that the mouse was moved at. This property will be ~nil~ if the mouse didn't move. +- ~args.inputs.mouse.click~: Returns a ~GTK::MousePoint~ for that specific frame (~args.state.tick_count~) if the mouse button was pressed. +- ~args.inputs.mouse.previous_click~: Returns a ~GTK::MousePoint~ for the previous frame (~args.state.tick_count - 1~) if the mouse button was pressed. +- ~args.inputs.mouse.up~: Returns true if for that specific frame (~args.state.tick_count~) if the mouse button was released. +- ~args.inputs.mouse.point~ | ~args.inputs.mouse.position~: Returns an ~Array~ which contains the ~x~ and ~y~ position of the mouse. +- ~args.inputs.mouse.has_focus~: Returns true if the game window has the mouse's focus. +- ~args.inputs.mouse.wheel~: Returns an ~GTK::OpenEntity~ that contains an ~x~ and ~y~ property which represents how much the wheel has moved. If the wheel has not moved within the tick, this property will be ~nil~. +- ~args.inputs.mouse.button_left~: Returns true if the left mouse button is down. +- ~args.inputs.mouse.button_right~: Returns true if the right mouse button is down. +- ~args.inputs.mouse.button_middle~: Returns true if the middle mouse button is down. +- ~args.inputs.mouse.button_bits~: Gives the bits for each mouse button and its current state. + +* DOCS: ~GTK::MousePoint~ + +The ~GTK::MousePoint~ has the following properties. + +- ~x~: Integer representing the mouse's x. +- ~y~: Integer representing the mouse's y. +- ~point~: Array with the ~x~ and ~y~ values. +- ~w~: Width of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~h~: Height of the point that always returns ~0~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~left~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~right~: This value is the same as ~x~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~top~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~bottom~: This value is the same as ~y~ (included so that it can seemlessly work with ~GTK::Geometry~ functions). +- ~created_at~: The tick (~args.state.tick_count~) that this structure was created. +- ~global_created_at~: The global tick (~Kernel.global_tick_count~) that this structure was created. + +S + end +end + +class GTK::Mouse + extend Docs + extend MouseDocs +end diff --git a/dragon/numeric.rb b/dragon/numeric.rb index c2c461f..5485ff8 100644 --- a/dragon/numeric.rb +++ b/dragon/numeric.rb @@ -9,6 +9,11 @@ class Numeric alias_method :gte, :>= alias_method :lte, :<= + + # Converts numeric value to distance from top of stage + def from_top + $gtk.args.grid.h - self + end # Converts a numeric value representing seconds into frames. # @@ -28,12 +33,6 @@ class Numeric clamp(0, 255).to_i end - # For a given number, the elapsed frames since that number is returned. - # `Kernel.tick_count` is used to determine how many frames have elapsed. - # An override numeric value can be passed in which will be used instead - # of `Kernel.tick_count`. - # - # @gtk def elapsed_time tick_count_override = nil (tick_count_override || Kernel.tick_count) - self end @@ -51,25 +50,42 @@ class Numeric # moment in time. # # @gtk - def elapsed? offset, tick_count_override = nil - (self + offset) < (tick_count_override || Kernel.tick_count) + def elapsed? offset = 0, tick_count_override = Kernel.tick_count + (self + offset) < tick_count_override end - # This is helpful for determining the index of frame-by-frame sprite animation. - # The numeric value `self` represents the moment the animation started. `frame_index` - # takes three additional parameters: how many frames exist in the sprite animation; - # how long to hold each animation for; and whether the animation should repeat. - # - # @gtk - def frame_index frame_count, hold_for, repeat, tick_count_override = nil + def frame_index *opts + frame_count_or_hash, hold_for, repeat, tick_count_override = opts + if frame_count_or_hash.is_a? Hash + frame_count = frame_count_or_hash[:count] + hold_for = frame_count_or_hash[:hold_for] + repeat = frame_count_or_hash[:repeat] + tick_count_override = frame_count_or_hash[:tick_count_override] + else + frame_count = frame_count_or_hash + end + + tick_count_override ||= Kernel.tick_count animation_frame_count = frame_count animation_frame_hold_time = hold_for animation_length = animation_frame_hold_time * animation_frame_count - if !repeat && self.+(animation_length) < (tick_count_override || Kernel.tick_count).-(1) + return nil if Kernel.tick_count < self + + if !repeat && (self + animation_length) < (tick_count_override - 1) return nil else return self.elapsed_time.-(1).idiv(animation_frame_hold_time) % animation_frame_count end + rescue Exception => e + raise <<-S +* ERROR: +#{opts} +#{e} +S + end + + def zero? + self == 0 end def zero @@ -479,6 +495,11 @@ S def serialize self end + + def from_top + return 720 - self unless $gtk + $gtk.args.grid.h - self + end end class Fixnum diff --git a/dragon/numeric_docs.rb b/dragon/numeric_docs.rb new file mode 100644 index 0000000..fb8a94d --- /dev/null +++ b/dragon/numeric_docs.rb @@ -0,0 +1,240 @@ +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# numeric_docs.rb has been released under MIT (*only this file*). + +module NumericDocs + def docs_method_sort_order + [ + :docs_frame_index, + :docs_elapsed_time, + :docs_elapsed?, + :docs_new? + ] + end + + def docs_frame_index + <<-S +* DOCS: ~Numeric#frame_index~ + +This function is helpful for determining the index of frame-by-frame + sprite animation. The numeric value ~self~ represents the moment the + animation started. + +~frame_index~ takes three additional parameters: + +- How many frames exist in the sprite animation. +- How long to hold each animation for. +- Whether the animation should repeat. + +~frame_index~ will return ~nil~ if the time for the animation is out +of bounds of the parameter specification. + +Example using variables: + +#+begin_src ruby + def tick args + start_looping_at = 0 + number_of_sprites = 6 + number_of_frames_to_show_each_sprite = 4 + does_sprite_loop = true + + sprite_index = + start_looping_at.frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + sprite_index ||= 0 + + args.outputs.sprites << [ + 640 - 50, + 360 - 50, + 100, + 100, + "sprites/dragon-\#{sprite_index}.png" + ] + end +#+end_src + +Example using named parameters: + +#+begin_src ruby + def tick args + start_looping_at = 0 + + sprite_index = + start_looping_at.frame_index count: 6, + hold_for: 4, + repeat: true, + tick_count_override: args.state.tick_count + + sprite_index ||= 0 + + args.outputs.sprites << [ + 640 - 50, + 360 - 50, + 100, + 100, + "sprites/dragon-\#{sprite_index}.png" + ] + end +#+end_src + +S + end + + def docs_new? + <<-S +* DOCS: ~Numeric#created?~ +Returns true if ~Numeric#elapsed_time == 0~. Essentially communicating that +number is equal to the current frame. + +Example usage: + +#+begin_src ruby + def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + create_at: args.state.tick_count + 60 } + end + + boxes_to_spawn_this_frame = args.state + .box_queue + .find_all { |b| b[:create_at].new? } + + boxes_to_spawn_this_frame.each { |b| puts "box \#{b} was new? on \#{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_spawn_this_frame + end +#+end_src +S + end + + def docs_elapsed? + <<-S +* DOCS: ~Numeric#elapsed?~ +Returns true if ~Numeric#elapsed_time~ is greater than the number. An optional parameter can be +passed into ~elapsed?~ which is added to the number before evaluating whether ~elapsed?~ is true. + +Example usage (no optional parameter): + +#+begin_src ruby + def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + destroy_at: args.state.tick_count + 60 } + args.state.box_queue << { name: :green, + destroy_at: args.state.tick_count + 60 } + args.state.box_queue << { name: :blue, + destroy_at: args.state.tick_count + 120 } + end + + boxes_to_destroy = args.state + .box_queue + .find_all { |b| b[:destroy_at].elapsed? } + + if !boxes_to_destroy.empty? + puts "boxes to destroy count: \#{boxes_to_destroy.length}" + end + + boxes_to_destroy.each { |b| puts "box \#{b} was elapsed? on \#{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_destroy + end +#+end_src + +Example usage (with optional parameter): + +#+begin_src ruby + def tick args + args.state.box_queue ||= [] + + if args.state.box_queue.empty? + args.state.box_queue << { name: :red, + create_at: args.state.tick_count + 120, + lifespan: 60 } + args.state.box_queue << { name: :green, + create_at: args.state.tick_count + 120, + lifespan: 60 } + args.state.box_queue << { name: :blue, + create_at: args.state.tick_count + 120, + lifespan: 120 } + end + + # lifespan is passed in as a parameter to ~elapsed?~ + boxes_to_destroy = args.state + .box_queue + .find_all { |b| b[:create_at].elapsed? b[:lifespan] } + + if !boxes_to_destroy.empty? + puts "boxes to destroy count: \#{boxes_to_destroy.length}" + end + + boxes_to_destroy.each { |b| puts "box \#{b} was elapsed? on \#{args.state.tick_count}." } + + args.state.box_queue -= boxes_to_destroy + end +#+end_src + +S + end + + def docs_elapsed_time + <<-S +* DOCS: ~Numeric#elapsed_time~ +For a given number, the elapsed frames since that number is returned. +`Kernel.tick_count` is used to determine how many frames have elapsed. +An optional numeric argument can be passed in which will be used instead +of `Kernel.tick_count`. + +Here is an example of how elapsed_time can be used. + +#+begin_src ruby + def tick args + args.state.last_click_at ||= 0 + + # record when a mouse click occurs + if args.inputs.mouse.click + args.state.last_click_at = args.state.tick_count + end + + # Use Numeric#elapsed_time to determine how long it's been + if args.state.last_click_at.elapsed_time > 120 + args.outputs.labels << [10, 710, "It has been over 2 seconds since the mouse was clicked."] + end + end +#+end_src + +And here is an example where the override parameter is passed in: + +#+begin_src ruby + def tick args + args.state.last_click_at ||= 0 + + # create a state variable that tracks time at half the speed of args.state.tick_count + args.state.simulation_tick = args.state.tick_count.idiv 2 + + # record when a mouse click occurs + if args.inputs.mouse.click + args.state.last_click_at = args.state.simulation_tick + end + + # Use Numeric#elapsed_time to determine how long it's been + if (args.state.last_click_at.elapsed_time args.state.simulation_tick) > 120 + args.outputs.labels << [10, 710, "It has been over 4 seconds since the mouse was clicked."] + end + end +#+end_src + +S + end +end + +class Numeric + extend Docs + extend NumericDocs +end diff --git a/dragon/outputs_docs.rb b/dragon/outputs_docs.rb new file mode 100644 index 0000000..16c97ec --- /dev/null +++ b/dragon/outputs_docs.rb @@ -0,0 +1,157 @@ +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# outputs_docs.rb has been released under MIT (*only this file*). + +module OutputsDocs + def docs_method_sort_order + [ + :docs_class, + :docs_solids, + :docs_borders + ] + end + + def docs_class + <<-S +* DOCS: ~GTK::Outputs~ + +Outputs is how you render primitives to the screen. The minimal setup for +rendering something to the screen is via a ~tick~ method defined in +mygame/app/main.rb + +#+begin_src + def tick args + # code goes here + end +#+end_src + +S + end + + def docs_borders + <<-S +* DOCS: ~GTK::Outputs#borders~ + +Add primitives to this collection to render an unfilled solid to the screen. Take a look at the +documentation for Outputs#solids. + +The only difference between the two primitives is where they are added. + +Instead of using ~args.outputs.solids~: + +#+begin_src + def tick args + # X Y WIDTH HEIGHT + args.outputs.solids << [100, 100, 160, 90] + end +#+end_src + +You have to use ~args.outputs.borders~: + +#+begin_src + def tick args + # X Y WIDTH HEIGHT + args.outputs.borders << [100, 100, 160, 90] + end +#+end_src + +S + end + + def docs_solids + <<-S +* DOCS: ~GTK::Outputs#solids~ + +Add primitives to this collection to render a solid to the screen. + +** Rendering a solid using an Array + +Creates a solid black rectangle located at 100, 100. 160 pixels +wide and 90 pixels tall. + +#+begin_src + def tick args + # X Y WIDTH HEIGHT + args.outputs.solids << [100, 100, 160, 90] + end +#+end_src + +** Rendering a solid using an Array with colors and alpha + +The value for the color and alpha is an number between ~0~ and ~255~. The +alpha property is optional and will be set to ~255~ if not specified. + +Creates a green solid rectangle with an opacity of 50%. + +#+begin_src + def tick args + # X Y WIDTH HEIGHT RED GREEN BLUE ALPHA + args.outputs.solids << [100, 100, 160, 90, 0, 255, 0, 128] + end +#+end_src + +** Rendering a solid using a Hash + +If you want a more readable invocation. You can use the following hash to create a solid. +Any parameters that are not specified will be given a default value. The keys of the hash can +be provided in any order. + +#+begin_src + def tick args + args.outputs.solids << { + x: 0, + y: 0, + w: 100, + h: 100, + r: 0, + g: 255, + b: 0, + a: 255 + } + end +#+end_src + +** Rendering a solid using a Class + +You can also create a class with solid/border properties and render it as a primitive. +ALL properties must on the class. *Additionally*, a method called ~primitive_marker~ +must be defined on the class. + +Here is an example: + +#+begin_src + # Create type with ALL solid properties AND primitive_marker + class Solid + attr_accessor :x, :y, :w, :h, :r, :g, :b, :a + + def primitive_marker + :solid + end + end + + # Inherit from type + class Square < Solid + # constructor + def initialize x, y, size + self.x = x + self.y = y + self.w = size + self.h = size + end + end + + def tick args + # render solid/border + args.outputs.solids << Square.new(10, 10, 32) + end +#+end_src + +S + end +end + +class GTK::Outputs + extend Docs + extend OutputsDocs +end diff --git a/dragon/readme_docs.rb b/dragon/readme_docs.rb new file mode 100644 index 0000000..39fc283 --- /dev/null +++ b/dragon/readme_docs.rb @@ -0,0 +1,1182 @@ +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# readme_docs.rb has been released under MIT (*only this file*). + +module GTK + module ReadMeDocs + def docs_method_sort_order + [ + :docs_usage, + :docs_hello_world, + :docs_deployment, + :docs_dragonruby_philosophy, + :docs_ticks_and_frames, + :docs_sprites, + :docs_labels, + :docs_sounds, + :docs_game_state, + :docs_faq + ] + end + + def docs_usage + <<-S +* DragonRuby Game Toolkit Live Docs + +The information contained here is all available via the DragonRuby +Console. You can Open the DragonRuby Console by pressing [`] [~] [²] +[^] [º] or [§] within your game. + +To search docs you can type ~docs_search "SEARCH TERM"~ or if you want +to get fancy you can provide a ~lambda~ to filter documentation: + +#+begin_src + docs_search { |entry| (entry.include? "Array") && (!entry.include? "Enumerable") } +#+end_src + +[[docs_search.gif]] +S + end + + def docs_hello_world +<<-S +* Hello World + +Welcome to DragonRuby Game Toolkit. Take the steps below to get started. + +* Join the Discord and Subscribe to the News Letter + +Our Discord channel is [[http://discord.dragonruby.org]]. + +The News Letter will keep you in the loop with regards to current +DragonRuby Events: [[http://dragonrubydispatch.com]]. + +Those who use DragonRuby are called Dragon Riders. This identity is +incredibly important to us. When someone asks you: + +#+begin_quote +What game engine do you use? +#+end_quote + +Reply with: + +#+begin_quote +I am a Dragon Rider. +#+end_quote + +* Watch Some Intro Videos + +Each video is only 20 minutes and all of them will fit into a lunch +break. So please watch them: + +1. Beginner Introduction to DragonRuby Game Toolkit: [[https://youtu.be/ixw7TJhU08E]] +2. Intermediate Introduction to Ruby Syntax: [[https://youtu.be/HG-XRZ5Ppgc]] +3. Intermediate Introduction to Arrays in Ruby: [[https://youtu.be/N72sEYFRqfo]] + +The second and third videos are not required if you are proficient +with Ruby, but *definitely* watch the first one. + +You may also want to try this free course provided at +[[http://dragonruby.school]]. + +* Getting Started Tutorial + +This is a tutorial written by Ryan C Gordon (a Juggernaut in the +industry who has contracted to Valve, Epic, Activision, and +EA... check out his Wikipedia page: [[https://en.wikipedia.org/wiki/Ryan_C._Gordon]]). + +** Introduction + +Welcome! + +Here's just a little push to get you started if you're new to +programming or game development. + +If you want to write a game, it's no different than writing any other +program for any other framework: there are a few simple rules that +might be new to you, but more or less programming is programming no +matter what you are building. + +Did you not know that? Did you think you couldn't write a game because +you're a "web guy" or you're writing Java at a desk job? Stop letting +people tell you that you can't, because you already have everything +you need. + +Here, we're going to be programming in a language called "Ruby." In +the interest of full disclosure, I (Ryan Gordon) wrote the C parts of +this toolkit and Ruby looks a little strange to me (Amir Rajan wrote +the Ruby parts, discounting the parts I mangled), but I'm going to +walk you through the basics because we're all learning together, and +if you mostly think of yourself as someone that writes C (or C++, C#, +Objective-C), PHP, or Java, then you're only a step behind me right +now. + +** Prerequisites + +Here's the most important thing you should know: Ruby lets you do some +complicated things really easily, and you can learn that stuff +later. I'm going to show you one or two cool tricks, but that's all. + +Do you know what an if statement is? A for-loop? An array? That's all +you'll need to start. + +** The Game Loop + +Ok, here are few rules with regards to game development with GTK: + +- Your game is all going to happen under one function ... +- that runs 60 times a second ... +- and has to tell the computer what to draw each time. + +That's an entire video game in one run-on sentence. + +Here's that function. You're going to want to put this in +mygame/app/main.rb, because that's where we'll look for it by +default. Load it up in your favorite text editor. + +#+begin_src ruby + def tick args + args.outputs.labels << [580, 400, 'Hello World!'] + end +#+end_src + +Now run ~dragonruby~ ...did you get a window with "Hello World!" +written in it? Good, you're officially a game developer! + +** Breakdown Of The ~tick~ Method + +~mygame/app/main.rb~, is where the Ruby source code is located. This +looks a little strange, so I'll break it down line by line. In Ruby, a +'#' character starts a single-line comment, so I'll talk about this +inline. + +#+begin_src ruby + # This "def"ines a function, named "tick," which takes a single argument + # named "args". DragonRuby looks for this function and calls it every + # frame, 60 times a second. "args" is a magic structure with lots of + # information in it. You can set variables in there for your own game state, + # and every frame it will updated if keys are pressed, joysticks moved, + # mice clicked, etc. + def tick args + + # One of the things in "args" is the "outputs" object that your game uses + # to draw things. Afraid of rendering APIs? No problem. In DragonRuby, + # you use arrays to draw things and we figure out the details. + # If you want to draw text on the screen, you give it an array (the thing + # in the [ brackets ]), with an X and Y coordinate and the text to draw. + # The "<<" thing says "append this array onto the list of them at + # args.outputs.labels) + args.outputs.labels << [580, 400, 'Hello World!'] + end +#+end_src + +Once your ~tick~ function finishes, we look at all the arrays you made +and figure out how to draw it. You don't need to know about graphics +APIs. You're just setting up some arrays! DragonRuby clears out these +arrays every frame, so you just need to add what you need _right now_ +each time. + +** Rendering A Sprite + +Now let's spice this up a little. + +We're going to add some graphics. Each 2D image in DragonRuby is +called a "sprite," and to use them, you just make sure they exist in a +reasonable file format (png, jpg, gif, bmp, etc) and specify them by +filename. The first time you use one, DragonRuby will load it and keep +it in video memory for fast access in the future. If you use a +filename that doesn't exist, you get a fun checkerboard pattern! + +There's a "dragonruby.png" file included, just to get you +started. Let's have it draw every frame with our text: + +#+begin_src ruby + def tick args + args.outputs.labels << [580, 400, 'Hello World!'] + args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png'] + end +#+end_src + +(Pro Tip: you don't have to restart DragonRuby to test your changes; +when you save main.rb, DragonRuby will notice and reload your +program.) + +That ~.sprites~ line says "add a sprite to the list of sprites we're +drawing, and draw it at position (576, 100) at a size of 128x101 +pixels". You can find the image to draw at dragonruby.png. + +** Coordinate System and Virtual Canvas + +Quick note about coordinates: (0, 0) is the bottom left corner of the +screen, and positive numbers go up and to the right. This is more +"geometrically correct," even if it's not how you remember doing 2D +graphics, but we chose this for a simpler reason: when you're making +Super Mario Brothers and you want Mario to jump, you should be able to +add to Mario's y position as he goes up and subtract as he falls. It +makes things easier to understand. + +Also: your game screen is _always_ 1280x720 pixels. If you resize the +window, we will scale and letterbox everything appropriately, so you +never have to worry about different resolutions. + +Ok, now we have an image on the screen, let's animate it: + +#+begin_src ruby + def tick args + args.state.rotation ||= 0 + args.outputs.labels << [580, 400, 'Hello World!' ] + args.outputs.sprites << [576, 100, 128, 101, 'dragonruby.png', args.state.rotation] + args.state.rotation -= 1 + end +#+end_src + +Now you can see that this function is getting called a lot! + +** Game State + +Here's a fun Ruby thing: ~args.state.rotation ||= 0~ is shorthand for +"if args.state.rotation isn't initialized, set it to zero." It's a +nice way to embed your initialization code right next to where you +need the variable. + +~args.state~ is a place you can hang your own data and have it survive +past the life of the function call. In this case, the current rotation +of our sprite, which is happily spinning at 60 frames per second. If +you don't specify rotation (or alpha, or color modulation, or a source +rectangle, etc), DragonRuby picks a reasonable default, and the array +is ordered by the most likely things you need to tell us: position, +size, name. + +** There Is No Delta Time + +One thing we decided to do in DragonRuby is not make you worry about +delta time: your function runs at 60 frames per second (about 16 +milliseconds) and that's that. Having to worry about framerate is +something massive triple-AAA games do, but for fun little 2D games? +You'd have to work really hard to not hit 60fps. All your drawing is +happening on a GPU designed to run Fortnite quickly; it can definitely +handle this. + +Since we didn't make you worry about delta time, you can just move the +rotation by 1 every time and it works without you having to keep track +of time and math. Want it to move faster? Subtract 2. + +** Handling User Input + +Now, let's move that image around. + +#+begin_src ruby + def tick args + args.state.rotation ||= 0 + args.state.x ||= 576 + args.state.y ||= 100 + + if args.inputs.mouse.click + args.state.x = args.inputs.mouse.click.point.x - 64 + args.state.y = args.inputs.mouse.click.point.y - 50 + end + + args.outputs.labels << [580, 400, 'Hello World!'] + args.outputs.sprites << [args.state.x, + args.state.y, + 128, + 101, + 'dragonruby.png', + args.state.rotation] + + args.state.rotation -= 1 + end +#+end_src + +Everywhere you click your mouse, the image moves there. We set a +default location for it with ~args.state.x ||= 576~, and then we +change those variables when we see the mouse button in action. You can +get at the keyboard and game controllers in similar ways. + +** Coding On A Raspberry Pi + +We have only tested DragonRuby on a Raspberry Pi 3, Models B and B+, but we +believe it _should_ work on any model with comparable specs. + +If you're running DragonRuby Game Toolkit on a Raspberry Pi, or trying to run +a game made with the Toolkit on a Raspberry Pi, and it's really really slow-- +like one frame every few seconds--then there's likely a simple fix. + +You're probably running a desktop environment: menus, apps, web browsers, +etc. This is okay! Launch the terminal app and type: + +#+begin_src +sudo raspi-config +#+end_src + +It'll ask you for your password (if you don't know, try "raspberry"), and then +give you a menu of options. Find your way to "Advanced Options", then "GL +Driver", and change this to "GL (Full KMS)" ... not "fake KMS," which is +also listed there. Save and reboot. In theory, this should fix the problem. + +If you're _still_ having problems and have a Raspberry Pi 2 or better, go back +to raspi-config and head over to "Advanced Options", "Memory split," and give +the GPU 256 megabytes. You might be able to avoid this for simple games, as +this takes RAM away from the system and reserves it for graphics. You can +also try 128 megabytes as a gentler option. + +Note that you can also run DragonRuby without X11 at all: if you run it from +a virtual terminal it will render fullscreen and won't need the "Full KMS" +option. This might be attractive if you want to use it as a game console +sort of thing, or develop over ssh, or launch it from RetroPie, etc. + +** Conclusion + +There is a lot more you can do with DragonRuby, but now you've already +got just about everything you need to make a simple game. After all, +even the most fancy games are just creating objects and moving them +around. Experiment a little. Add a few more things and have them +interact in small ways. Want something to go away? Just don't add it +to ~args.output~ anymore. + +** IMPORTANT: Go Through All Of The Sample Apps! Study Them Thoroughly!! + +Now that you've completed the Hello World tutorial. Head over to the +`samples` directory. It is very very important that you study the +sample apps thoroughly! Go through them in order. Here is a short +description of each sample app. + +1. 00_beginner_ruby_primer: This is an interactive tutorial that shows how to render ~solid~s, animated ~sprite~s, ~label~s. +2. 00_intermediate_ruby_primer: This is a set of sample Ruby snippets that give you a high level introduction to the programming language. +3. 01_api_01_labels: Various ways to render ~label~s. +4. 01_api_02_lines: Various ways to render ~line~s. +5. 01_api_03_rects: Sample app shows various ways to render ~solid~s and ~border~s. +6. 01_api_04_sprites: Sample app shows various ways to render ~sprite~s. +7. 01_api_05_keyboard: Hows how to get keyboard input from the user. +8. 01_api_06_mouse: Hows how to get mouse mouse position. +9. 01_api_07_point_to_rect: How to get mouse input from the user and shows collision/hit detection. +10. 01_api_08_rect_to_rect: Hit detection/collision between two rectangles. +11. 01_api_10_controller: Interaction with a USB/Bluetooth controller. +12. 01_api_99_tech_demo: All the different render primitives along with using ~render_targets~. +13. 02_collision_01_simple: Collision detection with dynamically moving bodies. +14. 02_collision_02_moving_objects: Collision detection between many primitives, simple platformer physics, and keyboard input. +15. 02_collision_03_entities: Collision with entities and serves as a small introduction to ECS (entity component system). +16. 02_collision_04_ramp_with_debugging: How ramp trajectory can be calculated. +17. 02_collision_05_ramp_with_debugging_two: How ramp trajectory can be calculated. +18. 02_sprite_animation_and_keyboard_input: How to animate a sprite based off of keyboard input. +19. 03_mouse_click: How to determine what direction/vector a mouse was clicked relative to a player. +20. 04_sounds: How to play sounds and work with buttons. +21. 05_mouse_move: How to determine what direction/vector a mouse was clicked relative to a player. +22. 05_mouse_move_paint_app: Represents a simple paint app. +23. 05_mouse_move_tile_editor: A starting point for a tile editor. +24. 06_coordinate_systems: Shows the two origin systems within Game Toolkit where the origin is in the center and where the origin is at the bottom left. +25. 07_render_targets: Shows a powerful concept called ~render_target~s. You can use this to programatically create sprites (it's also useful for representing parts of a scene as if it was a view port/camera). +26. 07_render_targets_advanced: Advanced usage of ~render_target~s. +27. 08_platformer_collisions: Axis aligned collision along with platformer physics. +28. 08_platformer_collisions_metroidvania: How to save map data and place sprites live within a game. +29. 08_platformer_jumping_inertia: Jump physics and how inertia affects collision. +30. 09_controller_analog_usage_advanced_sprites: Extended properties of a ~sprite~ and how to change the rotation anchor point and render a subset/tile of a sprite. +31. 09_sprite_animation_using_tile_sheet: How to perform sprite animates using a tile sheet. +32. 10_save_load_game: Save and load game data. +33. 11_coersion_of_primitives: How primitives of one specific type can be rendered as another primitive type. +34. 11_hash_primitives: How primitives can be represented using a ~Hash~. +35. 12_controller_input_sprite_sheet_animations: How to leverage vectors to move a player around the screen. +36. 12_top_down_area: How to render a top down map and how to manage collision of a player. +37. 13_01_easing_functions: How to use lerping functions to define animations/movement. +38. 13_02_cubic_bezier: How to create a bezier curve using lines. +39. 13_03_easing_using_spline: How a collection of bezier curves can be used to define an animation. +40. 13_04_parametric_enemy_movement: How to define the movement of enemies and projectiles using lerping/parametric functions. +41. 14_sprite_limits: Upper limit for how many sprites can be rendered to the screen. +42. 14_sprite_limits_static_references: Upper limit for how many sprites can be rendered to the screen using ~static~ output collections (which are updated by reference as opposed to by value). +43. 15_collision_limits: How many collisions can be processed across many primitives. +44. 18_moddable_game: How you can make a game where content is authored by the player (modding support). +45. 19_lowrez_jam: How to use ~render_targets~ to create a low resolution game. +46. 20_roguelike_starting_point: A starting point for a roguelike and explores concepts such as line of sight. +47. 20_roguelike_starting_point_two: A starting point for a roguelike where sprites are provided from a tile map/tile sheet. +48. 21_mailbox_usage: How to do interprocess communication. +49. 22_trace_debugging: Debugging techniques and tracing execution through your game. +50. 22_trace_debugging_classes: Debugging techniques and tracing execution through your game. +51. 23_hexagonal_grid: How to make a tactical grid/map made of hexagons. +52. 23_isometric_grid: How to make a tactical grid/map made of isometric sprites. +53. 24_http_example: How to make http requests. +54. 25_3d_experiment_01_square: How to create 3D objects. +55. 26_jam_craft: Starting point for crafting game. It also shows how to customize the mouse cursor. +56. 99_sample_game_basic_gorillas: Reference implementation of a full game. Topics covered: physics, keyboard input, collision, sprite animation. +57. 99_sample_game_clepto_frog: Reference implementation of a full game. Topics covered: camera control, spring/rope physics, scene orchestration. +58. 99_sample_game_dueling_starships: Reference implementation that shows local multiplayer. Topics covered: vectors, particles, friction, inertia. +59. 99_sample_game_flappy_dragon: Reference implementation that is a clone of Flappy Bird. Topics covered: scene orchestration, collision, sound, sprite animations, lerping. +60. 99_sample_game_pong: Reference implementation of pong. +61. 99_sample_game_return_of_serenity: Reference implementation of low resolution story based game. +62. 99_sample_game_the_little_probe: Reference implementation of a full game. Topics covered: Arbitrary collision detection, loading map data, bounce/ball physics. +63. 99_sample_nddnug_workshop: Reference implementation of a full game. Topics covered: vectors, controller input, sound, trig functions. +64. 99_sample_snakemoji: Shows that Ruby supports coding with emojis. +65. 99_zz_gtk_unit_tests: A collection of unit tests that exercise parts of DragonRuby's API. + +S + end + + def docs_deployment +<<-S + +* Deploying To Itch.io + +Once you've built your game, you're all set to deploy! Good luck in +your game dev journey and if you get stuck, come to the Discord +channel! + +** Creating Your Game Landing Page + +Log into Itch.io and go to [[https://itch.io/game/new]]. + +- Title: Give your game a Title. This value represents your `gametitle`. +- Project URL: Set your project url. This value represents your `gameid`. +- Classification: Keep this as Game. +- Kind of Project: Select HTML from the drop down list. Don't worry, + the HTML project type _also supports binary downloads_. +- Uploads: Skip this section for now. + +You can fill out all the other options later. + +** Update Your Game's Metadata + +Point your text editor at mygame/metadata/game_metadata.txt and +make it look like this: + +NOTE: Remove the ~#~ at the beginning of each line. + +#+begin_src +devid=bob +devtitle=Bob The Game Developer +gameid=mygame +gametitle=My Game +version=0.1 +#+end_src + +The ~devid~ property is the username you use to log into Itch.io. +The ~devtitle~ is your name or company name (it can contain spaces). +The ~gameid~ is the Project URL value. +The ~gametitle~ is the name of your game (it can contain spaces). +The ~version~ can be any ~major.minor~ number format. + +** Building Your Game For Distribution + +Open up the terminal and run this from the command line: + +#+begin_src +./dragonruby-publish --only-package mygame +#+end_src + +(if you're on Windows, don't put the "./" on the front. That's a Mac and +Linux thing.) + +A directory called ~./build~ will be created that contains your +binaries. You can upload this to Itch.io manually. + +For the HTML version of your game after you upload it. Check the checkbox labeled +"This file will be played in the browser". + +For subsequent updates you can use an automated deployment to Itch.io: + +#+begin_src +./dragonruby-publish mygame +#+end_src + +DragonRuby will package _and publish_ your game to itch.io! Tell your +friends to go to your game's very own webpage and buy it! + +If you make changes to your game, just re-run dragonruby-publish and it'll +update the downloads for you. +S + end + + def docs_dragonruby_philosophy + <<-S +** DragonRuby's Philosophy + +The following tenants of DragonRuby are what set us apart from other +game engines. Given that Game Toolkit is a relatively new engine, +there are definitely features that are missing. So having a big check +list of "all the cool things" is not this engine's forte. This is +compensated with a strong commitment to the following principals. + +*** Challenge The Status Quo + +Game engines of today are in a local maximum and don't take into +consideration the challenges of this day and age. Unity and GameMaker +specifically rot your brain. It's not sufficient to say: + +#+begin_quote +But that's how we've always done it. +#+end_quote + +It's a hard pill to swallow, but forget blindly accepted best +practices and try to figure out the underlying motivation for a +specific approach to game development. Collaborate with us. + +*** Continuity of Design + +There is a programming idiom in software called "the pit of +success". The term normalizes up front pain as a necessity in the +(hopes that the investment will yield dividends "when you become +successful"). This results in more "Enterprise TM" code upfront, and +makes it more difficult to get started when you are new to programming. + +DragonRuby's philosophy is to provide a spectrum across the "make it +fast" vs "make it right" spectrum and provide incremental, intuitive +transitions between points on that spectrum. This is captured in how +render primitives can be represented as tuples/arrays, hashes, open +structs/entities, and then finally classes (as opposed to forcing devs +to use classes upfront). + +*** Release Often And Soon + +The biggest mistake game devs make is spending too much time in +isolation building their game. Release something, however small, and +release it quickly. + +Stop worrying about everything being pixel perfect. Don't wait until +your game is 100% complete. Build your game publicly and +iterate. Post in the #show-and-tell channel in the community Discord. +You'll find a lot of support and encouragement there. + +Remember: + +#+begin_quote +Real artists ship. +#+end_quote + +*** Sustainable And Ethical Monetization + +We all aspire to put food on the table doing what we love. Whether it +is building games, writing tools to support game development, or +anything in between. + +Charge a fair amount of money for the things you create. It's expected +and encouraged within the community. Give what you create away for +free to those that can't afford it. + +*** Sustainable And Ethical Open Source + +This goes hand in hand with sustainable and ethical monetization. The +current state of open source is not sustainable. There is an immense +amount of contributor burnout. Users of open source expect everything +to be free, and few give back. This is a problem we want to fix (we're +still trying to figure out the best solution). + +So, don't be "that guy" in the Discord that says "DragonRuby should be +free and open source!" You will be personally flogged by Amir. + +*** People Over Entities + +We prioritize the endorsement of real people over faceless +entities. This game engine, and other products we create, are not +insignificant line items of a large company. And you aren't a generic +"commodity" or "corporate resource". So be active in the community +Discord and you'll reap the benefits as more devs use DragonRuby. + +*** Building A Game Should Be Fun And Bring Happiness + +We will prioritize the removal of pain. The aesthetics of Ruby make it +such a joy to work with, and we want to capture that within the +engine. + +*** Real World Application Drives Features + +We are bombarded by marketing speak day in and day out. We don't do +that here. There are things that are really great in the engine, and +things that need a lot of work. Collaborate with us so we can help you +reach your goals. Ask for features you actually need as opposed to +anything speculative. + +We want DragonRuby to *actually* help you build the game you +want to build (as opposed to sell you something piece of demoware that +doesn't work). +S + end + + def docs_ticks_and_frames + <<-S +* How To Determine What Frame You Are On + +There is a property on ~state~ called ~tick_count~ that is incremented +by DragonRuby every time the ~tick~ method is called. The following +code renders a label that displays the current ~tick_count~. + +#+begin_src ruby + def tick args + args.outputs.labels << [10, 670, "\#{args.state.tick_count}"] + end +#+end_src + +* How To Get Current Framerate + +Current framerate is a top level property on the Game Toolkit Runtime +and is accessible via ~args.gtk.current_framerate~. + +#+begin_src ruby + def tick args + args.outputs.labels << [10, 710, "framerate: \#{args.gtk.current_framerate.round}"] + end +#+end_src +S + end + + def docs_sprites + <<-S +* How To Render A Sprite Using An Array + +All file paths should use the forward slash ~/~ *not* backslash +~\~. Game Toolkit includes a number of sprites in the ~sprites~ +folder (everything about your game is located in the ~mygame~ directory). + +The following code renders a sprite with a ~width~ and ~height~ of +~100~ in the center of the screen. + +~args.outputs.sprites~ is used to render a sprite. + +#+begin_src ruby + def tick args + args.outputs.sprites << [ + 640 - 50, # X + 360 - 50, # Y + 100, # W + 100, # H + 'sprites/square-blue.png' # PATH + ] + end +#+end_src + +* More Sprite Properties As An Array + +Here are all the properties you can set on a sprite. + +#+begin_src ruby + def tick args + args.outputs.sprites << [ + 100, # X + 100, # Y + 32, # W + 64, # H + 'sprites/square-blue.png', # PATH + 0, # ANGLE + 255, # ALPHA + 0, # RED_SATURATION + 255, # GREEN_SATURATION + 0 # BLUE_SATURATION + ] + end +#+end_src + +* Different Sprite Representations + +Using ordinal positioning can get a little unruly given so many +properties you have control over. + +You can represent a sprite as a ~Hash~: + +#+begin_src ruby + def tick args + args.outputs.sprites << { + x: 640 - 50, + y: 360 - 50, + w: 100, + h: 100, + path: 'sprites/square-blue.png', + angle: 0, + a: 255, + r: 255, + g: 255, + b: 255, + source_x: 0, + source_y: 0, + source_w: -1, + source_h: -1, + flip_vertically: false, + flip_horizontally: false, + angle_anchor_x: 0.5, + angle_anchor_y: 1.0 + } + end +#+end_src + +You can represent a sprite as an ~object~: + +#+begin_src ruby + # Create type with ALL sprite properties AND primitive_marker + class Sprite + attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, + :source_x, :source_y, :source_w, :source_h, + :tile_x, :tile_y, :tile_w, :tile_h, + :flip_horizontally, :flip_vertically, + :angle_anchor_x, :angle_anchor_y + + def primitive_marker + :sprite + end + end + + class BlueSquare < Sprite + def initialize opts + @x = opts[:x] + @y = opts[:y] + @w = opts[:w] + @h = opts[:h] + @path = 'sprites/square-blue.png' + end + end + + def tick args + args.outputs.sprites << (BlueSquare.new x: 640 - 50, + y: 360 - 50, + w: 50, + h: 50) + end +#+end_src +S + end + + def docs_labels + <<-S +* How To Render A Label + +~args.outputs.labels~ is used to render labels. + +Labels are how you display text. This code will go directly inside of +the ~def tick args~ method. + +Here is the minimum code: + +#+begin_src + def tick args + # X Y TEXT + args.outputs.labels << [640, 360, "I am a black label."] + end +#+end_src + +* A Colored Label + +#+begin_src + def tick args + # A colored label + # X Y TEXT, RED GREEN BLUE ALPHA + args.outputs.labels << [640, 360, "I am a redish label.", 255, 128, 128, 255] + end +#+end_src + +* Extended Label Properties + +#+begin_src + def tick args + # A colored label + # X Y TEXT SIZE ALIGNMENT RED GREEN BLUE ALPHA FONT FILE + args.outputs.labels << [ + 640, # X + 360, # Y + "Hello world", # TEXT + 0, # SIZE_ENUM + 1, # ALIGNMENT_ENUM + 0, # RED + 0, # GREEN + 0, # BLUE + 255, # ALPHA + "fonts/coolfont.ttf" # FONT + ] + end +#+end_src + +A ~SIZE_ENUM~ of ~0~ represents "default size". A ~negative~ value +will decrease the label size. A ~positive~ value will increase the +label's size. + +An ~ALIGNMENT_ENUM~ of ~0~ represents "left aligned". ~1~ represents +"center aligned". ~2~ represents "right aligned". + +* Rendering A Label As A ~Hash~ + +You can add additional metadata about your game within a label, which requires you to use a `Hash` instead. + +#+begin_src + def tick args + args.outputs.labels << { + x: 200, + y: 550, + text: "dragonruby", + size_enum: 2, + alignment_enum: 1, + r: 155, + g: 50, + b: 50, + a: 255, + font: "fonts/manaspc.ttf", + # You can add any properties you like (this will be ignored/won't cause errors) + game_data_one: "Something", + game_data_two: { + value_1: "value", + value_2: "value two", + a_number: 15 + } + } + end +#+end_src + +* Getting The Size Of A Piece Of Text + +You can get the render size of any string using ~args.gtk.calcstringbox~. + +#+begin_src ruby + def tick args + # TEXT SIZE_ENUM FONT + w, h = args.gtk.calcstringbox("some string", 0, "font.ttf") + + # NOTE: The SIZE_ENUM and FONT are optional arguments. + + # Render a label showing the w and h of the text: + args.outputs.labels << [ + 10, + 710, + # This string uses Ruby's string interpolation literal: \#{} + "'some string' has width: \#{w}, and height: \#{h}." + ] + end +#+end_src +S + end + + def docs_sounds + <<-S +* How To Play A Sound + +Sounds that end ~.wav~ will play once: + +#+begin_src ruby + def tick args + # Play a sound every second + if (args.state.tick_count % 60) == 0 + args.outputs.sounds << 'something.wav' + end + end +#+end_src + +Sounds that end ~.ogg~ is considered background music and will loop: + +#+begin_src ruby + def tick args + # Start a sound loop at the beginning of the game + if args.state.tick_count == 0 + args.outputs.sounds << 'background_music.ogg' + end + end +#+end_src + +If you want to play a ~.ogg~ once as if it were a sound effect, you can do: + +#+begin_src ruby + def tick args + # Play a sound every second + if (args.state.tick_count % 60) == 0 + args.gtk.queue_sound 'some-ogg.ogg' + end + end +#+end_src +S + end + + def docs_game_state + <<-S +* Using ~args.state~ To Store Your Game State + +~args.state~ is a open data structure that allows you to define +properties that are arbitrarily nested. You don't need to define any kind of +~class~. + +To initialize your game state, use the ~||=~ operator. Any value on +the right side of ~||=~ will only be assigned _once_. + +To assign a value every frame, just use the ~=~ operator, but _make +sure_ you've initialized a default value. + +#+begin_src + def tick args + # initialize your game state ONCE + args.player.x ||= 0 + args.player.y ||= 0 + args.player.hp ||= 100 + + # increment the x position of the character by one every frame + args.player.x += 1 + + # Render a sprite with a label above the sprite + args.outputs.sprites << [ + args.player.x, + args.player.y, + 32, 32, + "player.png" + ] + + args.outputs.labels << [ + args.player.x, + args.player.y - 50, + args.player.hp + ] + end +#+end_src +S + end + + def animate_a_sprite + <<-S +* How To Animate A Sprite Using Separate PNGs + +DragonRuby has a property on ~Numeric~ called ~frame_index~ that can +be used to determine what frame of an animation to show. Here is an +example of how to cycle through 6 sprites every 4 frames. + +#+begin_src ruby + def tick args + start_looping_at = 0 + number_of_sprites = 6 + number_of_frames_to_show_each_sprite = 4 + does_sprite_loop = true + + sprite_index = + start_looping_at.frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + sprite_index ||= 0 + + args.outputs.sprites << [ + 640 - 50, + 360 - 50, + 100, + 100, + "sprites/dragon-\#{sprite_index}.png" + ] + end +#+end_src +S + end + + def docs_faq +<<-S +* Frequently Asked Questions, Comments, and Concerns + +Here are questions, comments, and concerns that frequently come +up. + +** Frequently Asked Questions + +*** What is DragonRuby LLP? + +DragonRuby LLP is a partnership of four devs who came together +with the goal of bringing the aesthetics and joy of Ruby, everywhere possible. + +Under DragonRuby LLP, we offer a number of products (with more on the +way): + +- Game Toolkit (GTK): A 2D game engine that is compatible with modern + gaming platforms. [Home Page]() [FAQ Page]() +- RubyMotion (RM): A compiler toolchain that allows you to build native, cross-platform mobile + apps. [Home Page]() [FAQ Page]() +- Commandline Toolkit (CTK): A zero dependency, zero installation Ruby + environment that works on Windows, Mac, and Linux. [Home Page]() [FAQ Page]() + +All of the products above leverage a shared core called DragonRuby. + +NOTE: From an official branding standpoint each one of the products is +suffixed with "A DragonRuby LLP Product" tagline. Also, DragonRuby is +_one word, title cased_. + +NOTE: We leave the "A DragonRuby LLP Product" off of this one because +that just sounds really weird. + +NOTE: Devs who use DragonRuby are "Dragon Riders/Riders of Dragons". That's a bad ass +identifier huh? + +*** What is DragonRuby? + +The response to this question requires a few subparts. First we need +to clarify some terms. Specifically _language specification_ vs _runtime_. + +*** Okay... so what is the difference between a language specification and a runtime? + +A runtime is an _implementation_ of a language specification. When +people say "Ruby," they are usually referring to "the Ruby 3.0+ language +specification implemented via the CRuby/MRI Runtime." + +But, there are many Ruby Runtimes: CRuby/MRI, JRuby, Truffle, Rubinius, Artichoke, +and (last but certainly not least) DragonRuby. + +*** Okay... what language specification does DragonRuby use then? + +DragonRuby's goal is to be compliant with the ISO/IEC 30170:2012 standard. It's +syntax is Ruby 2.x compatible, but also contains semantic changes that help +it natively interface with platform specific libraries. + +*** So... why another runtime? + +The elevator pitch is: + +DragonRuby is a Multilevel Cross-platform Runtime. The "multiple levels" +within the runtime allows us to target platforms no other Ruby can +target: PC, Mac, Linux, Raspberry Pi, WASM, iOS, Android, Nintendo +Switch, PS4, Xbox, and Scadia. + +*** What does Multilevel Cross-platform mean? + +There are complexities associated with targeting all the platforms we +support. Because of this, the runtime had to be architected in such a +way that new platforms could be easily added (which lead to us partitioning the +runtime internally): + +- Level 1 we leverage a good portion of mRuby. +- Level 2 consists of optimizations to mRuby we've made given that our + target platforms are well known. +- Level 3 consists of portable C libraries and their Ruby + C-Extensions. + +Levels 1 through 3 are fairly commonplace in many runtime +implementations (with level 1 being the most portable, and level 3 +being the fastest). But the DragonRuby Runtime has taken things a +bit further: + +- Level 4 consists of shared abstractions around hardware I/O and operating + system resources. This level leverages open source and proprietary + components within Simple DirectMedia Layer (a low level multimedia + component library that has been in active development for 22 years + and counting). + +- Level 5 is a code generation layer which creates metadata that allows + for native interoperability with host runtime libraries. It also + includes OS specific message pump orchestrations. + +- Level 6 is a Ahead of Time/Just in Time Ruby compiler built with LLVM. This + compiler outputs _very_ fast platform specific bitcode, but only + supports a subset of the Ruby language specification. + +These levels allow us to stay up to date with open source +implementations of Ruby; provide fast, native code execution +on proprietary platforms; ensure good separation between these two +worlds; and provides a means to add new platforms without going insane. + +*** Cool cool. So given that I understand everything to this point, can we answer the original question? What is DragonRuby? + +DragonRuby is a Ruby runtime implementation that takes all the lessons +we've learned from MRI/CRuby, and merges it with the latest and greatest +compiler and OSS technologies. + +** Frequent Comments + +*** But Ruby is dead. + +Let's check the official source for the answer to this question: +isrubydead.com: [[https://isrubydead.com/]]. + +On a more serious note, Ruby's _quantity_ levels aren't what they used +to be. And that's totally fine. Every one chases the new and shiny. + +What really matters is _quality/maturity_. Here is the latest (StackOverflow +Survey sorted by highest paid developers)[https://insights.stackoverflow.com/survey/2019#top-paying-technologies]. + +Let's stop making this comment shall we? + +*** But Ruby is slow. + +That doesn't make any sense. A language specification can't be +slow... it's a language spec. Sure, an _implementation/runtime_ can be slow though, but then we'd +have to talk about which runtime. + +*** Dynamic languages are slow. + +They are certainly slower than statically compiled languages. With the +processing power and compiler optimizations we have today, +dynamic languages like Ruby are _fast enough_. + +Unless you are writing in some form of intermediate representation by hand, +your language of choice also suffers this same fallacy of slow. Like, nothing is +faster than a low level assembly-like language. So unless you're +writing in that, let's stop making this comment. + +NOTE: If you _are_ hand writing LLVM IR, we are always open to +bringing on new partners with such a skill set. Email us ^_^. + +** Frequent Concerns + +*** DragonRuby is not open source. That's not right. + +The current state of open source is unsustainable. Contributors work +for free, most all open source repositories are severely under-staffed, +and burnout from core members is rampant. + +We believe in open source very strongly. Parts of DragonRuby are +in fact, open source. Just not all of it (for legal reasons, and +because the IP we've created has value). And we promise that we are +looking for (or creating) ways to _sustainably_ open source everything we do. + +If you have ideas on how we can do this, email us! + +If the reason above isn't sufficient, then definitely use something else. + +*** DragonRuby is for pay. You should offer a free version. + +If you can afford to pay for DragonRuby, you should (and will). We don't go +around telling writers that they should give us their books for free, +and only require payment if we read the entire thing. It's time we stop asking that +of software products. + +That being said, we will _never_ put someone out financially. We have +income assistance for anyone that can't afford a license to any one of +our products. + +You qualify for a free, unrestricted license to DragonRuby products if +any of the following items pertain to you: + +- Your income is below $2,000.00 (USD) per month. +- You are under 18 years of age. +- You are a student of any type: traditional public school, home + schooling, college, bootcamp, or online. +- You are a teacher, mentor, or parent who wants to teach a kid how to code. +- You work/worked in public service or at a charitable organization: + for example public office, army, or any 501(c)(3) organization. + +Just contact Amir at [email protected] with a short +explanation of your current situation and he'll set you up. No +questions asked. + +*** But still, you should offer a free version. So I can try it out and see if I like it. + +You can try our [web-based sandbox environment](). But it won't do the +runtime justice. Or just come to our [Slack]() or [Discord]() channel +and ask questions. We'd be happy to have a one on one video chat with +you and show off all the cool stuff we're doing. + +Seriously just buy it. Get a refund if you don't like it. We make it +stupid easy to do so. + +*** I still think you should do a free version. Think of all people who would give it a shot. + +Free isn't a sustainable financial model. We don't want to spam your +email. We don't want to collect usage data off of you either. We just +want to provide quality toolchains to quality developers (as opposed +to a large quantity of developers). + +The people that pay for DragonRuby and make an effort to understand it are the +ones we want to build a community around, partner with, and collaborate +with. So having that small monetary wall deters entitled individuals +that don't value the same things we do. + +*** What if I build something with DragonRuby, but DragonRuby LLP becomes insolvent. + +That won't happen if the development world stop asking for free stuff +and non-trivially compensate open source developers. Look, we want to be +able to work on the stuff we love, every day of our lives. And we'll go +to great lengths to make that happen. + +But, in the event that sad day comes, our partnership bylaws state that +_all_ DragonRuby IP that can be legally open sourced, will be released +under a permissive license. +S + end + end + + class ReadMe + extend Docs + extend ReadMeDocs + end +end diff --git a/dragon/runtime_docs.rb b/dragon/runtime_docs.rb new file mode 100644 index 0000000..09759b4 --- /dev/null +++ b/dragon/runtime_docs.rb @@ -0,0 +1,39 @@ +# coding: utf-8 +# Copyright 2019 DragonRuby LLC +# MIT License +# runtime_docs.rb has been released under MIT (*only this file*). + +module RuntimeDocs + def docs_class + <<-S +* DOCS: ~GTK::Runtime~ +The GTK::Runtime class is the core of DragonRuby. It is globally accessible via ~$gtk~. +S + end + + def docs_reset + <<-S +* DOCS: ~GTK::Runtime#reset~ +This function will reset Kernel.tick_count to 0 and will remove all data from args.state. +S + end + + def docs_calcstringbox + <<-S +* DOCS: ~GTK::Runtime#calcstringbox~ +This function returns the width and height of a string. + +#+begin_src ruby + def tick args + args.state.string_size ||= args.gtk.calcstringbox "Hello World" + args.state.string_size_font_size ||= args.gtk.calcstringbox "Hello World" + end +#+end_src +S + end +end + +class GTK::Runtime + extend Docs + extend RuntimeDocs +end diff --git a/dragon/string.rb b/dragon/string.rb index 8d2d9ba..5fa273c 100644 --- a/dragon/string.rb +++ b/dragon/string.rb @@ -38,6 +38,7 @@ S self[0..-2] end + # @gtk def wrapped_lines length self.each_line.map do |l| l = l.rstrip @@ -50,20 +51,22 @@ S end.flatten end + # @gtk def wrap length wrapped_lines(length).join.rstrip end + # @gtk def multiline? include? "\n" end - def indent_lines amount + def indent_lines amount, char = " " self.each_line.each_with_index.map do |l, i| if i == 0 l else - " " * amount + l + char * amount + l end end.join end diff --git a/dragon/tests.rb b/dragon/tests.rb index 5cda2fe..7cbba09 100644 --- a/dragon/tests.rb +++ b/dragon/tests.rb @@ -16,7 +16,6 @@ module GTK def run_test m args = Args.new $gtk, nil assert = Assert.new - setup(args) if respond_to?(:setup) begin log_test_running m send(m, args, assert) @@ -32,7 +31,6 @@ module GTK mark_test_failed m, e end end - teardown if respond_to?(:teardown) end def test_methods_focused @@ -43,6 +41,7 @@ module GTK Object.methods.find_all { |m| m.start_with? "test_" } end + # @gtk def start log "* TEST: gtk.test.start has been invoked." if test_methods_focused.length != 0 @@ -73,10 +72,6 @@ module GTK def log_inconclusive m self.inconclusive << {m: m} log "Inconclusive." - log_once :assertion_ok_note, <<-S -NOTE FOR INCONCLUSIVE TESTS: No assertion was performed in the test. -Add assert.ok! at the end of the test if you are using your own assertions. -S end def log_passed m @@ -125,6 +120,12 @@ S log "#{self.passed.length} test(s) passed." self.passed.each { |h| log "**** :#{h[:m]}" } log "*** Inconclusive" + if self.inconclusive.length > 0 + log_once :assertion_ok_note, <<-S +NOTE FOR INCONCLUSIVE TESTS: No assertion was performed in the test. +Add assert.ok! at the end of the test if you are using your own assertions. +S + end log "#{self.inconclusive.length} test(s) inconclusive." self.inconclusive.each { |h| log "**** :#{h[:m]}" } log "*** Failed" diff --git a/dragon/trace.rb b/dragon/trace.rb index c3b4bbd..04067bf 100644 --- a/dragon/trace.rb +++ b/dragon/trace.rb @@ -65,7 +65,7 @@ module GTK @traced_classes.clear $trace_enabled = false if !$gtk.production - $gtk.write_file 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of `tick` and this file will be populated with invocation information.\n" + $gtk.write_file 'logs/trace.txt', "Add trace!(SOMEOBJECT) to the top of ~tick~ and this file will be populated with invocation information.\n" end end @@ -95,6 +95,7 @@ module GTK $trace_puts.clear end + # @gtk def self.trace! instance = nil $trace_history ||= [] $trace_enabled = true diff --git a/samples/00_beginner_ruby_primer/app/automation.rb b/samples/00_beginner_ruby_primer/app/automation.rb new file mode 100644 index 0000000..014c14c --- /dev/null +++ b/samples/00_beginner_ruby_primer/app/automation.rb @@ -0,0 +1,120 @@ +# ========================================================================== +# _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _ +# | | | | ____\ \ / / | | |_ _|/ ____|__ __| ____| \ | | | | | | +# | |__| | |__ \ \_/ / | | | | | (___ | | | |__ | \| | | | | | +# | __ | __| \ / | | | | \___ \ | | | __| | . ` | | | | | +# | | | | |____ | | | |____ _| |_ ____) | | | | |____| |\ |_|_|_|_| +# |_| |_|______| |_| |______|_____|_____/ |_| |______|_| \_(_|_|_|_) +# +# +# | +# | +# | +# | +# | +# | +# | +# | +# | +# | +# \ | / +# \ | / +# + +# +# If you are new to the programming language Ruby, then you may find the +# following code a bit overwhelming. Come back to this file when you have +# a better grasp of Ruby and Game Toolkit. +# +# What follows is an automations script # that can be run via terminal: +# ./samples/00_beginner_ruby_primer $ ../../dragonruby . --eval app/automation.rb +# ========================================================================== + +$gtk.reset +$gtk.scheduled_callbacks.clear +$gtk.schedule_callback 10 do + $gtk.console.set_command 'puts "Hello DragonRuby!"' +end + +$gtk.schedule_callback 20 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 30 do + $gtk.console.set_command 'outputs.solids << [910, 200, 100, 100, 255, 0, 0]' +end + +$gtk.schedule_callback 40 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 50 do + $gtk.console.set_command 'outputs.solids << [1010, 200, 100, 100, 0, 0, 255]' +end + +$gtk.schedule_callback 60 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 70 do + $gtk.console.set_command 'outputs.sprites << [1110, 200, 100, 100, "sprites/dragon_fly_0.png"]' +end + +$gtk.schedule_callback 80 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 90 do + $gtk.console.set_command "outputs.labels << [1210, 200, state.tick_count, 0, 255, 0]" +end + +$gtk.schedule_callback 100 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 110 do + $gtk.console.set_command "state.sprite_frame = state.tick_count.idiv(4).mod(6)" +end + +$gtk.schedule_callback 120 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 130 do + $gtk.console.set_command "outputs.labels << [1210, 170, state.sprite_frame, 0, 255, 0]" +end + +$gtk.schedule_callback 140 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 150 do + $gtk.console.set_command "state.sprite_path = \"sprites/dragon_fly_\#{state.sprite_frame}.png\"" +end + +$gtk.schedule_callback 160 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 170 do + $gtk.console.set_command "outputs.labels << [910, 330, \"path: \#{state.sprite_path}\", 0, 255, 0]" +end + +$gtk.schedule_callback 180 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 190 do + $gtk.console.set_command "outputs.sprites << [910, 330, 370, 370, state.sprite_path]" +end + +$gtk.schedule_callback 200 do + $gtk.console.eval_the_set_command +end + +$gtk.schedule_callback 300 do + $gtk.console.set_command ":wq" +end + +$gtk.schedule_callback 400 do + $gtk.console.eval_the_set_command +end diff --git a/samples/00_beginner_ruby_primer/app/main.rb b/samples/00_beginner_ruby_primer/app/main.rb new file mode 100644 index 0000000..6822cf3 --- /dev/null +++ b/samples/00_beginner_ruby_primer/app/main.rb @@ -0,0 +1,317 @@ +# ========================================================================== +# _ _ ________ __ _ _____ _____ _______ ______ _ _ _ _ _ _ +# | | | | ____\ \ / / | | |_ _|/ ____|__ __| ____| \ | | | | | | +# | |__| | |__ \ \_/ / | | | | | (___ | | | |__ | \| | | | | | +# | __ | __| \ / | | | | \___ \ | | | __| | . ` | | | | | +# | | | | |____ | | | |____ _| |_ ____) | | | | |____| |\ |_|_|_|_| +# |_| |_|______| |_| |______|_____|_____/ |_| |______|_| \_(_|_|_|_) +# +# +# | +# | +# | +# | +# | +# | +# | +# | +# | +# | +# \ | / +# \ | / +# + +# +# If you are new to the programming language Ruby, then you may find the +# following code a bit overwhelming. This sample is only designed to be +# run interactively (as opposed to being manipulated via source code). +# +# Start up this sample and follow along by visiting: +# https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-primer.mp4 +# +# It is STRONGLY recommended that you work through all the samples before +# looking at the code in this file. +# ========================================================================== + +class TutorialOutputs + attr_accessor :solids, :sprites, :labels, :lines, :borders + + def initialize + @solids = [] + @sprites = [] + @labels = [] + @lines = [] + @borders = [] + end + + def tick + @solids ||= [] + @sprites ||= [] + @labels ||= [] + @lines ||= [] + @borders ||= [] + @solids.each { |p| $gtk.args.outputs.reserved << p.solid } + @sprites.each { |p| $gtk.args.outputs.reserved << p.sprite } + @labels.each { |p| $gtk.args.outputs.reserved << p.label } + @lines.each { |p| $gtk.args.outputs.reserved << p.line } + @borders.each { |p| $gtk.args.outputs.reserved << p.border } + end + + def clear + @solids.clear + @sprites.clear + @labels.clear + @borders.clear + end +end + +def defaults + state.reset_button ||= + state.new_entity( + :button, + label: [1190, 68, "RESTART", -2, 0, 0, 0, 0].label, + background: [1160, 38, 120, 50, 255, 255, 255].solid + ) + $gtk.log_level = :off +end + +def tick_reset_button + return unless state.hello_dragonruby_confirmed + $gtk.args.outputs.reserved << state.reset_button.background + $gtk.args.outputs.reserved << state.reset_button.label + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.reset_button.background) + restart_tutorial + end +end + +def seperator + @seperator = "=" * 80 +end + +def tick_intro + queue_message "Welcome to the DragonRuby GTK primer! Try typing the +code below and press ENTER: + + puts \"Hello DragonRuby!\" +" +end + +def tick_hello_dragonruby + return unless console_has? "Hello DragonRuby!" + + $gtk.args.state.hello_dragonruby_confirmed = true + + queue_message "Well HELLO to you too! + +If you ever want to RESTART the tutorial, just click the \"RESTART\" +button in the bottom right-hand corner. + +Let's continue shall we? Type the code below and press ENTER: + + outputs.solids << [910, 200, 100, 100, 255, 0, 0] +" + +end + +def tick_explain_solid + return unless $tutorial_outputs.solids.any? {|s| s == [910, 200, 100, 100, 255, 0, 0]} + + queue_message "Sweet! + +The code: outputs.solids << [910, 200, 100, 100, 255, 0, 0] +Does the following: +1. GET the place where SOLIDS go: outputs.solids +2. Request that a new SOLID be ADDED: << +3. The DEFINITION of a SOLID is the ARRAY: + [910, 200, 100, 100, 255, 0, 0] + + GET ADD X Y WIDTH HEIGHT RED GREEN BLUE + | | | | | | | | | + | | | | | | | | | +outputs.solids << [910, 200, 100, 100, 255, 0, 0] + |_________________________________________| + | + | + ARRAY + +Now let's create a blue SOLID. Type: + + outputs.solids << [1010, 200, 100, 100, 0, 0, 255] +" + + state.explain_solid_confirmed = true +end + +def tick_explain_solid_blue + return unless state.explain_solid_confirmed + return unless $tutorial_outputs.solids.any? {|s| s == [1010, 200, 100, 100, 0, 0, 255]} + state.explain_solid_blue_confirmed = true + + queue_message "And there is our blue SOLID! + +The ARRAY is the MOST important thing in DragonRuby GTK. + +Let's create a SPRITE using an ARRAY: + + outputs.sprites << [1110, 200, 100, 100, 'sprites/dragon_fly_0.png'] +" +end + +def tick_explain_tick_count + return unless $tutorial_outputs.sprites.any? {|s| s == [1110, 200, 100, 100, 'sprites/dragon_fly_0.png']} + return if $tutorial_outputs.labels.any? {|l| l == [1210, 200, state.tick_count, 255, 255, 255]} + state.explain_tick_count_confirmed = true + + queue_message "Look at the cute little dragon! + +We can create a LABEL with ARRAYS too. Let's create a LABEL showing +THE PASSAGE OF TIME, which is called TICK_COUNT. + + outputs.labels << [1210, 200, state.tick_count, 0, 255, 0] +" +end + +def tick_explain_mod + return unless $tutorial_outputs.labels.any? {|l| l == [1210, 200, state.tick_count, 0, 255, 0]} + state.explain_mod_confirmed = true + queue_message " +The code: outputs.labels << [1210, 200, state.tick_count, 0, 255, 0] +Does the following: +1. GET the place where labels go: outputs.labels +2. Request that a new label be ADDED: << +3. The DEFINITION of a LABEL is the ARRAY: + [1210, 200, state.tick_count, 0, 255, 0] + + GET ADD X Y TEXT RED GREEN BLUE + | | | | | | | | + | | | | | | | | +outputs.labels << [1210, 200, state.tick_count, 0, 255, 0] + |______________________________________________| + | + | + ARRAY + +Now let's do some MATH, save the result to STATE, and create a LABEL: + + state.sprite_frame = state.tick_count.idiv(4).mod(6) + outputs.labels << [1210, 170, state.sprite_frame, 0, 255, 0] + +Type the lines above (pressing ENTER after each line). +" +end + +def tick_explain_string_interpolation + return unless state.explain_mod_confirmed + return unless state.sprite_frame == state.tick_count.idiv(4).mod(6) + return unless $tutorial_outputs.labels.any? {|l| l == [1210, 170, state.sprite_frame, 0, 255, 0]} + + queue_message "Here is what the mathematical computation you just typed does: + +1. Create an item of STATE named SPRITE_FRAME: state.sprite_frame = +2. Set this SPRITE_FRAME to the PASSAGE OF TIME (tick_count), + DIVIDED EVENLY (idiv) into 4, + and then compute the REMAINDER (mod) of 6. + + STATE SPRITE_FRAME PASSAGE OF HOW LONG HOW MANY + | | TIME TO SHOW IMAGES + | | | AN IMAGE TO FLIP THROUGH + | | | | | +state.sprite_frame = state.tick_count.idiv(4).mod(6) + | | + | +- REMAINDER OF DIVIDE + DIVIDE EVENLY + (NO DECIMALS) + +With the information above, we can animate a SPRITE +using STRING INTERPOLATION: \#{} +which creates a unique SPRITE_PATH: + + state.sprite_path = \"sprites/dragon_fly_\#{state.sprite_frame}.png\" + outputs.labels << [910, 330, \"path: \#{state.sprite_path}\", 0, 255, 0] + outputs.sprites << [910, 330, 370, 370, state.sprite_path] + +Type the lines above (pressing ENTER after each line). +" +end + +def tick_reprint_on_error + return unless console.last_command_errored + puts $gtk.state.messages.last + puts "\nWhoops! Try again." + console.last_command_errored = false +end + +def tick_evals + state.evals ||= [] + if console.last_command && (console.last_command.start_with?("outputs.") || console.last_command.start_with?("state.")) + state.evals << console.last_command + console.last_command = nil + end + + state.evals.each do |l| + Kernel.eval l + end +rescue Exception => e + state.evals = state.evals[0..-2] +end + +$tutorial_outputs ||= TutorialOutputs.new + +def tick args + $gtk.log_level = :off + defaults + console.show + $tutorial_outputs.clear + $tutorial_outputs.solids << [900, 37, 480, 700, 0, 0, 0, 255] + $tutorial_outputs.borders << [900, 37, 380, 683, 255, 255, 255] + tick_evals + $tutorial_outputs.tick + tick_intro + tick_hello_dragonruby + tick_reset_button + tick_explain_solid + tick_explain_solid_blue + tick_reprint_on_error + tick_explain_tick_count + tick_explain_mod + tick_explain_string_interpolation +end + +def console + $gtk.console +end + +def queue_message message + $gtk.args.state.messages ||= [] + return if $gtk.args.state.messages.include? message + $gtk.args.state.messages << message + last_three = [$gtk.console.log[-3], $gtk.console.log[-2], $gtk.console.log[-1]].reject_nil + $gtk.console.log.clear + puts seperator + $gtk.console.log += last_three + puts seperator + puts message + puts seperator +end + +def console_has? message + console.log.map(&:upcase).include? "#{message.upcase}\n" +end + +def restart_tutorial + $tutorial_outputs.clear + $gtk.console.log.clear + $gtk.reset + puts "Starting the tutorial over!" +end + +def state + $gtk.args.state +end + +def inputs + $gtk.args.inputs +end + +def outputs + $tutorial_outputs +end diff --git a/samples/00_beginner_ruby_primer/license-for-sample.txt b/samples/00_beginner_ruby_primer/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/00_beginner_ruby_primer/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/00_beginner_ruby_primer/sprites/dragon_fly_0.png b/samples/00_beginner_ruby_primer/sprites/dragon_fly_0.png Binary files differnew file mode 100644 index 0000000..fb179af --- /dev/null +++ b/samples/00_beginner_ruby_primer/sprites/dragon_fly_0.png diff --git a/samples/00_beginner_ruby_primer/sprites/dragon_fly_1.png b/samples/00_beginner_ruby_primer/sprites/dragon_fly_1.png Binary files differnew file mode 100644 index 0000000..8cfe531 --- /dev/null +++ b/samples/00_beginner_ruby_primer/sprites/dragon_fly_1.png diff --git a/samples/00_beginner_ruby_primer/sprites/dragon_fly_2.png b/samples/00_beginner_ruby_primer/sprites/dragon_fly_2.png Binary files differnew file mode 100644 index 0000000..cb462e1 --- /dev/null +++ b/samples/00_beginner_ruby_primer/sprites/dragon_fly_2.png diff --git a/samples/00_beginner_ruby_primer/sprites/dragon_fly_3.png b/samples/00_beginner_ruby_primer/sprites/dragon_fly_3.png Binary files differnew file mode 100644 index 0000000..04c4977 --- /dev/null +++ b/samples/00_beginner_ruby_primer/sprites/dragon_fly_3.png diff --git a/samples/00_beginner_ruby_primer/sprites/dragon_fly_4.png b/samples/00_beginner_ruby_primer/sprites/dragon_fly_4.png Binary files differnew file mode 100644 index 0000000..b29fa3d --- /dev/null +++ b/samples/00_beginner_ruby_primer/sprites/dragon_fly_4.png diff --git a/samples/00_beginner_ruby_primer/sprites/dragon_fly_5.png b/samples/00_beginner_ruby_primer/sprites/dragon_fly_5.png Binary files differnew file mode 100644 index 0000000..99f4e74 --- /dev/null +++ b/samples/00_beginner_ruby_primer/sprites/dragon_fly_5.png diff --git a/samples/00_intermediate_ruby_primer/app/01_commenting_code.txt b/samples/00_intermediate_ruby_primer/app/01_commenting_code.txt new file mode 100644 index 0000000..37cd3ed --- /dev/null +++ b/samples/00_intermediate_ruby_primer/app/01_commenting_code.txt @@ -0,0 +1,13 @@ +# ==================================================================================== +# Commenting Code +# ==================================================================================== +# +# Prefixing text with a pound sign (#) is how you comment code in Ruby. Example: +# +# I am commented code. And so are the lines above. +# +# I you want more than a quick primer on Ruby, check out https://poignant.guide/. It's +# an entertaining read. Otherwise, go to the next txt file. +# +# Follow along by visiting: +# https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-gtk-intermediate.mp4 diff --git a/samples/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt b/samples/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt new file mode 100644 index 0000000..54fbb5c --- /dev/null +++ b/samples/00_intermediate_ruby_primer/app/02_printing_to_the_console.txt @@ -0,0 +1,14 @@ +# ==================================================================================== +# Printing to the Console: +# ==================================================================================== +# +# Every time you save repl.rb file, DragonRuby runs the code within it. Copy this text +# to repl.rb and save to see Hello World printed to the console. + +puts '' +puts '' +puts '================================' +puts 'Hello World' +puts '================================' +puts '' +puts '' diff --git a/samples/00_intermediate_ruby_primer/app/03_types_and_assignments.txt b/samples/00_intermediate_ruby_primer/app/03_types_and_assignments.txt new file mode 100644 index 0000000..2617ae4 --- /dev/null +++ b/samples/00_intermediate_ruby_primer/app/03_types_and_assignments.txt @@ -0,0 +1,74 @@ +# ==================================================================================== +# Types and Assignments +# ==================================================================================== +# +# Here is how you define various data structures in Ruby. Same deal here. Take the text +# in this file and paste it into repl.rb and save: + +puts '' +puts '' +puts '================================' +puts '' + +# ==================================================================================== +# Strings +# ==================================================================================== + +puts '======== strings' +message = "Hello World" +puts "The value of message is: " + message +puts "Any value can be interpolated within a string using \#{}." +puts "Interpolated message: #{message}." +puts 'This #{message} is not interpolated because the string uses single quotes.' +puts '' + +# ==================================================================================== +# Numerics +# ==================================================================================== + +puts '======== ints and floats' +a = 10 +puts "The value of a is: #{a}" +puts "a + 1 is: #{a + 1}" +puts "a / 3 is: #{a / 3}" +puts '' + +b = 10.12 +puts "The value of b is: #{b}" +puts "b + 1 is: #{b + 1}" +puts "b as an integer is: #{b.to_i}" +puts '' + +# ==================================================================================== +# Booleans +# ==================================================================================== + +puts '======== truthy / falsey values' +puts "Anything that *isn't* false or nil is true." + +c = 30 +puts "The value of c is #{c}." + +if c + puts "This if statement ran because c is truthy." +end + +d = false +puts "The value if d is #{d}." + +if !d + puts "This if statement ran because d is falsey, using the not operator (!)." +end + +e = nil + +puts "Nil is also considered falsey. The value of e is: #{e}." + +if !e + puts "This if statement ran because e is nil (a falsey value)." +end + +puts '' +puts '================================' +puts '' +puts '' diff --git a/samples/00_intermediate_ruby_primer/app/04_conditionals.txt b/samples/00_intermediate_ruby_primer/app/04_conditionals.txt new file mode 100644 index 0000000..6cf24f0 --- /dev/null +++ b/samples/00_intermediate_ruby_primer/app/04_conditionals.txt @@ -0,0 +1,104 @@ +# ==================================================================================== +# Conditionals +# ==================================================================================== + +puts '' +puts '' +puts '================================' +puts '' + +i_am_true = true +i_am_nil = nil +i_am_false = false +i_am_hi = "hi" + +# ==================================================================================== +# if +# ==================================================================================== + +puts "======== if statement" +i_am_one = 1 +if i_am_one + puts "This was printed because i_am_one is truthy." +end + +# ==================================================================================== +# if/else +# ==================================================================================== + +puts "======== if/else statement" +if i_am_false + puts "This will NOT get printed because i_am_false is false." +else + puts "This was printed because i_am_false is false." +end + +# ==================================================================================== +# if/elsif/else +# ==================================================================================== + +puts "======== if/elsif/else statement" +if i_am_false + puts "This will NOT get printed because i_am_false is false." +elsif i_am_true + puts "This was printed because i_am_true is true." +else + puts "This will NOT get printed i_am_true was true." +end + +# ==================================================================================== +# case +# ==================================================================================== + +puts "======== case statement " +i_am_one = 1 +case i_am_one +when 10 + puts "10" +when 9 + puts "9" +when 5 + puts "5" +when 1 + puts "1" +else + puts "Value wasn't cased." +end + +# ==================================================================================== +# comparison operators +# ==================================================================================== + +puts "======== different types of comparisons" +if 4 == 4 + puts "equal" +end + +if 4 != 3 + puts "not equal" +end + +if 3 < 4 + puts "less than" +end + +if 4 > 3 + puts "greater than" +end + +# ==================================================================================== +# and/or conditionals +# ==================================================================================== + +if ((4 > 3) || (3 < 4) || false) + puts "or statement" +end + +if ((4 > 3) && (3 < 4)) + puts "and statement" +end + +puts '' +puts '================================' +puts '' +puts '' diff --git a/samples/00_intermediate_ruby_primer/app/05_looping.txt b/samples/00_intermediate_ruby_primer/app/05_looping.txt new file mode 100644 index 0000000..fafdcfc --- /dev/null +++ b/samples/00_intermediate_ruby_primer/app/05_looping.txt @@ -0,0 +1,61 @@ +# ==================================================================================== +# Looping +# ==================================================================================== +# +# Looping looks a whole lot different than other languages. +# But it's pretty awesome when you get used to it. + +puts '' +puts '' +puts '================================' +puts '' + +# ==================================================================================== +# times +# ==================================================================================== + + +puts "times block:" +3.times do |i| + puts i +end +puts '' + + +# ==================================================================================== +# ranges +# ==================================================================================== + +puts "range block exclusive:" +(0...3).each do |i| + puts i +end +puts '' + +puts "range block inclusive:" +(0..3).each do |i| + puts i +end +puts '' + +# ==================================================================================== +# Enumerables +# ==================================================================================== + +puts 'array each' +colors = ["red", "blue", "yellow"] +colors.each do |color| + puts color +end +puts '' + +puts 'array each_with_index' +colors = ["red", "blue", "yellow"] +colors.each_with_index do |color, i| + puts "#{color} at index #{i}" +end + +puts '' +puts '================================' +puts '' +puts '' diff --git a/samples/00_intermediate_ruby_primer/app/06_functions.txt b/samples/00_intermediate_ruby_primer/app/06_functions.txt new file mode 100644 index 0000000..6ee8da1 --- /dev/null +++ b/samples/00_intermediate_ruby_primer/app/06_functions.txt @@ -0,0 +1,49 @@ +# ==================================================================================== +# Functions +# ==================================================================================== + +# The last statement of a function is implictly returned. Parenthesis for functions +# are optional as long as the statement can be envaluated disambiguously. + +puts '' +puts '' +puts '================================' +puts '' + +# ==================================================================================== +# Functions single parameter +# ==================================================================================== + +def add_one_to n + n + 1 +end + +puts add_one_to(3) + +# ==================================================================================== +# Functions with default parameter values +# ==================================================================================== + +def function_with_default_value v = 10 + v * 10 +end + +puts "passing three: #{function_with_default_value(3)}" +puts "passing nil: #{function_with_default_value}" + +# ==================================================================================== +# Nil default parameter value and ||= operator. +# ==================================================================================== + +def function_with_nil_default_with_local a = nil + result = a + result ||= "or equal operator was exected and set a default value" +end + +puts "passing 'hi': #{function_with_nil_default_with_local 'hi'}" +puts "passing nil: #{function_with_nil_default_with_local}" + +puts '' +puts '================================' +puts '' +puts '' diff --git a/samples/00_intermediate_ruby_primer/app/07_powerful_arrays.txt b/samples/00_intermediate_ruby_primer/app/07_powerful_arrays.txt new file mode 100644 index 0000000..2c7e2f1 --- /dev/null +++ b/samples/00_intermediate_ruby_primer/app/07_powerful_arrays.txt @@ -0,0 +1,171 @@ +# ==================================================================================== +# Arrays +# ==================================================================================== + +# Arrays are incredibly powerful in Ruby. Learn to use them well. + +puts '' +puts '' +puts '================================' +puts '' + +# ==================================================================================== +# Enumerable ranges and .to_a +# ==================================================================================== + +puts "Create an array with the numbers 1 to 10." +one_to_ten = (1..10).to_a +puts one_to_ten + +# ==================================================================================== +# Finding elements +# ==================================================================================== + +puts "Create a new array that only contains even numbers from the previous array." +evens = one_to_ten.find_all do |number| + number % 2 == 0 +end +puts evens + +# ==================================================================================== +# Rejecting elements +# ==================================================================================== + +puts "Create a new array that rejects odd numbers." +also_even = one_to_ten.reject do |number| + number % 2 != 0 +end +puts also_even + +# ==================================================================================== +# Array transform using the map function. +# ==================================================================================== + +puts "Create an array that doubles every number." +doubled = one_to_ten.map do |number| + number * 2 +end +puts doubled + +# ==================================================================================== +# Combining array functions. +# ==================================================================================== + +puts "Create an array that selects only odd numbers and then multiply those by 10." +odd_doubled = one_to_ten.find_all do |number| + number % 2 != 0 +end.map do |odd_number| + odd_number * 10 +end +puts odd_doubled + +# ==================================================================================== +# Product function. +# ==================================================================================== + +puts "All combination of numbers 1 to 10." +all_combinations = one_to_ten.product(one_to_ten) +puts all_combinations + +# ==================================================================================== +# Uniq and sort function. +# ==================================================================================== + +puts "All uniq combinations of numbers." +puts "For example: [1, 2] is the same as [2, 1]." +uniq_combinations = + one_to_ten.product(one_to_ten) + .map do |unsorted_number| + unsorted_number.sort + end.uniq +puts uniq_combinations + +# ==================================================================================== +# Example of an advanced array transform. +# ==================================================================================== + +puts "All unique Pythagorean Triples between 1 and 100 sorted by area of the triangle." + +one_to_hundred = (1..100).to_a + +triples = + one_to_hundred.product(one_to_hundred).map do |width, height| + [width, height, Math.sqrt(width ** 2 + height ** 2)] + end.find_all do |_, _, hypotenuse| + hypotenuse.to_i == hypotenuse + end.map do |triangle| + triangle.map(&:to_i) + end.uniq do |triangle| + triangle.sort + end.map do |width, height, hypotenuse| + [width, height, hypotenuse, (width * height) / 2] + end.sort_by do |_, _, _, area| + area + end + +triples.each do |width, height, hypotenuse, _| + puts "(#{width}, #{height}, #{hypotenuse})" +end + +puts '' +puts '================================' +puts '' +puts '' + +# ==================================================================================== +# Example of an sorting. +# ==================================================================================== + +things_to_sort = [ + { type: :background, order: 1 }, + { type: :foreground, order: 1 }, + { type: :foreground, order: 2 } +] + +# For a simple sort, you can use sort_by +results = things_to_sort.sort_by do |hash| + hash[:order] +end + +puts "Simple sort:" +puts results + +# for a more complicated sort, you can provide a block that returns +# -1, 0, 1 for a left and right operand +results = things_to_sort.sort do |l, r| + sort_result = 0 + puts "here is l: #{l}" + puts "here is r: #{r || "nil"}" + # if either value is nil/false return 0 + if !l || !r + sort_result = 0 + # if the type of "left" is background and the + # type of "right" is foreground, then return + # -1 (which means "left" is less than "right" + elsif l[:type] == :background && r[:type] == :foreground + sort_result = -1 + # if the type of "left" is foreground and the + # type of "right" is background, then return + # 1 (which means "left" is greater than "right" + elsif l[:type] == :foreground && r[:type] == :background + sort_result = 1 + # if "left" and "right"'s type are the same, then + # use the order as the tie breaker + elsif l[:order] < r[:order] + sort_result = -1 + elsif l[:order] > r[:order] + sort_result = 1 + # returning 0 means both values are equal + else + sort_result = 0 + end + sort_result +end.to_a + +puts "Custom sort:" +puts results + +# ==================================================================================== +# Api documention for Array that is worth commiting to memory because arrays are so +# awesome in Ruby: https://docs.ruby-lang.org/en/2.0.0/Array.html +# ==================================================================================== diff --git a/samples/00_intermediate_ruby_primer/app/main.rb b/samples/00_intermediate_ruby_primer/app/main.rb new file mode 100644 index 0000000..96461aa --- /dev/null +++ b/samples/00_intermediate_ruby_primer/app/main.rb @@ -0,0 +1,3 @@ +def tick args + args.outputs.labels << [640, 380, "Open repl.rb in the text editor of your choice and follow the document.", 0, 1] +end diff --git a/samples/00_intermediate_ruby_primer/license-for-sample.txt b/samples/00_intermediate_ruby_primer/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/00_intermediate_ruby_primer/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_01_labels/app/main.rb b/samples/01_api_01_labels/app/main.rb new file mode 100644 index 0000000..c3e1afc --- /dev/null +++ b/samples/01_api_01_labels/app/main.rb @@ -0,0 +1,99 @@ +=begin + +APIs listing that haven't been encountered in a previous sample apps: + +- args.outputs.labels: An array. Values in this array generate labels + the screen. +- args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). +- Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction + by adding or subracting. + +=end + +# Labels are used to represent text elements in DragonRuby + +# An example of creating a label is: +# args.outputs.labels << [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] + +# The code above does the following: +# 1. GET the place where labels go: args.outputs.labels +# 2. Request a new LABEL be ADDED: << +# 3. The DEFINITION of a SOLID is the ARRAY: +# [320, 640, "Example", 3, 1, 255, 0, 0, 200, manaspace.ttf] +# [ X , Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + + +# The tick method is called by DragonRuby every frame +# args contains all the information regarding the game. +def tick args + tick_instructions args, "Sample app shows different version of label sizes and alignments. And how to use hashes instead of arrays." + # Here are some examples of simple labels, with the minimum number of parameters + # Note that the default values for the other parameters are 0, except for Alpha which is 255 and Font Style which is the default font + args.outputs.labels << [400, 620, "Here is a label with just an x, y, and text"] + + args.outputs.labels << [args.grid.left.shift_right(5), args.grid.top.shift_down(5), "This is a label located at the top left."] + args.outputs.labels << [args.grid.left.shift_right(5), args.grid.bottom.shift_up(30), "This is a label located at the bottom left."] + args.outputs.labels << [args.grid.right.shift_left(420), args.grid.top.shift_down(5), "This is a label located at the top right."] + args.outputs.labels << [args.grid.right.shift_left(440), args.grid.bottom.shift_up(30), "This is a label located at the bottom right."] + + # Demonstration of the Size Parameter + args.outputs.labels << [175 + 150, 610 - 50, "Smaller label.", -2] + args.outputs.labels << [175 + 150, 580 - 50, "Small label.", -1] + args.outputs.labels << [175 + 150, 550 - 50, "Medium label.", 0] + args.outputs.labels << [175 + 150, 520 - 50, "Large label.", 1] + args.outputs.labels << [175 + 150, 490 - 50, "Larger label.", 2] + + # Demonstration of the Align Parameter + args.outputs.labels << [260 + 150, 345 - 50, "Left aligned.", 0, 2] + args.outputs.labels << [260 + 150, 325 - 50, "Center aligned.", 0, 1] + args.outputs.labels << [260 + 150, 305 - 50, "Right aligned.", 0, 0] + + # Demonstration of the RGBA parameters + args.outputs.labels << [600 + 150, 590 - 50, "Red Label.", 0, 0, 255, 0, 0] + args.outputs.labels << [600 + 150, 570 - 50, "Green Label.", 0, 0, 0, 255, 0] + args.outputs.labels << [600 + 150, 550 - 50, "Blue Label.", 0, 0, 0, 0, 255] + args.outputs.labels << [600 + 150, 530 - 50, "Faded Label.", 0, 0, 0, 0, 0, 128] + + # Demonstration of the Font parameter + # In order to use a font of your choice, add its ttf file to the project folder, where the app folder is + args.outputs.labels << [690 + 150, 330 - 20, "Custom font (Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ] + args.outputs.primitives << { x: 690 + 150, + y: 330 - 50, + text: "Custom font (Hash)", + size_enum: 0, + alignment_enum: 1, + r: 125, + g: 0, + b: 200, + a: 255, + font: "manaspc.ttf" }.label + + # Primitives can hold anything, and can be given a label in the following forms + args.outputs.primitives << [690 + 150, 330 - 80, "Custom font (.primitives Array)", 0, 1, 125, 0, 200, 255, "manaspc.ttf" ].label + + args.outputs.primitives << { x: 690 + 150, + y: 330 - 110, + text: "Custom font (.primitives Hash)", + size_enum: 0, + alignment_enum: 1, + r: 125, + g: 0, + b: 200, + a: 255, + font: "manaspc.ttf" }.label +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_01_labels/license-for-sample.txt b/samples/01_api_01_labels/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_01_labels/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_01_labels/manaspc.ttf b/samples/01_api_01_labels/manaspc.ttf Binary files differnew file mode 100644 index 0000000..0c56733 --- /dev/null +++ b/samples/01_api_01_labels/manaspc.ttf diff --git a/samples/01_api_02_lines/app/main.rb b/samples/01_api_02_lines/app/main.rb new file mode 100644 index 0000000..fd0781f --- /dev/null +++ b/samples/01_api_02_lines/app/main.rb @@ -0,0 +1,54 @@ +=begin + +APIs listing that haven't been encountered in a previous sample apps: + +- args.outputs.lines: An array. Values in this array generate lines on + the screen. +- args.state.tick_count: This property contains an integer value that + represents the current frame. GTK renders at 60 FPS. A value of 0 + for args.state.tick_count represents the initial load of the game. + +=end + +# The parameters required for lines are: +# 1. The initial point (x, y) +# 2. The end point (x2, y2) +# 3. The rgba values for the color and transparency (r, g, b, a) + +# An example of creating a line would be: +# args.outputs.lines << [100, 100, 300, 300, 255, 0, 255, 255] + +# This would create a line from (100, 100) to (300, 300) +# The RGB code (255, 0, 255) would determine its color, a purple +# It would have an Alpha value of 255, making it completely opaque + +def tick args + tick_instructions args, "Sample app shows how to create lines." + + args.outputs.labels << [480, 620, "Lines (x, y, x2, y2, r, g, b, a)"] + + # Some simple lines + args.outputs.lines << [380, 450, 675, 450] + args.outputs.lines << [380, 410, 875, 410] + + # These examples utilize args.state.tick_count to change the length of the lines over time + # args.state.tick_count is the ticks that have occurred in the game + # This is accomplished by making either the starting or ending point based on the args.state.tick_count + args.outputs.lines << [380, 370, 875, 370, args.state.tick_count % 255, 0, 0, 255] + args.outputs.lines << [380, 330 - args.state.tick_count % 25, 875, 330, 0, 0, 0, 255] + args.outputs.lines << [380 + args.state.tick_count % 400, 290, 875, 290, 0, 0, 0, 255] +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_02_lines/license-for-sample.txt b/samples/01_api_02_lines/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_02_lines/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_03_rects/app/main.rb b/samples/01_api_03_rects/app/main.rb new file mode 100644 index 0000000..8d1bfef --- /dev/null +++ b/samples/01_api_03_rects/app/main.rb @@ -0,0 +1,66 @@ +=begin + +APIs listing that haven't been encountered in a previous sample apps: + +- args.outputs.solids: An array. Values in this array generate + solid/filled rectangles on the screen. + +=end + +# Rects are outputted in DragonRuby as rectangles +# If filled in, they are solids +# If hollow, they are borders + +# Solids are added to args.outputs.solids +# Borders are added to args.outputs.borders + +# The parameters required for rects are: +# 1. The upper right corner (x, y) +# 2. The width (w) +# 3. The height (h) +# 4. The rgba values for the color and transparency (r, g, b, a) + +# Here is an example of a rect definition: +# [100, 100, 400, 500, 0, 255, 0, 180] + +# The example would create a rect from (100, 100) +# Extending 400 pixels across the x axis +# and 500 pixels across the y axis +# The rect would be green (0, 255, 0) +# and mostly opaque with some transparency (180) + +# Whether the rect would be filled or not depends on if +# it is added to args.outputs.solids or args.outputs.borders + + +def tick args + tick_instructions args, "Sample app shows how to create solid squares." + args.outputs.labels << [460, 600, "Solids (x, y, w, h, r, g, b, a)"] + args.outputs.solids << [470, 520, 50, 50] + args.outputs.solids << [530, 520, 50, 50, 0, 0, 0] + args.outputs.solids << [590, 520, 50, 50, 255, 0, 0] + args.outputs.solids << [650, 520, 50, 50, 255, 0, 0, 128] + args.outputs.solids << [710, 520, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] + + + args.outputs.labels << [460, 400, "Borders (x, y, w, h, r, g, b, a)"] + args.outputs.borders << [470, 320, 50, 50] + args.outputs.borders << [530, 320, 50, 50, 0, 0, 0] + args.outputs.borders << [590, 320, 50, 50, 255, 0, 0] + args.outputs.borders << [650, 320, 50, 50, 255, 0, 0, 128] + args.outputs.borders << [710, 320, 50, 50, 0, 0, 0, 128 + args.state.tick_count % 128] +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_03_rects/license-for-sample.txt b/samples/01_api_03_rects/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_03_rects/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_04_sprites/app/main.rb b/samples/01_api_04_sprites/app/main.rb new file mode 100644 index 0000000..8fd91c7 --- /dev/null +++ b/samples/01_api_04_sprites/app/main.rb @@ -0,0 +1,43 @@ +=begin + +APIs listing that haven't been encountered in a previous sample apps: + +- args.outputs.sprites: An array. Values in this array generate + sprites on the screen. The location of the sprite is assumed to + be under the mygame/ directory (the exception being dragonruby.png). + +=end + + +# For all other display outputs, Sprites are your solution +# Sprites import images and display them with a certain rectangular area +# The image can be of any usual format and should be located within the folder, +# similar to additional fonts. + +# Sprites have the following parameters +# Rectangular area (x, y, width, height) +# The image (path) +# Rotation (angle) +# Alpha (a) + +def tick args + tick_instructions args, "Sample app shows how to render a sprite. Set its alpha, and rotate it." + args.outputs.labels << [460, 600, "Sprites (x, y, w, h, path, angle, a)"] + args.outputs.sprites << [460, 470, 128, 101, 'dragonruby.png'] + args.outputs.sprites << [610, 470, 128, 101, 'dragonruby.png', args.state.tick_count % 360] + args.outputs.sprites << [760, 470, 128, 101, 'dragonruby.png', 0, args.state.tick_count % 255] +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_04_sprites/license-for-sample.txt b/samples/01_api_04_sprites/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_04_sprites/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_05_keyboard/app/main.rb b/samples/01_api_05_keyboard/app/main.rb new file mode 100644 index 0000000..ee5c8cf --- /dev/null +++ b/samples/01_api_05_keyboard/app/main.rb @@ -0,0 +1,170 @@ +=begin + +APIs listing that haven't been encountered in a previous sample apps: + +- args.inputs.keyboard.key_up.KEY: The value of the properties will be set + to the frame that the key_up event occurred (the frame correlates + to args.state.tick_count). Otherwise the value will be nil. For a + full listing of keys, take a look at mygame/documentation/06-keyboard.md. +- args.state.PROPERTY: The state property on args is a dynamic + structure. You can define ANY property here with ANY type of + arbitrary nesting. Properties defined on args.state will be retained + across frames. If you attempt access a property that doesn't exist + on args.state, it will simply return nil (no exception will be thrown). + +=end + +# Along with outputs, inputs are also an essential part of video game development +# DragonRuby can take input from keyboards, mouse, and controllers. +# This sample app will cover keyboard input. + +# args.inputs.keyboard.key_up.a will check to see if the a key has been pressed +# This will work with the other keys as well + + +def tick args + tick_instructions args, "Sample app shows how keyboard events are registered and accessed.", 360 + # Notice how small_font accounts for all the remaining parameters + args.outputs.labels << [460, row_to_px(args, 0), "Current game time: #{args.state.tick_count}", small_font] + args.outputs.labels << [460, row_to_px(args, 2), "Keyboard input: args.inputs.keyboard.key_up.h", small_font] + args.outputs.labels << [460, row_to_px(args, 3), "Press \"h\" on the keyboard.", small_font] + + # Input on a specifc key can be found through args.inputs.keyboard.key_up followed by the key + if args.inputs.keyboard.key_up.h + args.state.h_pressed_at = args.state.tick_count + end + + # This code simplifies to if args.state.h_pressed_at has not been initialized, set it to false + args.state.h_pressed_at ||= false + + if args.state.h_pressed_at + args.outputs.labels << [460, row_to_px(args, 4), "\"h\" was pressed at time: #{args.state.h_pressed_at}", small_font] + else + args.outputs.labels << [460, row_to_px(args, 4), "\"h\" has never been pressed.", small_font] + end + + tick_help_text args +end + +def small_font + # This method provides some values for the construction of labels + # Specifically, Size, Alignment, & RGBA + # This makes it so that custom parameters don't have to be repeatedly typed. + # Additionally "small_font" provides programmers with more information than some numbers + [-2, 0, 0, 0, 0, 255] +end + +def row_to_px args, row_number + # This takes a row_number and converts it to pixels DragonRuby understands. + # Row 0 starts 5 units below the top of the grid + # Each row afterward is 20 units lower + args.grid.top.shift_down(5).shift_down(20 * row_number) +end + +# Don't worry about understanding the code within this method just yet. +# This method shows you the help text within the game. +def tick_help_text args + return unless args.state.h_pressed_at + + args.state.key_value_history ||= {} + args.state.key_down_value_history ||= {} + args.state.key_held_value_history ||= {} + args.state.key_up_value_history ||= {} + + if (args.inputs.keyboard.key_down.truthy_keys.length > 0 || + args.inputs.keyboard.key_held.truthy_keys.length > 0 || + args.inputs.keyboard.key_up.truthy_keys.length > 0) + args.state.help_available = true + args.state.no_activity_debounce = nil + else + args.state.no_activity_debounce ||= 5.seconds + args.state.no_activity_debounce -= 1 + if args.state.no_activity_debounce <= 0 + args.state.help_available = false + args.state.key_value_history = {} + args.state.key_down_value_history = {} + args.state.key_held_value_history = {} + args.state.key_up_value_history = {} + end + end + + args.outputs.labels << [10, row_to_px(args, 6), "Advanced Help:", small_font] + + if !args.state.help_available + args.outputs.labels << [10, row_to_px(args, 7), "Press a key and I'll show code to access the key and what value will be returned if you used the code.", small_font] + return + end + + args.outputs.labels << [10 , row_to_px(args, 7), "args.inputs.keyboard", small_font] + args.outputs.labels << [330, row_to_px(args, 7), "args.inputs.keyboard.key_down", small_font] + args.outputs.labels << [650, row_to_px(args, 7), "args.inputs.keyboard.key_held", small_font] + args.outputs.labels << [990, row_to_px(args, 7), "args.inputs.keyboard.key_up", small_font] + + fill_history args, :key_value_history, :down_or_held, nil + fill_history args, :key_down_value_history, :down, :key_down + fill_history args, :key_held_value_history, :held, :key_held + fill_history args, :key_up_value_history, :up, :key_up + + render_help_labels args, :key_value_history, :down_or_held, nil, 10 + render_help_labels args, :key_down_value_history, :down, :key_down, 330 + render_help_labels args, :key_held_value_history, :held, :key_held, 650 + render_help_labels args, :key_up_value_history, :up, :key_up, 990 +end + +def fill_history args, history_key, state_key, keyboard_method + fill_single_history args, history_key, state_key, keyboard_method, :raw_key + fill_single_history args, history_key, state_key, keyboard_method, :char + args.inputs.keyboard.keys[state_key].each do |key_name| + fill_single_history args, history_key, state_key, keyboard_method, key_name + end +end + +def fill_single_history args, history_key, state_key, keyboard_method, key_name + current_value = args.inputs.keyboard.send(key_name) + if keyboard_method + current_value = args.inputs.keyboard.send(keyboard_method).send(key_name) + end + args.state.as_hash[history_key][key_name] ||= [] + args.state.as_hash[history_key][key_name] << current_value + args.state.as_hash[history_key][key_name] = args.state.as_hash[history_key][key_name].reverse.uniq.take(3).reverse +end + +def render_help_labels args, history_key, state_key, keyboard_method, x + idx = 8 + args.outputs.labels << args.state + .as_hash[history_key] + .keys + .reverse + .map + .with_index do |k, i| + v = args.state.as_hash[history_key][k] + current_value = args.inputs.keyboard.send(k) + if keyboard_method + current_value = args.inputs.keyboard.send(keyboard_method).send(k) + end + idx += 2 + [ + [x, row_to_px(args, idx - 2), + " .#{k} is #{current_value || "nil"}", + small_font], + [x, row_to_px(args, idx - 1), + " was #{v}", + small_font] + ] + end +end + + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_05_keyboard/license-for-sample.txt b/samples/01_api_05_keyboard/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_05_keyboard/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_05_keyboard/replay.txt b/samples/01_api_05_keyboard/replay.txt new file mode 100644 index 0000000..ac3ff2d --- /dev/null +++ b/samples/01_api_05_keyboard/replay.txt @@ -0,0 +1,814 @@ +replay_version 2.0 +stopped_at 1283 +seed 100 +recorded_at Sun Sep 29 21:23:38 2019 +[:mouse_move, 39, 552, 2, 1, 54] +[:mouse_move, 87, 534, 2, 2, 55] +[:mouse_move, 96, 531, 2, 3, 56] +[:mouse_move, 115, 523, 2, 4, 57] +[:mouse_move, 122, 520, 2, 5, 58] +[:mouse_move, 136, 513, 2, 6, 59] +[:mouse_move, 143, 510, 2, 7, 60] +[:mouse_move, 147, 507, 2, 8, 61] +[:mouse_move, 168, 492, 2, 9, 62] +[:mouse_move, 181, 479, 2, 10, 63] +[:mouse_move, 233, 424, 2, 11, 64] +[:mouse_move, 259, 390, 2, 12, 65] +[:mouse_move, 286, 353, 2, 13, 66] +[:mouse_move, 326, 301, 2, 14, 67] +[:mouse_move, 335, 287, 2, 15, 68] +[:mouse_move, 368, 240, 2, 16, 69] +[:mouse_move, 377, 221, 2, 17, 70] +[:mouse_move, 395, 169, 2, 18, 71] +[:mouse_move, 401, 127, 2, 19, 72] +[:mouse_move, 403, 122, 2, 20, 86] +[:mouse_move, 422, 96, 2, 21, 87] +[:mouse_move, 431, 84, 2, 22, 88] +[:mouse_move, 439, 73, 2, 23, 89] +[:mouse_move, 450, 57, 2, 24, 90] +[:mouse_move, 454, 53, 2, 25, 91] +[:mouse_move, 462, 43, 2, 26, 92] +[:mouse_move, 465, 39, 2, 27, 93] +[:mouse_move, 468, 35, 2, 28, 94] +[:mouse_move, 469, 35, 2, 29, 95] +[:mouse_move, 470, 34, 2, 30, 96] +[:mouse_move, 469, 34, 2, 31, 100] +[:mouse_move, 467, 34, 2, 32, 101] +[:mouse_move, 459, 37, 2, 33, 102] +[:mouse_move, 455, 37, 2, 34, 103] +[:mouse_move, 449, 38, 2, 35, 104] +[:mouse_move, 444, 38, 2, 36, 105] +[:mouse_move, 440, 37, 2, 37, 106] +[:mouse_move, 440, 35, 2, 38, 107] +[:mouse_move, 439, 31, 2, 39, 108] +[:mouse_move, 439, 29, 2, 40, 109] +[:mouse_move, 440, 24, 2, 41, 110] +[:mouse_move, 441, 23, 2, 42, 111] +[:mouse_move, 445, 20, 2, 43, 112] +[:mouse_move, 446, 19, 2, 44, 113] +[:mouse_move, 451, 18, 2, 45, 114] +[:mouse_move, 453, 18, 2, 46, 115] +[:mouse_move, 456, 18, 2, 47, 116] +[:mouse_move, 463, 18, 2, 48, 117] +[:mouse_move, 466, 18, 2, 49, 118] +[:mouse_move, 474, 18, 2, 50, 119] +[:mouse_move, 478, 18, 2, 51, 120] +[:mouse_move, 489, 18, 2, 52, 121] +[:mouse_move, 495, 20, 2, 53, 122] +[:mouse_move, 508, 22, 2, 54, 123] +[:mouse_move, 513, 23, 2, 55, 124] +[:mouse_move, 525, 24, 2, 56, 125] +[:mouse_move, 528, 24, 2, 57, 126] +[:mouse_move, 539, 25, 2, 58, 127] +[:mouse_move, 541, 25, 2, 59, 128] +[:mouse_move, 547, 25, 2, 60, 129] +[:mouse_move, 550, 25, 2, 61, 130] +[:mouse_move, 555, 25, 2, 62, 131] +[:mouse_move, 557, 25, 2, 63, 132] +[:mouse_move, 564, 25, 2, 64, 133] +[:mouse_move, 567, 25, 2, 65, 134] +[:mouse_move, 571, 25, 2, 66, 135] +[:mouse_move, 574, 25, 2, 67, 136] +[:mouse_move, 581, 26, 2, 68, 137] +[:mouse_move, 585, 27, 2, 69, 138] +[:mouse_move, 592, 28, 2, 70, 139] +[:mouse_move, 596, 28, 2, 71, 140] +[:mouse_move, 602, 29, 2, 72, 141] +[:mouse_move, 605, 30, 2, 73, 142] +[:mouse_move, 610, 30, 2, 74, 143] +[:mouse_move, 617, 30, 2, 75, 144] +[:mouse_move, 619, 30, 2, 76, 145] +[:mouse_move, 628, 30, 2, 77, 146] +[:mouse_move, 629, 30, 2, 78, 147] +[:mouse_move, 634, 30, 2, 79, 148] +[:mouse_move, 636, 29, 2, 80, 149] +[:mouse_move, 639, 29, 2, 81, 150] +[:mouse_move, 640, 28, 2, 82, 151] +[:mouse_move, 642, 28, 2, 83, 152] +[:mouse_move, 643, 28, 2, 84, 153] +[:mouse_move, 645, 27, 2, 85, 154] +[:mouse_move, 646, 27, 2, 86, 155] +[:mouse_move, 647, 26, 2, 87, 156] +[:mouse_move, 648, 26, 2, 88, 158] +[:mouse_move, 649, 26, 2, 89, 160] +[:mouse_move, 648, 26, 2, 90, 192] +[:mouse_move, 642, 26, 2, 91, 193] +[:mouse_move, 638, 26, 2, 92, 194] +[:mouse_move, 628, 27, 2, 93, 195] +[:mouse_move, 623, 28, 2, 94, 196] +[:mouse_move, 618, 29, 2, 95, 197] +[:mouse_move, 607, 31, 2, 96, 198] +[:mouse_move, 600, 34, 2, 97, 199] +[:mouse_move, 591, 35, 2, 98, 200] +[:mouse_move, 586, 37, 2, 99, 201] +[:mouse_move, 577, 39, 2, 100, 202] +[:mouse_move, 574, 39, 2, 101, 203] +[:mouse_move, 564, 41, 2, 102, 204] +[:mouse_move, 560, 42, 2, 103, 205] +[:mouse_move, 552, 43, 2, 104, 206] +[:mouse_move, 548, 43, 2, 105, 207] +[:mouse_move, 538, 44, 2, 106, 208] +[:mouse_move, 533, 44, 2, 107, 209] +[:mouse_move, 525, 44, 2, 108, 210] +[:mouse_move, 520, 44, 2, 109, 211] +[:mouse_move, 505, 44, 2, 110, 212] +[:mouse_move, 501, 45, 2, 111, 213] +[:mouse_move, 489, 46, 2, 112, 214] +[:mouse_move, 487, 46, 2, 113, 215] +[:mouse_move, 480, 48, 2, 114, 216] +[:mouse_move, 477, 48, 2, 115, 217] +[:mouse_move, 471, 51, 2, 116, 218] +[:mouse_move, 467, 53, 2, 117, 219] +[:mouse_move, 462, 55, 2, 118, 220] +[:mouse_move, 459, 57, 2, 119, 221] +[:mouse_move, 456, 59, 2, 120, 222] +[:mouse_move, 455, 60, 2, 121, 223] +[:mouse_move, 454, 61, 2, 122, 224] +[:mouse_move, 453, 61, 2, 123, 225] +[:mouse_move, 457, 61, 2, 124, 242] +[:mouse_move, 465, 63, 2, 125, 243] +[:mouse_move, 471, 64, 2, 126, 244] +[:mouse_move, 486, 67, 2, 127, 245] +[:mouse_move, 498, 68, 2, 128, 246] +[:mouse_move, 523, 70, 2, 129, 247] +[:mouse_move, 535, 70, 2, 130, 248] +[:mouse_move, 551, 70, 2, 131, 249] +[:mouse_move, 560, 70, 2, 132, 250] +[:mouse_move, 571, 70, 2, 133, 251] +[:mouse_move, 578, 70, 2, 134, 252] +[:mouse_move, 583, 70, 2, 135, 253] +[:mouse_move, 588, 70, 2, 136, 254] +[:mouse_move, 590, 70, 2, 137, 255] +[:mouse_move, 592, 70, 2, 138, 256] +[:mouse_move, 593, 70, 2, 139, 257] +[:mouse_move, 595, 70, 2, 140, 258] +[:mouse_move, 596, 70, 2, 141, 259] +[:mouse_move, 597, 70, 2, 142, 260] +[:mouse_move, 598, 70, 2, 143, 261] +[:mouse_move, 600, 70, 2, 144, 262] +[:mouse_move, 601, 70, 2, 145, 263] +[:mouse_move, 603, 70, 2, 146, 264] +[:mouse_move, 605, 70, 2, 147, 265] +[:mouse_move, 608, 70, 2, 148, 266] +[:mouse_move, 609, 70, 2, 149, 267] +[:mouse_move, 613, 70, 2, 150, 268] +[:mouse_move, 614, 70, 2, 151, 269] +[:mouse_move, 616, 69, 2, 152, 270] +[:mouse_move, 617, 69, 2, 153, 271] +[:mouse_move, 619, 68, 2, 154, 272] +[:mouse_move, 620, 68, 2, 155, 273] +[:mouse_move, 621, 68, 2, 156, 274] +[:mouse_move, 622, 67, 2, 157, 275] +[:mouse_move, 623, 67, 2, 158, 276] +[:mouse_move, 624, 67, 2, 159, 278] +[:mouse_move, 625, 67, 2, 160, 279] +[:mouse_move, 626, 66, 2, 161, 280] +[:mouse_move, 628, 66, 2, 162, 281] +[:mouse_move, 629, 66, 2, 163, 282] +[:mouse_move, 631, 66, 2, 164, 283] +[:mouse_move, 633, 66, 2, 165, 284] +[:mouse_move, 638, 65, 2, 166, 285] +[:mouse_move, 640, 65, 2, 167, 286] +[:mouse_move, 646, 65, 2, 168, 287] +[:mouse_move, 648, 65, 2, 169, 288] +[:mouse_move, 656, 65, 2, 170, 289] +[:mouse_move, 659, 65, 2, 171, 290] +[:mouse_move, 666, 64, 2, 172, 291] +[:mouse_move, 668, 64, 2, 173, 292] +[:mouse_move, 675, 63, 2, 174, 293] +[:mouse_move, 677, 63, 2, 175, 294] +[:mouse_move, 682, 63, 2, 176, 295] +[:mouse_move, 684, 62, 2, 177, 296] +[:mouse_move, 688, 62, 2, 178, 297] +[:mouse_move, 690, 61, 2, 179, 298] +[:mouse_move, 693, 61, 2, 180, 299] +[:mouse_move, 696, 60, 2, 181, 300] +[:mouse_move, 699, 59, 2, 182, 301] +[:mouse_move, 701, 58, 2, 183, 302] +[:mouse_move, 706, 58, 2, 184, 303] +[:mouse_move, 708, 57, 2, 185, 304] +[:mouse_move, 715, 56, 2, 186, 305] +[:mouse_move, 718, 56, 2, 187, 306] +[:mouse_move, 721, 56, 2, 188, 307] +[:mouse_move, 726, 54, 2, 189, 308] +[:mouse_move, 731, 53, 2, 190, 309] +[:mouse_move, 732, 53, 2, 191, 325] +[:mouse_move, 736, 54, 2, 192, 326] +[:mouse_move, 739, 55, 2, 193, 327] +[:mouse_move, 745, 57, 2, 194, 328] +[:mouse_move, 747, 58, 2, 195, 329] +[:mouse_move, 752, 59, 2, 196, 330] +[:mouse_move, 757, 61, 2, 197, 331] +[:mouse_move, 760, 61, 2, 198, 332] +[:mouse_move, 767, 63, 2, 199, 333] +[:mouse_move, 771, 63, 2, 200, 334] +[:mouse_move, 775, 63, 2, 201, 335] +[:mouse_move, 778, 63, 2, 202, 336] +[:mouse_move, 781, 64, 2, 203, 337] +[:mouse_move, 782, 64, 2, 204, 338] +[:mouse_move, 783, 64, 2, 205, 339] +[:mouse_move, 784, 64, 2, 206, 340] +[:mouse_move, 784, 65, 2, 207, 341] +[:mouse_move, 785, 65, 2, 208, 342] +[:mouse_move, 787, 65, 2, 209, 343] +[:mouse_move, 789, 66, 2, 210, 344] +[:mouse_move, 795, 67, 2, 211, 345] +[:mouse_move, 797, 67, 2, 212, 346] +[:mouse_move, 803, 67, 2, 213, 347] +[:mouse_move, 805, 67, 2, 214, 348] +[:mouse_move, 810, 67, 2, 215, 349] +[:mouse_move, 811, 66, 2, 216, 350] +[:mouse_move, 814, 64, 2, 217, 351] +[:mouse_move, 814, 63, 2, 218, 352] +[:mouse_move, 815, 61, 2, 219, 353] +[:mouse_move, 816, 58, 2, 220, 354] +[:mouse_move, 817, 55, 2, 221, 355] +[:mouse_move, 817, 53, 2, 222, 356] +[:mouse_move, 818, 49, 2, 223, 357] +[:mouse_move, 818, 47, 2, 224, 358] +[:mouse_move, 818, 46, 2, 225, 359] +[:mouse_move, 817, 42, 2, 226, 360] +[:mouse_move, 815, 40, 2, 227, 361] +[:mouse_move, 811, 38, 2, 228, 362] +[:mouse_move, 805, 35, 2, 229, 363] +[:mouse_move, 803, 35, 2, 230, 364] +[:mouse_move, 798, 34, 2, 231, 365] +[:mouse_move, 796, 34, 2, 232, 366] +[:mouse_move, 794, 34, 2, 233, 367] +[:mouse_move, 788, 34, 2, 234, 368] +[:mouse_move, 785, 34, 2, 235, 369] +[:mouse_move, 779, 34, 2, 236, 370] +[:mouse_move, 778, 35, 2, 237, 371] +[:mouse_move, 772, 37, 2, 238, 372] +[:mouse_move, 771, 38, 2, 239, 373] +[:mouse_move, 768, 41, 2, 240, 374] +[:mouse_move, 767, 42, 2, 241, 375] +[:mouse_move, 764, 46, 2, 242, 376] +[:mouse_move, 764, 48, 2, 243, 377] +[:mouse_move, 762, 53, 2, 244, 378] +[:mouse_move, 762, 55, 2, 245, 379] +[:mouse_move, 762, 59, 2, 246, 380] +[:mouse_move, 762, 62, 2, 247, 381] +[:mouse_move, 762, 64, 2, 248, 382] +[:mouse_move, 762, 66, 2, 249, 383] +[:mouse_move, 762, 68, 2, 250, 384] +[:mouse_move, 764, 69, 2, 251, 385] +[:mouse_move, 766, 71, 2, 252, 386] +[:mouse_move, 773, 73, 2, 253, 387] +[:mouse_move, 776, 74, 2, 254, 388] +[:mouse_move, 784, 76, 2, 255, 389] +[:mouse_move, 793, 76, 2, 256, 390] +[:mouse_move, 797, 76, 2, 257, 391] +[:mouse_move, 800, 75, 2, 258, 392] +[:mouse_move, 806, 71, 2, 259, 393] +[:mouse_move, 809, 68, 2, 260, 394] +[:mouse_move, 811, 66, 2, 261, 395] +[:mouse_move, 814, 63, 2, 262, 396] +[:mouse_move, 816, 60, 2, 263, 397] +[:mouse_move, 817, 57, 2, 264, 398] +[:mouse_move, 819, 51, 2, 265, 399] +[:mouse_move, 819, 48, 2, 266, 400] +[:mouse_move, 818, 42, 2, 267, 401] +[:mouse_move, 817, 39, 2, 268, 402] +[:mouse_move, 812, 35, 2, 269, 403] +[:mouse_move, 808, 33, 2, 270, 404] +[:mouse_move, 800, 30, 2, 271, 405] +[:mouse_move, 795, 29, 2, 272, 406] +[:mouse_move, 784, 29, 2, 273, 407] +[:mouse_move, 778, 29, 2, 274, 408] +[:mouse_move, 767, 29, 2, 275, 409] +[:mouse_move, 761, 29, 2, 276, 410] +[:mouse_move, 752, 34, 2, 277, 411] +[:mouse_move, 747, 36, 2, 278, 412] +[:mouse_move, 743, 40, 2, 279, 413] +[:mouse_move, 741, 43, 2, 280, 414] +[:mouse_move, 740, 45, 2, 281, 415] +[:mouse_move, 738, 49, 2, 282, 416] +[:mouse_move, 738, 53, 2, 283, 417] +[:mouse_move, 743, 58, 2, 284, 418] +[:mouse_move, 747, 60, 2, 285, 419] +[:mouse_move, 756, 62, 2, 286, 420] +[:mouse_move, 767, 64, 2, 287, 421] +[:mouse_move, 773, 64, 2, 288, 422] +[:mouse_move, 785, 64, 2, 289, 423] +[:mouse_move, 790, 64, 2, 290, 424] +[:mouse_move, 792, 63, 2, 291, 425] +[:mouse_move, 798, 61, 2, 292, 426] +[:mouse_move, 800, 61, 2, 293, 427] +[:mouse_move, 802, 61, 2, 294, 428] +[:mouse_move, 802, 60, 2, 295, 429] +[:mouse_move, 803, 60, 2, 296, 440] +[:mouse_move, 808, 60, 2, 297, 441] +[:mouse_move, 814, 60, 2, 298, 442] +[:mouse_move, 823, 60, 2, 299, 443] +[:mouse_move, 832, 59, 2, 300, 444] +[:mouse_move, 836, 59, 2, 301, 445] +[:mouse_move, 839, 59, 2, 302, 446] +[:mouse_move, 844, 58, 2, 303, 447] +[:mouse_move, 845, 58, 2, 304, 449] +[:mouse_move, 846, 58, 2, 305, 450] +[:mouse_move, 846, 61, 2, 306, 470] +[:mouse_move, 846, 64, 2, 307, 471] +[:mouse_move, 846, 70, 2, 308, 472] +[:mouse_move, 844, 73, 2, 309, 473] +[:mouse_move, 835, 83, 2, 310, 474] +[:mouse_move, 827, 89, 2, 311, 475] +[:mouse_move, 796, 103, 2, 312, 476] +[:mouse_move, 778, 107, 2, 313, 477] +[:mouse_move, 733, 113, 2, 314, 478] +[:mouse_move, 710, 113, 2, 315, 479] +[:mouse_move, 675, 114, 2, 316, 480] +[:mouse_move, 655, 114, 2, 317, 481] +[:mouse_move, 619, 108, 2, 318, 482] +[:mouse_move, 613, 107, 2, 319, 483] +[:mouse_move, 591, 100, 2, 320, 484] +[:mouse_move, 582, 97, 2, 321, 485] +[:mouse_move, 567, 93, 2, 322, 486] +[:mouse_move, 560, 92, 2, 323, 487] +[:mouse_move, 546, 89, 2, 324, 488] +[:mouse_move, 538, 88, 2, 325, 489] +[:mouse_move, 525, 86, 2, 326, 490] +[:mouse_move, 519, 86, 2, 327, 491] +[:mouse_move, 510, 85, 2, 328, 492] +[:mouse_move, 503, 85, 2, 329, 493] +[:mouse_move, 495, 85, 2, 330, 494] +[:mouse_move, 492, 85, 2, 331, 495] +[:mouse_move, 488, 85, 2, 332, 496] +[:mouse_move, 479, 85, 2, 333, 497] +[:mouse_move, 473, 85, 2, 334, 498] +[:mouse_move, 466, 85, 2, 335, 499] +[:mouse_move, 462, 85, 2, 336, 500] +[:mouse_move, 457, 85, 2, 337, 501] +[:mouse_move, 455, 85, 2, 338, 502] +[:mouse_move, 453, 85, 2, 339, 503] +[:mouse_move, 452, 85, 2, 340, 504] +[:mouse_move, 451, 85, 2, 341, 506] +[:mouse_move, 454, 85, 2, 342, 513] +[:mouse_move, 457, 85, 2, 343, 514] +[:mouse_move, 461, 85, 2, 344, 515] +[:mouse_move, 465, 85, 2, 345, 516] +[:mouse_move, 471, 85, 2, 346, 517] +[:mouse_move, 473, 85, 2, 347, 518] +[:mouse_move, 479, 85, 2, 348, 519] +[:mouse_move, 484, 85, 2, 349, 520] +[:mouse_move, 488, 85, 2, 350, 521] +[:mouse_move, 490, 85, 2, 351, 522] +[:mouse_move, 492, 85, 2, 352, 523] +[:mouse_move, 497, 85, 2, 353, 524] +[:mouse_move, 500, 84, 2, 354, 525] +[:mouse_move, 505, 84, 2, 355, 526] +[:mouse_move, 509, 84, 2, 356, 527] +[:mouse_move, 515, 84, 2, 357, 528] +[:mouse_move, 518, 84, 2, 358, 529] +[:mouse_move, 525, 83, 2, 359, 530] +[:mouse_move, 529, 83, 2, 360, 531] +[:mouse_move, 537, 82, 2, 361, 532] +[:mouse_move, 541, 82, 2, 362, 533] +[:mouse_move, 550, 81, 2, 363, 534] +[:mouse_move, 554, 80, 2, 364, 535] +[:mouse_move, 562, 79, 2, 365, 536] +[:mouse_move, 566, 79, 2, 366, 537] +[:mouse_move, 574, 78, 2, 367, 538] +[:mouse_move, 577, 78, 2, 368, 539] +[:mouse_move, 585, 77, 2, 369, 540] +[:mouse_move, 587, 77, 2, 370, 541] +[:mouse_move, 593, 77, 2, 371, 542] +[:mouse_move, 596, 77, 2, 372, 543] +[:mouse_move, 600, 77, 2, 373, 544] +[:mouse_move, 604, 77, 2, 374, 545] +[:mouse_move, 608, 77, 2, 375, 546] +[:mouse_move, 610, 77, 2, 376, 547] +[:mouse_move, 616, 77, 2, 377, 548] +[:mouse_move, 619, 77, 2, 378, 549] +[:mouse_move, 621, 78, 2, 379, 550] +[:mouse_move, 628, 80, 2, 380, 551] +[:mouse_move, 631, 80, 2, 381, 552] +[:mouse_move, 637, 82, 2, 382, 553] +[:mouse_move, 641, 83, 2, 383, 554] +[:mouse_move, 648, 84, 2, 384, 555] +[:mouse_move, 651, 84, 2, 385, 556] +[:mouse_move, 657, 84, 2, 386, 557] +[:mouse_move, 660, 84, 2, 387, 558] +[:mouse_move, 665, 84, 2, 388, 559] +[:mouse_move, 668, 84, 2, 389, 560] +[:mouse_move, 671, 83, 2, 390, 561] +[:mouse_move, 673, 83, 2, 391, 562] +[:mouse_move, 674, 83, 2, 392, 563] +[:mouse_move, 675, 83, 2, 393, 564] +[:mouse_move, 676, 83, 2, 394, 566] +[:mouse_move, 674, 83, 2, 395, 587] +[:mouse_move, 667, 83, 2, 396, 588] +[:mouse_move, 661, 84, 2, 397, 589] +[:mouse_move, 642, 86, 2, 398, 590] +[:mouse_move, 629, 87, 2, 399, 591] +[:mouse_move, 598, 89, 2, 400, 592] +[:mouse_move, 582, 90, 2, 401, 593] +[:mouse_move, 553, 90, 2, 402, 594] +[:mouse_move, 547, 90, 2, 403, 595] +[:mouse_move, 529, 91, 2, 404, 596] +[:mouse_move, 521, 91, 2, 405, 597] +[:mouse_move, 514, 91, 2, 406, 598] +[:mouse_move, 509, 92, 2, 407, 599] +[:mouse_move, 501, 92, 2, 408, 600] +[:mouse_move, 499, 93, 2, 409, 601] +[:mouse_move, 492, 93, 2, 410, 602] +[:mouse_move, 489, 94, 2, 411, 603] +[:mouse_move, 485, 94, 2, 412, 604] +[:mouse_move, 474, 95, 2, 413, 605] +[:mouse_move, 469, 96, 2, 414, 606] +[:mouse_move, 462, 96, 2, 415, 607] +[:mouse_move, 459, 96, 2, 416, 608] +[:mouse_move, 456, 96, 2, 417, 609] +[:mouse_move, 454, 96, 2, 418, 610] +[:mouse_move, 453, 96, 2, 419, 611] +[:mouse_move, 453, 97, 2, 420, 615] +[:mouse_move, 455, 98, 2, 421, 617] +[:mouse_move, 457, 99, 2, 422, 618] +[:mouse_move, 465, 102, 2, 423, 619] +[:mouse_move, 470, 104, 2, 424, 620] +[:mouse_move, 481, 106, 2, 425, 621] +[:mouse_move, 487, 107, 2, 426, 622] +[:mouse_move, 499, 109, 2, 427, 623] +[:mouse_move, 504, 109, 2, 428, 624] +[:mouse_move, 513, 110, 2, 429, 625] +[:mouse_move, 518, 110, 2, 430, 626] +[:mouse_move, 527, 110, 2, 431, 627] +[:mouse_move, 531, 110, 2, 432, 628] +[:mouse_move, 538, 108, 2, 433, 629] +[:mouse_move, 542, 108, 2, 434, 630] +[:mouse_move, 548, 106, 2, 435, 631] +[:mouse_move, 549, 106, 2, 436, 632] +[:mouse_move, 554, 105, 2, 437, 633] +[:mouse_move, 557, 104, 2, 438, 634] +[:mouse_move, 560, 104, 2, 439, 635] +[:mouse_move, 565, 103, 2, 440, 636] +[:mouse_move, 568, 103, 2, 441, 637] +[:mouse_move, 573, 102, 2, 442, 638] +[:mouse_move, 575, 102, 2, 443, 639] +[:mouse_move, 581, 102, 2, 444, 640] +[:mouse_move, 585, 102, 2, 445, 641] +[:mouse_move, 592, 102, 2, 446, 642] +[:mouse_move, 596, 102, 2, 447, 643] +[:mouse_move, 604, 102, 2, 448, 644] +[:mouse_move, 608, 102, 2, 449, 645] +[:mouse_move, 617, 102, 2, 450, 646] +[:mouse_move, 622, 102, 2, 451, 647] +[:mouse_move, 634, 102, 2, 452, 648] +[:mouse_move, 641, 102, 2, 453, 649] +[:mouse_move, 655, 102, 2, 454, 650] +[:mouse_move, 668, 102, 2, 455, 651] +[:mouse_move, 680, 102, 2, 456, 652] +[:mouse_move, 687, 102, 2, 457, 653] +[:mouse_move, 699, 102, 2, 458, 654] +[:mouse_move, 705, 102, 2, 459, 655] +[:mouse_move, 712, 102, 2, 460, 656] +[:mouse_move, 715, 102, 2, 461, 657] +[:mouse_move, 718, 102, 2, 462, 658] +[:mouse_move, 719, 102, 2, 463, 660] +[:mouse_move, 718, 102, 2, 464, 663] +[:mouse_move, 717, 102, 2, 465, 664] +[:mouse_move, 713, 102, 2, 466, 665] +[:mouse_move, 709, 101, 2, 467, 666] +[:mouse_move, 693, 100, 2, 468, 667] +[:mouse_move, 673, 99, 2, 469, 668] +[:mouse_move, 640, 99, 2, 470, 669] +[:mouse_move, 622, 99, 2, 471, 670] +[:mouse_move, 585, 99, 2, 472, 671] +[:mouse_move, 578, 99, 2, 473, 672] +[:mouse_move, 554, 100, 2, 474, 673] +[:mouse_move, 550, 100, 2, 475, 674] +[:mouse_move, 538, 100, 2, 476, 675] +[:mouse_move, 535, 100, 2, 477, 676] +[:mouse_move, 532, 100, 2, 478, 677] +[:mouse_move, 531, 100, 2, 479, 678] +[:mouse_move, 530, 100, 2, 480, 679] +[:mouse_move, 529, 100, 2, 481, 681] +[:mouse_move, 530, 100, 2, 482, 686] +[:mouse_move, 532, 100, 2, 483, 687] +[:mouse_move, 542, 104, 2, 484, 688] +[:mouse_move, 546, 104, 2, 485, 689] +[:mouse_move, 560, 107, 2, 486, 690] +[:mouse_move, 567, 107, 2, 487, 691] +[:mouse_move, 581, 107, 2, 488, 692] +[:mouse_move, 587, 107, 2, 489, 693] +[:mouse_move, 593, 103, 2, 490, 694] +[:mouse_move, 595, 101, 2, 491, 695] +[:mouse_move, 598, 96, 2, 492, 696] +[:mouse_move, 599, 93, 2, 493, 697] +[:mouse_move, 599, 88, 2, 494, 698] +[:mouse_move, 598, 86, 2, 495, 699] +[:mouse_move, 589, 78, 2, 496, 700] +[:mouse_move, 583, 75, 2, 497, 701] +[:mouse_move, 570, 70, 2, 498, 702] +[:mouse_move, 563, 68, 2, 499, 703] +[:mouse_move, 546, 66, 2, 500, 704] +[:mouse_move, 540, 65, 2, 501, 705] +[:mouse_move, 526, 65, 2, 502, 706] +[:mouse_move, 521, 65, 2, 503, 707] +[:mouse_move, 513, 66, 2, 504, 708] +[:mouse_move, 510, 68, 2, 505, 709] +[:mouse_move, 504, 71, 2, 506, 710] +[:mouse_move, 502, 72, 2, 507, 711] +[:mouse_move, 499, 76, 2, 508, 712] +[:mouse_move, 498, 78, 2, 509, 713] +[:mouse_move, 498, 81, 2, 510, 714] +[:mouse_move, 498, 87, 2, 511, 715] +[:mouse_move, 498, 90, 2, 512, 716] +[:mouse_move, 500, 97, 2, 513, 717] +[:mouse_move, 500, 98, 2, 514, 718] +[:mouse_move, 506, 105, 2, 515, 719] +[:mouse_move, 512, 110, 2, 516, 720] +[:mouse_move, 523, 115, 2, 517, 721] +[:mouse_move, 531, 118, 2, 518, 722] +[:mouse_move, 550, 121, 2, 519, 723] +[:mouse_move, 555, 121, 2, 520, 724] +[:mouse_move, 571, 121, 2, 521, 725] +[:mouse_move, 577, 119, 2, 522, 726] +[:mouse_move, 586, 113, 2, 523, 727] +[:mouse_move, 590, 110, 2, 524, 728] +[:mouse_move, 595, 101, 2, 525, 729] +[:mouse_move, 598, 94, 2, 526, 730] +[:mouse_move, 599, 83, 2, 527, 731] +[:mouse_move, 599, 80, 2, 528, 732] +[:mouse_move, 599, 69, 2, 529, 733] +[:mouse_move, 597, 66, 2, 530, 734] +[:mouse_move, 593, 62, 2, 531, 735] +[:mouse_move, 581, 60, 2, 532, 736] +[:mouse_move, 561, 59, 2, 533, 737] +[:mouse_move, 551, 59, 2, 534, 738] +[:mouse_move, 535, 59, 2, 535, 739] +[:mouse_move, 526, 60, 2, 536, 740] +[:mouse_move, 518, 62, 2, 537, 741] +[:mouse_move, 506, 65, 2, 538, 742] +[:mouse_move, 504, 67, 2, 539, 743] +[:mouse_move, 498, 70, 2, 540, 744] +[:mouse_move, 496, 72, 2, 541, 745] +[:mouse_move, 493, 77, 2, 542, 746] +[:mouse_move, 493, 79, 2, 543, 747] +[:mouse_move, 493, 86, 2, 544, 748] +[:mouse_move, 493, 88, 2, 545, 749] +[:mouse_move, 495, 96, 2, 546, 750] +[:mouse_move, 497, 98, 2, 547, 751] +[:mouse_move, 502, 104, 2, 548, 752] +[:mouse_move, 504, 106, 2, 549, 753] +[:mouse_move, 509, 110, 2, 550, 754] +[:mouse_move, 513, 112, 2, 551, 755] +[:mouse_move, 521, 116, 2, 552, 756] +[:mouse_move, 525, 118, 2, 553, 757] +[:mouse_move, 535, 120, 2, 554, 758] +[:mouse_move, 540, 121, 2, 555, 759] +[:mouse_move, 549, 122, 2, 556, 760] +[:mouse_move, 553, 122, 2, 557, 761] +[:mouse_move, 560, 121, 2, 558, 762] +[:mouse_move, 561, 120, 2, 559, 763] +[:mouse_move, 564, 119, 2, 560, 764] +[:mouse_move, 565, 118, 2, 561, 765] +[:mouse_move, 566, 118, 2, 562, 766] +[:key_down_raw, 104, 0, 2, 563, 817] +[:key_up_raw, 104, 0, 2, 564, 820] +[:mouse_move, 566, 115, 2, 565, 843] +[:mouse_move, 564, 113, 2, 566, 844] +[:mouse_move, 562, 110, 2, 567, 845] +[:mouse_move, 560, 107, 2, 568, 846] +[:mouse_move, 557, 104, 2, 569, 847] +[:mouse_move, 556, 103, 2, 570, 848] +[:mouse_move, 555, 102, 2, 571, 849] +[:mouse_move, 554, 101, 2, 572, 850] +[:mouse_move, 553, 101, 2, 573, 851] +[:mouse_move, 552, 100, 2, 574, 853] +[:mouse_move, 549, 99, 2, 575, 854] +[:mouse_move, 548, 99, 2, 576, 855] +[:mouse_move, 543, 98, 2, 577, 856] +[:mouse_move, 541, 98, 2, 578, 857] +[:mouse_move, 538, 98, 2, 579, 858] +[:mouse_move, 536, 98, 2, 580, 859] +[:mouse_move, 535, 98, 2, 581, 860] +[:mouse_move, 537, 99, 2, 582, 862] +[:mouse_move, 544, 101, 2, 583, 863] +[:mouse_move, 555, 105, 2, 584, 864] +[:mouse_move, 569, 108, 2, 585, 865] +[:mouse_move, 590, 112, 2, 586, 866] +[:mouse_move, 595, 112, 2, 587, 867] +[:mouse_move, 612, 114, 2, 588, 868] +[:mouse_move, 619, 115, 2, 589, 869] +[:mouse_move, 631, 115, 2, 590, 870] +[:mouse_move, 636, 115, 2, 591, 871] +[:mouse_move, 640, 115, 2, 592, 872] +[:mouse_move, 643, 115, 2, 593, 873] +[:mouse_move, 646, 115, 2, 594, 874] +[:mouse_move, 646, 114, 2, 595, 875] +[:mouse_move, 646, 113, 2, 596, 877] +[:mouse_move, 645, 113, 2, 597, 879] +[:mouse_move, 644, 112, 2, 598, 880] +[:mouse_move, 644, 111, 2, 599, 882] +[:mouse_move, 644, 110, 2, 600, 883] +[:mouse_move, 647, 110, 2, 601, 884] +[:mouse_move, 656, 110, 2, 602, 885] +[:mouse_move, 665, 110, 2, 603, 886] +[:mouse_move, 676, 109, 2, 604, 887] +[:mouse_move, 683, 108, 2, 605, 888] +[:mouse_move, 690, 106, 2, 606, 889] +[:mouse_move, 693, 105, 2, 607, 890] +[:mouse_move, 695, 104, 2, 608, 891] +[:mouse_move, 695, 103, 2, 609, 892] +[:mouse_move, 690, 103, 2, 610, 893] +[:mouse_move, 688, 103, 2, 611, 894] +[:mouse_move, 683, 103, 2, 612, 895] +[:mouse_move, 682, 103, 2, 613, 896] +[:mouse_move, 680, 103, 2, 614, 897] +[:mouse_move, 682, 103, 2, 615, 901] +[:mouse_move, 683, 103, 2, 616, 902] +[:mouse_move, 685, 103, 2, 617, 904] +[:mouse_move, 685, 102, 2, 618, 905] +[:mouse_move, 676, 102, 2, 619, 908] +[:mouse_move, 673, 102, 2, 620, 909] +[:mouse_move, 667, 102, 2, 621, 910] +[:mouse_move, 664, 102, 2, 622, 911] +[:mouse_move, 661, 102, 2, 623, 912] +[:mouse_move, 660, 102, 2, 624, 913] +[:mouse_move, 662, 102, 2, 625, 915] +[:mouse_move, 668, 102, 2, 626, 916] +[:mouse_move, 670, 102, 2, 627, 917] +[:mouse_move, 675, 102, 2, 628, 918] +[:mouse_move, 676, 102, 2, 629, 919] +[:mouse_move, 677, 102, 2, 630, 920] +[:mouse_move, 674, 102, 2, 631, 922] +[:mouse_move, 671, 102, 2, 632, 923] +[:mouse_move, 665, 102, 2, 633, 924] +[:mouse_move, 663, 103, 2, 634, 925] +[:mouse_move, 660, 103, 2, 635, 926] +[:mouse_move, 661, 103, 2, 636, 928] +[:mouse_move, 663, 103, 2, 637, 929] +[:mouse_move, 667, 103, 2, 638, 930] +[:mouse_move, 669, 103, 2, 639, 931] +[:mouse_move, 671, 103, 2, 640, 932] +[:mouse_move, 673, 103, 2, 641, 933] +[:key_down_raw, 104, 0, 2, 642, 949] +[:key_up_raw, 104, 0, 2, 643, 955] +[:mouse_move, 665, 102, 2, 644, 985] +[:mouse_move, 657, 101, 2, 645, 986] +[:mouse_move, 647, 101, 2, 646, 987] +[:mouse_move, 646, 101, 2, 647, 988] +[:mouse_move, 641, 101, 2, 648, 989] +[:mouse_move, 640, 101, 2, 649, 990] +[:mouse_move, 640, 102, 2, 650, 991] +[:mouse_move, 642, 102, 2, 651, 992] +[:mouse_move, 655, 103, 2, 652, 993] +[:mouse_move, 663, 104, 2, 653, 994] +[:mouse_move, 676, 104, 2, 654, 995] +[:mouse_move, 679, 104, 2, 655, 996] +[:mouse_move, 689, 104, 2, 656, 997] +[:mouse_move, 691, 104, 2, 657, 998] +[:mouse_move, 695, 104, 2, 658, 999] +[:mouse_move, 695, 103, 2, 659, 1000] +[:mouse_move, 692, 102, 2, 660, 1002] +[:mouse_move, 681, 102, 2, 661, 1003] +[:mouse_move, 677, 102, 2, 662, 1004] +[:mouse_move, 670, 103, 2, 663, 1005] +[:mouse_move, 667, 103, 2, 664, 1006] +[:mouse_move, 663, 104, 2, 665, 1007] +[:mouse_move, 662, 104, 2, 666, 1008] +[:mouse_move, 663, 104, 2, 667, 1009] +[:mouse_move, 666, 104, 2, 668, 1010] +[:mouse_move, 674, 103, 2, 669, 1011] +[:mouse_move, 678, 102, 2, 670, 1012] +[:mouse_move, 680, 102, 2, 671, 1013] +[:mouse_move, 687, 101, 2, 672, 1014] +[:mouse_move, 689, 101, 2, 673, 1015] +[:mouse_move, 691, 101, 2, 674, 1016] +[:mouse_move, 686, 101, 2, 675, 1018] +[:mouse_move, 682, 101, 2, 676, 1019] +[:mouse_move, 676, 102, 2, 677, 1020] +[:mouse_move, 673, 103, 2, 678, 1021] +[:mouse_move, 670, 104, 2, 679, 1022] +[:mouse_move, 669, 104, 2, 680, 1023] +[:mouse_move, 672, 104, 2, 681, 1025] +[:mouse_move, 677, 104, 2, 682, 1026] +[:mouse_move, 680, 104, 2, 683, 1027] +[:mouse_move, 685, 103, 2, 684, 1028] +[:mouse_move, 686, 103, 2, 685, 1029] +[:mouse_move, 687, 103, 2, 686, 1030] +[:mouse_move, 676, 103, 2, 687, 1032] +[:mouse_move, 672, 103, 2, 688, 1033] +[:mouse_move, 663, 104, 2, 689, 1034] +[:mouse_move, 660, 104, 2, 690, 1035] +[:mouse_move, 655, 105, 2, 691, 1036] +[:mouse_move, 657, 105, 2, 692, 1038] +[:mouse_move, 659, 105, 2, 693, 1039] +[:mouse_move, 660, 105, 2, 694, 1040] +[:mouse_move, 663, 105, 2, 695, 1041] +[:mouse_move, 664, 105, 2, 696, 1042] +[:mouse_move, 665, 105, 2, 697, 1043] +[:key_down_raw, 104, 0, 2, 698, 1052] +[:key_up_raw, 104, 0, 2, 699, 1056] +[:mouse_move, 664, 105, 2, 700, 1074] +[:mouse_move, 666, 105, 2, 701, 1079] +[:mouse_move, 673, 105, 2, 702, 1080] +[:mouse_move, 677, 104, 2, 703, 1081] +[:mouse_move, 689, 103, 2, 704, 1082] +[:mouse_move, 695, 102, 2, 705, 1083] +[:mouse_move, 702, 101, 2, 706, 1084] +[:mouse_move, 705, 99, 2, 707, 1085] +[:mouse_move, 710, 97, 2, 708, 1086] +[:mouse_move, 711, 96, 2, 709, 1087] +[:mouse_move, 711, 93, 2, 710, 1088] +[:mouse_move, 711, 91, 2, 711, 1089] +[:mouse_move, 711, 86, 2, 712, 1090] +[:mouse_move, 710, 83, 2, 713, 1091] +[:mouse_move, 706, 78, 2, 714, 1092] +[:mouse_move, 703, 75, 2, 715, 1093] +[:mouse_move, 699, 74, 2, 716, 1094] +[:mouse_move, 690, 73, 2, 717, 1095] +[:mouse_move, 683, 73, 2, 718, 1096] +[:mouse_move, 675, 73, 2, 719, 1097] +[:mouse_move, 670, 73, 2, 720, 1098] +[:mouse_move, 662, 73, 2, 721, 1099] +[:mouse_move, 660, 73, 2, 722, 1100] +[:mouse_move, 655, 75, 2, 723, 1101] +[:mouse_move, 652, 77, 2, 724, 1102] +[:mouse_move, 649, 81, 2, 725, 1103] +[:mouse_move, 648, 83, 2, 726, 1104] +[:mouse_move, 647, 87, 2, 727, 1105] +[:mouse_move, 647, 89, 2, 728, 1106] +[:mouse_move, 646, 92, 2, 729, 1107] +[:mouse_move, 646, 95, 2, 730, 1108] +[:mouse_move, 648, 99, 2, 731, 1109] +[:mouse_move, 652, 102, 2, 732, 1110] +[:mouse_move, 664, 107, 2, 733, 1111] +[:mouse_move, 668, 108, 2, 734, 1112] +[:mouse_move, 682, 111, 2, 735, 1113] +[:mouse_move, 688, 111, 2, 736, 1114] +[:mouse_move, 696, 111, 2, 737, 1115] +[:mouse_move, 703, 110, 2, 738, 1116] +[:mouse_move, 707, 107, 2, 739, 1117] +[:mouse_move, 709, 105, 2, 740, 1118] +[:mouse_move, 712, 102, 2, 741, 1119] +[:mouse_move, 712, 100, 2, 742, 1120] +[:mouse_move, 712, 96, 2, 743, 1121] +[:mouse_move, 710, 94, 2, 744, 1122] +[:mouse_move, 709, 94, 2, 745, 1123] +[:mouse_move, 704, 92, 2, 746, 1124] +[:mouse_move, 701, 89, 2, 747, 1125] +[:mouse_move, 696, 84, 2, 748, 1126] +[:mouse_move, 691, 78, 2, 749, 1127] +[:mouse_move, 682, 63, 2, 750, 1128] +[:mouse_move, 679, 59, 2, 751, 1129] +[:mouse_move, 668, 46, 2, 752, 1130] +[:mouse_move, 666, 44, 2, 753, 1131] +[:mouse_move, 656, 33, 2, 754, 1132] +[:mouse_move, 652, 30, 2, 755, 1133] +[:mouse_move, 647, 25, 2, 756, 1134] +[:mouse_move, 643, 23, 2, 757, 1135] +[:mouse_move, 638, 20, 2, 758, 1136] +[:mouse_move, 636, 19, 2, 759, 1137] +[:mouse_move, 631, 18, 2, 760, 1138] +[:mouse_move, 629, 17, 2, 761, 1139] +[:mouse_move, 625, 17, 2, 762, 1140] +[:mouse_move, 624, 17, 2, 763, 1141] +[:mouse_move, 620, 17, 2, 764, 1142] +[:mouse_move, 618, 17, 2, 765, 1143] +[:mouse_move, 615, 17, 2, 766, 1144] +[:mouse_move, 614, 17, 2, 767, 1145] +[:mouse_move, 612, 18, 2, 768, 1146] +[:mouse_move, 611, 18, 2, 769, 1147] +[:mouse_move, 611, 19, 2, 770, 1150] +[:mouse_move, 612, 19, 2, 771, 1151] +[:mouse_move, 615, 20, 2, 772, 1152] +[:mouse_move, 624, 22, 2, 773, 1153] +[:mouse_move, 629, 23, 2, 774, 1154] +[:mouse_move, 640, 24, 2, 775, 1155] +[:mouse_move, 646, 24, 2, 776, 1156] +[:mouse_move, 652, 25, 2, 777, 1157] +[:mouse_move, 656, 25, 2, 778, 1158] +[:mouse_move, 661, 25, 2, 779, 1159] +[:mouse_move, 663, 25, 2, 780, 1160] +[:mouse_move, 665, 25, 2, 781, 1161] +[:mouse_move, 666, 25, 2, 782, 1162] +[:mouse_move, 667, 25, 2, 783, 1163] +[:mouse_move, 665, 25, 2, 784, 1166] +[:mouse_move, 659, 25, 2, 785, 1167] +[:mouse_move, 650, 26, 2, 786, 1168] +[:mouse_move, 644, 26, 2, 787, 1169] +[:mouse_move, 635, 26, 2, 788, 1170] +[:mouse_move, 629, 26, 2, 789, 1171] +[:mouse_move, 627, 26, 2, 790, 1172] +[:mouse_move, 624, 26, 2, 791, 1173] +[:mouse_move, 623, 26, 2, 792, 1174] +[:mouse_move, 624, 26, 2, 793, 1178] +[:mouse_move, 626, 26, 2, 794, 1179] +[:mouse_move, 634, 26, 2, 795, 1180] +[:mouse_move, 636, 26, 2, 796, 1181] +[:mouse_move, 641, 26, 2, 797, 1182] +[:mouse_move, 643, 26, 2, 798, 1183] +[:mouse_move, 646, 26, 2, 799, 1184] +[:mouse_move, 645, 26, 2, 800, 1187] +[:mouse_move, 634, 26, 2, 801, 1188] +[:mouse_move, 631, 26, 2, 802, 1189] +[:mouse_move, 623, 26, 2, 803, 1190] +[:mouse_move, 620, 26, 2, 804, 1191] +[:mouse_move, 615, 26, 2, 805, 1192] +[:mouse_move, 614, 26, 2, 806, 1193] +[:mouse_move, 613, 26, 2, 807, 1195] +[:mouse_move, 613, 27, 2, 808, 1197] +[:key_down_raw, 1073742051, 1024, 2, 809, 1282] +[:key_down_raw, 113, 1024, 2, 810, 1282] diff --git a/samples/01_api_06_mouse/app/main.rb b/samples/01_api_06_mouse/app/main.rb new file mode 100644 index 0000000..43217f5 --- /dev/null +++ b/samples/01_api_06_mouse/app/main.rb @@ -0,0 +1,87 @@ +=begin + +APIs that haven't been encountered in a previous sample apps: + +- args.inputs.mouse.click: This property will be set if the mouse was clicked. +- args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. +- args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. +- args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed + since the click event. + +Reminder: + +- args.state.PROPERTY: The state property on args is a dynamic + structure. You can define ANY property here with ANY type of + arbitrary nesting. Properties defined on args.state will be retained + across frames. If you attempt access a property that doesn't exist + on args.state, it will simply return nil (no exception will be thrown). + +=end + +# This code demonstrates DragonRuby mouse input + +# To see if the a mouse click occurred +# Use args.inputs.mouse.click +# Which returns a boolean + +# To see where a mouse click occurred +# Use args.inputs.mouse.click.point.x AND +# args.inputs.mouse.click.point.y + +# To see which frame the click occurred +# Use args.inputs.mouse.click.created_at + +# To see how many frames its been since the click occurred +# Use args.inputs.mouse.click.creat_at_elapsed + +# Saving the click in args.state can be quite useful + +def tick args + tick_instructions args, "Sample app shows how mouse events are registered and how to measure elapsed time." + x = 460 + + args.outputs.labels << small_label(args, x, 11, "Mouse input: args.inputs.mouse") + + if args.inputs.mouse.click + args.state.last_mouse_click = args.inputs.mouse.click + end + + if args.state.last_mouse_click + click = args.state.last_mouse_click + args.outputs.labels << small_label(args, x, 12, "Mouse click happened at: #{click.created_at}") + args.outputs.labels << small_label(args, x, 13, "Mouse clicked #{click.created_at_elapsed} ticks ago") + args.outputs.labels << small_label(args, x, 14, "Mouse click location: #{click.point.x}, #{click.point.y}") + else + args.outputs.labels << small_label(args, x, 12, "Mouse click has not occurred yet.") + args.outputs.labels << small_label(args, x, 13, "Please click mouse.") + end +end + +def small_label args, x, row, message + # This method effectively combines the row_to_px and small_font methods + # It changes the given row value to a DragonRuby pixel value + # and adds the customization parameters + [x, row_to_px(args, row), message, small_font] +end + +def small_font + [-2, 0, 0, 0, 0, 255] +end + +def row_to_px args, row_number + args.grid.top.shift_down(5).shift_down(20 * row_number) +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_06_mouse/license-for-sample.txt b/samples/01_api_06_mouse/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_06_mouse/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_06_mouse/replay.txt b/samples/01_api_06_mouse/replay.txt new file mode 100644 index 0000000..61b4bd1 --- /dev/null +++ b/samples/01_api_06_mouse/replay.txt @@ -0,0 +1,893 @@ +replay_version 2.0 +stopped_at 1510 +seed 100 +recorded_at Sun Sep 29 21:33:51 2019 +[:mouse_move, 312, 285, 2, 1, 87] +[:mouse_move, 316, 285, 2, 2, 88] +[:mouse_move, 323, 285, 2, 3, 89] +[:mouse_move, 328, 285, 2, 4, 90] +[:mouse_move, 334, 285, 2, 5, 91] +[:mouse_move, 338, 285, 2, 6, 92] +[:mouse_move, 354, 285, 2, 7, 93] +[:mouse_move, 363, 285, 2, 8, 94] +[:mouse_move, 375, 284, 2, 9, 95] +[:mouse_move, 382, 284, 2, 10, 96] +[:mouse_move, 395, 282, 2, 11, 97] +[:mouse_move, 407, 280, 2, 12, 98] +[:mouse_move, 424, 279, 2, 13, 99] +[:mouse_move, 429, 279, 2, 14, 100] +[:mouse_move, 432, 278, 2, 15, 101] +[:mouse_move, 441, 278, 2, 16, 102] +[:mouse_move, 444, 278, 2, 17, 103] +[:mouse_move, 447, 278, 2, 18, 104] +[:mouse_move, 448, 278, 2, 19, 106] +[:mouse_move, 447, 277, 2, 20, 110] +[:mouse_move, 445, 276, 2, 21, 111] +[:mouse_move, 444, 273, 2, 22, 112] +[:mouse_move, 444, 271, 2, 23, 113] +[:mouse_move, 444, 268, 2, 24, 114] +[:mouse_move, 444, 266, 2, 25, 115] +[:mouse_move, 446, 263, 2, 26, 116] +[:mouse_move, 447, 262, 2, 27, 117] +[:mouse_move, 448, 261, 2, 28, 118] +[:mouse_move, 449, 261, 2, 29, 120] +[:mouse_move, 453, 261, 2, 30, 137] +[:mouse_move, 457, 261, 2, 31, 138] +[:mouse_move, 469, 260, 2, 32, 139] +[:mouse_move, 477, 260, 2, 33, 140] +[:mouse_move, 492, 260, 2, 34, 141] +[:mouse_move, 499, 260, 2, 35, 142] +[:mouse_move, 512, 261, 2, 36, 143] +[:mouse_move, 517, 261, 2, 37, 144] +[:mouse_move, 526, 262, 2, 38, 145] +[:mouse_move, 528, 262, 2, 39, 146] +[:mouse_move, 536, 262, 2, 40, 147] +[:mouse_move, 539, 262, 2, 41, 148] +[:mouse_move, 544, 262, 2, 42, 149] +[:mouse_move, 546, 262, 2, 43, 150] +[:mouse_move, 550, 262, 2, 44, 151] +[:mouse_move, 551, 262, 2, 45, 152] +[:mouse_move, 553, 262, 2, 46, 153] +[:mouse_move, 557, 262, 2, 47, 154] +[:mouse_move, 563, 262, 2, 48, 155] +[:mouse_move, 565, 262, 2, 49, 156] +[:mouse_move, 568, 262, 2, 50, 157] +[:mouse_move, 575, 261, 2, 51, 158] +[:mouse_move, 579, 260, 2, 52, 159] +[:mouse_move, 586, 259, 2, 53, 160] +[:mouse_move, 590, 258, 2, 54, 161] +[:mouse_move, 598, 257, 2, 55, 162] +[:mouse_move, 602, 257, 2, 56, 163] +[:mouse_move, 610, 257, 2, 57, 164] +[:mouse_move, 613, 257, 2, 58, 165] +[:mouse_move, 619, 257, 2, 59, 166] +[:mouse_move, 625, 256, 2, 60, 167] +[:mouse_move, 631, 256, 2, 61, 168] +[:mouse_move, 635, 256, 2, 62, 169] +[:mouse_move, 640, 255, 2, 63, 170] +[:mouse_move, 645, 255, 2, 64, 171] +[:mouse_move, 649, 254, 2, 65, 172] +[:mouse_move, 652, 254, 2, 66, 173] +[:mouse_move, 657, 254, 2, 67, 174] +[:mouse_move, 659, 253, 2, 68, 175] +[:mouse_move, 663, 253, 2, 69, 176] +[:mouse_move, 666, 253, 2, 70, 177] +[:mouse_move, 669, 253, 2, 71, 178] +[:mouse_move, 673, 252, 2, 72, 179] +[:mouse_move, 677, 252, 2, 73, 180] +[:mouse_move, 680, 251, 2, 74, 181] +[:mouse_move, 685, 250, 2, 75, 182] +[:mouse_move, 686, 250, 2, 76, 183] +[:mouse_move, 688, 249, 2, 77, 184] +[:mouse_move, 691, 248, 2, 78, 185] +[:mouse_move, 692, 248, 2, 79, 186] +[:mouse_move, 693, 248, 2, 80, 187] +[:mouse_move, 694, 248, 2, 81, 189] +[:mouse_move, 692, 248, 2, 82, 207] +[:mouse_move, 690, 248, 2, 83, 208] +[:mouse_move, 681, 248, 2, 84, 209] +[:mouse_move, 676, 249, 2, 85, 210] +[:mouse_move, 669, 249, 2, 86, 211] +[:mouse_move, 655, 250, 2, 87, 212] +[:mouse_move, 641, 251, 2, 88, 213] +[:mouse_move, 622, 251, 2, 89, 214] +[:mouse_move, 610, 251, 2, 90, 215] +[:mouse_move, 594, 251, 2, 91, 216] +[:mouse_move, 578, 251, 2, 92, 217] +[:mouse_move, 570, 251, 2, 93, 218] +[:mouse_move, 563, 251, 2, 94, 219] +[:mouse_move, 544, 251, 2, 95, 220] +[:mouse_move, 539, 251, 2, 96, 221] +[:mouse_move, 525, 251, 2, 97, 222] +[:mouse_move, 512, 252, 2, 98, 223] +[:mouse_move, 507, 252, 2, 99, 224] +[:mouse_move, 501, 252, 2, 100, 225] +[:mouse_move, 488, 252, 2, 101, 226] +[:mouse_move, 481, 252, 2, 102, 227] +[:mouse_move, 466, 253, 2, 103, 228] +[:mouse_move, 458, 253, 2, 104, 229] +[:mouse_move, 445, 254, 2, 105, 230] +[:mouse_move, 439, 254, 2, 106, 231] +[:mouse_move, 434, 255, 2, 107, 232] +[:mouse_move, 431, 256, 2, 108, 233] +[:mouse_move, 428, 256, 2, 109, 234] +[:mouse_move, 427, 257, 2, 110, 235] +[:mouse_move, 426, 257, 2, 111, 236] +[:mouse_move, 426, 258, 2, 112, 239] +[:mouse_move, 427, 259, 2, 113, 240] +[:mouse_move, 433, 263, 2, 114, 241] +[:mouse_move, 436, 264, 2, 115, 242] +[:mouse_move, 445, 268, 2, 116, 243] +[:mouse_move, 450, 269, 2, 117, 244] +[:mouse_move, 461, 270, 2, 118, 245] +[:mouse_move, 474, 270, 2, 119, 246] +[:mouse_move, 481, 270, 2, 120, 247] +[:mouse_move, 488, 270, 2, 121, 248] +[:mouse_move, 501, 269, 2, 122, 249] +[:mouse_move, 507, 268, 2, 123, 250] +[:mouse_move, 518, 266, 2, 124, 251] +[:mouse_move, 523, 265, 2, 125, 252] +[:mouse_move, 533, 264, 2, 126, 253] +[:mouse_move, 538, 264, 2, 127, 254] +[:mouse_move, 548, 263, 2, 128, 255] +[:mouse_move, 553, 262, 2, 129, 256] +[:mouse_move, 563, 262, 2, 130, 257] +[:mouse_move, 569, 261, 2, 131, 258] +[:mouse_move, 578, 261, 2, 132, 259] +[:mouse_move, 583, 261, 2, 133, 260] +[:mouse_move, 592, 261, 2, 134, 261] +[:mouse_move, 596, 261, 2, 135, 262] +[:mouse_move, 605, 261, 2, 136, 263] +[:mouse_move, 609, 261, 2, 137, 264] +[:mouse_move, 611, 261, 2, 138, 265] +[:mouse_move, 621, 261, 2, 139, 266] +[:mouse_move, 624, 261, 2, 140, 267] +[:mouse_move, 631, 261, 2, 141, 268] +[:mouse_move, 635, 261, 2, 142, 269] +[:mouse_move, 642, 261, 2, 143, 270] +[:mouse_move, 646, 261, 2, 144, 271] +[:mouse_move, 653, 262, 2, 145, 272] +[:mouse_move, 656, 262, 2, 146, 273] +[:mouse_move, 664, 263, 2, 147, 274] +[:mouse_move, 666, 263, 2, 148, 275] +[:mouse_move, 673, 264, 2, 149, 276] +[:mouse_move, 678, 264, 2, 150, 277] +[:mouse_move, 685, 264, 2, 151, 278] +[:mouse_move, 689, 265, 2, 152, 279] +[:mouse_move, 694, 265, 2, 153, 280] +[:mouse_move, 697, 265, 2, 154, 281] +[:mouse_move, 702, 265, 2, 155, 282] +[:mouse_move, 704, 265, 2, 156, 283] +[:mouse_move, 706, 265, 2, 157, 284] +[:mouse_move, 706, 266, 2, 158, 285] +[:mouse_move, 708, 266, 2, 159, 286] +[:mouse_move, 709, 266, 2, 160, 288] +[:mouse_move, 708, 269, 2, 161, 318] +[:mouse_move, 693, 283, 2, 162, 319] +[:mouse_move, 680, 294, 2, 163, 320] +[:mouse_move, 641, 322, 2, 164, 321] +[:mouse_move, 618, 340, 2, 165, 322] +[:mouse_move, 609, 346, 2, 166, 323] +[:mouse_move, 583, 363, 2, 167, 324] +[:mouse_move, 570, 371, 2, 168, 325] +[:mouse_move, 552, 378, 2, 169, 326] +[:mouse_move, 546, 379, 2, 170, 327] +[:mouse_move, 538, 379, 2, 171, 328] +[:mouse_move, 536, 379, 2, 172, 329] +[:mouse_move, 531, 372, 2, 173, 330] +[:mouse_move, 526, 365, 2, 174, 331] +[:mouse_move, 517, 352, 2, 175, 332] +[:mouse_move, 510, 344, 2, 176, 333] +[:mouse_move, 496, 334, 2, 177, 334] +[:mouse_move, 488, 328, 2, 178, 335] +[:mouse_move, 474, 319, 2, 179, 336] +[:mouse_move, 467, 315, 2, 180, 337] +[:mouse_move, 458, 307, 2, 181, 338] +[:mouse_move, 454, 304, 2, 182, 339] +[:mouse_move, 449, 300, 2, 183, 340] +[:mouse_move, 447, 298, 2, 184, 341] +[:mouse_move, 445, 294, 2, 185, 342] +[:mouse_move, 444, 292, 2, 186, 343] +[:mouse_move, 443, 291, 2, 187, 344] +[:mouse_move, 442, 290, 2, 188, 345] +[:mouse_move, 442, 289, 2, 189, 346] +[:mouse_move, 442, 288, 2, 190, 349] +[:mouse_move, 442, 287, 2, 191, 353] +[:mouse_move, 444, 287, 2, 192, 354] +[:mouse_move, 449, 287, 2, 193, 355] +[:mouse_move, 454, 287, 2, 194, 356] +[:mouse_move, 470, 287, 2, 195, 357] +[:mouse_move, 480, 287, 2, 196, 358] +[:mouse_move, 504, 288, 2, 197, 359] +[:mouse_move, 517, 289, 2, 198, 360] +[:mouse_move, 534, 290, 2, 199, 361] +[:mouse_move, 546, 290, 2, 200, 362] +[:mouse_move, 565, 290, 2, 201, 363] +[:mouse_move, 573, 290, 2, 202, 364] +[:mouse_move, 583, 290, 2, 203, 365] +[:mouse_move, 587, 290, 2, 204, 366] +[:mouse_move, 595, 290, 2, 205, 367] +[:mouse_move, 598, 290, 2, 206, 368] +[:mouse_move, 602, 290, 2, 207, 369] +[:mouse_move, 604, 290, 2, 208, 370] +[:mouse_move, 607, 290, 2, 209, 371] +[:mouse_move, 608, 291, 2, 210, 372] +[:mouse_move, 611, 291, 2, 211, 373] +[:mouse_move, 612, 291, 2, 212, 374] +[:mouse_move, 613, 291, 2, 213, 375] +[:mouse_move, 615, 291, 2, 214, 376] +[:mouse_move, 616, 292, 2, 215, 377] +[:mouse_move, 617, 292, 2, 216, 380] +[:mouse_move, 616, 294, 2, 217, 395] +[:mouse_move, 604, 307, 2, 218, 396] +[:mouse_move, 592, 318, 2, 219, 397] +[:mouse_move, 569, 336, 2, 220, 398] +[:mouse_move, 562, 340, 2, 221, 399] +[:mouse_move, 549, 348, 2, 222, 400] +[:mouse_move, 544, 352, 2, 223, 401] +[:mouse_move, 540, 354, 2, 224, 402] +[:mouse_move, 536, 357, 2, 225, 403] +[:mouse_move, 539, 357, 2, 226, 407] +[:mouse_move, 541, 357, 2, 227, 408] +[:mouse_move, 544, 357, 2, 228, 409] +[:mouse_move, 548, 357, 2, 229, 410] +[:mouse_move, 553, 357, 2, 230, 411] +[:mouse_move, 557, 357, 2, 231, 412] +[:mouse_move, 566, 358, 2, 232, 413] +[:mouse_move, 570, 358, 2, 233, 414] +[:mouse_move, 575, 358, 2, 234, 415] +[:mouse_move, 577, 358, 2, 235, 416] +[:mouse_move, 581, 358, 2, 236, 417] +[:mouse_move, 583, 358, 2, 237, 418] +[:mouse_move, 584, 358, 2, 238, 419] +[:mouse_move, 585, 358, 2, 239, 420] +[:mouse_button_pressed, 1, 0, 1, 240, 428] +[:mouse_button_up, 1, 0, 1, 241, 437] +[:mouse_move, 583, 359, 2, 242, 463] +[:mouse_move, 583, 360, 2, 243, 464] +[:mouse_move, 585, 360, 2, 244, 466] +[:mouse_move, 595, 359, 2, 245, 467] +[:mouse_move, 605, 357, 2, 246, 468] +[:mouse_move, 627, 351, 2, 247, 469] +[:mouse_move, 632, 349, 2, 248, 470] +[:mouse_move, 642, 346, 2, 249, 471] +[:mouse_move, 660, 342, 2, 250, 472] +[:mouse_move, 672, 338, 2, 251, 473] +[:mouse_move, 677, 336, 2, 252, 474] +[:mouse_move, 684, 332, 2, 253, 475] +[:mouse_move, 686, 330, 2, 254, 476] +[:mouse_move, 689, 327, 2, 255, 477] +[:mouse_move, 691, 325, 2, 256, 478] +[:mouse_move, 693, 322, 2, 257, 479] +[:mouse_move, 693, 321, 2, 258, 480] +[:mouse_move, 693, 318, 2, 259, 481] +[:mouse_move, 692, 318, 2, 260, 482] +[:mouse_move, 688, 316, 2, 261, 483] +[:mouse_move, 684, 314, 2, 262, 484] +[:mouse_move, 683, 314, 2, 263, 485] +[:mouse_move, 678, 312, 2, 264, 486] +[:mouse_move, 676, 311, 2, 265, 487] +[:mouse_move, 673, 310, 2, 266, 488] +[:mouse_move, 672, 310, 2, 267, 489] +[:mouse_move, 669, 310, 2, 268, 490] +[:mouse_move, 667, 309, 2, 269, 491] +[:mouse_move, 663, 309, 2, 270, 492] +[:mouse_move, 661, 309, 2, 271, 493] +[:mouse_move, 657, 308, 2, 272, 494] +[:mouse_move, 655, 308, 2, 273, 495] +[:mouse_move, 652, 307, 2, 274, 496] +[:mouse_move, 651, 306, 2, 275, 497] +[:mouse_move, 650, 306, 2, 276, 498] +[:mouse_move, 649, 306, 2, 277, 503] +[:mouse_move, 648, 306, 2, 278, 508] +[:mouse_move, 647, 305, 2, 279, 509] +[:mouse_move, 645, 305, 2, 280, 510] +[:mouse_move, 636, 301, 2, 281, 511] +[:mouse_move, 628, 298, 2, 282, 512] +[:mouse_move, 605, 293, 2, 283, 513] +[:mouse_move, 593, 291, 2, 284, 514] +[:mouse_move, 581, 289, 2, 285, 515] +[:mouse_move, 565, 287, 2, 286, 516] +[:mouse_move, 555, 286, 2, 287, 517] +[:mouse_move, 550, 285, 2, 288, 518] +[:mouse_move, 544, 284, 2, 289, 519] +[:mouse_move, 542, 284, 2, 290, 520] +[:mouse_move, 541, 283, 2, 291, 521] +[:mouse_move, 540, 283, 2, 292, 523] +[:mouse_move, 541, 283, 2, 293, 529] +[:mouse_move, 543, 283, 2, 294, 531] +[:mouse_move, 545, 283, 2, 295, 532] +[:mouse_move, 550, 282, 2, 296, 533] +[:mouse_move, 553, 282, 2, 297, 534] +[:mouse_move, 558, 282, 2, 298, 535] +[:mouse_move, 561, 282, 2, 299, 536] +[:mouse_move, 566, 282, 2, 300, 537] +[:mouse_move, 570, 282, 2, 301, 538] +[:mouse_move, 571, 282, 2, 302, 539] +[:mouse_move, 576, 282, 2, 303, 540] +[:mouse_move, 578, 282, 2, 304, 541] +[:mouse_move, 584, 282, 2, 305, 542] +[:mouse_move, 588, 282, 2, 306, 543] +[:mouse_move, 590, 282, 2, 307, 544] +[:mouse_move, 592, 282, 2, 308, 545] +[:mouse_move, 595, 282, 2, 309, 546] +[:mouse_move, 597, 282, 2, 310, 547] +[:mouse_move, 599, 282, 2, 311, 548] +[:mouse_move, 601, 281, 2, 312, 549] +[:mouse_move, 602, 281, 2, 313, 550] +[:mouse_move, 602, 280, 2, 314, 551] +[:mouse_move, 604, 279, 2, 315, 552] +[:mouse_move, 605, 278, 2, 316, 554] +[:mouse_move, 606, 277, 2, 317, 555] +[:mouse_move, 606, 276, 2, 318, 556] +[:mouse_move, 607, 274, 2, 319, 557] +[:mouse_move, 607, 272, 2, 320, 558] +[:mouse_move, 607, 270, 2, 321, 559] +[:mouse_move, 607, 267, 2, 322, 560] +[:mouse_move, 607, 265, 2, 323, 561] +[:mouse_move, 606, 262, 2, 324, 562] +[:mouse_move, 605, 261, 2, 325, 563] +[:mouse_move, 603, 259, 2, 326, 564] +[:mouse_move, 598, 256, 2, 327, 565] +[:mouse_move, 597, 255, 2, 328, 566] +[:mouse_move, 592, 253, 2, 329, 567] +[:mouse_move, 590, 253, 2, 330, 568] +[:mouse_move, 585, 251, 2, 331, 569] +[:mouse_move, 581, 250, 2, 332, 570] +[:mouse_move, 575, 250, 2, 333, 571] +[:mouse_move, 573, 250, 2, 334, 572] +[:mouse_move, 569, 251, 2, 335, 573] +[:mouse_move, 565, 253, 2, 336, 574] +[:mouse_move, 564, 254, 2, 337, 575] +[:mouse_move, 562, 255, 2, 338, 576] +[:mouse_move, 560, 258, 2, 339, 577] +[:mouse_move, 559, 259, 2, 340, 578] +[:mouse_move, 558, 262, 2, 341, 579] +[:mouse_move, 558, 264, 2, 342, 580] +[:mouse_move, 558, 267, 2, 343, 581] +[:mouse_move, 558, 269, 2, 344, 582] +[:mouse_move, 559, 271, 2, 345, 583] +[:mouse_move, 561, 274, 2, 346, 584] +[:mouse_move, 562, 274, 2, 347, 585] +[:mouse_move, 565, 276, 2, 348, 586] +[:mouse_move, 571, 279, 2, 349, 587] +[:mouse_move, 573, 279, 2, 350, 588] +[:mouse_move, 580, 280, 2, 351, 589] +[:mouse_move, 581, 280, 2, 352, 590] +[:mouse_move, 586, 280, 2, 353, 591] +[:mouse_move, 590, 280, 2, 354, 592] +[:mouse_move, 592, 279, 2, 355, 593] +[:mouse_move, 596, 278, 2, 356, 594] +[:mouse_move, 597, 277, 2, 357, 595] +[:mouse_move, 599, 275, 2, 358, 596] +[:mouse_move, 599, 274, 2, 359, 597] +[:mouse_move, 600, 272, 2, 360, 598] +[:mouse_move, 600, 271, 2, 361, 599] +[:mouse_move, 601, 269, 2, 362, 600] +[:mouse_move, 602, 267, 2, 363, 601] +[:mouse_move, 602, 265, 2, 364, 602] +[:mouse_move, 603, 263, 2, 365, 603] +[:mouse_move, 603, 260, 2, 366, 604] +[:mouse_move, 603, 258, 2, 367, 605] +[:mouse_move, 602, 254, 2, 368, 606] +[:mouse_move, 600, 252, 2, 369, 607] +[:mouse_move, 594, 249, 2, 370, 608] +[:mouse_move, 590, 248, 2, 371, 609] +[:mouse_move, 580, 247, 2, 372, 610] +[:mouse_move, 578, 247, 2, 373, 611] +[:mouse_move, 571, 247, 2, 374, 612] +[:mouse_move, 568, 247, 2, 375, 613] +[:mouse_move, 565, 248, 2, 376, 614] +[:mouse_move, 564, 249, 2, 377, 615] +[:mouse_move, 563, 252, 2, 378, 616] +[:mouse_move, 563, 254, 2, 379, 617] +[:mouse_move, 567, 261, 2, 380, 618] +[:mouse_move, 573, 266, 2, 381, 619] +[:mouse_move, 585, 275, 2, 382, 620] +[:mouse_move, 608, 288, 2, 383, 621] +[:mouse_move, 623, 296, 2, 384, 622] +[:mouse_move, 641, 305, 2, 385, 623] +[:mouse_move, 645, 307, 2, 386, 624] +[:mouse_move, 658, 314, 2, 387, 625] +[:mouse_move, 661, 315, 2, 388, 626] +[:mouse_move, 659, 315, 2, 389, 637] +[:mouse_move, 658, 315, 2, 390, 638] +[:mouse_move, 656, 315, 2, 391, 639] +[:mouse_move, 653, 313, 2, 392, 640] +[:mouse_move, 640, 309, 2, 393, 641] +[:mouse_move, 635, 308, 2, 394, 642] +[:mouse_move, 626, 305, 2, 395, 643] +[:mouse_move, 625, 305, 2, 396, 644] +[:mouse_move, 619, 304, 2, 397, 645] +[:mouse_move, 618, 303, 2, 398, 646] +[:mouse_move, 616, 303, 2, 399, 648] +[:mouse_move, 617, 303, 2, 400, 651] +[:mouse_move, 624, 303, 2, 401, 652] +[:mouse_move, 627, 303, 2, 402, 653] +[:mouse_move, 645, 303, 2, 403, 654] +[:mouse_move, 654, 304, 2, 404, 655] +[:mouse_move, 669, 304, 2, 405, 656] +[:mouse_move, 678, 304, 2, 406, 657] +[:mouse_move, 692, 304, 2, 407, 658] +[:mouse_move, 697, 304, 2, 408, 659] +[:mouse_move, 703, 304, 2, 409, 660] +[:mouse_move, 707, 304, 2, 410, 661] +[:mouse_move, 712, 304, 2, 411, 662] +[:mouse_move, 717, 304, 2, 412, 663] +[:mouse_move, 722, 304, 2, 413, 664] +[:mouse_move, 725, 304, 2, 414, 665] +[:mouse_move, 730, 304, 2, 415, 666] +[:mouse_move, 732, 304, 2, 416, 667] +[:mouse_move, 736, 304, 2, 417, 668] +[:mouse_move, 737, 304, 2, 418, 670] +[:mouse_move, 733, 303, 2, 419, 672] +[:mouse_move, 726, 303, 2, 420, 673] +[:mouse_move, 716, 303, 2, 421, 674] +[:mouse_move, 691, 303, 2, 422, 675] +[:mouse_move, 675, 303, 2, 423, 676] +[:mouse_move, 651, 304, 2, 424, 677] +[:mouse_move, 638, 305, 2, 425, 678] +[:mouse_move, 624, 306, 2, 426, 679] +[:mouse_move, 618, 306, 2, 427, 680] +[:mouse_move, 612, 307, 2, 428, 681] +[:mouse_move, 611, 307, 2, 429, 682] +[:mouse_move, 610, 307, 2, 430, 683] +[:mouse_move, 615, 307, 2, 431, 685] +[:mouse_move, 620, 308, 2, 432, 686] +[:mouse_move, 640, 309, 2, 433, 687] +[:mouse_move, 651, 311, 2, 434, 688] +[:mouse_move, 667, 312, 2, 435, 689] +[:mouse_move, 671, 312, 2, 436, 690] +[:mouse_move, 683, 313, 2, 437, 691] +[:mouse_move, 687, 313, 2, 438, 692] +[:mouse_move, 690, 313, 2, 439, 693] +[:mouse_move, 691, 313, 2, 440, 695] +[:mouse_move, 695, 311, 2, 441, 699] +[:mouse_move, 704, 305, 2, 442, 700] +[:mouse_move, 717, 299, 2, 443, 701] +[:mouse_move, 782, 275, 2, 444, 702] +[:mouse_move, 821, 262, 2, 445, 703] +[:mouse_move, 919, 230, 2, 446, 704] +[:mouse_move, 973, 212, 2, 447, 705] +[:mouse_move, 1042, 188, 2, 448, 706] +[:mouse_move, 1084, 173, 2, 449, 707] +[:mouse_move, 1126, 157, 2, 450, 708] +[:mouse_move, 1135, 154, 2, 451, 709] +[:mouse_move, 1163, 139, 2, 452, 710] +[:mouse_move, 1166, 138, 2, 453, 711] +[:mouse_move, 1175, 131, 2, 454, 712] +[:mouse_move, 1177, 129, 2, 455, 713] +[:mouse_move, 1180, 124, 2, 456, 714] +[:mouse_move, 1180, 123, 2, 457, 715] +[:mouse_move, 1181, 120, 2, 458, 716] +[:mouse_move, 1182, 118, 2, 459, 717] +[:mouse_move, 1183, 113, 2, 460, 718] +[:mouse_move, 1183, 109, 2, 461, 719] +[:mouse_move, 1187, 99, 2, 462, 720] +[:mouse_move, 1189, 91, 2, 463, 721] +[:mouse_move, 1198, 72, 2, 464, 722] +[:mouse_move, 1203, 61, 2, 465, 723] +[:mouse_move, 1213, 45, 2, 466, 724] +[:mouse_move, 1219, 37, 2, 467, 725] +[:mouse_move, 1232, 24, 2, 468, 726] +[:mouse_move, 1237, 19, 2, 469, 727] +[:mouse_move, 1242, 17, 2, 470, 728] +[:mouse_move, 1247, 15, 2, 471, 729] +[:mouse_move, 1250, 14, 2, 472, 730] +[:mouse_move, 1251, 14, 2, 473, 754] +[:mouse_move, 1252, 14, 2, 474, 755] +[:mouse_move, 1255, 14, 2, 475, 756] +[:mouse_move, 1256, 14, 2, 476, 757] +[:mouse_move, 1258, 14, 2, 477, 758] +[:mouse_move, 1260, 13, 2, 478, 760] +[:mouse_button_pressed, 1, 0, 1, 479, 768] +[:mouse_button_up, 1, 0, 1, 480, 776] +[:mouse_move, 1254, 17, 2, 481, 801] +[:mouse_move, 1242, 23, 2, 482, 802] +[:mouse_move, 1193, 43, 2, 483, 803] +[:mouse_move, 1154, 56, 2, 484, 804] +[:mouse_move, 1045, 90, 2, 485, 805] +[:mouse_move, 978, 113, 2, 486, 806] +[:mouse_move, 845, 154, 2, 487, 807] +[:mouse_move, 821, 161, 2, 488, 808] +[:mouse_move, 772, 176, 2, 489, 809] +[:mouse_move, 722, 190, 2, 490, 810] +[:mouse_move, 713, 193, 2, 491, 811] +[:mouse_move, 689, 200, 2, 492, 812] +[:mouse_move, 678, 203, 2, 493, 813] +[:mouse_move, 666, 207, 2, 494, 814] +[:mouse_move, 663, 208, 2, 495, 815] +[:mouse_move, 656, 211, 2, 496, 816] +[:mouse_move, 654, 212, 2, 497, 817] +[:mouse_move, 649, 215, 2, 498, 818] +[:mouse_move, 646, 217, 2, 499, 819] +[:mouse_move, 641, 222, 2, 500, 820] +[:mouse_move, 638, 224, 2, 501, 821] +[:mouse_move, 632, 231, 2, 502, 822] +[:mouse_move, 630, 235, 2, 503, 823] +[:mouse_move, 625, 245, 2, 504, 824] +[:mouse_move, 621, 255, 2, 505, 825] +[:mouse_move, 618, 265, 2, 506, 826] +[:mouse_move, 618, 267, 2, 507, 827] +[:mouse_move, 616, 275, 2, 508, 828] +[:mouse_move, 616, 277, 2, 509, 829] +[:mouse_move, 616, 285, 2, 510, 830] +[:mouse_move, 616, 288, 2, 511, 831] +[:mouse_move, 616, 293, 2, 512, 832] +[:mouse_move, 617, 295, 2, 513, 833] +[:mouse_move, 617, 298, 2, 514, 834] +[:mouse_move, 618, 300, 2, 515, 835] +[:mouse_move, 618, 302, 2, 516, 837] +[:mouse_move, 618, 303, 2, 517, 839] +[:mouse_move, 619, 303, 2, 518, 841] +[:mouse_move, 621, 303, 2, 519, 842] +[:mouse_move, 626, 303, 2, 520, 843] +[:mouse_move, 630, 303, 2, 521, 844] +[:mouse_move, 642, 303, 2, 522, 845] +[:mouse_move, 649, 302, 2, 523, 846] +[:mouse_move, 664, 300, 2, 524, 847] +[:mouse_move, 669, 299, 2, 525, 848] +[:mouse_move, 680, 298, 2, 526, 849] +[:mouse_move, 685, 298, 2, 527, 850] +[:mouse_move, 695, 298, 2, 528, 851] +[:mouse_move, 699, 298, 2, 529, 852] +[:mouse_move, 705, 298, 2, 530, 853] +[:mouse_move, 708, 298, 2, 531, 854] +[:mouse_move, 714, 299, 2, 532, 855] +[:mouse_move, 718, 301, 2, 533, 856] +[:mouse_move, 725, 303, 2, 534, 857] +[:mouse_move, 729, 304, 2, 535, 858] +[:mouse_move, 736, 306, 2, 536, 859] +[:mouse_move, 743, 309, 2, 537, 861] +[:mouse_move, 745, 309, 2, 538, 862] +[:mouse_move, 747, 309, 2, 539, 863] +[:mouse_move, 748, 309, 2, 540, 864] +[:mouse_move, 749, 309, 2, 541, 866] +[:mouse_move, 750, 309, 2, 542, 867] +[:mouse_move, 762, 316, 2, 543, 889] +[:mouse_move, 793, 340, 2, 544, 890] +[:mouse_move, 824, 367, 2, 545, 891] +[:mouse_move, 905, 445, 2, 546, 892] +[:mouse_move, 926, 465, 2, 547, 893] +[:mouse_move, 966, 506, 2, 548, 894] +[:mouse_move, 1010, 548, 2, 549, 895] +[:mouse_move, 1033, 569, 2, 550, 896] +[:mouse_move, 1072, 604, 2, 551, 897] +[:mouse_move, 1087, 619, 2, 552, 898] +[:mouse_move, 1113, 647, 2, 553, 899] +[:mouse_move, 1118, 653, 2, 554, 900] +[:mouse_move, 1134, 670, 2, 555, 901] +[:mouse_move, 1136, 673, 2, 556, 902] +[:mouse_move, 1144, 680, 2, 557, 903] +[:mouse_move, 1150, 685, 2, 558, 904] +[:mouse_move, 1153, 687, 2, 559, 905] +[:mouse_move, 1155, 687, 2, 560, 918] +[:mouse_move, 1160, 687, 2, 561, 919] +[:mouse_move, 1173, 688, 2, 562, 920] +[:mouse_move, 1179, 691, 2, 563, 921] +[:mouse_move, 1197, 698, 2, 564, 922] +[:mouse_move, 1203, 701, 2, 565, 923] +[:mouse_move, 1216, 705, 2, 566, 924] +[:mouse_move, 1222, 708, 2, 567, 925] +[:mouse_move, 1231, 711, 2, 568, 926] +[:mouse_move, 1238, 712, 2, 569, 927] +[:mouse_move, 1245, 713, 2, 570, 928] +[:mouse_move, 1249, 713, 2, 571, 929] +[:mouse_move, 1254, 713, 2, 572, 930] +[:mouse_move, 1256, 713, 2, 573, 931] +[:mouse_move, 1259, 713, 2, 574, 932] +[:mouse_move, 1261, 713, 2, 575, 934] +[:mouse_move, 1261, 712, 2, 576, 936] +[:mouse_move, 1261, 710, 2, 577, 938] +[:mouse_move, 1261, 709, 2, 578, 939] +[:mouse_move, 1261, 707, 2, 579, 940] +[:mouse_move, 1261, 706, 2, 580, 941] +[:mouse_move, 1261, 703, 2, 581, 942] +[:mouse_move, 1261, 702, 2, 582, 943] +[:mouse_move, 1261, 700, 2, 583, 944] +[:mouse_move, 1261, 699, 2, 584, 945] +[:mouse_move, 1261, 697, 2, 585, 947] +[:mouse_move, 1261, 696, 2, 586, 949] +[:mouse_move, 1261, 695, 2, 587, 951] +[:mouse_button_pressed, 1, 0, 1, 588, 953] +[:mouse_button_up, 1, 0, 1, 589, 959] +[:mouse_move, 1243, 677, 2, 590, 974] +[:mouse_move, 1229, 666, 2, 591, 975] +[:mouse_move, 1186, 633, 2, 592, 976] +[:mouse_move, 1134, 597, 2, 593, 977] +[:mouse_move, 1024, 527, 2, 594, 978] +[:mouse_move, 1003, 516, 2, 595, 979] +[:mouse_move, 924, 478, 2, 596, 980] +[:mouse_move, 911, 474, 2, 597, 981] +[:mouse_move, 851, 449, 2, 598, 982] +[:mouse_move, 829, 440, 2, 599, 983] +[:mouse_move, 804, 427, 2, 600, 984] +[:mouse_move, 793, 422, 2, 601, 985] +[:mouse_move, 782, 416, 2, 602, 986] +[:mouse_move, 771, 409, 2, 603, 987] +[:mouse_move, 759, 399, 2, 604, 988] +[:mouse_move, 754, 395, 2, 605, 989] +[:mouse_move, 746, 389, 2, 606, 990] +[:mouse_move, 742, 386, 2, 607, 991] +[:mouse_move, 733, 380, 2, 608, 992] +[:mouse_move, 727, 377, 2, 609, 993] +[:mouse_move, 709, 368, 2, 610, 994] +[:mouse_move, 699, 363, 2, 611, 995] +[:mouse_move, 686, 355, 2, 612, 996] +[:mouse_move, 679, 350, 2, 613, 997] +[:mouse_move, 672, 346, 2, 614, 998] +[:mouse_move, 669, 343, 2, 615, 999] +[:mouse_move, 667, 341, 2, 616, 1000] +[:mouse_move, 663, 339, 2, 617, 1001] +[:mouse_move, 662, 337, 2, 618, 1002] +[:mouse_move, 658, 332, 2, 619, 1003] +[:mouse_move, 655, 329, 2, 620, 1004] +[:mouse_move, 652, 325, 2, 621, 1005] +[:mouse_move, 650, 322, 2, 622, 1006] +[:mouse_move, 646, 318, 2, 623, 1007] +[:mouse_move, 645, 317, 2, 624, 1008] +[:mouse_move, 644, 315, 2, 625, 1009] +[:mouse_move, 643, 314, 2, 626, 1010] +[:mouse_move, 640, 313, 2, 627, 1011] +[:mouse_move, 639, 312, 2, 628, 1012] +[:mouse_move, 636, 310, 2, 629, 1013] +[:mouse_move, 635, 310, 2, 630, 1014] +[:mouse_move, 634, 309, 2, 631, 1015] +[:mouse_move, 633, 308, 2, 632, 1016] +[:mouse_move, 632, 308, 2, 633, 1017] +[:mouse_move, 633, 308, 2, 634, 1024] +[:mouse_move, 634, 308, 2, 635, 1025] +[:mouse_move, 635, 308, 2, 636, 1027] +[:mouse_move, 637, 308, 2, 637, 1028] +[:mouse_move, 639, 308, 2, 638, 1029] +[:mouse_move, 643, 308, 2, 639, 1030] +[:mouse_move, 646, 308, 2, 640, 1031] +[:mouse_move, 650, 308, 2, 641, 1032] +[:mouse_move, 652, 308, 2, 642, 1033] +[:mouse_move, 658, 308, 2, 643, 1034] +[:mouse_move, 661, 308, 2, 644, 1035] +[:mouse_move, 670, 308, 2, 645, 1036] +[:mouse_move, 674, 308, 2, 646, 1037] +[:mouse_move, 680, 307, 2, 647, 1038] +[:mouse_move, 683, 307, 2, 648, 1039] +[:mouse_move, 691, 306, 2, 649, 1040] +[:mouse_move, 694, 305, 2, 650, 1041] +[:mouse_move, 702, 304, 2, 651, 1042] +[:mouse_move, 705, 304, 2, 652, 1043] +[:mouse_move, 712, 303, 2, 653, 1044] +[:mouse_move, 715, 303, 2, 654, 1045] +[:mouse_move, 722, 303, 2, 655, 1046] +[:mouse_move, 727, 303, 2, 656, 1047] +[:mouse_move, 735, 303, 2, 657, 1048] +[:mouse_move, 740, 303, 2, 658, 1049] +[:mouse_move, 748, 303, 2, 659, 1050] +[:mouse_move, 750, 303, 2, 660, 1051] +[:mouse_move, 756, 303, 2, 661, 1052] +[:mouse_move, 758, 304, 2, 662, 1053] +[:mouse_move, 760, 304, 2, 663, 1054] +[:mouse_move, 762, 304, 2, 664, 1055] +[:mouse_move, 763, 304, 2, 665, 1056] +[:mouse_move, 764, 304, 2, 666, 1057] +[:mouse_move, 756, 304, 2, 667, 1075] +[:mouse_move, 744, 306, 2, 668, 1076] +[:mouse_move, 707, 310, 2, 669, 1077] +[:mouse_move, 682, 311, 2, 670, 1078] +[:mouse_move, 548, 334, 2, 671, 1079] +[:mouse_move, 472, 350, 2, 672, 1080] +[:mouse_move, 432, 363, 2, 673, 1081] +[:mouse_move, 289, 420, 2, 674, 1082] +[:mouse_move, 226, 452, 2, 675, 1083] +[:mouse_move, 156, 504, 2, 676, 1084] +[:mouse_move, 124, 536, 2, 677, 1085] +[:mouse_move, 97, 576, 2, 678, 1086] +[:mouse_move, 93, 584, 2, 679, 1087] +[:mouse_move, 84, 606, 2, 680, 1088] +[:mouse_move, 81, 610, 2, 681, 1100] +[:mouse_move, 75, 620, 2, 682, 1101] +[:mouse_move, 59, 642, 2, 683, 1102] +[:mouse_move, 52, 649, 2, 684, 1103] +[:mouse_move, 45, 658, 2, 685, 1104] +[:mouse_move, 39, 666, 2, 686, 1105] +[:mouse_move, 31, 676, 2, 687, 1106] +[:mouse_move, 30, 678, 2, 688, 1107] +[:mouse_move, 28, 681, 2, 689, 1108] +[:mouse_move, 27, 682, 2, 690, 1109] +[:mouse_move, 27, 683, 2, 691, 1111] +[:mouse_move, 27, 684, 2, 692, 1113] +[:mouse_move, 27, 685, 2, 693, 1116] +[:mouse_move, 27, 686, 2, 694, 1117] +[:mouse_move, 27, 689, 2, 695, 1119] +[:mouse_move, 26, 690, 2, 696, 1120] +[:mouse_move, 23, 694, 2, 697, 1121] +[:mouse_move, 22, 695, 2, 698, 1122] +[:mouse_move, 18, 697, 2, 699, 1123] +[:mouse_move, 17, 698, 2, 700, 1124] +[:mouse_move, 16, 699, 2, 701, 1125] +[:mouse_move, 15, 699, 2, 702, 1126] +[:mouse_move, 15, 700, 2, 703, 1127] +[:mouse_move, 15, 701, 2, 704, 1131] +[:mouse_button_pressed, 1, 0, 1, 705, 1141] +[:mouse_button_up, 1, 0, 1, 706, 1148] +[:mouse_move, 21, 699, 2, 707, 1160] +[:mouse_move, 31, 694, 2, 708, 1161] +[:mouse_move, 77, 673, 2, 709, 1162] +[:mouse_move, 153, 638, 2, 710, 1163] +[:mouse_move, 225, 604, 2, 711, 1164] +[:mouse_move, 406, 525, 2, 712, 1165] +[:mouse_move, 512, 479, 2, 713, 1166] +[:mouse_move, 655, 417, 2, 714, 1167] +[:mouse_move, 737, 382, 2, 715, 1168] +[:mouse_move, 788, 360, 2, 716, 1169] +[:mouse_move, 831, 339, 2, 717, 1170] +[:mouse_move, 849, 332, 2, 718, 1171] +[:mouse_move, 864, 325, 2, 719, 1172] +[:mouse_move, 879, 317, 2, 720, 1173] +[:mouse_move, 880, 316, 2, 721, 1174] +[:mouse_move, 877, 316, 2, 722, 1175] +[:mouse_move, 875, 316, 2, 723, 1176] +[:mouse_move, 871, 316, 2, 724, 1177] +[:mouse_move, 866, 315, 2, 725, 1178] +[:mouse_move, 855, 314, 2, 726, 1179] +[:mouse_move, 842, 313, 2, 727, 1180] +[:mouse_move, 808, 313, 2, 728, 1181] +[:mouse_move, 783, 313, 2, 729, 1182] +[:mouse_move, 728, 313, 2, 730, 1183] +[:mouse_move, 715, 313, 2, 731, 1184] +[:mouse_move, 670, 313, 2, 732, 1185] +[:mouse_move, 652, 313, 2, 733, 1186] +[:mouse_move, 641, 313, 2, 734, 1187] +[:mouse_move, 634, 313, 2, 735, 1188] +[:mouse_move, 625, 313, 2, 736, 1189] +[:mouse_move, 623, 313, 2, 737, 1190] +[:mouse_move, 622, 313, 2, 738, 1191] +[:mouse_move, 621, 312, 2, 739, 1192] +[:mouse_move, 622, 312, 2, 740, 1201] +[:mouse_move, 624, 312, 2, 741, 1202] +[:mouse_move, 626, 312, 2, 742, 1203] +[:mouse_move, 632, 311, 2, 743, 1204] +[:mouse_move, 636, 311, 2, 744, 1205] +[:mouse_move, 647, 311, 2, 745, 1206] +[:mouse_move, 653, 311, 2, 746, 1207] +[:mouse_move, 665, 310, 2, 747, 1208] +[:mouse_move, 669, 310, 2, 748, 1209] +[:mouse_move, 676, 310, 2, 749, 1210] +[:mouse_move, 683, 310, 2, 750, 1211] +[:mouse_move, 687, 310, 2, 751, 1212] +[:mouse_move, 689, 310, 2, 752, 1213] +[:mouse_move, 693, 310, 2, 753, 1214] +[:mouse_move, 696, 310, 2, 754, 1215] +[:mouse_move, 702, 310, 2, 755, 1216] +[:mouse_move, 706, 310, 2, 756, 1217] +[:mouse_move, 709, 310, 2, 757, 1218] +[:mouse_move, 714, 310, 2, 758, 1219] +[:mouse_move, 716, 310, 2, 759, 1220] +[:mouse_move, 721, 310, 2, 760, 1221] +[:mouse_move, 724, 310, 2, 761, 1222] +[:mouse_move, 727, 310, 2, 762, 1223] +[:mouse_move, 728, 310, 2, 763, 1224] +[:mouse_move, 730, 310, 2, 764, 1225] +[:mouse_move, 731, 310, 2, 765, 1227] +[:mouse_move, 730, 310, 2, 766, 1245] +[:mouse_move, 687, 306, 2, 767, 1246] +[:mouse_move, 658, 303, 2, 768, 1247] +[:mouse_move, 570, 289, 2, 769, 1248] +[:mouse_move, 503, 280, 2, 770, 1249] +[:mouse_move, 371, 259, 2, 771, 1250] +[:mouse_move, 345, 254, 2, 772, 1251] +[:mouse_move, 248, 229, 2, 773, 1252] +[:mouse_move, 212, 215, 2, 774, 1253] +[:mouse_move, 177, 195, 2, 775, 1254] +[:mouse_move, 159, 184, 2, 776, 1255] +[:mouse_move, 141, 168, 2, 777, 1256] +[:mouse_move, 123, 151, 2, 778, 1257] +[:mouse_move, 96, 121, 2, 779, 1258] +[:mouse_move, 91, 114, 2, 780, 1259] +[:mouse_move, 71, 87, 2, 781, 1260] +[:mouse_move, 62, 74, 2, 782, 1261] +[:mouse_move, 51, 59, 2, 783, 1262] +[:mouse_move, 45, 52, 2, 784, 1263] +[:mouse_move, 36, 40, 2, 785, 1264] +[:mouse_move, 34, 39, 2, 786, 1279] +[:mouse_move, 32, 39, 2, 787, 1280] +[:mouse_move, 30, 37, 2, 788, 1281] +[:mouse_move, 29, 35, 2, 789, 1282] +[:mouse_move, 26, 32, 2, 790, 1283] +[:mouse_move, 25, 31, 2, 791, 1284] +[:mouse_move, 24, 30, 2, 792, 1285] +[:mouse_move, 23, 29, 2, 793, 1286] +[:mouse_move, 22, 27, 2, 794, 1287] +[:mouse_move, 22, 26, 2, 795, 1289] +[:mouse_move, 21, 25, 2, 796, 1290] +[:mouse_move, 21, 23, 2, 797, 1291] +[:mouse_move, 21, 22, 2, 798, 1292] +[:mouse_move, 20, 20, 2, 799, 1293] +[:mouse_move, 20, 19, 2, 800, 1295] +[:mouse_move, 19, 19, 2, 801, 1296] +[:mouse_move, 19, 18, 2, 802, 1297] +[:mouse_move, 18, 17, 2, 803, 1298] +[:mouse_move, 17, 16, 2, 804, 1299] +[:mouse_move, 16, 15, 2, 805, 1300] +[:mouse_move, 15, 14, 2, 806, 1302] +[:mouse_move, 15, 13, 2, 807, 1303] +[:mouse_move, 14, 13, 2, 808, 1304] +[:mouse_move, 14, 12, 2, 809, 1307] +[:mouse_button_pressed, 1, 0, 1, 810, 1322] +[:mouse_button_up, 1, 0, 1, 811, 1328] +[:mouse_move, 36, 23, 2, 812, 1345] +[:mouse_move, 57, 34, 2, 813, 1346] +[:mouse_move, 231, 131, 2, 814, 1347] +[:mouse_move, 347, 196, 2, 815, 1348] +[:mouse_move, 530, 298, 2, 816, 1349] +[:mouse_move, 582, 323, 2, 817, 1350] +[:mouse_move, 707, 381, 2, 818, 1351] +[:mouse_move, 769, 405, 2, 819, 1352] +[:mouse_move, 786, 409, 2, 820, 1353] +[:mouse_move, 807, 414, 2, 821, 1354] +[:mouse_move, 826, 420, 2, 822, 1355] +[:mouse_move, 844, 425, 2, 823, 1356] +[:mouse_move, 850, 426, 2, 824, 1357] +[:mouse_move, 850, 425, 2, 825, 1358] +[:mouse_move, 847, 423, 2, 826, 1359] +[:mouse_move, 838, 418, 2, 827, 1360] +[:mouse_move, 833, 414, 2, 828, 1361] +[:mouse_move, 816, 403, 2, 829, 1362] +[:mouse_move, 809, 398, 2, 830, 1363] +[:mouse_move, 781, 378, 2, 831, 1364] +[:mouse_move, 773, 373, 2, 832, 1365] +[:mouse_move, 745, 360, 2, 833, 1366] +[:mouse_move, 730, 354, 2, 834, 1367] +[:mouse_move, 709, 348, 2, 835, 1368] +[:mouse_move, 697, 345, 2, 836, 1369] +[:mouse_move, 685, 342, 2, 837, 1370] +[:mouse_move, 680, 342, 2, 838, 1371] +[:mouse_move, 672, 340, 2, 839, 1372] +[:mouse_move, 670, 340, 2, 840, 1373] +[:mouse_move, 666, 340, 2, 841, 1374] +[:mouse_move, 665, 339, 2, 842, 1375] +[:mouse_move, 661, 339, 2, 843, 1376] +[:mouse_move, 660, 338, 2, 844, 1377] +[:mouse_move, 655, 337, 2, 845, 1378] +[:mouse_move, 652, 336, 2, 846, 1379] +[:mouse_move, 650, 333, 2, 847, 1380] +[:mouse_move, 644, 328, 2, 848, 1381] +[:mouse_move, 642, 326, 2, 849, 1382] +[:mouse_move, 638, 322, 2, 850, 1383] +[:mouse_move, 637, 321, 2, 851, 1384] +[:mouse_move, 636, 318, 2, 852, 1385] +[:mouse_move, 635, 318, 2, 853, 1386] +[:mouse_move, 635, 317, 2, 854, 1387] +[:mouse_move, 636, 317, 2, 855, 1392] +[:mouse_move, 642, 317, 2, 856, 1393] +[:mouse_move, 648, 317, 2, 857, 1394] +[:mouse_move, 658, 318, 2, 858, 1395] +[:mouse_move, 664, 318, 2, 859, 1396] +[:mouse_move, 671, 318, 2, 860, 1397] +[:mouse_move, 676, 318, 2, 861, 1398] +[:mouse_move, 684, 318, 2, 862, 1399] +[:mouse_move, 687, 318, 2, 863, 1400] +[:mouse_move, 693, 318, 2, 864, 1401] +[:mouse_move, 694, 318, 2, 865, 1402] +[:mouse_move, 701, 318, 2, 866, 1403] +[:mouse_move, 702, 318, 2, 867, 1404] +[:mouse_move, 708, 318, 2, 868, 1405] +[:mouse_move, 711, 318, 2, 869, 1406] +[:mouse_move, 713, 318, 2, 870, 1407] +[:mouse_move, 718, 318, 2, 871, 1408] +[:mouse_move, 721, 318, 2, 872, 1409] +[:mouse_move, 726, 317, 2, 873, 1410] +[:mouse_move, 728, 317, 2, 874, 1411] +[:mouse_move, 731, 317, 2, 875, 1412] +[:mouse_move, 733, 317, 2, 876, 1413] +[:mouse_move, 736, 317, 2, 877, 1414] +[:mouse_move, 738, 317, 2, 878, 1415] +[:mouse_move, 739, 317, 2, 879, 1416] +[:mouse_move, 740, 317, 2, 880, 1417] +[:mouse_move, 741, 317, 2, 881, 1418] +[:mouse_move, 705, 270, 2, 882, 1455] +[:mouse_move, 659, 221, 2, 883, 1456] +[:mouse_move, 515, 112, 2, 884, 1457] +[:mouse_move, 474, 92, 2, 885, 1458] +[:mouse_move, 315, 31, 2, 886, 1459] +[:mouse_move, 238, 13, 2, 887, 1460] +[:mouse_move, 168, 3, 2, 888, 1461] +[:mouse_move, 92, 0, 2, 889, 1462] diff --git a/samples/01_api_07_point_to_rect/app/main.rb b/samples/01_api_07_point_to_rect/app/main.rb new file mode 100644 index 0000000..7dd627f --- /dev/null +++ b/samples/01_api_07_point_to_rect/app/main.rb @@ -0,0 +1,90 @@ +=begin + +APIs that haven't been encountered in a previous sample apps: + +- args.outputus.borders: An array. Values in this array will be rendered as + unfilled rectangles on the screen. +- ARRAY#inside_rect?: An array with at least two values is considered a point. An array + with at least four values is considered a rect. The inside_rect? function returns true + or false depending on if the point is inside the rect. + + ``` + # Point: x: 100, y: 100 + # Rect: x: 0, y: 0, w: 500, h: 500 + # Result: true + + [100, 100].inside_rect? [0, 0, 500, 500] + ``` + + ``` + # Point: x: 100, y: 100 + # Rect: x: 300, y: 300, w: 100, h: 100 + # Result: false + + [100, 100].inside_rect? [300, 300, 100, 100] + ``` + +- args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. +- args.inputs.mouse.click.point.created_at_elapsed: How many frames have passed + since the click event. + +=end + +# To determine whether a point is in a rect +# Use point.inside_rect? rect + +# This is useful to determine if a click occurred in a rect + +def tick args + tick_instructions args, "Sample app shows how to determing if a click happened inside a rectangle." + + x = 460 + + args.outputs.labels << small_label(args, x, 15, "Click inside the blue box maybe ---->") + + box = [785, 370, 50, 50, 0, 0, 170] + args.outputs.borders << box + + # Saves the most recent click into args.state + # Unlike the other components of args, + # args.state does not reset every tick. + if args.inputs.mouse.click + args.state.last_mouse_click = args.inputs.mouse.click + end + + if args.state.last_mouse_click + if args.state.last_mouse_click.point.inside_rect? box + args.outputs.labels << small_label(args, x, 16, "Mouse click happened *inside* the box.") + else + args.outputs.labels << small_label(args, x, 16, "Mouse click happened *outside* the box.") + end + else + args.outputs.labels << small_label(args, x, 16, "Mouse click has not occurred yet.") + end +end + +def small_label args, x, row, message + [x, row_to_px(args, row), message, small_font] +end + +def small_font + [-2, 0, 0, 0, 0, 255] +end + +def row_to_px args, row_number + args.grid.top.shift_down(5).shift_down(20 * row_number) +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_07_point_to_rect/license-for-sample.txt b/samples/01_api_07_point_to_rect/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_07_point_to_rect/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_07_point_to_rect/replay.txt b/samples/01_api_07_point_to_rect/replay.txt new file mode 100644 index 0000000..8da3bad --- /dev/null +++ b/samples/01_api_07_point_to_rect/replay.txt @@ -0,0 +1,515 @@ +replay_version 2.0 +stopped_at 796 +seed 100 +recorded_at Sun Sep 29 21:34:41 2019 +[:mouse_move, 1191, 0, 2, 1, 90] +[:mouse_move, 1115, 68, 2, 2, 90] +[:mouse_move, 1039, 143, 2, 3, 91] +[:mouse_move, 963, 216, 2, 4, 92] +[:mouse_move, 928, 249, 2, 5, 92] +[:mouse_move, 866, 308, 2, 6, 93] +[:mouse_move, 843, 329, 2, 7, 94] +[:mouse_move, 787, 381, 2, 8, 95] +[:mouse_move, 776, 391, 2, 9, 96] +[:mouse_move, 755, 410, 2, 10, 97] +[:mouse_move, 745, 418, 2, 11, 98] +[:mouse_move, 738, 424, 2, 12, 99] +[:mouse_move, 736, 425, 2, 13, 100] +[:mouse_move, 736, 424, 2, 14, 103] +[:mouse_move, 736, 423, 2, 15, 105] +[:mouse_move, 736, 422, 2, 16, 106] +[:mouse_move, 736, 421, 2, 17, 107] +[:mouse_move, 736, 419, 2, 18, 107] +[:mouse_move, 736, 416, 2, 19, 108] +[:mouse_move, 735, 413, 2, 20, 109] +[:mouse_move, 735, 411, 2, 21, 109] +[:mouse_move, 734, 408, 2, 22, 110] +[:mouse_move, 732, 404, 2, 23, 111] +[:mouse_move, 731, 401, 2, 24, 111] +[:mouse_move, 729, 393, 2, 25, 112] +[:mouse_move, 728, 385, 2, 26, 113] +[:mouse_move, 728, 376, 2, 27, 113] +[:mouse_move, 729, 367, 2, 28, 114] +[:mouse_move, 734, 355, 2, 29, 115] +[:mouse_move, 741, 344, 2, 30, 115] +[:mouse_move, 748, 333, 2, 31, 116] +[:mouse_move, 752, 329, 2, 32, 117] +[:mouse_move, 755, 326, 2, 33, 117] +[:mouse_move, 758, 322, 2, 34, 118] +[:mouse_move, 760, 319, 2, 35, 119] +[:mouse_move, 762, 317, 2, 36, 119] +[:mouse_move, 762, 316, 2, 37, 120] +[:mouse_move, 755, 318, 2, 38, 122] +[:mouse_move, 748, 321, 2, 39, 123] +[:mouse_move, 721, 326, 2, 40, 124] +[:mouse_move, 705, 329, 2, 41, 125] +[:mouse_move, 674, 330, 2, 42, 126] +[:mouse_move, 645, 328, 2, 43, 127] +[:mouse_move, 602, 310, 2, 44, 128] +[:mouse_move, 590, 304, 2, 45, 129] +[:mouse_move, 577, 298, 2, 46, 130] +[:mouse_move, 567, 293, 2, 47, 131] +[:mouse_move, 555, 287, 2, 48, 132] +[:mouse_move, 553, 286, 2, 49, 133] +[:mouse_move, 551, 284, 2, 50, 134] +[:mouse_move, 550, 284, 2, 51, 134] +[:mouse_move, 550, 285, 2, 52, 140] +[:mouse_move, 550, 286, 2, 53, 141] +[:mouse_move, 549, 288, 2, 54, 142] +[:mouse_move, 548, 291, 2, 55, 142] +[:mouse_move, 546, 295, 2, 56, 143] +[:mouse_move, 542, 302, 2, 57, 144] +[:mouse_move, 539, 305, 2, 58, 144] +[:mouse_move, 535, 311, 2, 59, 145] +[:mouse_move, 530, 317, 2, 60, 146] +[:mouse_move, 524, 321, 2, 61, 146] +[:mouse_move, 518, 327, 2, 62, 147] +[:mouse_move, 513, 331, 2, 63, 148] +[:mouse_move, 507, 335, 2, 64, 148] +[:mouse_move, 504, 336, 2, 65, 149] +[:mouse_move, 500, 338, 2, 66, 150] +[:mouse_move, 494, 341, 2, 67, 151] +[:mouse_move, 492, 342, 2, 68, 152] +[:mouse_move, 491, 342, 2, 69, 152] +[:mouse_move, 489, 342, 2, 70, 153] +[:mouse_move, 486, 343, 2, 71, 154] +[:mouse_move, 482, 343, 2, 72, 155] +[:mouse_move, 480, 343, 2, 73, 156] +[:mouse_move, 477, 343, 2, 74, 157] +[:mouse_move, 475, 343, 2, 75, 158] +[:mouse_move, 473, 343, 2, 76, 159] +[:mouse_move, 472, 343, 2, 77, 160] +[:mouse_move, 471, 343, 2, 78, 162] +[:mouse_move, 471, 342, 2, 79, 163] +[:mouse_move, 471, 341, 2, 80, 167] +[:mouse_move, 471, 340, 2, 81, 169] +[:mouse_move, 472, 340, 2, 82, 171] +[:mouse_move, 473, 340, 2, 83, 172] +[:mouse_move, 473, 339, 2, 84, 173] +[:mouse_move, 474, 339, 2, 85, 174] +[:mouse_move, 475, 339, 2, 86, 175] +[:mouse_move, 476, 339, 2, 87, 178] +[:mouse_move, 479, 338, 2, 88, 180] +[:mouse_move, 482, 338, 2, 89, 181] +[:mouse_move, 489, 336, 2, 90, 182] +[:mouse_move, 493, 335, 2, 91, 183] +[:mouse_move, 502, 334, 2, 92, 184] +[:mouse_move, 505, 334, 2, 93, 185] +[:mouse_move, 515, 333, 2, 94, 186] +[:mouse_move, 525, 333, 2, 95, 187] +[:mouse_move, 529, 333, 2, 96, 188] +[:mouse_move, 536, 333, 2, 97, 188] +[:mouse_move, 539, 333, 2, 98, 189] +[:mouse_move, 544, 332, 2, 99, 190] +[:mouse_move, 548, 332, 2, 100, 190] +[:mouse_move, 555, 332, 2, 101, 191] +[:mouse_move, 559, 332, 2, 102, 192] +[:mouse_move, 563, 332, 2, 103, 192] +[:mouse_move, 568, 332, 2, 104, 193] +[:mouse_move, 572, 332, 2, 105, 194] +[:mouse_move, 577, 332, 2, 106, 194] +[:mouse_move, 579, 332, 2, 107, 195] +[:mouse_move, 583, 332, 2, 108, 196] +[:mouse_move, 585, 332, 2, 109, 196] +[:mouse_move, 588, 332, 2, 110, 197] +[:mouse_move, 589, 332, 2, 111, 198] +[:mouse_move, 591, 332, 2, 112, 198] +[:mouse_move, 594, 332, 2, 113, 199] +[:mouse_move, 597, 332, 2, 114, 200] +[:mouse_move, 600, 332, 2, 115, 200] +[:mouse_move, 602, 332, 2, 116, 201] +[:mouse_move, 605, 332, 2, 117, 202] +[:mouse_move, 610, 332, 2, 118, 202] +[:mouse_move, 614, 332, 2, 119, 203] +[:mouse_move, 618, 332, 2, 120, 204] +[:mouse_move, 634, 333, 2, 121, 205] +[:mouse_move, 638, 334, 2, 122, 206] +[:mouse_move, 654, 337, 2, 123, 207] +[:mouse_move, 660, 338, 2, 124, 208] +[:mouse_move, 675, 340, 2, 125, 209] +[:mouse_move, 681, 340, 2, 126, 210] +[:mouse_move, 688, 341, 2, 127, 211] +[:mouse_move, 692, 341, 2, 128, 212] +[:mouse_move, 696, 341, 2, 129, 212] +[:mouse_move, 698, 341, 2, 130, 213] +[:mouse_move, 700, 340, 2, 131, 214] +[:mouse_move, 702, 340, 2, 132, 215] +[:mouse_move, 703, 339, 2, 133, 215] +[:mouse_move, 704, 339, 2, 134, 216] +[:mouse_move, 705, 338, 2, 135, 217] +[:mouse_move, 706, 338, 2, 136, 217] +[:mouse_move, 707, 338, 2, 137, 220] +[:mouse_move, 707, 337, 2, 138, 221] +[:mouse_move, 704, 337, 2, 139, 242] +[:mouse_move, 697, 337, 2, 140, 242] +[:mouse_move, 683, 337, 2, 141, 243] +[:mouse_move, 666, 337, 2, 142, 244] +[:mouse_move, 655, 337, 2, 143, 244] +[:mouse_move, 638, 337, 2, 144, 245] +[:mouse_move, 619, 337, 2, 145, 246] +[:mouse_move, 602, 338, 2, 146, 246] +[:mouse_move, 586, 340, 2, 147, 247] +[:mouse_move, 572, 342, 2, 148, 248] +[:mouse_move, 559, 344, 2, 149, 248] +[:mouse_move, 547, 347, 2, 150, 249] +[:mouse_move, 542, 348, 2, 151, 250] +[:mouse_move, 532, 349, 2, 152, 250] +[:mouse_move, 525, 351, 2, 153, 251] +[:mouse_move, 517, 352, 2, 154, 252] +[:mouse_move, 512, 352, 2, 155, 252] +[:mouse_move, 506, 353, 2, 156, 253] +[:mouse_move, 501, 353, 2, 157, 254] +[:mouse_move, 495, 354, 2, 158, 254] +[:mouse_move, 490, 354, 2, 159, 255] +[:mouse_move, 488, 354, 2, 160, 256] +[:mouse_move, 484, 354, 2, 161, 256] +[:mouse_move, 481, 354, 2, 162, 257] +[:mouse_move, 480, 354, 2, 163, 258] +[:mouse_move, 477, 354, 2, 164, 259] +[:mouse_move, 476, 354, 2, 165, 260] +[:mouse_move, 474, 354, 2, 166, 261] +[:mouse_move, 473, 354, 2, 167, 262] +[:mouse_move, 471, 354, 2, 168, 263] +[:mouse_move, 470, 354, 2, 169, 265] +[:mouse_move, 470, 355, 2, 170, 267] +[:mouse_move, 473, 355, 2, 171, 269] +[:mouse_move, 481, 356, 2, 172, 269] +[:mouse_move, 492, 357, 2, 173, 270] +[:mouse_move, 508, 357, 2, 174, 271] +[:mouse_move, 519, 357, 2, 175, 271] +[:mouse_move, 536, 357, 2, 176, 272] +[:mouse_move, 544, 357, 2, 177, 273] +[:mouse_move, 556, 357, 2, 178, 273] +[:mouse_move, 568, 357, 2, 179, 274] +[:mouse_move, 578, 355, 2, 180, 275] +[:mouse_move, 588, 355, 2, 181, 275] +[:mouse_move, 597, 353, 2, 182, 276] +[:mouse_move, 605, 353, 2, 183, 277] +[:mouse_move, 612, 353, 2, 184, 277] +[:mouse_move, 619, 352, 2, 185, 278] +[:mouse_move, 625, 352, 2, 186, 279] +[:mouse_move, 631, 352, 2, 187, 279] +[:mouse_move, 637, 352, 2, 188, 280] +[:mouse_move, 642, 352, 2, 189, 281] +[:mouse_move, 647, 352, 2, 190, 281] +[:mouse_move, 652, 352, 2, 191, 282] +[:mouse_move, 659, 352, 2, 192, 283] +[:mouse_move, 665, 351, 2, 193, 283] +[:mouse_move, 671, 351, 2, 194, 284] +[:mouse_move, 673, 350, 2, 195, 285] +[:mouse_move, 679, 349, 2, 196, 286] +[:mouse_move, 681, 348, 2, 197, 287] +[:mouse_move, 683, 347, 2, 198, 288] +[:mouse_move, 684, 347, 2, 199, 289] +[:mouse_move, 687, 347, 2, 200, 298] +[:mouse_move, 691, 347, 2, 201, 299] +[:mouse_move, 698, 347, 2, 202, 300] +[:mouse_move, 714, 347, 2, 203, 300] +[:mouse_move, 728, 347, 2, 204, 301] +[:mouse_move, 738, 346, 2, 205, 302] +[:mouse_move, 752, 343, 2, 206, 302] +[:mouse_move, 759, 342, 2, 207, 303] +[:mouse_move, 770, 340, 2, 208, 304] +[:mouse_move, 779, 338, 2, 209, 304] +[:mouse_move, 782, 337, 2, 210, 305] +[:mouse_move, 794, 335, 2, 211, 306] +[:mouse_move, 796, 335, 2, 212, 306] +[:mouse_move, 801, 334, 2, 213, 307] +[:mouse_move, 804, 333, 2, 214, 308] +[:mouse_move, 806, 332, 2, 215, 308] +[:mouse_move, 808, 332, 2, 216, 309] +[:mouse_move, 810, 331, 2, 217, 310] +[:mouse_move, 811, 331, 2, 218, 310] +[:mouse_move, 812, 330, 2, 219, 311] +[:mouse_move, 813, 329, 2, 220, 313] +[:mouse_move, 814, 327, 2, 221, 315] +[:mouse_move, 814, 326, 2, 222, 316] +[:mouse_move, 814, 324, 2, 223, 317] +[:mouse_move, 815, 323, 2, 224, 319] +[:mouse_button_pressed, 1, 0, 1, 225, 326] +[:mouse_button_up, 1, 0, 1, 226, 334] +[:mouse_move, 815, 324, 2, 227, 367] +[:mouse_move, 814, 327, 2, 228, 369] +[:mouse_move, 811, 330, 2, 229, 370] +[:mouse_move, 800, 337, 2, 230, 371] +[:mouse_move, 791, 341, 2, 231, 372] +[:mouse_move, 753, 353, 2, 232, 373] +[:mouse_move, 743, 355, 2, 233, 374] +[:mouse_move, 708, 362, 2, 234, 375] +[:mouse_move, 692, 364, 2, 235, 376] +[:mouse_move, 676, 364, 2, 236, 377] +[:mouse_move, 656, 365, 2, 237, 378] +[:mouse_move, 645, 365, 2, 238, 379] +[:mouse_move, 628, 365, 2, 239, 380] +[:mouse_move, 623, 364, 2, 240, 381] +[:mouse_move, 612, 364, 2, 241, 382] +[:mouse_move, 610, 364, 2, 242, 383] +[:mouse_move, 600, 363, 2, 243, 384] +[:mouse_move, 599, 362, 2, 244, 385] +[:mouse_move, 595, 361, 2, 245, 386] +[:mouse_move, 594, 361, 2, 246, 387] +[:mouse_move, 593, 361, 2, 247, 388] +[:mouse_move, 597, 361, 2, 248, 392] +[:mouse_move, 601, 361, 2, 249, 393] +[:mouse_move, 609, 361, 2, 250, 394] +[:mouse_move, 612, 361, 2, 251, 395] +[:mouse_move, 620, 360, 2, 252, 396] +[:mouse_move, 626, 360, 2, 253, 397] +[:mouse_move, 633, 358, 2, 254, 398] +[:mouse_move, 637, 357, 2, 255, 399] +[:mouse_move, 646, 354, 2, 256, 400] +[:mouse_move, 650, 352, 2, 257, 401] +[:mouse_move, 658, 349, 2, 258, 402] +[:mouse_move, 662, 346, 2, 259, 403] +[:mouse_move, 663, 344, 2, 260, 404] +[:mouse_move, 671, 339, 2, 261, 405] +[:mouse_move, 672, 338, 2, 262, 406] +[:mouse_move, 677, 334, 2, 263, 407] +[:mouse_move, 678, 332, 2, 264, 408] +[:mouse_move, 681, 330, 2, 265, 409] +[:mouse_move, 681, 329, 2, 266, 410] +[:mouse_move, 683, 327, 2, 267, 411] +[:mouse_move, 684, 326, 2, 268, 412] +[:mouse_move, 685, 323, 2, 269, 413] +[:mouse_move, 685, 322, 2, 270, 414] +[:mouse_move, 686, 319, 2, 271, 415] +[:mouse_move, 686, 317, 2, 272, 416] +[:mouse_move, 686, 312, 2, 273, 417] +[:mouse_move, 685, 311, 2, 274, 418] +[:mouse_move, 680, 307, 2, 275, 419] +[:mouse_move, 677, 305, 2, 276, 420] +[:mouse_move, 672, 303, 2, 277, 421] +[:mouse_move, 669, 302, 2, 278, 422] +[:mouse_move, 663, 299, 2, 279, 423] +[:mouse_move, 658, 299, 2, 280, 424] +[:mouse_move, 652, 299, 2, 281, 425] +[:mouse_move, 649, 299, 2, 282, 426] +[:mouse_move, 645, 300, 2, 283, 427] +[:mouse_move, 642, 301, 2, 284, 428] +[:mouse_move, 639, 303, 2, 285, 429] +[:mouse_move, 637, 304, 2, 286, 430] +[:mouse_move, 633, 308, 2, 287, 431] +[:mouse_move, 631, 311, 2, 288, 432] +[:mouse_move, 629, 313, 2, 289, 433] +[:mouse_move, 623, 319, 2, 290, 434] +[:mouse_move, 620, 322, 2, 291, 435] +[:mouse_move, 616, 327, 2, 292, 436] +[:mouse_move, 614, 331, 2, 293, 437] +[:mouse_move, 611, 336, 2, 294, 438] +[:mouse_move, 610, 338, 2, 295, 439] +[:mouse_move, 609, 345, 2, 296, 440] +[:mouse_move, 610, 350, 2, 297, 441] +[:mouse_move, 617, 360, 2, 298, 442] +[:mouse_move, 620, 364, 2, 299, 443] +[:mouse_move, 629, 373, 2, 300, 444] +[:mouse_move, 634, 376, 2, 301, 445] +[:mouse_move, 640, 379, 2, 302, 446] +[:mouse_move, 646, 380, 2, 303, 447] +[:mouse_move, 651, 380, 2, 304, 448] +[:mouse_move, 654, 378, 2, 305, 449] +[:mouse_move, 659, 373, 2, 306, 450] +[:mouse_move, 662, 370, 2, 307, 451] +[:mouse_move, 667, 362, 2, 308, 452] +[:mouse_move, 670, 358, 2, 309, 453] +[:mouse_move, 673, 354, 2, 310, 454] +[:mouse_move, 676, 349, 2, 311, 455] +[:mouse_move, 679, 343, 2, 312, 456] +[:mouse_move, 680, 340, 2, 313, 457] +[:mouse_move, 681, 332, 2, 314, 458] +[:mouse_move, 682, 327, 2, 315, 459] +[:mouse_move, 682, 321, 2, 316, 460] +[:mouse_move, 682, 310, 2, 317, 461] +[:mouse_move, 682, 308, 2, 318, 462] +[:mouse_move, 681, 301, 2, 319, 463] +[:mouse_move, 679, 296, 2, 320, 464] +[:mouse_move, 674, 291, 2, 321, 465] +[:mouse_move, 670, 289, 2, 322, 466] +[:mouse_move, 659, 287, 2, 323, 467] +[:mouse_move, 654, 287, 2, 324, 468] +[:mouse_move, 644, 287, 2, 325, 469] +[:mouse_move, 642, 287, 2, 326, 470] +[:mouse_move, 633, 288, 2, 327, 471] +[:mouse_move, 629, 289, 2, 328, 472] +[:mouse_move, 623, 295, 2, 329, 473] +[:mouse_move, 619, 298, 2, 330, 474] +[:mouse_move, 613, 306, 2, 331, 475] +[:mouse_move, 611, 310, 2, 332, 476] +[:mouse_move, 608, 315, 2, 333, 477] +[:mouse_move, 608, 318, 2, 334, 478] +[:mouse_move, 607, 323, 2, 335, 479] +[:mouse_move, 607, 327, 2, 336, 480] +[:mouse_move, 607, 334, 2, 337, 481] +[:mouse_move, 608, 337, 2, 338, 482] +[:mouse_move, 613, 344, 2, 339, 483] +[:mouse_move, 617, 347, 2, 340, 484] +[:mouse_move, 625, 355, 2, 341, 485] +[:mouse_move, 630, 358, 2, 342, 486] +[:mouse_move, 635, 361, 2, 343, 487] +[:mouse_move, 648, 366, 2, 344, 488] +[:mouse_move, 654, 367, 2, 345, 489] +[:mouse_move, 667, 368, 2, 346, 490] +[:mouse_move, 672, 368, 2, 347, 491] +[:mouse_move, 681, 364, 2, 348, 492] +[:mouse_move, 684, 360, 2, 349, 493] +[:mouse_move, 690, 354, 2, 350, 494] +[:mouse_move, 690, 352, 2, 351, 495] +[:mouse_move, 693, 346, 2, 352, 496] +[:mouse_move, 693, 343, 2, 353, 497] +[:mouse_move, 694, 335, 2, 354, 498] +[:mouse_move, 693, 332, 2, 355, 499] +[:mouse_move, 687, 326, 2, 356, 500] +[:mouse_move, 684, 323, 2, 357, 501] +[:mouse_move, 679, 320, 2, 358, 502] +[:mouse_move, 677, 319, 2, 359, 503] +[:mouse_move, 674, 318, 2, 360, 504] +[:mouse_move, 674, 317, 2, 361, 505] +[:mouse_move, 675, 317, 2, 362, 519] +[:mouse_move, 682, 317, 2, 363, 520] +[:mouse_move, 700, 321, 2, 364, 521] +[:mouse_move, 710, 324, 2, 365, 522] +[:mouse_move, 726, 326, 2, 366, 523] +[:mouse_move, 741, 328, 2, 367, 524] +[:mouse_move, 774, 330, 2, 368, 525] +[:mouse_move, 779, 330, 2, 369, 526] +[:mouse_move, 799, 330, 2, 370, 527] +[:mouse_move, 808, 330, 2, 371, 528] +[:mouse_move, 832, 330, 2, 372, 529] +[:mouse_move, 835, 331, 2, 373, 530] +[:mouse_move, 850, 331, 2, 374, 531] +[:mouse_move, 852, 332, 2, 375, 532] +[:mouse_move, 860, 332, 2, 376, 533] +[:mouse_move, 863, 332, 2, 377, 534] +[:mouse_move, 868, 332, 2, 378, 535] +[:mouse_move, 870, 332, 2, 379, 536] +[:mouse_move, 873, 332, 2, 380, 537] +[:mouse_move, 875, 332, 2, 381, 538] +[:mouse_move, 878, 332, 2, 382, 539] +[:mouse_move, 881, 332, 2, 383, 540] +[:mouse_move, 883, 332, 2, 384, 541] +[:mouse_move, 887, 331, 2, 385, 542] +[:mouse_move, 890, 331, 2, 386, 543] +[:mouse_move, 894, 330, 2, 387, 544] +[:mouse_move, 895, 330, 2, 388, 545] +[:mouse_move, 898, 330, 2, 389, 546] +[:mouse_move, 899, 330, 2, 390, 547] +[:mouse_move, 900, 330, 2, 391, 548] +[:mouse_move, 901, 330, 2, 392, 549] +[:mouse_button_pressed, 1, 0, 1, 393, 552] +[:mouse_button_up, 1, 0, 1, 394, 560] +[:mouse_move, 895, 336, 2, 395, 598] +[:mouse_move, 888, 341, 2, 396, 599] +[:mouse_move, 856, 356, 2, 397, 600] +[:mouse_move, 834, 364, 2, 398, 601] +[:mouse_move, 779, 375, 2, 399, 602] +[:mouse_move, 747, 379, 2, 400, 603] +[:mouse_move, 701, 382, 2, 401, 604] +[:mouse_move, 675, 382, 2, 402, 605] +[:mouse_move, 650, 382, 2, 403, 606] +[:mouse_move, 637, 381, 2, 404, 607] +[:mouse_move, 626, 378, 2, 405, 608] +[:mouse_move, 622, 376, 2, 406, 609] +[:mouse_move, 616, 372, 2, 407, 610] +[:mouse_move, 615, 371, 2, 408, 611] +[:mouse_move, 614, 369, 2, 409, 612] +[:mouse_move, 614, 368, 2, 410, 614] +[:mouse_move, 614, 367, 2, 411, 615] +[:mouse_move, 614, 366, 2, 412, 616] +[:mouse_move, 615, 365, 2, 413, 618] +[:mouse_move, 616, 364, 2, 414, 620] +[:mouse_move, 617, 364, 2, 415, 623] +[:mouse_move, 617, 363, 2, 416, 624] +[:mouse_move, 618, 363, 2, 417, 626] +[:mouse_move, 623, 363, 2, 418, 627] +[:mouse_move, 626, 364, 2, 419, 628] +[:mouse_move, 635, 367, 2, 420, 629] +[:mouse_move, 641, 368, 2, 421, 630] +[:mouse_move, 654, 370, 2, 422, 631] +[:mouse_move, 661, 370, 2, 423, 632] +[:mouse_move, 678, 369, 2, 424, 633] +[:mouse_move, 681, 367, 2, 425, 634] +[:mouse_move, 694, 361, 2, 426, 635] +[:mouse_move, 699, 356, 2, 427, 636] +[:mouse_move, 707, 348, 2, 428, 637] +[:mouse_move, 709, 346, 2, 429, 638] +[:mouse_move, 714, 338, 2, 430, 639] +[:mouse_move, 715, 335, 2, 431, 640] +[:mouse_move, 715, 327, 2, 432, 641] +[:mouse_move, 715, 323, 2, 433, 642] +[:mouse_move, 709, 315, 2, 434, 643] +[:mouse_move, 706, 311, 2, 435, 644] +[:mouse_move, 697, 304, 2, 436, 645] +[:mouse_move, 688, 299, 2, 437, 646] +[:mouse_move, 672, 296, 2, 438, 647] +[:mouse_move, 667, 296, 2, 439, 648] +[:mouse_move, 654, 295, 2, 440, 649] +[:mouse_move, 647, 295, 2, 441, 650] +[:mouse_move, 642, 295, 2, 442, 651] +[:mouse_move, 631, 296, 2, 443, 652] +[:mouse_move, 625, 298, 2, 444, 653] +[:mouse_move, 619, 301, 2, 445, 654] +[:mouse_move, 616, 303, 2, 446, 655] +[:mouse_move, 611, 306, 2, 447, 656] +[:mouse_move, 608, 309, 2, 448, 657] +[:mouse_move, 607, 314, 2, 449, 658] +[:mouse_move, 606, 317, 2, 450, 659] +[:mouse_move, 606, 324, 2, 451, 660] +[:mouse_move, 606, 329, 2, 452, 661] +[:mouse_move, 611, 338, 2, 453, 662] +[:mouse_move, 612, 340, 2, 454, 663] +[:mouse_move, 615, 345, 2, 455, 664] +[:mouse_move, 617, 347, 2, 456, 665] +[:mouse_move, 622, 351, 2, 457, 666] +[:mouse_move, 624, 352, 2, 458, 667] +[:mouse_move, 632, 355, 2, 459, 668] +[:mouse_move, 636, 356, 2, 460, 669] +[:mouse_move, 645, 358, 2, 461, 670] +[:mouse_move, 650, 359, 2, 462, 671] +[:mouse_move, 667, 360, 2, 463, 672] +[:mouse_move, 675, 360, 2, 464, 673] +[:mouse_move, 686, 360, 2, 465, 674] +[:mouse_move, 693, 360, 2, 466, 675] +[:mouse_move, 699, 360, 2, 467, 676] +[:mouse_move, 707, 356, 2, 468, 677] +[:mouse_move, 710, 354, 2, 469, 678] +[:mouse_move, 716, 348, 2, 470, 679] +[:mouse_move, 717, 343, 2, 471, 680] +[:mouse_move, 718, 334, 2, 472, 681] +[:mouse_move, 718, 329, 2, 473, 682] +[:mouse_move, 717, 319, 2, 474, 683] +[:mouse_move, 714, 314, 2, 475, 684] +[:mouse_move, 705, 305, 2, 476, 685] +[:mouse_move, 699, 301, 2, 477, 686] +[:mouse_move, 688, 295, 2, 478, 687] +[:mouse_move, 682, 293, 2, 479, 688] +[:mouse_move, 674, 290, 2, 480, 689] +[:mouse_move, 666, 288, 2, 481, 690] +[:mouse_move, 657, 287, 2, 482, 691] +[:mouse_move, 651, 287, 2, 483, 692] +[:mouse_move, 642, 288, 2, 484, 693] +[:mouse_move, 638, 290, 2, 485, 694] +[:mouse_move, 628, 295, 2, 486, 695] +[:mouse_move, 624, 298, 2, 487, 696] +[:mouse_move, 617, 305, 2, 488, 697] +[:mouse_move, 614, 309, 2, 489, 698] +[:mouse_move, 611, 317, 2, 490, 699] +[:mouse_move, 610, 322, 2, 491, 700] +[:mouse_move, 610, 329, 2, 492, 701] +[:mouse_move, 610, 333, 2, 493, 702] +[:mouse_move, 615, 341, 2, 494, 703] +[:mouse_move, 618, 345, 2, 495, 704] +[:mouse_move, 622, 348, 2, 496, 705] +[:mouse_move, 631, 355, 2, 497, 706] +[:mouse_move, 636, 359, 2, 498, 707] +[:mouse_move, 646, 365, 2, 499, 708] +[:mouse_move, 650, 368, 2, 500, 709] +[:mouse_move, 659, 371, 2, 501, 710] +[:mouse_move, 663, 372, 2, 502, 711] +[:mouse_move, 668, 372, 2, 503, 712] +[:mouse_move, 671, 372, 2, 504, 713] +[:mouse_move, 676, 372, 2, 505, 714] +[:mouse_move, 678, 371, 2, 506, 715] +[:mouse_move, 681, 369, 2, 507, 716] +[:mouse_move, 682, 369, 2, 508, 717] +[:mouse_move, 683, 368, 2, 509, 718] +[:key_down_raw, 1073742051, 1024, 2, 510, 794] +[:key_down_raw, 113, 1024, 2, 511, 795] diff --git a/samples/01_api_08_rect_to_rect/app/main.rb b/samples/01_api_08_rect_to_rect/app/main.rb new file mode 100644 index 0000000..1a00a41 --- /dev/null +++ b/samples/01_api_08_rect_to_rect/app/main.rb @@ -0,0 +1,97 @@ +=begin + +APIs that haven't been encountered in a previous sample apps: + +- args.outputs.borders: An array. Values in this array will be rendered as + unfilled rectangles on the screen. +- ARRAY#intersect_rect?: An array with at least four values is + considered a rect. The intersect_rect? function returns true + or false depending on if the two rectangles intersect. + + ``` + # Rect One: x: 100, y: 100, w: 100, h: 100 + # Rect Two: x: 0, y: 0, w: 500, h: 500 + # Result: true + + [100, 100, 100, 100].intersect_rect? [0, 0, 500, 500] + ``` + + ``` + # Rect One: x: 100, y: 100, w: 10, h: 10 + # Rect Two: x: 500, y: 500, w: 10, h: 10 + # Result: false + + [100, 100, 10, 10].intersect_rect? [500, 500, 10, 10] + ``` + +=end + +# Similarly, whether rects intersect can be found through +# rect1.intersect_rect? rect2 + +def tick args + tick_instructions args, "Sample app shows how to determine if two rectangles intersect." + x = 460 + + args.outputs.labels << small_label(args, x, 3, "Click anywhere on the screen") + # red_box = [460, 250, 355, 90, 170, 0, 0] + # args.outputs.borders << red_box + + # args.state.box_collision_one and args.state.box_collision_two + # Are given values of a solid when they should be rendered + # They are stored in game so that they do not get reset every tick + if args.inputs.mouse.click + if !args.state.box_collision_one + args.state.box_collision_one = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 180, 0, 0, 180] + elsif !args.state.box_collision_two + args.state.box_collision_two = [args.inputs.mouse.click.point.x - 25, args.inputs.mouse.click.point.y - 25, 125, 125, 0, 0, 180, 180] + else + args.state.box_collision_one = nil + args.state.box_collision_two = nil + end + end + + if args.state.box_collision_one + args.outputs.solids << args.state.box_collision_one + end + + if args.state.box_collision_two + args.outputs.solids << args.state.box_collision_two + end + + if args.state.box_collision_one && args.state.box_collision_two + if args.state.box_collision_one.intersect_rect? args.state.box_collision_two + args.outputs.labels << small_label(args, x, 4, 'The boxes intersect.') + else + args.outputs.labels << small_label(args, x, 4, 'The boxes do not intersect.') + end + else + args.outputs.labels << small_label(args, x, 4, '--') + end +end + +def small_label args, x, row, message + [x, row_to_px(args, row), message, small_font] +end + +def small_font + [-2, 0, 0, 0, 0, 255] +end + +def row_to_px args, row_number + args.grid.top.shift_down(5).shift_down(20 * row_number) +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_08_rect_to_rect/license-for-sample.txt b/samples/01_api_08_rect_to_rect/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_08_rect_to_rect/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_08_rect_to_rect/replay.txt b/samples/01_api_08_rect_to_rect/replay.txt new file mode 100644 index 0000000..7ddec95 --- /dev/null +++ b/samples/01_api_08_rect_to_rect/replay.txt @@ -0,0 +1,376 @@ +replay_version 2.0 +stopped_at 909 +seed 100 +recorded_at Sun Sep 29 21:35:19 2019 +[:mouse_move, 670, 363, 2, 1, 87] +[:mouse_move, 642, 353, 2, 2, 88] +[:mouse_move, 631, 351, 2, 3, 89] +[:mouse_move, 578, 338, 2, 4, 90] +[:mouse_move, 555, 332, 2, 5, 91] +[:mouse_move, 521, 326, 2, 6, 92] +[:mouse_move, 503, 323, 2, 7, 93] +[:mouse_move, 495, 322, 2, 8, 94] +[:mouse_move, 479, 319, 2, 9, 95] +[:mouse_move, 472, 318, 2, 10, 96] +[:mouse_move, 463, 317, 2, 11, 97] +[:mouse_move, 461, 317, 2, 12, 98] +[:mouse_move, 457, 316, 2, 13, 99] +[:mouse_move, 455, 315, 2, 14, 101] +[:mouse_move, 454, 315, 2, 15, 102] +[:mouse_move, 454, 314, 2, 16, 105] +[:mouse_button_pressed, 1, 0, 1, 17, 110] +[:mouse_button_up, 1, 0, 1, 18, 118] +[:mouse_move, 455, 314, 2, 19, 201] +[:mouse_move, 472, 314, 2, 20, 202] +[:mouse_move, 490, 314, 2, 21, 203] +[:mouse_move, 528, 313, 2, 22, 204] +[:mouse_move, 585, 307, 2, 23, 205] +[:mouse_move, 625, 301, 2, 24, 206] +[:mouse_move, 697, 288, 2, 25, 207] +[:mouse_move, 729, 283, 2, 26, 208] +[:mouse_move, 763, 279, 2, 27, 209] +[:mouse_move, 784, 278, 2, 28, 210] +[:mouse_move, 788, 278, 2, 29, 211] +[:mouse_move, 797, 278, 2, 30, 212] +[:mouse_move, 802, 278, 2, 31, 213] +[:mouse_move, 809, 278, 2, 32, 214] +[:mouse_move, 810, 278, 2, 33, 215] +[:mouse_move, 811, 279, 2, 34, 216] +[:mouse_move, 812, 279, 2, 35, 218] +[:mouse_move, 810, 279, 2, 36, 222] +[:mouse_move, 801, 276, 2, 37, 223] +[:mouse_move, 793, 273, 2, 38, 224] +[:mouse_move, 784, 271, 2, 39, 225] +[:mouse_move, 757, 268, 2, 40, 226] +[:mouse_move, 738, 266, 2, 41, 227] +[:mouse_move, 734, 266, 2, 42, 228] +[:mouse_move, 721, 266, 2, 43, 229] +[:mouse_move, 717, 266, 2, 44, 230] +[:mouse_move, 715, 266, 2, 45, 231] +[:mouse_move, 712, 266, 2, 46, 232] +[:mouse_move, 711, 266, 2, 47, 234] +[:mouse_move, 711, 267, 2, 48, 238] +[:mouse_move, 710, 267, 2, 49, 242] +[:mouse_move, 709, 267, 2, 50, 246] +[:mouse_button_pressed, 1, 0, 1, 51, 247] +[:mouse_button_up, 1, 0, 1, 52, 254] +[:mouse_move, 708, 264, 2, 53, 296] +[:mouse_move, 706, 261, 2, 54, 297] +[:mouse_move, 696, 249, 2, 55, 298] +[:mouse_move, 688, 242, 2, 56, 299] +[:mouse_move, 671, 228, 2, 57, 300] +[:mouse_move, 632, 204, 2, 58, 301] +[:mouse_move, 582, 176, 2, 59, 302] +[:mouse_move, 571, 169, 2, 60, 303] +[:mouse_move, 543, 153, 2, 61, 304] +[:mouse_move, 521, 140, 2, 62, 306] +[:mouse_move, 516, 137, 2, 63, 307] +[:mouse_move, 512, 135, 2, 64, 308] +[:mouse_move, 510, 134, 2, 65, 309] +[:mouse_move, 508, 133, 2, 66, 310] +[:mouse_move, 504, 132, 2, 67, 311] +[:mouse_move, 500, 132, 2, 68, 312] +[:mouse_move, 497, 132, 2, 69, 313] +[:mouse_move, 491, 132, 2, 70, 315] +[:mouse_move, 488, 132, 2, 71, 316] +[:mouse_move, 487, 132, 2, 72, 317] +[:mouse_move, 484, 131, 2, 73, 318] +[:mouse_move, 482, 130, 2, 74, 319] +[:mouse_move, 481, 129, 2, 75, 320] +[:mouse_move, 477, 127, 2, 76, 321] +[:mouse_move, 475, 125, 2, 77, 322] +[:mouse_move, 472, 123, 2, 78, 323] +[:mouse_move, 470, 122, 2, 79, 324] +[:mouse_move, 468, 120, 2, 80, 325] +[:mouse_move, 466, 120, 2, 81, 326] +[:mouse_move, 463, 117, 2, 82, 327] +[:mouse_move, 461, 116, 2, 83, 328] +[:mouse_move, 459, 115, 2, 84, 329] +[:mouse_move, 458, 114, 2, 85, 330] +[:mouse_move, 457, 112, 2, 86, 331] +[:mouse_move, 456, 112, 2, 87, 332] +[:mouse_move, 456, 111, 2, 88, 335] +[:mouse_move, 457, 111, 2, 89, 340] +[:mouse_move, 458, 111, 2, 90, 342] +[:mouse_move, 459, 111, 2, 91, 343] +[:mouse_move, 461, 111, 2, 92, 346] +[:mouse_move, 463, 111, 2, 93, 347] +[:mouse_move, 468, 110, 2, 94, 348] +[:mouse_move, 471, 109, 2, 95, 349] +[:mouse_move, 475, 109, 2, 96, 350] +[:mouse_move, 483, 107, 2, 97, 351] +[:mouse_move, 491, 106, 2, 98, 352] +[:mouse_move, 496, 106, 2, 99, 353] +[:mouse_move, 505, 105, 2, 100, 354] +[:mouse_move, 510, 104, 2, 101, 355] +[:mouse_move, 520, 104, 2, 102, 356] +[:mouse_move, 525, 104, 2, 103, 357] +[:mouse_move, 529, 104, 2, 104, 358] +[:mouse_move, 537, 104, 2, 105, 359] +[:mouse_move, 540, 104, 2, 106, 360] +[:mouse_move, 548, 104, 2, 107, 361] +[:mouse_move, 553, 104, 2, 108, 362] +[:mouse_move, 560, 106, 2, 109, 363] +[:mouse_move, 562, 106, 2, 110, 364] +[:mouse_move, 571, 108, 2, 111, 365] +[:mouse_move, 576, 110, 2, 112, 366] +[:mouse_move, 578, 110, 2, 113, 367] +[:mouse_move, 584, 112, 2, 114, 368] +[:mouse_move, 585, 112, 2, 115, 369] +[:mouse_move, 588, 112, 2, 116, 370] +[:mouse_move, 592, 113, 2, 117, 371] +[:mouse_move, 596, 113, 2, 118, 372] +[:mouse_move, 597, 113, 2, 119, 373] +[:mouse_move, 599, 113, 2, 120, 374] +[:mouse_move, 604, 113, 2, 121, 375] +[:mouse_move, 606, 113, 2, 122, 376] +[:mouse_move, 610, 113, 2, 123, 377] +[:mouse_move, 612, 113, 2, 124, 378] +[:mouse_move, 617, 113, 2, 125, 379] +[:mouse_move, 618, 113, 2, 126, 380] +[:mouse_move, 620, 113, 2, 127, 381] +[:mouse_move, 625, 113, 2, 128, 382] +[:mouse_move, 629, 113, 2, 129, 383] +[:mouse_move, 632, 113, 2, 130, 384] +[:mouse_move, 633, 113, 2, 131, 385] +[:mouse_move, 639, 112, 2, 132, 386] +[:mouse_move, 644, 111, 2, 133, 387] +[:mouse_move, 647, 111, 2, 134, 388] +[:mouse_move, 648, 111, 2, 135, 389] +[:mouse_move, 653, 110, 2, 136, 390] +[:mouse_move, 659, 110, 2, 137, 391] +[:mouse_move, 663, 109, 2, 138, 392] +[:mouse_move, 667, 109, 2, 139, 393] +[:mouse_move, 669, 109, 2, 140, 394] +[:mouse_move, 672, 109, 2, 141, 395] +[:mouse_move, 673, 109, 2, 142, 396] +[:mouse_move, 674, 109, 2, 143, 397] +[:mouse_move, 675, 109, 2, 144, 398] +[:mouse_move, 674, 117, 2, 145, 426] +[:mouse_move, 663, 166, 2, 146, 427] +[:mouse_move, 654, 205, 2, 147, 428] +[:mouse_move, 636, 260, 2, 148, 429] +[:mouse_move, 617, 308, 2, 149, 430] +[:mouse_move, 606, 332, 2, 150, 431] +[:mouse_move, 595, 354, 2, 151, 432] +[:mouse_move, 591, 361, 2, 152, 433] +[:mouse_move, 579, 388, 2, 153, 434] +[:mouse_move, 571, 406, 2, 154, 435] +[:mouse_move, 570, 409, 2, 155, 436] +[:mouse_move, 566, 418, 2, 156, 437] +[:mouse_move, 564, 421, 2, 157, 438] +[:mouse_move, 563, 423, 2, 158, 439] +[:mouse_move, 560, 427, 2, 159, 440] +[:mouse_move, 558, 428, 2, 160, 441] +[:mouse_move, 553, 431, 2, 161, 442] +[:mouse_move, 545, 433, 2, 162, 443] +[:mouse_move, 542, 434, 2, 163, 444] +[:mouse_move, 540, 435, 2, 164, 445] +[:mouse_move, 535, 436, 2, 165, 446] +[:mouse_move, 533, 436, 2, 166, 447] +[:mouse_move, 530, 437, 2, 167, 448] +[:mouse_move, 529, 437, 2, 168, 449] +[:mouse_button_pressed, 1, 0, 1, 169, 456] +[:mouse_button_up, 1, 0, 1, 170, 466] +[:mouse_move, 529, 435, 2, 171, 509] +[:mouse_move, 529, 433, 2, 172, 510] +[:mouse_move, 528, 426, 2, 173, 511] +[:mouse_move, 527, 418, 2, 174, 512] +[:mouse_move, 526, 410, 2, 175, 513] +[:mouse_move, 525, 400, 2, 176, 514] +[:mouse_move, 523, 388, 2, 177, 515] +[:mouse_move, 521, 369, 2, 178, 516] +[:mouse_move, 521, 356, 2, 179, 517] +[:mouse_move, 520, 347, 2, 180, 518] +[:mouse_move, 520, 344, 2, 181, 519] +[:mouse_move, 519, 341, 2, 182, 520] +[:mouse_move, 519, 340, 2, 183, 522] +[:mouse_move, 519, 341, 2, 184, 524] +[:mouse_move, 519, 345, 2, 185, 525] +[:mouse_move, 519, 348, 2, 186, 526] +[:mouse_move, 519, 352, 2, 187, 527] +[:mouse_move, 519, 356, 2, 188, 528] +[:mouse_move, 519, 364, 2, 189, 529] +[:mouse_move, 519, 371, 2, 190, 530] +[:mouse_move, 520, 373, 2, 191, 531] +[:mouse_move, 522, 377, 2, 192, 532] +[:mouse_move, 523, 379, 2, 193, 533] +[:mouse_move, 524, 380, 2, 194, 534] +[:mouse_move, 525, 382, 2, 195, 535] +[:mouse_move, 526, 382, 2, 196, 536] +[:mouse_move, 527, 383, 2, 197, 537] +[:mouse_button_pressed, 1, 0, 1, 198, 540] +[:mouse_button_up, 1, 0, 1, 199, 549] +[:mouse_move, 530, 383, 2, 200, 563] +[:mouse_move, 533, 383, 2, 201, 564] +[:mouse_move, 537, 381, 2, 202, 565] +[:mouse_move, 542, 379, 2, 203, 566] +[:mouse_move, 543, 377, 2, 204, 567] +[:mouse_move, 548, 371, 2, 205, 568] +[:mouse_move, 551, 364, 2, 206, 569] +[:mouse_move, 553, 358, 2, 207, 570] +[:mouse_move, 557, 345, 2, 208, 571] +[:mouse_move, 558, 342, 2, 209, 572] +[:mouse_move, 559, 338, 2, 210, 573] +[:mouse_move, 562, 331, 2, 211, 574] +[:mouse_move, 562, 330, 2, 212, 575] +[:mouse_move, 562, 329, 2, 213, 576] +[:mouse_move, 563, 329, 2, 214, 578] +[:mouse_move, 563, 332, 2, 215, 579] +[:mouse_move, 564, 334, 2, 216, 580] +[:mouse_move, 564, 337, 2, 217, 581] +[:mouse_move, 565, 339, 2, 218, 582] +[:mouse_move, 565, 341, 2, 219, 583] +[:mouse_move, 565, 342, 2, 220, 584] +[:mouse_move, 566, 343, 2, 221, 585] +[:mouse_move, 567, 343, 2, 222, 593] +[:mouse_move, 568, 343, 2, 223, 594] +[:mouse_move, 570, 343, 2, 224, 595] +[:mouse_move, 571, 343, 2, 225, 596] +[:mouse_move, 574, 344, 2, 226, 597] +[:mouse_move, 575, 344, 2, 227, 598] +[:mouse_move, 577, 344, 2, 228, 599] +[:mouse_move, 583, 344, 2, 229, 600] +[:mouse_move, 588, 345, 2, 230, 601] +[:mouse_move, 603, 346, 2, 231, 602] +[:mouse_move, 614, 346, 2, 232, 603] +[:mouse_move, 622, 346, 2, 233, 604] +[:mouse_move, 632, 347, 2, 234, 605] +[:mouse_move, 636, 347, 2, 235, 606] +[:mouse_move, 639, 347, 2, 236, 607] +[:mouse_move, 643, 347, 2, 237, 608] +[:mouse_move, 642, 347, 2, 238, 611] +[:mouse_move, 641, 347, 2, 239, 612] +[:mouse_move, 640, 347, 2, 240, 613] +[:mouse_move, 639, 347, 2, 241, 614] +[:mouse_move, 638, 347, 2, 242, 615] +[:mouse_move, 636, 347, 2, 243, 617] +[:mouse_move, 635, 347, 2, 244, 618] +[:mouse_move, 634, 347, 2, 245, 619] +[:mouse_move, 633, 347, 2, 246, 620] +[:mouse_move, 632, 347, 2, 247, 621] +[:mouse_move, 631, 347, 2, 248, 623] +[:mouse_move, 630, 347, 2, 249, 627] +[:mouse_move, 630, 346, 2, 250, 629] +[:mouse_move, 631, 346, 2, 251, 635] +[:mouse_move, 631, 345, 2, 252, 636] +[:mouse_button_pressed, 1, 0, 1, 253, 642] +[:mouse_button_up, 1, 0, 1, 254, 651] +[:mouse_move, 630, 340, 2, 255, 701] +[:mouse_move, 628, 330, 2, 256, 702] +[:mouse_move, 619, 293, 2, 257, 703] +[:mouse_move, 615, 278, 2, 258, 704] +[:mouse_move, 606, 251, 2, 259, 705] +[:mouse_move, 601, 236, 2, 260, 706] +[:mouse_move, 591, 213, 2, 261, 707] +[:mouse_move, 574, 195, 2, 262, 708] +[:mouse_move, 552, 182, 2, 263, 709] +[:mouse_move, 539, 176, 2, 264, 710] +[:mouse_move, 521, 168, 2, 265, 711] +[:mouse_move, 510, 162, 2, 266, 712] +[:mouse_move, 500, 157, 2, 267, 713] +[:mouse_move, 473, 144, 2, 268, 714] +[:mouse_move, 452, 130, 2, 269, 715] +[:mouse_move, 443, 121, 2, 270, 716] +[:mouse_move, 439, 118, 2, 271, 717] +[:mouse_move, 427, 104, 2, 272, 718] +[:mouse_move, 425, 102, 2, 273, 719] +[:mouse_move, 420, 95, 2, 274, 720] +[:mouse_move, 419, 93, 2, 275, 721] +[:mouse_move, 418, 92, 2, 276, 722] +[:mouse_move, 417, 90, 2, 277, 723] +[:mouse_move, 417, 89, 2, 278, 724] +[:mouse_move, 417, 88, 2, 279, 726] +[:mouse_move, 418, 88, 2, 280, 728] +[:mouse_move, 419, 88, 2, 281, 729] +[:mouse_move, 423, 89, 2, 282, 730] +[:mouse_move, 427, 91, 2, 283, 731] +[:mouse_move, 436, 95, 2, 284, 732] +[:mouse_move, 440, 98, 2, 285, 733] +[:mouse_move, 445, 100, 2, 286, 734] +[:mouse_move, 453, 106, 2, 287, 735] +[:mouse_move, 458, 109, 2, 288, 736] +[:mouse_move, 466, 116, 2, 289, 737] +[:mouse_move, 469, 119, 2, 290, 738] +[:mouse_move, 478, 125, 2, 291, 739] +[:mouse_move, 486, 131, 2, 292, 740] +[:mouse_move, 497, 136, 2, 293, 741] +[:mouse_move, 504, 139, 2, 294, 742] +[:mouse_move, 511, 141, 2, 295, 743] +[:mouse_move, 527, 143, 2, 296, 744] +[:mouse_move, 542, 143, 2, 297, 745] +[:mouse_move, 581, 137, 2, 298, 746] +[:mouse_move, 589, 135, 2, 299, 747] +[:mouse_move, 616, 126, 2, 300, 748] +[:mouse_move, 623, 124, 2, 301, 749] +[:mouse_move, 645, 114, 2, 302, 750] +[:mouse_move, 654, 109, 2, 303, 752] +[:mouse_move, 661, 104, 2, 304, 753] +[:mouse_move, 662, 102, 2, 305, 754] +[:mouse_move, 663, 101, 2, 306, 755] +[:mouse_move, 664, 97, 2, 307, 756] +[:mouse_move, 661, 91, 2, 308, 757] +[:mouse_move, 657, 88, 2, 309, 758] +[:mouse_move, 652, 83, 2, 310, 759] +[:mouse_move, 625, 68, 2, 311, 760] +[:mouse_move, 586, 53, 2, 312, 761] +[:mouse_move, 576, 50, 2, 313, 762] +[:mouse_move, 555, 45, 2, 314, 763] +[:mouse_move, 531, 39, 2, 315, 764] +[:mouse_move, 494, 33, 2, 316, 765] +[:mouse_move, 482, 32, 2, 317, 766] +[:mouse_move, 470, 32, 2, 318, 767] +[:mouse_move, 448, 32, 2, 319, 768] +[:mouse_move, 435, 33, 2, 320, 769] +[:mouse_move, 427, 36, 2, 321, 770] +[:mouse_move, 420, 39, 2, 322, 771] +[:mouse_move, 409, 46, 2, 323, 772] +[:mouse_move, 398, 63, 2, 324, 774] +[:mouse_move, 395, 69, 2, 325, 775] +[:mouse_move, 394, 77, 2, 326, 776] +[:mouse_move, 394, 81, 2, 327, 777] +[:mouse_move, 394, 90, 2, 328, 778] +[:mouse_move, 396, 96, 2, 329, 780] +[:mouse_move, 406, 107, 2, 330, 781] +[:mouse_move, 417, 116, 2, 331, 782] +[:mouse_move, 428, 125, 2, 332, 783] +[:mouse_move, 449, 135, 2, 333, 784] +[:mouse_move, 461, 141, 2, 334, 785] +[:mouse_move, 489, 151, 2, 335, 786] +[:mouse_move, 503, 154, 2, 336, 787] +[:mouse_move, 521, 158, 2, 337, 788] +[:mouse_move, 541, 161, 2, 338, 789] +[:mouse_move, 552, 161, 2, 339, 790] +[:mouse_move, 569, 161, 2, 340, 791] +[:mouse_move, 596, 154, 2, 341, 793] +[:mouse_move, 612, 148, 2, 342, 794] +[:mouse_move, 619, 144, 2, 343, 795] +[:mouse_move, 628, 139, 2, 344, 796] +[:mouse_move, 631, 137, 2, 345, 797] +[:mouse_move, 633, 134, 2, 346, 798] +[:mouse_move, 637, 129, 2, 347, 799] +[:mouse_move, 637, 125, 2, 348, 800] +[:mouse_move, 631, 118, 2, 349, 801] +[:mouse_move, 620, 109, 2, 350, 802] +[:mouse_move, 611, 102, 2, 351, 803] +[:mouse_move, 592, 90, 2, 352, 804] +[:mouse_move, 581, 83, 2, 353, 805] +[:mouse_move, 567, 77, 2, 354, 806] +[:mouse_move, 535, 65, 2, 355, 807] +[:mouse_move, 519, 61, 2, 356, 808] +[:mouse_move, 498, 59, 2, 357, 809] +[:mouse_move, 476, 57, 2, 358, 810] +[:mouse_move, 452, 58, 2, 359, 811] +[:mouse_move, 442, 62, 2, 360, 812] +[:mouse_move, 424, 74, 2, 361, 813] +[:mouse_move, 416, 83, 2, 362, 814] +[:mouse_move, 402, 111, 2, 363, 815] +[:mouse_move, 398, 127, 2, 364, 816] +[:mouse_move, 397, 135, 2, 365, 817] +[:mouse_move, 395, 151, 2, 366, 818] +[:mouse_move, 395, 158, 2, 367, 819] +[:mouse_move, 396, 176, 2, 368, 820] +[:mouse_move, 404, 181, 2, 369, 821] +[:mouse_move, 422, 186, 2, 370, 822] +[:key_down_raw, 1073742051, 1024, 2, 371, 904] +[:key_down_raw, 113, 1024, 2, 372, 908] diff --git a/samples/01_api_10_controller/app/main.rb b/samples/01_api_10_controller/app/main.rb new file mode 100644 index 0000000..99cca15 --- /dev/null +++ b/samples/01_api_10_controller/app/main.rb @@ -0,0 +1,126 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - args.inputs.controller_one.key_held.KEY: Will check to see if a specific key + is being held down on the controller. + If there is more than one controller being used, they can be differentiated by + using names like controller_one and controller_two. + + For a full listing of buttons, take a look at mygame/documentation/08-controllers.md. + + Reminder: + + - args.state.PROPERTY: The state property on args is a dynamic + structure. You can define ANY property here with ANY type of + arbitrary nesting. Properties defined on args.state will be retained + across frames. If you attempt to access a property that doesn't exist + on args.state, it will simply return nil (no exception will be thrown). + + In this sample app, args.state.BUTTONS is an array that stores the buttons of the controller. + The parameters of a button are: + 1. the position (x, y) + 2. the input key held on the controller + 3. the text or name of the button + +=end + +# This sample app provides a visual demonstration of a standard controller, including +# the placement and function of all buttons. + +class ControllerDemo + attr_accessor :inputs, :state, :outputs + + # Calls the methods necessary for the app to run successfully. + def tick + process_inputs + render + end + + # Starts with an empty collection of buttons. + # Adds buttons that are on the controller to the collection. + def process_inputs + state.buttons = [] + + state.buttons << [100, 500, inputs.controller_one.key_held.l1, "L1"] + state.buttons << [100, 600, inputs.controller_one.key_held.l2, "L2"] + + state.buttons << [1100, 500, inputs.controller_one.key_held.r1, "R1"] + state.buttons << [1100, 600, inputs.controller_one.key_held.r2, "R2"] + + state.buttons << [540, 450, inputs.controller_one.key_held.select, "Select"] + state.buttons << [660, 450, inputs.controller_one.key_held.start, "Start"] + + state.buttons << [200, 300, inputs.controller_one.key_held.left, "Left"] + state.buttons << [300, 400, inputs.controller_one.key_held.up, "Up"] + state.buttons << [400, 300, inputs.controller_one.key_held.right, "Right"] + state.buttons << [300, 200, inputs.controller_one.key_held.down, "Down"] + + state.buttons << [800, 300, inputs.controller_one.key_held.x, "X"] + state.buttons << [900, 400, inputs.controller_one.key_held.y, "Y"] + state.buttons << [1000, 300, inputs.controller_one.key_held.a, "A"] + state.buttons << [900, 200, inputs.controller_one.key_held.b, "B"] + + state.buttons << [450 + inputs.controller_one.left_analog_x_perc * 100, + 100 + inputs.controller_one.left_analog_y_perc * 100, + inputs.controller_one.key_held.l3, + "L3"] + + state.buttons << [750 + inputs.controller_one.right_analog_x_perc * 100, + 100 + inputs.controller_one.right_analog_y_perc * 100, + inputs.controller_one.key_held.r3, + "R3"] + end + + # Gives each button a square shape. + # If the button is being pressed or held (which means it is considered active), + # the square is filled in. Otherwise, the button simply has a border. + def render + state.buttons.each do |x, y, active, text| + rect = [x, y, 75, 75] + + if active # if button is pressed + outputs.solids << rect # rect is output as solid (filled in) + else + outputs.borders << rect # otherwise, output as border + end + + # Outputs the text of each button using labels. + outputs.labels << [x, y + 95, text] # add 95 to place label above button + end + + outputs.labels << [10, 60, "Left Analog x: #{inputs.controller_one.left_analog_x_raw} (#{inputs.controller_one.left_analog_x_perc * 100}%)"] + outputs.labels << [10, 30, "Left Analog y: #{inputs.controller_one.left_analog_y_raw} (#{inputs.controller_one.left_analog_y_perc * 100}%)"] + outputs.labels << [900, 60, "Right Analog x: #{inputs.controller_one.right_analog_x_raw} (#{inputs.controller_one.right_analog_x_perc * 100}%)"] + outputs.labels << [900, 30, "Right Analog y: #{inputs.controller_one.right_analog_y_raw} (#{inputs.controller_one.right_analog_y_perc * 100}%)"] + end +end + +$controller_demo = ControllerDemo.new + +def tick args + tick_instructions args, "Sample app shows how controller input is handled. You'll need to connect a USB controller." + $controller_demo.inputs = args.inputs + $controller_demo.state = args.state + $controller_demo.outputs = args.outputs + $controller_demo.tick +end + +# Resets the app. +def r + $gtk.reset +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_10_controller/license-for-sample.txt b/samples/01_api_10_controller/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_10_controller/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_10_controller/replay.txt b/samples/01_api_10_controller/replay.txt new file mode 100644 index 0000000..859e01a --- /dev/null +++ b/samples/01_api_10_controller/replay.txt @@ -0,0 +1,1062 @@ +replay_version 2.0 +stopped_at 1530 +seed 100 +recorded_at Sun Sep 29 21:36:37 2019 +[:mouse_move, 41, 311, 2, 1, 140] +[:mouse_move, 173, 294, 2, 2, 141] +[:mouse_move, 233, 281, 2, 3, 142] +[:mouse_move, 344, 249, 2, 4, 143] +[:mouse_move, 365, 240, 2, 5, 144] +[:mouse_move, 422, 219, 2, 6, 145] +[:mouse_move, 452, 206, 2, 7, 146] +[:mouse_move, 468, 198, 2, 8, 147] +[:mouse_move, 481, 192, 2, 9, 148] +[:mouse_move, 507, 182, 2, 10, 149] +[:mouse_move, 513, 181, 2, 11, 150] +[:mouse_move, 525, 179, 2, 12, 151] +[:mouse_move, 535, 176, 2, 13, 152] +[:mouse_move, 542, 174, 2, 14, 153] +[:mouse_move, 561, 164, 2, 15, 154] +[:mouse_move, 572, 156, 2, 16, 155] +[:mouse_move, 594, 136, 2, 17, 156] +[:mouse_move, 604, 125, 2, 18, 157] +[:mouse_move, 623, 99, 2, 19, 158] +[:mouse_move, 631, 85, 2, 20, 159] +[:mouse_move, 640, 68, 2, 21, 160] +[:mouse_move, 644, 58, 2, 22, 161] +[:mouse_move, 652, 42, 2, 23, 162] +[:mouse_move, 656, 36, 2, 24, 163] +[:mouse_move, 663, 26, 2, 25, 164] +[:mouse_move, 666, 21, 2, 26, 165] +[:mouse_move, 675, 10, 2, 27, 166] +[:mouse_move, 679, 5, 2, 28, 167] +[:mouse_move, 686, 0, 2, 29, 168] +[:mouse_move, 679, 2, 2, 30, 192] +[:mouse_move, 672, 12, 2, 31, 193] +[:mouse_move, 669, 18, 2, 32, 194] +[:mouse_move, 665, 24, 2, 33, 195] +[:mouse_move, 664, 26, 2, 34, 196] +[:mouse_move, 662, 29, 2, 35, 197] +[:mouse_move, 662, 30, 2, 36, 198] +[:mouse_move, 661, 31, 2, 37, 199] +[:mouse_move, 660, 31, 2, 38, 206] +[:mouse_move, 660, 32, 2, 39, 208] +[:mouse_move, 658, 34, 2, 40, 212] +[:mouse_move, 656, 39, 2, 41, 213] +[:mouse_move, 644, 63, 2, 42, 214] +[:mouse_move, 639, 74, 2, 43, 215] +[:mouse_move, 625, 107, 2, 44, 216] +[:mouse_move, 622, 114, 2, 45, 217] +[:mouse_move, 616, 131, 2, 46, 218] +[:mouse_move, 613, 140, 2, 47, 219] +[:key_down_player_one, 13, 0, 1, 48, 302] +[:key_held_player_one, 13, 0, 1, 49, 303] +[:key_held_player_one, 13, 0, 1, 50, 304] +[:key_held_player_one, 13, 0, 1, 51, 305] +[:key_held_player_one, 13, 0, 1, 52, 306] +[:key_held_player_one, 13, 0, 1, 53, 307] +[:key_held_player_one, 13, 0, 1, 54, 308] +[:key_held_player_one, 13, 0, 1, 55, 309] +[:key_held_player_one, 13, 0, 1, 56, 310] +[:key_held_player_one, 13, 0, 1, 57, 311] +[:key_up_player_one, 13, 0, 1, 58, 312] +[:key_down_player_one, 13, 0, 1, 59, 357] +[:key_held_player_one, 13, 0, 1, 60, 358] +[:key_held_player_one, 13, 0, 1, 61, 359] +[:key_held_player_one, 13, 0, 1, 62, 360] +[:key_held_player_one, 13, 0, 1, 63, 361] +[:key_held_player_one, 13, 0, 1, 64, 362] +[:key_held_player_one, 13, 0, 1, 65, 363] +[:key_held_player_one, 13, 0, 1, 66, 364] +[:key_up_player_one, 13, 0, 1, 67, 365] +[:key_down_player_one, 13, 0, 1, 68, 371] +[:key_held_player_one, 13, 0, 1, 69, 372] +[:key_held_player_one, 13, 0, 1, 70, 373] +[:key_held_player_one, 13, 0, 1, 71, 374] +[:key_held_player_one, 13, 0, 1, 72, 375] +[:key_held_player_one, 13, 0, 1, 73, 376] +[:key_held_player_one, 13, 0, 1, 74, 377] +[:key_held_player_one, 13, 0, 1, 75, 378] +[:key_up_player_one, 13, 0, 1, 76, 379] +[:key_down_player_one, 13, 0, 1, 77, 393] +[:key_held_player_one, 13, 0, 1, 78, 394] +[:key_held_player_one, 13, 0, 1, 79, 395] +[:key_held_player_one, 13, 0, 1, 80, 396] +[:key_held_player_one, 13, 0, 1, 81, 397] +[:key_held_player_one, 13, 0, 1, 82, 398] +[:key_held_player_one, 13, 0, 1, 83, 399] +[:key_held_player_one, 13, 0, 1, 84, 400] +[:key_held_player_one, 13, 0, 1, 85, 401] +[:key_held_player_one, 13, 0, 1, 86, 402] +[:key_held_player_one, 13, 0, 1, 87, 403] +[:key_up_player_one, 13, 0, 1, 88, 404] +[:key_down_player_one, 13, 0, 1, 89, 419] +[:key_held_player_one, 13, 0, 1, 90, 420] +[:key_held_player_one, 13, 0, 1, 91, 421] +[:key_held_player_one, 13, 0, 1, 92, 422] +[:key_held_player_one, 13, 0, 1, 93, 423] +[:key_held_player_one, 13, 0, 1, 94, 424] +[:key_up_player_one, 13, 0, 1, 95, 425] +[:key_down_player_one, 13, 0, 1, 96, 431] +[:key_held_player_one, 13, 0, 1, 97, 432] +[:key_held_player_one, 13, 0, 1, 98, 433] +[:key_held_player_one, 13, 0, 1, 99, 434] +[:key_up_player_one, 13, 0, 1, 100, 435] +[:key_down_player_one, 13, 0, 1, 101, 441] +[:key_held_player_one, 13, 0, 1, 102, 442] +[:key_held_player_one, 13, 0, 1, 103, 443] +[:key_held_player_one, 13, 0, 1, 104, 444] +[:key_held_player_one, 13, 0, 1, 105, 445] +[:key_held_player_one, 13, 0, 1, 106, 446] +[:key_up_player_one, 13, 0, 1, 107, 447] +[:key_down_player_one, 17, 0, 1, 108, 503] +[:key_held_player_one, 17, 0, 1, 109, 504] +[:key_held_player_one, 17, 0, 1, 110, 505] +[:key_held_player_one, 17, 0, 1, 111, 506] +[:key_held_player_one, 17, 0, 1, 112, 507] +[:key_held_player_one, 17, 0, 1, 113, 508] +[:key_held_player_one, 17, 0, 1, 114, 509] +[:key_up_player_one, 17, 0, 1, 115, 510] +[:key_down_player_one, 16, 0, 1, 116, 540] +[:key_held_player_one, 16, 0, 1, 117, 541] +[:key_held_player_one, 16, 0, 1, 118, 542] +[:key_held_player_one, 16, 0, 1, 119, 543] +[:key_held_player_one, 16, 0, 1, 120, 544] +[:key_held_player_one, 16, 0, 1, 121, 545] +[:key_held_player_one, 16, 0, 1, 122, 546] +[:key_held_player_one, 16, 0, 1, 123, 547] +[:key_held_player_one, 16, 0, 1, 124, 548] +[:key_held_player_one, 16, 0, 1, 125, 549] +[:key_held_player_one, 16, 0, 1, 126, 550] +[:key_held_player_one, 16, 0, 1, 127, 551] +[:key_held_player_one, 16, 0, 1, 128, 552] +[:key_held_player_one, 16, 0, 1, 129, 553] +[:key_held_player_one, 16, 0, 1, 130, 554] +[:key_held_player_one, 16, 0, 1, 131, 555] +[:key_held_player_one, 16, 0, 1, 132, 556] +[:key_held_player_one, 16, 0, 1, 133, 557] +[:key_up_player_one, 16, 0, 1, 134, 558] +[:key_down_player_one, 14, 0, 1, 135, 589] +[:key_held_player_one, 14, 0, 1, 136, 590] +[:key_held_player_one, 14, 0, 1, 137, 591] +[:key_held_player_one, 14, 0, 1, 138, 592] +[:key_held_player_one, 14, 0, 1, 139, 593] +[:key_held_player_one, 14, 0, 1, 140, 594] +[:key_held_player_one, 14, 0, 1, 141, 595] +[:key_held_player_one, 14, 0, 1, 142, 596] +[:key_held_player_one, 14, 0, 1, 143, 597] +[:key_held_player_one, 14, 0, 1, 144, 598] +[:key_held_player_one, 14, 0, 1, 145, 599] +[:key_held_player_one, 14, 0, 1, 146, 600] +[:key_held_player_one, 14, 0, 1, 147, 601] +[:key_held_player_one, 14, 0, 1, 148, 602] +[:key_held_player_one, 14, 0, 1, 149, 603] +[:key_held_player_one, 14, 0, 1, 150, 604] +[:key_held_player_one, 14, 0, 1, 151, 605] +[:key_held_player_one, 14, 0, 1, 152, 606] +[:key_up_player_one, 14, 0, 1, 153, 607] +[:key_down_player_one, 14, 0, 1, 154, 638] +[:key_held_player_one, 14, 0, 1, 155, 639] +[:key_held_player_one, 14, 0, 1, 156, 640] +[:key_held_player_one, 14, 0, 1, 157, 641] +[:key_held_player_one, 14, 0, 1, 158, 642] +[:key_held_player_one, 14, 0, 1, 159, 643] +[:key_held_player_one, 14, 0, 1, 160, 644] +[:key_held_player_one, 14, 0, 1, 161, 645] +[:key_held_player_one, 14, 0, 1, 162, 646] +[:key_held_player_one, 14, 0, 1, 163, 647] +[:key_held_player_one, 14, 0, 1, 164, 648] +[:key_held_player_one, 14, 0, 1, 165, 649] +[:key_held_player_one, 14, 0, 1, 166, 650] +[:key_held_player_one, 14, 0, 1, 167, 651] +[:key_held_player_one, 14, 0, 1, 168, 652] +[:key_held_player_one, 14, 0, 1, 169, 653] +[:key_held_player_one, 14, 0, 1, 170, 654] +[:key_up_player_one, 14, 0, 1, 171, 655] +[:key_down_player_one, 15, 0, 1, 172, 673] +[:key_held_player_one, 15, 0, 1, 173, 674] +[:key_held_player_one, 15, 0, 1, 174, 675] +[:key_held_player_one, 15, 0, 1, 175, 676] +[:key_held_player_one, 15, 0, 1, 176, 677] +[:key_held_player_one, 15, 0, 1, 177, 678] +[:key_held_player_one, 15, 0, 1, 178, 679] +[:key_held_player_one, 15, 0, 1, 179, 680] +[:key_held_player_one, 15, 0, 1, 180, 681] +[:key_held_player_one, 15, 0, 1, 181, 682] +[:key_held_player_one, 15, 0, 1, 182, 683] +[:key_held_player_one, 15, 0, 1, 183, 684] +[:key_held_player_one, 15, 0, 1, 184, 685] +[:key_held_player_one, 15, 0, 1, 185, 686] +[:key_held_player_one, 15, 0, 1, 186, 687] +[:key_held_player_one, 15, 0, 1, 187, 688] +[:key_held_player_one, 15, 0, 1, 188, 689] +[:key_held_player_one, 15, 0, 1, 189, 690] +[:key_held_player_one, 15, 0, 1, 190, 691] +[:key_held_player_one, 15, 0, 1, 191, 692] +[:key_up_player_one, 15, 0, 1, 192, 693] +[:key_down_player_one, 15, 0, 1, 193, 708] +[:key_held_player_one, 15, 0, 1, 194, 709] +[:key_held_player_one, 15, 0, 1, 195, 710] +[:key_held_player_one, 15, 0, 1, 196, 711] +[:key_held_player_one, 15, 0, 1, 197, 712] +[:key_held_player_one, 15, 0, 1, 198, 713] +[:key_held_player_one, 15, 0, 1, 199, 714] +[:key_held_player_one, 15, 0, 1, 200, 715] +[:key_held_player_one, 15, 0, 1, 201, 716] +[:key_held_player_one, 15, 0, 1, 202, 717] +[:key_up_player_one, 15, 0, 1, 203, 718] +[:key_down_player_one, 19, 0, 1, 204, 795] +[:key_held_player_one, 19, 0, 1, 205, 796] +[:key_held_player_one, 19, 0, 1, 206, 797] +[:key_held_player_one, 19, 0, 1, 207, 798] +[:key_held_player_one, 19, 0, 1, 208, 799] +[:key_held_player_one, 19, 0, 1, 209, 800] +[:key_held_player_one, 19, 0, 1, 210, 801] +[:key_held_player_one, 19, 0, 1, 211, 802] +[:key_held_player_one, 19, 0, 1, 212, 803] +[:key_held_player_one, 19, 0, 1, 213, 804] +[:key_held_player_one, 19, 0, 1, 214, 805] +[:key_held_player_one, 19, 0, 1, 215, 806] +[:key_up_player_one, 19, 0, 1, 216, 807] +[:key_down_player_one, 18, 0, 1, 217, 822] +[:key_held_player_one, 18, 0, 1, 218, 823] +[:key_held_player_one, 18, 0, 1, 219, 824] +[:key_held_player_one, 18, 0, 1, 220, 825] +[:key_held_player_one, 18, 0, 1, 221, 826] +[:key_held_player_one, 18, 0, 1, 222, 827] +[:key_held_player_one, 18, 0, 1, 223, 828] +[:key_held_player_one, 18, 0, 1, 224, 829] +[:key_held_player_one, 18, 0, 1, 225, 830] +[:key_held_player_one, 18, 0, 1, 226, 831] +[:key_held_player_one, 18, 0, 1, 227, 832] +[:key_held_player_one, 18, 0, 1, 228, 833] +[:key_up_player_one, 18, 0, 1, 229, 834] +[:key_down_player_one, 23, 0, 1, 230, 860] +[:key_held_player_one, 23, 0, 1, 231, 861] +[:key_held_player_one, 23, 0, 1, 232, 862] +[:key_held_player_one, 23, 0, 1, 233, 863] +[:key_held_player_one, 23, 0, 1, 234, 864] +[:key_held_player_one, 23, 0, 1, 235, 865] +[:key_held_player_one, 23, 0, 1, 236, 866] +[:key_held_player_one, 23, 0, 1, 237, 867] +[:key_held_player_one, 23, 0, 1, 238, 868] +[:key_held_player_one, 23, 0, 1, 239, 869] +[:key_held_player_one, 23, 0, 1, 240, 870] +[:key_held_player_one, 23, 0, 1, 241, 871] +[:key_held_player_one, 23, 0, 1, 242, 872] +[:key_up_player_one, 23, 0, 1, 243, 873] +[:key_down_player_one, 22, 0, 1, 244, 886] +[:key_held_player_one, 22, 0, 1, 245, 887] +[:key_held_player_one, 22, 0, 1, 246, 888] +[:key_held_player_one, 22, 0, 1, 247, 889] +[:key_held_player_one, 22, 0, 1, 248, 890] +[:key_held_player_one, 22, 0, 1, 249, 891] +[:key_held_player_one, 22, 0, 1, 250, 892] +[:key_held_player_one, 22, 0, 1, 251, 893] +[:key_held_player_one, 22, 0, 1, 252, 894] +[:key_held_player_one, 22, 0, 1, 253, 895] +[:key_held_player_one, 22, 0, 1, 254, 896] +[:key_held_player_one, 22, 0, 1, 255, 897] +[:key_held_player_one, 22, 0, 1, 256, 898] +[:key_up_player_one, 22, 0, 1, 257, 899] +[:key_down_player_one, 3, 0, 1, 258, 956] +[:key_down_player_one, 26, 0, 1, 259, 956] +[:key_held_player_one, 3, 0, 1, 260, 957] +[:key_held_player_one, 26, 0, 1, 261, 957] +[:key_held_player_one, 3, 0, 1, 262, 958] +[:key_held_player_one, 26, 0, 1, 263, 958] +[:key_held_player_one, 3, 0, 1, 264, 959] +[:key_held_player_one, 26, 0, 1, 265, 959] +[:key_held_player_one, 3, 0, 1, 266, 960] +[:key_held_player_one, 26, 0, 1, 267, 960] +[:key_held_player_one, 3, 0, 1, 268, 961] +[:key_held_player_one, 26, 0, 1, 269, 961] +[:key_held_player_one, 3, 0, 1, 270, 962] +[:key_held_player_one, 26, 0, 1, 271, 962] +[:key_held_player_one, 3, 0, 1, 272, 963] +[:key_held_player_one, 26, 0, 1, 273, 963] +[:key_held_player_one, 3, 0, 1, 274, 964] +[:key_held_player_one, 26, 0, 1, 275, 964] +[:key_held_player_one, 3, 0, 1, 276, 965] +[:key_held_player_one, 26, 0, 1, 277, 965] +[:key_held_player_one, 3, 0, 1, 278, 966] +[:key_held_player_one, 26, 0, 1, 279, 966] +[:key_held_player_one, 3, 0, 1, 280, 967] +[:key_held_player_one, 26, 0, 1, 281, 967] +[:key_up_player_one, 3, 0, 1, 282, 968] +[:key_up_player_one, 26, 0, 1, 283, 968] +[:key_down_player_one, 4, 0, 1, 284, 986] +[:key_down_player_one, 27, 0, 1, 285, 986] +[:key_held_player_one, 4, 0, 1, 286, 987] +[:key_held_player_one, 27, 0, 1, 287, 987] +[:key_held_player_one, 4, 0, 1, 288, 988] +[:key_held_player_one, 27, 0, 1, 289, 988] +[:key_held_player_one, 4, 0, 1, 290, 989] +[:key_held_player_one, 27, 0, 1, 291, 989] +[:key_held_player_one, 4, 0, 1, 292, 990] +[:key_held_player_one, 27, 0, 1, 293, 990] +[:key_held_player_one, 4, 0, 1, 294, 991] +[:key_held_player_one, 27, 0, 1, 295, 991] +[:key_held_player_one, 4, 0, 1, 296, 992] +[:key_held_player_one, 27, 0, 1, 297, 992] +[:key_held_player_one, 4, 0, 1, 298, 993] +[:key_held_player_one, 27, 0, 1, 299, 993] +[:key_held_player_one, 4, 0, 1, 300, 994] +[:key_held_player_one, 27, 0, 1, 301, 994] +[:key_held_player_one, 4, 0, 1, 302, 995] +[:key_held_player_one, 27, 0, 1, 303, 995] +[:key_held_player_one, 4, 0, 1, 304, 996] +[:key_held_player_one, 27, 0, 1, 305, 996] +[:key_up_player_one, 4, 0, 1, 306, 997] +[:key_up_player_one, 27, 0, 1, 307, 997] +[:key_down_player_one, 1, 0, 1, 308, 1010] +[:key_down_player_one, 24, 0, 1, 309, 1010] +[:key_held_player_one, 1, 0, 1, 310, 1011] +[:key_held_player_one, 24, 0, 1, 311, 1011] +[:key_held_player_one, 1, 0, 1, 312, 1012] +[:key_held_player_one, 24, 0, 1, 313, 1012] +[:key_held_player_one, 1, 0, 1, 314, 1013] +[:key_held_player_one, 24, 0, 1, 315, 1013] +[:key_held_player_one, 1, 0, 1, 316, 1014] +[:key_held_player_one, 24, 0, 1, 317, 1014] +[:key_held_player_one, 1, 0, 1, 318, 1015] +[:key_held_player_one, 24, 0, 1, 319, 1015] +[:key_held_player_one, 1, 0, 1, 320, 1016] +[:key_held_player_one, 24, 0, 1, 321, 1016] +[:key_held_player_one, 1, 0, 1, 322, 1017] +[:key_held_player_one, 24, 0, 1, 323, 1017] +[:key_held_player_one, 1, 0, 1, 324, 1018] +[:key_held_player_one, 24, 0, 1, 325, 1018] +[:key_held_player_one, 1, 0, 1, 326, 1019] +[:key_held_player_one, 24, 0, 1, 327, 1019] +[:key_held_player_one, 1, 0, 1, 328, 1020] +[:key_held_player_one, 24, 0, 1, 329, 1020] +[:key_held_player_one, 1, 0, 1, 330, 1021] +[:key_held_player_one, 24, 0, 1, 331, 1021] +[:key_up_player_one, 1, 0, 1, 332, 1022] +[:key_up_player_one, 24, 0, 1, 333, 1022] +[:key_down_player_one, 2, 0, 1, 334, 1035] +[:key_down_player_one, 25, 0, 1, 335, 1035] +[:key_held_player_one, 2, 0, 1, 336, 1036] +[:key_held_player_one, 25, 0, 1, 337, 1036] +[:key_held_player_one, 2, 0, 1, 338, 1037] +[:key_held_player_one, 25, 0, 1, 339, 1037] +[:key_held_player_one, 2, 0, 1, 340, 1038] +[:key_held_player_one, 25, 0, 1, 341, 1038] +[:key_held_player_one, 2, 0, 1, 342, 1039] +[:key_held_player_one, 25, 0, 1, 343, 1039] +[:key_held_player_one, 2, 0, 1, 344, 1040] +[:key_held_player_one, 25, 0, 1, 345, 1040] +[:key_held_player_one, 2, 0, 1, 346, 1041] +[:key_held_player_one, 25, 0, 1, 347, 1041] +[:key_held_player_one, 2, 0, 1, 348, 1042] +[:key_held_player_one, 25, 0, 1, 349, 1042] +[:key_held_player_one, 2, 0, 1, 350, 1043] +[:key_held_player_one, 25, 0, 1, 351, 1043] +[:key_held_player_one, 2, 0, 1, 352, 1044] +[:key_held_player_one, 25, 0, 1, 353, 1044] +[:key_held_player_one, 2, 0, 1, 354, 1045] +[:key_held_player_one, 25, 0, 1, 355, 1045] +[:key_up_player_one, 2, 0, 1, 356, 1046] +[:key_up_player_one, 25, 0, 1, 357, 1046] +[:left_analog_y_player_1, -5000, 0, 1, 358, 1065] +[:left_analog_x_player_1, 5000, 0, 1, 359, 1066] +[:left_analog_y_player_1, -12000, 0, 1, 360, 1066] +[:left_analog_x_player_1, 10000, 0, 1, 361, 1067] +[:left_analog_y_player_1, -18000, 0, 1, 362, 1067] +[:left_analog_x_player_1, 15000, 0, 1, 363, 1068] +[:left_analog_y_player_1, -27000, 0, 1, 364, 1068] +[:key_down_player_one, 1, 0, 1, 365, 1069] +[:left_analog_x_player_1, 18000, 0, 1, 366, 1069] +[:left_analog_y_player_1, -32000, 0, 1, 367, 1069] +[:key_held_player_one, 1, 0, 1, 368, 1070] +[:left_analog_x_player_1, 19000, 0, 1, 369, 1070] +[:key_held_player_one, 1, 0, 1, 370, 1071] +[:left_analog_x_player_1, 21000, 0, 1, 371, 1071] +[:key_held_player_one, 1, 0, 1, 372, 1072] +[:key_down_player_one, 4, 0, 1, 373, 1072] +[:key_held_player_one, 1, 0, 1, 374, 1073] +[:key_held_player_one, 4, 0, 1, 375, 1073] +[:key_held_player_one, 1, 0, 1, 376, 1074] +[:key_held_player_one, 4, 0, 1, 377, 1074] +[:key_held_player_one, 1, 0, 1, 378, 1075] +[:key_held_player_one, 4, 0, 1, 379, 1075] +[:left_analog_x_player_1, 18000, 0, 1, 380, 1075] +[:key_held_player_one, 1, 0, 1, 381, 1076] +[:key_up_player_one, 4, 0, 1, 382, 1076] +[:left_analog_x_player_1, 11000, 0, 1, 383, 1076] +[:key_held_player_one, 1, 0, 1, 384, 1077] +[:left_analog_x_player_1, 7000, 0, 1, 385, 1077] +[:key_held_player_one, 1, 0, 1, 386, 1078] +[:left_analog_x_player_1, 2000, 0, 1, 387, 1078] +[:key_held_player_one, 1, 0, 1, 388, 1079] +[:left_analog_x_player_1, 0, 0, 1, 389, 1079] +[:key_held_player_one, 1, 0, 1, 390, 1080] +[:left_analog_x_player_1, -1000, 0, 1, 391, 1080] +[:key_held_player_one, 1, 0, 1, 392, 1081] +[:left_analog_x_player_1, -7000, 0, 1, 393, 1081] +[:key_held_player_one, 1, 0, 1, 394, 1082] +[:left_analog_x_player_1, -11000, 0, 1, 395, 1082] +[:key_held_player_one, 1, 0, 1, 396, 1083] +[:left_analog_x_player_1, -17000, 0, 1, 397, 1083] +[:key_held_player_one, 1, 0, 1, 398, 1084] +[:left_analog_x_player_1, -21000, 0, 1, 399, 1084] +[:left_analog_y_player_1, -31000, 0, 1, 400, 1084] +[:key_held_player_one, 1, 0, 1, 401, 1085] +[:key_down_player_one, 3, 0, 1, 402, 1085] +[:left_analog_x_player_1, -24000, 0, 1, 403, 1085] +[:left_analog_y_player_1, -30000, 0, 1, 404, 1085] +[:key_held_player_one, 1, 0, 1, 405, 1086] +[:key_held_player_one, 3, 0, 1, 406, 1086] +[:left_analog_x_player_1, -27000, 0, 1, 407, 1086] +[:left_analog_y_player_1, -28000, 0, 1, 408, 1086] +[:key_held_player_one, 1, 0, 1, 409, 1087] +[:key_held_player_one, 3, 0, 1, 410, 1087] +[:left_analog_x_player_1, -30000, 0, 1, 411, 1087] +[:left_analog_y_player_1, -25000, 0, 1, 412, 1087] +[:key_held_player_one, 1, 0, 1, 413, 1088] +[:key_held_player_one, 3, 0, 1, 414, 1088] +[:left_analog_x_player_1, -31000, 0, 1, 415, 1088] +[:left_analog_y_player_1, -22000, 0, 1, 416, 1088] +[:key_held_player_one, 1, 0, 1, 417, 1089] +[:key_held_player_one, 3, 0, 1, 418, 1089] +[:left_analog_x_player_1, -32000, 0, 1, 419, 1089] +[:left_analog_y_player_1, -18000, 0, 1, 420, 1089] +[:key_up_player_one, 1, 0, 1, 421, 1090] +[:key_held_player_one, 3, 0, 1, 422, 1090] +[:left_analog_y_player_1, -15000, 0, 1, 423, 1090] +[:key_held_player_one, 3, 0, 1, 424, 1091] +[:left_analog_y_player_1, -10000, 0, 1, 425, 1091] +[:key_held_player_one, 3, 0, 1, 426, 1092] +[:left_analog_y_player_1, -4000, 0, 1, 427, 1092] +[:key_held_player_one, 3, 0, 1, 428, 1093] +[:left_analog_y_player_1, 0, 0, 1, 429, 1093] +[:key_held_player_one, 3, 0, 1, 430, 1094] +[:left_analog_y_player_1, 3000, 0, 1, 431, 1094] +[:key_held_player_one, 3, 0, 1, 432, 1095] +[:left_analog_y_player_1, 9000, 0, 1, 433, 1095] +[:key_held_player_one, 3, 0, 1, 434, 1096] +[:left_analog_y_player_1, 12000, 0, 1, 435, 1096] +[:key_held_player_one, 3, 0, 1, 436, 1097] +[:left_analog_y_player_1, 16000, 0, 1, 437, 1097] +[:key_held_player_one, 3, 0, 1, 438, 1098] +[:left_analog_y_player_1, 19000, 0, 1, 439, 1098] +[:key_held_player_one, 3, 0, 1, 440, 1099] +[:left_analog_x_player_1, -31000, 0, 1, 441, 1099] +[:left_analog_y_player_1, 21000, 0, 1, 442, 1099] +[:key_down_player_one, 2, 0, 1, 443, 1100] +[:key_held_player_one, 3, 0, 1, 444, 1100] +[:left_analog_x_player_1, -28000, 0, 1, 445, 1100] +[:left_analog_y_player_1, 25000, 0, 1, 446, 1100] +[:key_held_player_one, 2, 0, 1, 447, 1101] +[:key_held_player_one, 3, 0, 1, 448, 1101] +[:left_analog_x_player_1, -26000, 0, 1, 449, 1101] +[:left_analog_y_player_1, 28000, 0, 1, 450, 1101] +[:key_held_player_one, 2, 0, 1, 451, 1102] +[:key_held_player_one, 3, 0, 1, 452, 1102] +[:left_analog_x_player_1, -22000, 0, 1, 453, 1102] +[:left_analog_y_player_1, 30000, 0, 1, 454, 1102] +[:key_held_player_one, 2, 0, 1, 455, 1103] +[:key_held_player_one, 3, 0, 1, 456, 1103] +[:left_analog_x_player_1, -19000, 0, 1, 457, 1103] +[:left_analog_y_player_1, 31000, 0, 1, 458, 1103] +[:key_held_player_one, 2, 0, 1, 459, 1104] +[:key_up_player_one, 3, 0, 1, 460, 1104] +[:left_analog_x_player_1, -14000, 0, 1, 461, 1104] +[:left_analog_y_player_1, 32000, 0, 1, 462, 1104] +[:key_held_player_one, 2, 0, 1, 463, 1105] +[:left_analog_x_player_1, -9000, 0, 1, 464, 1105] +[:key_held_player_one, 2, 0, 1, 465, 1106] +[:left_analog_x_player_1, -2000, 0, 1, 466, 1106] +[:key_held_player_one, 2, 0, 1, 467, 1107] +[:left_analog_x_player_1, 0, 0, 1, 468, 1107] +[:key_held_player_one, 2, 0, 1, 469, 1108] +[:left_analog_x_player_1, 11000, 0, 1, 470, 1108] +[:key_held_player_one, 2, 0, 1, 471, 1109] +[:left_analog_x_player_1, 18000, 0, 1, 472, 1109] +[:key_held_player_one, 2, 0, 1, 473, 1110] +[:left_analog_x_player_1, 25000, 0, 1, 474, 1110] +[:left_analog_y_player_1, 29000, 0, 1, 475, 1110] +[:key_held_player_one, 2, 0, 1, 476, 1111] +[:key_down_player_one, 4, 0, 1, 477, 1111] +[:left_analog_x_player_1, 30000, 0, 1, 478, 1111] +[:left_analog_y_player_1, 25000, 0, 1, 479, 1111] +[:key_held_player_one, 2, 0, 1, 480, 1112] +[:key_held_player_one, 4, 0, 1, 481, 1112] +[:left_analog_x_player_1, 32000, 0, 1, 482, 1112] +[:left_analog_y_player_1, 20000, 0, 1, 483, 1112] +[:key_held_player_one, 2, 0, 1, 484, 1113] +[:key_held_player_one, 4, 0, 1, 485, 1113] +[:left_analog_y_player_1, 11000, 0, 1, 486, 1113] +[:key_up_player_one, 2, 0, 1, 487, 1114] +[:key_held_player_one, 4, 0, 1, 488, 1114] +[:left_analog_y_player_1, 4000, 0, 1, 489, 1114] +[:key_held_player_one, 4, 0, 1, 490, 1115] +[:left_analog_y_player_1, 0, 0, 1, 491, 1115] +[:key_held_player_one, 4, 0, 1, 492, 1116] +[:key_held_player_one, 4, 0, 1, 493, 1117] +[:left_analog_y_player_1, -4000, 0, 1, 494, 1117] +[:key_held_player_one, 4, 0, 1, 495, 1118] +[:left_analog_y_player_1, -10000, 0, 1, 496, 1118] +[:key_held_player_one, 4, 0, 1, 497, 1119] +[:left_analog_y_player_1, -13000, 0, 1, 498, 1119] +[:key_held_player_one, 4, 0, 1, 499, 1120] +[:left_analog_y_player_1, -17000, 0, 1, 500, 1120] +[:key_held_player_one, 4, 0, 1, 501, 1121] +[:left_analog_x_player_1, 31000, 0, 1, 502, 1121] +[:left_analog_y_player_1, -21000, 0, 1, 503, 1121] +[:key_down_player_one, 1, 0, 1, 504, 1122] +[:key_held_player_one, 4, 0, 1, 505, 1122] +[:left_analog_x_player_1, 29000, 0, 1, 506, 1122] +[:left_analog_y_player_1, -25000, 0, 1, 507, 1122] +[:key_held_player_one, 1, 0, 1, 508, 1123] +[:key_held_player_one, 4, 0, 1, 509, 1123] +[:left_analog_x_player_1, 27000, 0, 1, 510, 1123] +[:left_analog_y_player_1, -27000, 0, 1, 511, 1123] +[:key_held_player_one, 1, 0, 1, 512, 1124] +[:key_held_player_one, 4, 0, 1, 513, 1124] +[:left_analog_x_player_1, 26000, 0, 1, 514, 1124] +[:left_analog_y_player_1, -28000, 0, 1, 515, 1124] +[:key_held_player_one, 1, 0, 1, 516, 1125] +[:key_held_player_one, 4, 0, 1, 517, 1125] +[:left_analog_x_player_1, 22000, 0, 1, 518, 1125] +[:left_analog_y_player_1, -30000, 0, 1, 519, 1125] +[:key_held_player_one, 1, 0, 1, 520, 1126] +[:key_held_player_one, 4, 0, 1, 521, 1126] +[:left_analog_x_player_1, 20000, 0, 1, 522, 1126] +[:left_analog_y_player_1, -31000, 0, 1, 523, 1126] +[:key_held_player_one, 1, 0, 1, 524, 1127] +[:key_held_player_one, 4, 0, 1, 525, 1127] +[:left_analog_x_player_1, 16000, 0, 1, 526, 1127] +[:left_analog_y_player_1, -32000, 0, 1, 527, 1127] +[:key_held_player_one, 1, 0, 1, 528, 1128] +[:key_up_player_one, 4, 0, 1, 529, 1128] +[:left_analog_x_player_1, 11000, 0, 1, 530, 1128] +[:key_held_player_one, 1, 0, 1, 531, 1129] +[:left_analog_x_player_1, 7000, 0, 1, 532, 1129] +[:key_held_player_one, 1, 0, 1, 533, 1130] +[:left_analog_x_player_1, 4000, 0, 1, 534, 1130] +[:key_held_player_one, 1, 0, 1, 535, 1131] +[:left_analog_x_player_1, 0, 0, 1, 536, 1131] +[:key_held_player_one, 1, 0, 1, 537, 1132] +[:key_held_player_one, 1, 0, 1, 538, 1133] +[:left_analog_x_player_1, -3000, 0, 1, 539, 1133] +[:key_held_player_one, 1, 0, 1, 540, 1134] +[:left_analog_x_player_1, -7000, 0, 1, 541, 1134] +[:key_held_player_one, 1, 0, 1, 542, 1135] +[:left_analog_x_player_1, -11000, 0, 1, 543, 1135] +[:key_held_player_one, 1, 0, 1, 544, 1136] +[:left_analog_x_player_1, -16000, 0, 1, 545, 1136] +[:key_held_player_one, 1, 0, 1, 546, 1137] +[:left_analog_x_player_1, -19000, 0, 1, 547, 1137] +[:left_analog_y_player_1, -30000, 0, 1, 548, 1137] +[:key_held_player_one, 1, 0, 1, 549, 1138] +[:left_analog_x_player_1, -23000, 0, 1, 550, 1138] +[:left_analog_y_player_1, -29000, 0, 1, 551, 1138] +[:key_held_player_one, 1, 0, 1, 552, 1139] +[:key_down_player_one, 3, 0, 1, 553, 1139] +[:left_analog_x_player_1, -25000, 0, 1, 554, 1139] +[:left_analog_y_player_1, -27000, 0, 1, 555, 1139] +[:key_held_player_one, 1, 0, 1, 556, 1140] +[:key_held_player_one, 3, 0, 1, 557, 1140] +[:left_analog_x_player_1, -27000, 0, 1, 558, 1140] +[:left_analog_y_player_1, -25000, 0, 1, 559, 1140] +[:key_held_player_one, 1, 0, 1, 560, 1141] +[:key_held_player_one, 3, 0, 1, 561, 1141] +[:left_analog_x_player_1, -28000, 0, 1, 562, 1141] +[:left_analog_y_player_1, -23000, 0, 1, 563, 1141] +[:key_held_player_one, 1, 0, 1, 564, 1142] +[:key_held_player_one, 3, 0, 1, 565, 1142] +[:left_analog_x_player_1, -30000, 0, 1, 566, 1142] +[:left_analog_y_player_1, -20000, 0, 1, 567, 1142] +[:key_held_player_one, 1, 0, 1, 568, 1143] +[:key_held_player_one, 3, 0, 1, 569, 1143] +[:left_analog_x_player_1, -32000, 0, 1, 570, 1143] +[:left_analog_y_player_1, -18000, 0, 1, 571, 1143] +[:key_up_player_one, 1, 0, 1, 572, 1144] +[:key_held_player_one, 3, 0, 1, 573, 1144] +[:left_analog_y_player_1, -14000, 0, 1, 574, 1144] +[:key_held_player_one, 3, 0, 1, 575, 1145] +[:left_analog_y_player_1, -11000, 0, 1, 576, 1145] +[:key_held_player_one, 3, 0, 1, 577, 1146] +[:left_analog_y_player_1, -6000, 0, 1, 578, 1146] +[:key_held_player_one, 3, 0, 1, 579, 1147] +[:left_analog_y_player_1, -1000, 0, 1, 580, 1147] +[:key_held_player_one, 3, 0, 1, 581, 1148] +[:left_analog_y_player_1, 2000, 0, 1, 582, 1148] +[:key_held_player_one, 3, 0, 1, 583, 1149] +[:left_analog_y_player_1, 7000, 0, 1, 584, 1149] +[:key_held_player_one, 3, 0, 1, 585, 1150] +[:left_analog_y_player_1, 12000, 0, 1, 586, 1150] +[:key_held_player_one, 3, 0, 1, 587, 1151] +[:left_analog_y_player_1, 17000, 0, 1, 588, 1151] +[:key_held_player_one, 3, 0, 1, 589, 1152] +[:left_analog_x_player_1, -31000, 0, 1, 590, 1152] +[:left_analog_y_player_1, 20000, 0, 1, 591, 1152] +[:key_down_player_one, 2, 0, 1, 592, 1153] +[:key_held_player_one, 3, 0, 1, 593, 1153] +[:left_analog_x_player_1, -28000, 0, 1, 594, 1153] +[:left_analog_y_player_1, 24000, 0, 1, 595, 1153] +[:key_held_player_one, 2, 0, 1, 596, 1154] +[:key_held_player_one, 3, 0, 1, 597, 1154] +[:left_analog_x_player_1, -25000, 0, 1, 598, 1154] +[:left_analog_y_player_1, 28000, 0, 1, 599, 1154] +[:key_held_player_one, 2, 0, 1, 600, 1155] +[:key_held_player_one, 3, 0, 1, 601, 1155] +[:left_analog_x_player_1, -22000, 0, 1, 602, 1155] +[:left_analog_y_player_1, 29000, 0, 1, 603, 1155] +[:key_held_player_one, 2, 0, 1, 604, 1156] +[:key_held_player_one, 3, 0, 1, 605, 1156] +[:left_analog_x_player_1, -19000, 0, 1, 606, 1156] +[:left_analog_y_player_1, 31000, 0, 1, 607, 1156] +[:key_held_player_one, 2, 0, 1, 608, 1157] +[:key_up_player_one, 3, 0, 1, 609, 1157] +[:left_analog_x_player_1, -15000, 0, 1, 610, 1157] +[:left_analog_y_player_1, 32000, 0, 1, 611, 1157] +[:key_held_player_one, 2, 0, 1, 612, 1158] +[:left_analog_x_player_1, -11000, 0, 1, 613, 1158] +[:key_held_player_one, 2, 0, 1, 614, 1159] +[:left_analog_x_player_1, -3000, 0, 1, 615, 1159] +[:key_held_player_one, 2, 0, 1, 616, 1160] +[:left_analog_x_player_1, 0, 0, 1, 617, 1160] +[:key_held_player_one, 2, 0, 1, 618, 1161] +[:left_analog_x_player_1, 5000, 0, 1, 619, 1161] +[:key_held_player_one, 2, 0, 1, 620, 1162] +[:left_analog_x_player_1, 12000, 0, 1, 621, 1162] +[:key_held_player_one, 2, 0, 1, 622, 1163] +[:left_analog_x_player_1, 17000, 0, 1, 623, 1163] +[:key_held_player_one, 2, 0, 1, 624, 1164] +[:left_analog_x_player_1, 22000, 0, 1, 625, 1164] +[:left_analog_y_player_1, 31000, 0, 1, 626, 1164] +[:key_held_player_one, 2, 0, 1, 627, 1165] +[:key_down_player_one, 4, 0, 1, 628, 1165] +[:left_analog_x_player_1, 26000, 0, 1, 629, 1165] +[:left_analog_y_player_1, 28000, 0, 1, 630, 1165] +[:key_held_player_one, 2, 0, 1, 631, 1166] +[:key_held_player_one, 4, 0, 1, 632, 1166] +[:left_analog_x_player_1, 29000, 0, 1, 633, 1166] +[:left_analog_y_player_1, 24000, 0, 1, 634, 1166] +[:key_held_player_one, 2, 0, 1, 635, 1167] +[:key_held_player_one, 4, 0, 1, 636, 1167] +[:left_analog_x_player_1, 31000, 0, 1, 637, 1167] +[:left_analog_y_player_1, 20000, 0, 1, 638, 1167] +[:key_held_player_one, 2, 0, 1, 639, 1168] +[:key_held_player_one, 4, 0, 1, 640, 1168] +[:left_analog_x_player_1, 32000, 0, 1, 641, 1168] +[:left_analog_y_player_1, 15000, 0, 1, 642, 1168] +[:key_up_player_one, 2, 0, 1, 643, 1169] +[:key_held_player_one, 4, 0, 1, 644, 1169] +[:left_analog_y_player_1, 9000, 0, 1, 645, 1169] +[:key_held_player_one, 4, 0, 1, 646, 1170] +[:left_analog_y_player_1, 4000, 0, 1, 647, 1170] +[:key_held_player_one, 4, 0, 1, 648, 1171] +[:left_analog_y_player_1, 0, 0, 1, 649, 1171] +[:key_held_player_one, 4, 0, 1, 650, 1172] +[:left_analog_y_player_1, -4000, 0, 1, 651, 1172] +[:key_held_player_one, 4, 0, 1, 652, 1173] +[:left_analog_y_player_1, -10000, 0, 1, 653, 1173] +[:key_held_player_one, 4, 0, 1, 654, 1174] +[:left_analog_y_player_1, -16000, 0, 1, 655, 1174] +[:key_held_player_one, 4, 0, 1, 656, 1175] +[:left_analog_x_player_1, 30000, 0, 1, 657, 1175] +[:left_analog_y_player_1, -24000, 0, 1, 658, 1175] +[:key_down_player_one, 1, 0, 1, 659, 1176] +[:key_held_player_one, 4, 0, 1, 660, 1176] +[:left_analog_x_player_1, 27000, 0, 1, 661, 1176] +[:left_analog_y_player_1, -26000, 0, 1, 662, 1176] +[:key_held_player_one, 1, 0, 1, 663, 1177] +[:key_held_player_one, 4, 0, 1, 664, 1177] +[:left_analog_x_player_1, 24000, 0, 1, 665, 1177] +[:left_analog_y_player_1, -29000, 0, 1, 666, 1177] +[:key_held_player_one, 1, 0, 1, 667, 1178] +[:key_held_player_one, 4, 0, 1, 668, 1178] +[:left_analog_x_player_1, 20000, 0, 1, 669, 1178] +[:left_analog_y_player_1, -31000, 0, 1, 670, 1178] +[:key_held_player_one, 1, 0, 1, 671, 1179] +[:key_held_player_one, 4, 0, 1, 672, 1179] +[:left_analog_x_player_1, 15000, 0, 1, 673, 1179] +[:left_analog_y_player_1, -32000, 0, 1, 674, 1179] +[:key_held_player_one, 1, 0, 1, 675, 1180] +[:key_up_player_one, 4, 0, 1, 676, 1180] +[:left_analog_x_player_1, 10000, 0, 1, 677, 1180] +[:key_held_player_one, 1, 0, 1, 678, 1181] +[:left_analog_x_player_1, 6000, 0, 1, 679, 1181] +[:key_held_player_one, 1, 0, 1, 680, 1182] +[:left_analog_x_player_1, 1000, 0, 1, 681, 1182] +[:key_held_player_one, 1, 0, 1, 682, 1183] +[:left_analog_x_player_1, 0, 0, 1, 683, 1183] +[:key_held_player_one, 1, 0, 1, 684, 1184] +[:left_analog_x_player_1, -4000, 0, 1, 685, 1184] +[:key_held_player_one, 1, 0, 1, 686, 1185] +[:left_analog_x_player_1, -10000, 0, 1, 687, 1185] +[:key_held_player_one, 1, 0, 1, 688, 1186] +[:left_analog_x_player_1, -14000, 0, 1, 689, 1186] +[:key_held_player_one, 1, 0, 1, 690, 1187] +[:left_analog_x_player_1, -20000, 0, 1, 691, 1187] +[:left_analog_y_player_1, -30000, 0, 1, 692, 1187] +[:key_held_player_one, 1, 0, 1, 693, 1188] +[:key_down_player_one, 3, 0, 1, 694, 1188] +[:left_analog_x_player_1, -24000, 0, 1, 695, 1188] +[:left_analog_y_player_1, -28000, 0, 1, 696, 1188] +[:key_held_player_one, 1, 0, 1, 697, 1189] +[:key_held_player_one, 3, 0, 1, 698, 1189] +[:left_analog_x_player_1, -27000, 0, 1, 699, 1189] +[:left_analog_y_player_1, -25000, 0, 1, 700, 1189] +[:key_held_player_one, 1, 0, 1, 701, 1190] +[:key_held_player_one, 3, 0, 1, 702, 1190] +[:left_analog_x_player_1, -30000, 0, 1, 703, 1190] +[:left_analog_y_player_1, -20000, 0, 1, 704, 1190] +[:key_held_player_one, 1, 0, 1, 705, 1191] +[:key_held_player_one, 3, 0, 1, 706, 1191] +[:left_analog_x_player_1, -32000, 0, 1, 707, 1191] +[:left_analog_y_player_1, -15000, 0, 1, 708, 1191] +[:key_up_player_one, 1, 0, 1, 709, 1192] +[:key_held_player_one, 3, 0, 1, 710, 1192] +[:left_analog_y_player_1, -9000, 0, 1, 711, 1192] +[:key_held_player_one, 3, 0, 1, 712, 1193] +[:left_analog_y_player_1, -5000, 0, 1, 713, 1193] +[:key_held_player_one, 3, 0, 1, 714, 1194] +[:left_analog_y_player_1, -1000, 0, 1, 715, 1194] +[:key_held_player_one, 3, 0, 1, 716, 1195] +[:left_analog_y_player_1, 0, 0, 1, 717, 1195] +[:key_held_player_one, 3, 0, 1, 718, 1196] +[:left_analog_y_player_1, 2000, 0, 1, 719, 1196] +[:key_held_player_one, 3, 0, 1, 720, 1197] +[:left_analog_y_player_1, 3000, 0, 1, 721, 1197] +[:key_held_player_one, 3, 0, 1, 722, 1198] +[:left_analog_x_player_1, -30000, 0, 1, 723, 1198] +[:left_analog_y_player_1, 4000, 0, 1, 724, 1198] +[:key_held_player_one, 3, 0, 1, 725, 1199] +[:left_analog_x_player_1, -19000, 0, 1, 726, 1199] +[:key_up_player_one, 3, 0, 1, 727, 1200] +[:left_analog_x_player_1, 0, 0, 1, 728, 1200] +[:left_analog_y_player_1, 0, 0, 1, 729, 1200] +[:right_analog_x_player_1, 1000, 0, 1, 730, 1225] +[:right_analog_x_player_1, 5000, 0, 1, 731, 1226] +[:right_analog_x_player_1, 11000, 0, 1, 732, 1227] +[:right_analog_x_player_1, 17000, 0, 1, 733, 1228] +[:right_analog_x_player_1, 22000, 0, 1, 734, 1229] +[:key_down_player_one, 4, 0, 1, 735, 1230] +[:right_analog_x_player_1, 26000, 0, 1, 736, 1230] +[:right_analog_y_player_1, -2000, 0, 1, 737, 1230] +[:key_held_player_one, 4, 0, 1, 738, 1231] +[:right_analog_x_player_1, 31000, 0, 1, 739, 1231] +[:right_analog_y_player_1, -10000, 0, 1, 740, 1231] +[:key_held_player_one, 4, 0, 1, 741, 1232] +[:right_analog_x_player_1, 32000, 0, 1, 742, 1232] +[:right_analog_y_player_1, -21000, 0, 1, 743, 1232] +[:key_down_player_one, 1, 0, 1, 744, 1233] +[:key_held_player_one, 4, 0, 1, 745, 1233] +[:right_analog_y_player_1, -24000, 0, 1, 746, 1233] +[:key_held_player_one, 1, 0, 1, 747, 1234] +[:key_held_player_one, 4, 0, 1, 748, 1234] +[:right_analog_x_player_1, 31000, 0, 1, 749, 1234] +[:right_analog_y_player_1, -28000, 0, 1, 750, 1234] +[:key_held_player_one, 1, 0, 1, 751, 1235] +[:key_held_player_one, 4, 0, 1, 752, 1235] +[:right_analog_x_player_1, 29000, 0, 1, 753, 1235] +[:right_analog_y_player_1, -31000, 0, 1, 754, 1235] +[:key_held_player_one, 1, 0, 1, 755, 1236] +[:key_held_player_one, 4, 0, 1, 756, 1236] +[:right_analog_x_player_1, 24000, 0, 1, 757, 1236] +[:right_analog_y_player_1, -32000, 0, 1, 758, 1236] +[:key_held_player_one, 1, 0, 1, 759, 1237] +[:key_held_player_one, 4, 0, 1, 760, 1237] +[:right_analog_x_player_1, 19000, 0, 1, 761, 1237] +[:key_held_player_one, 1, 0, 1, 762, 1238] +[:key_up_player_one, 4, 0, 1, 763, 1238] +[:right_analog_x_player_1, 15000, 0, 1, 764, 1238] +[:key_held_player_one, 1, 0, 1, 765, 1239] +[:right_analog_x_player_1, 11000, 0, 1, 766, 1239] +[:key_held_player_one, 1, 0, 1, 767, 1240] +[:right_analog_x_player_1, 10000, 0, 1, 768, 1240] +[:key_held_player_one, 1, 0, 1, 769, 1241] +[:right_analog_x_player_1, 8000, 0, 1, 770, 1241] +[:key_held_player_one, 1, 0, 1, 771, 1242] +[:right_analog_x_player_1, 6000, 0, 1, 772, 1242] +[:key_held_player_one, 1, 0, 1, 773, 1243] +[:right_analog_x_player_1, 2000, 0, 1, 774, 1243] +[:key_held_player_one, 1, 0, 1, 775, 1244] +[:right_analog_x_player_1, 0, 0, 1, 776, 1244] +[:key_held_player_one, 1, 0, 1, 777, 1245] +[:right_analog_x_player_1, -9000, 0, 1, 778, 1245] +[:key_held_player_one, 1, 0, 1, 779, 1246] +[:right_analog_x_player_1, -20000, 0, 1, 780, 1246] +[:key_held_player_one, 1, 0, 1, 781, 1247] +[:key_down_player_one, 3, 0, 1, 782, 1247] +[:right_analog_x_player_1, -26000, 0, 1, 783, 1247] +[:right_analog_y_player_1, -31000, 0, 1, 784, 1247] +[:key_held_player_one, 1, 0, 1, 785, 1248] +[:key_held_player_one, 3, 0, 1, 786, 1248] +[:right_analog_x_player_1, -30000, 0, 1, 787, 1248] +[:right_analog_y_player_1, -28000, 0, 1, 788, 1248] +[:key_held_player_one, 1, 0, 1, 789, 1249] +[:key_held_player_one, 3, 0, 1, 790, 1249] +[:right_analog_x_player_1, -32000, 0, 1, 791, 1249] +[:right_analog_y_player_1, -23000, 0, 1, 792, 1249] +[:key_held_player_one, 1, 0, 1, 793, 1250] +[:key_held_player_one, 3, 0, 1, 794, 1250] +[:right_analog_y_player_1, -20000, 0, 1, 795, 1250] +[:key_held_player_one, 1, 0, 1, 796, 1251] +[:key_held_player_one, 3, 0, 1, 797, 1251] +[:right_analog_y_player_1, -15000, 0, 1, 798, 1251] +[:key_up_player_one, 1, 0, 1, 799, 1252] +[:key_held_player_one, 3, 0, 1, 800, 1252] +[:right_analog_y_player_1, -11000, 0, 1, 801, 1252] +[:key_held_player_one, 3, 0, 1, 802, 1253] +[:right_analog_y_player_1, -7000, 0, 1, 803, 1253] +[:key_held_player_one, 3, 0, 1, 804, 1254] +[:right_analog_y_player_1, -3000, 0, 1, 805, 1254] +[:key_held_player_one, 3, 0, 1, 806, 1255] +[:right_analog_y_player_1, 0, 0, 1, 807, 1255] +[:key_held_player_one, 3, 0, 1, 808, 1256] +[:key_held_player_one, 3, 0, 1, 809, 1257] +[:right_analog_y_player_1, 5000, 0, 1, 810, 1257] +[:key_held_player_one, 3, 0, 1, 811, 1258] +[:right_analog_y_player_1, 11000, 0, 1, 812, 1258] +[:key_held_player_one, 3, 0, 1, 813, 1259] +[:right_analog_y_player_1, 16000, 0, 1, 814, 1259] +[:key_held_player_one, 3, 0, 1, 815, 1260] +[:right_analog_x_player_1, -31000, 0, 1, 816, 1260] +[:right_analog_y_player_1, 20000, 0, 1, 817, 1260] +[:key_down_player_one, 2, 0, 1, 818, 1261] +[:key_held_player_one, 3, 0, 1, 819, 1261] +[:right_analog_x_player_1, -30000, 0, 1, 820, 1261] +[:right_analog_y_player_1, 23000, 0, 1, 821, 1261] +[:key_held_player_one, 2, 0, 1, 822, 1262] +[:key_held_player_one, 3, 0, 1, 823, 1262] +[:right_analog_x_player_1, -27000, 0, 1, 824, 1262] +[:right_analog_y_player_1, 27000, 0, 1, 825, 1262] +[:key_held_player_one, 2, 0, 1, 826, 1263] +[:key_held_player_one, 3, 0, 1, 827, 1263] +[:right_analog_x_player_1, -25000, 0, 1, 828, 1263] +[:right_analog_y_player_1, 29000, 0, 1, 829, 1263] +[:key_held_player_one, 2, 0, 1, 830, 1264] +[:key_held_player_one, 3, 0, 1, 831, 1264] +[:right_analog_x_player_1, -22000, 0, 1, 832, 1264] +[:right_analog_y_player_1, 31000, 0, 1, 833, 1264] +[:key_held_player_one, 2, 0, 1, 834, 1265] +[:key_held_player_one, 3, 0, 1, 835, 1265] +[:right_analog_x_player_1, -19000, 0, 1, 836, 1265] +[:right_analog_y_player_1, 32000, 0, 1, 837, 1265] +[:key_held_player_one, 2, 0, 1, 838, 1266] +[:key_up_player_one, 3, 0, 1, 839, 1266] +[:right_analog_x_player_1, -15000, 0, 1, 840, 1266] +[:key_held_player_one, 2, 0, 1, 841, 1267] +[:right_analog_x_player_1, -11000, 0, 1, 842, 1267] +[:key_held_player_one, 2, 0, 1, 843, 1268] +[:right_analog_x_player_1, -9000, 0, 1, 844, 1268] +[:key_held_player_one, 2, 0, 1, 845, 1269] +[:right_analog_x_player_1, -7000, 0, 1, 846, 1269] +[:key_held_player_one, 2, 0, 1, 847, 1270] +[:right_analog_x_player_1, -3000, 0, 1, 848, 1270] +[:key_held_player_one, 2, 0, 1, 849, 1271] +[:right_analog_x_player_1, 0, 0, 1, 850, 1271] +[:key_held_player_one, 2, 0, 1, 851, 1272] +[:right_analog_x_player_1, 5000, 0, 1, 852, 1272] +[:key_held_player_one, 2, 0, 1, 853, 1273] +[:right_analog_x_player_1, 17000, 0, 1, 854, 1273] +[:key_held_player_one, 2, 0, 1, 855, 1274] +[:right_analog_x_player_1, 30000, 0, 1, 856, 1274] +[:right_analog_y_player_1, 25000, 0, 1, 857, 1274] +[:key_held_player_one, 2, 0, 1, 858, 1275] +[:key_down_player_one, 4, 0, 1, 859, 1275] +[:right_analog_x_player_1, 32000, 0, 1, 860, 1275] +[:right_analog_y_player_1, 14000, 0, 1, 861, 1275] +[:key_up_player_one, 2, 0, 1, 862, 1276] +[:key_held_player_one, 4, 0, 1, 863, 1276] +[:right_analog_y_player_1, 11000, 0, 1, 864, 1276] +[:key_held_player_one, 4, 0, 1, 865, 1277] +[:right_analog_y_player_1, 8000, 0, 1, 866, 1277] +[:key_held_player_one, 4, 0, 1, 867, 1278] +[:right_analog_y_player_1, 5000, 0, 1, 868, 1278] +[:key_held_player_one, 4, 0, 1, 869, 1279] +[:right_analog_y_player_1, 1000, 0, 1, 870, 1279] +[:key_held_player_one, 4, 0, 1, 871, 1280] +[:right_analog_y_player_1, -2000, 0, 1, 872, 1280] +[:key_held_player_one, 4, 0, 1, 873, 1281] +[:right_analog_y_player_1, -9000, 0, 1, 874, 1281] +[:key_held_player_one, 4, 0, 1, 875, 1282] +[:right_analog_y_player_1, -18000, 0, 1, 876, 1282] +[:key_held_player_one, 4, 0, 1, 877, 1283] +[:right_analog_x_player_1, 31000, 0, 1, 878, 1283] +[:right_analog_y_player_1, -23000, 0, 1, 879, 1283] +[:key_down_player_one, 1, 0, 1, 880, 1284] +[:key_held_player_one, 4, 0, 1, 881, 1284] +[:right_analog_x_player_1, 29000, 0, 1, 882, 1284] +[:right_analog_y_player_1, -26000, 0, 1, 883, 1284] +[:key_held_player_one, 1, 0, 1, 884, 1285] +[:key_held_player_one, 4, 0, 1, 885, 1285] +[:right_analog_x_player_1, 26000, 0, 1, 886, 1285] +[:right_analog_y_player_1, -29000, 0, 1, 887, 1285] +[:key_held_player_one, 1, 0, 1, 888, 1286] +[:key_held_player_one, 4, 0, 1, 889, 1286] +[:right_analog_x_player_1, 23000, 0, 1, 890, 1286] +[:right_analog_y_player_1, -31000, 0, 1, 891, 1286] +[:key_held_player_one, 1, 0, 1, 892, 1287] +[:key_held_player_one, 4, 0, 1, 893, 1287] +[:right_analog_x_player_1, 16000, 0, 1, 894, 1287] +[:right_analog_y_player_1, -32000, 0, 1, 895, 1287] +[:key_held_player_one, 1, 0, 1, 896, 1288] +[:key_up_player_one, 4, 0, 1, 897, 1288] +[:right_analog_x_player_1, 11000, 0, 1, 898, 1288] +[:key_held_player_one, 1, 0, 1, 899, 1289] +[:right_analog_x_player_1, 8000, 0, 1, 900, 1289] +[:key_held_player_one, 1, 0, 1, 901, 1290] +[:right_analog_x_player_1, 2000, 0, 1, 902, 1290] +[:key_held_player_one, 1, 0, 1, 903, 1291] +[:right_analog_x_player_1, 0, 0, 1, 904, 1291] +[:key_held_player_one, 1, 0, 1, 905, 1292] +[:right_analog_x_player_1, -3000, 0, 1, 906, 1292] +[:key_held_player_one, 1, 0, 1, 907, 1293] +[:right_analog_x_player_1, -12000, 0, 1, 908, 1293] +[:key_held_player_one, 1, 0, 1, 909, 1294] +[:right_analog_x_player_1, -23000, 0, 1, 910, 1294] +[:right_analog_y_player_1, -31000, 0, 1, 911, 1294] +[:key_held_player_one, 1, 0, 1, 912, 1295] +[:key_down_player_one, 3, 0, 1, 913, 1295] +[:right_analog_x_player_1, -29000, 0, 1, 914, 1295] +[:right_analog_y_player_1, -26000, 0, 1, 915, 1295] +[:key_held_player_one, 1, 0, 1, 916, 1296] +[:key_held_player_one, 3, 0, 1, 917, 1296] +[:right_analog_x_player_1, -31000, 0, 1, 918, 1296] +[:right_analog_y_player_1, -22000, 0, 1, 919, 1296] +[:key_held_player_one, 1, 0, 1, 920, 1297] +[:key_held_player_one, 3, 0, 1, 921, 1297] +[:right_analog_x_player_1, -32000, 0, 1, 922, 1297] +[:right_analog_y_player_1, -18000, 0, 1, 923, 1297] +[:key_up_player_one, 1, 0, 1, 924, 1298] +[:key_held_player_one, 3, 0, 1, 925, 1298] +[:right_analog_y_player_1, -15000, 0, 1, 926, 1298] +[:key_held_player_one, 3, 0, 1, 927, 1299] +[:right_analog_y_player_1, -12000, 0, 1, 928, 1299] +[:key_held_player_one, 3, 0, 1, 929, 1300] +[:right_analog_y_player_1, -9000, 0, 1, 930, 1300] +[:key_held_player_one, 3, 0, 1, 931, 1301] +[:right_analog_y_player_1, -5000, 0, 1, 932, 1301] +[:key_held_player_one, 3, 0, 1, 933, 1302] +[:right_analog_y_player_1, -1000, 0, 1, 934, 1302] +[:key_held_player_one, 3, 0, 1, 935, 1303] +[:right_analog_y_player_1, 0, 0, 1, 936, 1303] +[:key_held_player_one, 3, 0, 1, 937, 1304] +[:right_analog_y_player_1, 3000, 0, 1, 938, 1304] +[:key_held_player_one, 3, 0, 1, 939, 1305] +[:right_analog_y_player_1, 8000, 0, 1, 940, 1305] +[:key_held_player_one, 3, 0, 1, 941, 1306] +[:right_analog_y_player_1, 13000, 0, 1, 942, 1306] +[:key_held_player_one, 3, 0, 1, 943, 1307] +[:right_analog_y_player_1, 17000, 0, 1, 944, 1307] +[:key_held_player_one, 3, 0, 1, 945, 1308] +[:right_analog_x_player_1, -30000, 0, 1, 946, 1308] +[:right_analog_y_player_1, 20000, 0, 1, 947, 1308] +[:key_down_player_one, 2, 0, 1, 948, 1309] +[:key_held_player_one, 3, 0, 1, 949, 1309] +[:right_analog_x_player_1, -28000, 0, 1, 950, 1309] +[:right_analog_y_player_1, 23000, 0, 1, 951, 1309] +[:key_held_player_one, 2, 0, 1, 952, 1310] +[:key_held_player_one, 3, 0, 1, 953, 1310] +[:right_analog_x_player_1, -26000, 0, 1, 954, 1310] +[:right_analog_y_player_1, 26000, 0, 1, 955, 1310] +[:key_held_player_one, 2, 0, 1, 956, 1311] +[:key_held_player_one, 3, 0, 1, 957, 1311] +[:right_analog_x_player_1, -22000, 0, 1, 958, 1311] +[:right_analog_y_player_1, 29000, 0, 1, 959, 1311] +[:key_held_player_one, 2, 0, 1, 960, 1312] +[:key_held_player_one, 3, 0, 1, 961, 1312] +[:right_analog_x_player_1, -19000, 0, 1, 962, 1312] +[:right_analog_y_player_1, 31000, 0, 1, 963, 1312] +[:key_held_player_one, 2, 0, 1, 964, 1313] +[:key_up_player_one, 3, 0, 1, 965, 1313] +[:right_analog_x_player_1, -16000, 0, 1, 966, 1313] +[:right_analog_y_player_1, 32000, 0, 1, 967, 1313] +[:key_held_player_one, 2, 0, 1, 968, 1314] +[:right_analog_x_player_1, -12000, 0, 1, 969, 1314] +[:key_held_player_one, 2, 0, 1, 970, 1315] +[:right_analog_x_player_1, -10000, 0, 1, 971, 1315] +[:key_held_player_one, 2, 0, 1, 972, 1316] +[:right_analog_x_player_1, -7000, 0, 1, 973, 1316] +[:key_held_player_one, 2, 0, 1, 974, 1317] +[:right_analog_x_player_1, -2000, 0, 1, 975, 1317] +[:key_held_player_one, 2, 0, 1, 976, 1318] +[:right_analog_x_player_1, 0, 0, 1, 977, 1318] +[:key_held_player_one, 2, 0, 1, 978, 1319] +[:right_analog_x_player_1, 3000, 0, 1, 979, 1319] +[:key_held_player_one, 2, 0, 1, 980, 1320] +[:right_analog_x_player_1, 8000, 0, 1, 981, 1320] +[:key_held_player_one, 2, 0, 1, 982, 1321] +[:right_analog_x_player_1, 12000, 0, 1, 983, 1321] +[:key_held_player_one, 2, 0, 1, 984, 1322] +[:right_analog_x_player_1, 16000, 0, 1, 985, 1322] +[:key_held_player_one, 2, 0, 1, 986, 1323] +[:right_analog_x_player_1, 21000, 0, 1, 987, 1323] +[:right_analog_y_player_1, 31000, 0, 1, 988, 1323] +[:key_held_player_one, 2, 0, 1, 989, 1324] +[:key_down_player_one, 4, 0, 1, 990, 1324] +[:right_analog_x_player_1, 26000, 0, 1, 991, 1324] +[:right_analog_y_player_1, 28000, 0, 1, 992, 1324] +[:key_held_player_one, 2, 0, 1, 993, 1325] +[:key_held_player_one, 4, 0, 1, 994, 1325] +[:right_analog_x_player_1, 29000, 0, 1, 995, 1325] +[:right_analog_y_player_1, 24000, 0, 1, 996, 1325] +[:key_held_player_one, 2, 0, 1, 997, 1326] +[:key_held_player_one, 4, 0, 1, 998, 1326] +[:right_analog_x_player_1, 31000, 0, 1, 999, 1326] +[:right_analog_y_player_1, 20000, 0, 1, 1000, 1326] +[:key_held_player_one, 2, 0, 1, 1001, 1327] +[:key_held_player_one, 4, 0, 1, 1002, 1327] +[:right_analog_x_player_1, 32000, 0, 1, 1003, 1327] +[:right_analog_y_player_1, 14000, 0, 1, 1004, 1327] +[:key_up_player_one, 2, 0, 1, 1005, 1328] +[:key_held_player_one, 4, 0, 1, 1006, 1328] +[:right_analog_y_player_1, 2000, 0, 1, 1007, 1328] +[:key_held_player_one, 4, 0, 1, 1008, 1329] +[:right_analog_x_player_1, 27000, 0, 1, 1009, 1329] +[:right_analog_y_player_1, -9000, 0, 1, 1010, 1329] +[:key_held_player_one, 4, 0, 1, 1011, 1330] +[:right_analog_x_player_1, 21000, 0, 1, 1012, 1330] +[:right_analog_y_player_1, -11000, 0, 1, 1013, 1330] +[:key_held_player_one, 4, 0, 1, 1014, 1331] +[:right_analog_x_player_1, 17000, 0, 1, 1015, 1331] +[:right_analog_y_player_1, -10000, 0, 1, 1016, 1331] +[:key_up_player_one, 4, 0, 1, 1017, 1332] +[:right_analog_x_player_1, 11000, 0, 1, 1018, 1332] +[:right_analog_y_player_1, -4000, 0, 1, 1019, 1332] +[:right_analog_x_player_1, 6000, 0, 1, 1020, 1333] +[:right_analog_y_player_1, 0, 0, 1, 1021, 1333] +[:right_analog_x_player_1, 0, 0, 1, 1022, 1334] +[:right_analog_y_player_1, 1000, 0, 1, 1023, 1366] +[:right_analog_y_player_1, 0, 0, 1, 1024, 1367] +[:right_analog_y_player_1, 1000, 0, 1, 1025, 1369] +[:key_down_player_one, 21, 0, 1, 1026, 1370] +[:key_held_player_one, 21, 0, 1, 1027, 1371] +[:key_held_player_one, 21, 0, 1, 1028, 1372] +[:key_held_player_one, 21, 0, 1, 1029, 1373] +[:key_held_player_one, 21, 0, 1, 1030, 1374] +[:right_analog_x_player_1, 1000, 0, 1, 1031, 1374] +[:right_analog_y_player_1, 2000, 0, 1, 1032, 1374] +[:key_held_player_one, 21, 0, 1, 1033, 1375] +[:right_analog_y_player_1, 1000, 0, 1, 1034, 1375] +[:key_held_player_one, 21, 0, 1, 1035, 1376] +[:key_held_player_one, 21, 0, 1, 1036, 1377] +[:right_analog_y_player_1, 0, 0, 1, 1037, 1377] +[:key_held_player_one, 21, 0, 1, 1038, 1378] +[:right_analog_x_player_1, 0, 0, 1, 1039, 1378] +[:key_held_player_one, 21, 0, 1, 1040, 1379] +[:key_held_player_one, 21, 0, 1, 1041, 1380] +[:key_held_player_one, 21, 0, 1, 1042, 1381] +[:key_up_player_one, 21, 0, 1, 1043, 1382] +[:key_down_player_one, 20, 0, 1, 1044, 1411] +[:key_held_player_one, 20, 0, 1, 1045, 1412] +[:key_held_player_one, 20, 0, 1, 1046, 1413] +[:key_held_player_one, 20, 0, 1, 1047, 1414] +[:key_held_player_one, 20, 0, 1, 1048, 1415] +[:key_held_player_one, 20, 0, 1, 1049, 1416] +[:key_held_player_one, 20, 0, 1, 1050, 1417] +[:key_held_player_one, 20, 0, 1, 1051, 1418] +[:key_held_player_one, 20, 0, 1, 1052, 1419] +[:key_up_player_one, 20, 0, 1, 1053, 1420] +[:left_analog_x_player_1, -1000, 0, 1, 1054, 1422] +[:left_analog_x_player_1, 0, 0, 1, 1055, 1423] +[:key_down_raw, 1073742051, 1024, 2, 1056, 1529] +[:key_down_raw, 113, 1024, 2, 1057, 1529] +[:key_up_raw, 113, 1024, 2, 1058, 1529] diff --git a/samples/01_api_99_tech_demo/app/main.rb b/samples/01_api_99_tech_demo/app/main.rb new file mode 100644 index 0000000..dbceab3 --- /dev/null +++ b/samples/01_api_99_tech_demo/app/main.rb @@ -0,0 +1,468 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + For example, if we want to create a new button, we would declare it as a new entity and + then define its properties. (Remember, you can use state to define ANY property and it will + be retained across frames.) + + If you have a solar system and you're creating args.state.sun and setting its image path to an + image in the sprites folder, you would do the following: + (See samples/99_sample_nddnug_workshop for more details.) + + args.state.sun ||= args.state.new_entity(:sun) do |s| + s.path = 'sprites/sun.png' + end + + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + For example, if we have a variable + name = "Ruby" + then the line + puts "How are you, #{name}?" + would print "How are you, Ruby?" to the console. + (Remember, string interpolation only works with double quotes!) + + - Ternary operator (?): Similar to if statement; first evalulates whether a statement is + true or false, and then executes a command depending on that result. + For example, if we had a variable + grade = 75 + and used the ternary operator in the command + pass_or_fail = grade > 65 ? "pass" : "fail" + then the value of pass_or_fail would be "pass" since grade's value was greater than 65. + + Reminders: + + - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). + + - Numeric#shift_(left|right|up|down): Shifts the Numeric in the correct direction + by adding or subracting. + + - ARRAY#inside_rect?: An array with at least two values is considered a point. An array + with at least four values is considered a rect. The inside_rect? function returns true + or false depending on if the point is inside the rect. + + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + + - args.inputs.mouse.click: This property will be set if the mouse was clicked. + For more information about the mouse, go to mygame/documentation/07-mouse.md. + + - args.inputs.keyboard.key_up.KEY: The value of the properties will be set + to the frame that the key_up event occurred (the frame correlates + to args.state.tick_count). + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + + - args.state.labels: + The parameters for a label are + 1. the position (x, y) + 2. the text + 3. the size + 4. the alignment + 5. the color (red, green, and blue saturations) + 6. the alpha (or transparency) + For more information about labels, go to mygame/documentation/02-labels.md. + + - args.state.lines: + The parameters for a line are + 1. the starting position (x, y) + 2. the ending position (x2, y2) + 3. the color (red, green, and blue saturations) + 4. the alpha (or transparency) + For more information about lines, go to mygame/documentation/04-lines.md. + + - args.state.solids (and args.state.borders): + The parameters for a solid (or border) are + 1. the position (x, y) + 2. the width (w) + 3. the height (h) + 4. the color (r, g, b) + 5. the alpha (or transparency) + For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. + + - args.state.sprites: + The parameters for a sprite are + 1. the position (x, y) + 2. the width (w) + 3. the height (h) + 4. the image path + 5. the angle + 6. the alpha (or transparency) + For more information about sprites, go to mygame/documentation/05-sprites.md. +=end + +# This sample app shows different objects that can be used when making games, such as labels, +# lines, sprites, solids, buttons, etc. Each demo section shows how these objects can be used. + +# Also note that state.tick_count refers to the passage of time, or current frame. + +class TechDemo + attr_accessor :inputs, :state, :outputs, :grid, :args + + # Calls all methods necessary for the app to run properly. + def tick + labels_tech_demo + lines_tech_demo + solids_tech_demo + borders_tech_demo + sprites_tech_demo + keyboards_tech_demo + controller_tech_demo + mouse_tech_demo + point_to_rect_tech_demo + rect_to_rect_tech_demo + button_tech_demo + export_game_state_demo + window_state_demo + render_seperators + end + + # Shows output of different kinds of labels on the screen + def labels_tech_demo + outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), "This is a label located at the top left."] + outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), "This is a label located at the bottom left."] + outputs.labels << [ 5, 690, "Labels (x, y, text, size, align, r, g, b, a)"] + outputs.labels << [ 5, 660, "Smaller label.", -2] + outputs.labels << [ 5, 630, "Small label.", -1] + outputs.labels << [ 5, 600, "Medium label.", 0] + outputs.labels << [ 5, 570, "Large label.", 1] + outputs.labels << [ 5, 540, "Larger label.", 2] + outputs.labels << [300, 660, "Left aligned.", 0, 2] + outputs.labels << [300, 640, "Center aligned.", 0, 1] + outputs.labels << [300, 620, "Right aligned.", 0, 0] + outputs.labels << [175, 595, "Red Label.", 0, 0, 255, 0, 0] + outputs.labels << [175, 575, "Green Label.", 0, 0, 0, 255, 0] + outputs.labels << [175, 555, "Blue Label.", 0, 0, 0, 0, 255] + outputs.labels << [175, 535, "Faded Label.", 0, 0, 0, 0, 0, 128] + end + + # Shows output of lines on the screen + def lines_tech_demo + outputs.labels << [5, 500, "Lines (x, y, x2, y2, r, g, b, a)"] + outputs.lines << [5, 450, 100, 450] + outputs.lines << [5, 430, 300, 430] + outputs.lines << [5, 410, 300, 410, state.tick_count % 255, 0, 0, 255] # red saturation changes + outputs.lines << [5, 390 - state.tick_count % 25, 300, 390, 0, 0, 0, 255] # y position changes + outputs.lines << [5 + state.tick_count % 200, 360, 300, 360, 0, 0, 0, 255] # x position changes + end + + # Shows output of different kinds of solids on the screen + def solids_tech_demo + outputs.labels << [ 5, 350, "Solids (x, y, w, h, r, g, b, a)"] + outputs.solids << [ 10, 270, 50, 50] + outputs.solids << [ 70, 270, 50, 50, 0, 0, 0] + outputs.solids << [130, 270, 50, 50, 255, 0, 0] + outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128] + outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes + end + + # Shows output of different kinds of borders on the screen + # The parameters for a border are the same as the parameters for a solid + def borders_tech_demo + outputs.labels << [ 5, 260, "Borders (x, y, w, h, r, g, b, a)"] + outputs.borders << [ 10, 180, 50, 50] + outputs.borders << [ 70, 180, 50, 50, 0, 0, 0] + outputs.borders << [130, 180, 50, 50, 255, 0, 0] + outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128] + outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes + end + + # Shows output of different kinds of sprites on the screen + def sprites_tech_demo + outputs.labels << [ 5, 170, "Sprites (x, y, w, h, path, angle, a)"] + outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png'] + outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes + outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes + end + + # Holds size, alignment, color (black), and alpha (transparency) parameters + # Using small_font as a parameter accounts for all remaining parameters + # so they don't have to be repeatedly typed + def small_font + [-2, 0, 0, 0, 0, 255] + end + + # Sets position of each row + # Converts given row value to pixels that DragonRuby understands + def row_to_px row_number + + # Row 0 starts 5 units below the top of the grid. + # Each row afterward is 20 units lower. + grid.top.shift_down(5).shift_down(20 * row_number) + end + + # Uses labels to output current game time (passage of time), and whether or not "h" was pressed + # If "h" is pressed, the frame is output when the key_up event occurred + def keyboards_tech_demo + outputs.labels << [460, row_to_px(0), "Current game time: #{state.tick_count}", small_font] + outputs.labels << [460, row_to_px(2), "Keyboard input: inputs.keyboard.key_up.h", small_font] + outputs.labels << [460, row_to_px(3), "Press \"h\" on the keyboard.", small_font] + + if inputs.keyboard.key_up.h # if "h" key_up event occurs + state.h_pressed_at = state.tick_count # frame it occurred is stored + end + + # h_pressed_at is initially set to false, and changes once the user presses the "h" key. + state.h_pressed_at ||= false + + if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false) + outputs.labels << [460, row_to_px(4), "\"h\" was pressed at time: #{state.h_pressed_at}", small_font] + else # otherwise, label says "h" was never pressed + outputs.labels << [460, row_to_px(4), "\"h\" has never been pressed.", small_font] + end + + # border around keyboard input demo section + outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)] + end + + # Sets definition for a small label + # Makes it easier to position labels in respect to the position of other labels + def small_label x, row, message + [x, row_to_px(row), message, small_font] + end + + # Uses small labels to show whether the "a" button on the controller is down, held, or up. + # y value of each small label is set by calling the row_to_px method + def controller_tech_demo + x = 460 + outputs.labels << small_label(x, 6, "Controller one input: inputs.controller_one") + outputs.labels << small_label(x, 7, "Current state of the \"a\" button.") + outputs.labels << small_label(x, 8, "Check console window for more info.") + + if inputs.controller_one.key_down.a # if "a" is in "down" state + outputs.labels << small_label(x, 9, "\"a\" button down: #{inputs.controller_one.key_down.a}") + puts "\"a\" button down at #{inputs.controller_one.key_down.a}" # prints frame the event occurred + elsif inputs.controller_one.key_held.a # if "a" is held down + outputs.labels << small_label(x, 9, "\"a\" button held: #{inputs.controller_one.key_held.a}") + elsif inputs.controller_one.key_up.a # if "a" is in up state + outputs.labels << small_label(x, 9, "\"a\" button up: #{inputs.controller_one.key_up.a}") + puts "\"a\" key up at #{inputs.controller_one.key_up.a}" + else # if no event has occurred + outputs.labels << small_label(x, 9, "\"a\" button state is nil.") + end + + # border around controller input demo section + outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)] + end + + # Outputs when the mouse was clicked, as well as the coordinates on the screen + # of where the click occurred + def mouse_tech_demo + x = 460 + + outputs.labels << small_label(x, 11, "Mouse input: inputs.mouse") + + if inputs.mouse.click # if click has a value and is not nil + state.last_mouse_click = inputs.mouse.click # coordinates of click are stored + end + + if state.last_mouse_click # if mouse is clicked (has coordinates as value) + # outputs the time (frame) the click occurred, as well as how many frames have passed since the event + outputs.labels << small_label(x, 12, "Mouse click happened at: #{state.last_mouse_click.created_at}, #{state.last_mouse_click.created_at_elapsed}") + # outputs coordinates of click + outputs.labels << small_label(x, 13, "Mouse click location: #{state.last_mouse_click.point.x}, #{state.last_mouse_click.point.y}") + else # otherwise if the mouse has not been clicked + outputs.labels << small_label(x, 12, "Mouse click has not occurred yet.") + outputs.labels << small_label(x, 13, "Please click mouse.") + end + end + + # Outputs whether a mouse click occurred inside or outside of a box + def point_to_rect_tech_demo + x = 460 + + outputs.labels << small_label(x, 15, "Click inside the blue box maybe ---->") + + box = [765, 370, 50, 50, 0, 0, 170] # blue box + outputs.borders << box + + if state.last_mouse_click # if the mouse was clicked + if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box + outputs.labels << small_label(x, 16, "Mouse click happened inside the box.") + else # otherwise, if mouse was clicked outside the box + outputs.labels << small_label(x, 16, "Mouse click happened outside the box.") + end + else # otherwise, if was not clicked at all + outputs.labels << small_label(x, 16, "Mouse click has not occurred yet.") # output if the mouse was not clicked + end + + # border around mouse input demo section + outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)] + end + + # Outputs a red box onto the screen. A mouse click from the user inside of the red box will output + # a smaller box. If two small boxes are inside of the red box, it will be determined whether or not + # they intersect. + def rect_to_rect_tech_demo + x = 460 + + outputs.labels << small_label(x, 17.5, "Click inside the red box below.") # label with instructions + red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box + outputs.borders << red_box # output as a border (not filled in) + + # If the mouse is clicked inside the red box, two collision boxes are created. + if inputs.mouse.click + if inputs.mouse.click.point.inside_rect? red_box + if !state.box_collision_one # if the collision_one box does not yet have a definition + # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box. + # You can try deleting the subtraction to see how it impacts the box placement. + state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition + elsif !state.box_collision_two # if collision_two does not yet have a definition + state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition + else + state.box_collision_one = nil # both boxes are empty + state.box_collision_two = nil + end + end + end + + # If collision boxes exist, they are output onto screen inside the red box as solids + if state.box_collision_one + outputs.solids << state.box_collision_one + end + + if state.box_collision_two + outputs.solids << state.box_collision_two + end + + # Outputs whether or not the two collision boxes intersect. + if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty) + if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect + outputs.labels << small_label(x, 23.5, 'The boxes intersect.') + else # otherwise, if the two boxes do not intersect + outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.') + end + else + outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output + end + end + + # Creates a button and outputs it onto the screen using labels and borders. + # If the button is clicked, the color changes to make it look faded. + def button_tech_demo + x, y, w, h = 460, 160, 300, 50 + state.button ||= state.new_entity(:button_with_fade) + + # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders. + state.button.label ||= [x + w.half, y + h.half + 10, "click me and watch me fade", 0, 1] + state.button.border ||= [x, y, w, h] + + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border + state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred + end + + outputs.labels << state.button.label + outputs.borders << state.button.border + + if state.button.clicked_at # if button was clicked (variable has a value and is not nil) + + # The appearance of the button changes for 0.25 seconds after the time the button is clicked at. + # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes. + # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal. + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)] + end + end + + # Creates a new button by declaring it as a new entity, and sets values. + def new_button_prefab x, y, message + w, h = 300, 50 + button = state.new_entity(:button_with_fade) + button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders + button.border = [x, y, w, h] # sets border definition + button + end + + # If the mouse has been clicked and the click's location is inside of the button's border, that means + # that the button has been clicked. This method returns a boolean value. + def button_clicked? button + inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border) + end + + # Determines if button was clicked, and changes its appearance if it is clicked + def tick_button_prefab button + outputs.labels << button.label # outputs button's label and border + outputs.borders << button.border + + if button_clicked? button # if button is clicked + button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked + end + + if button.clicked_at # if clicked_at has a frame value and is not nil + # button is output; color changes and transparency changes for 0.25 seconds after click occurs + outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h, + 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds + end + end + + # Exports the app's game state if the export button is clicked. + def export_game_state_demo + state.export_game_state_button ||= new_button_prefab(460, 100, "click to export app state") + tick_button_prefab(state.export_game_state_button) # calls method to output button + if button_clicked? state.export_game_state_button # if the export button is clicked + args.gtk.export! "Exported from clicking the export button in the tech demo." # the export occurs + end + end + + # The mouse and keyboard focus are set to "yes" when the Dragonruby window is the active window. + def window_state_demo + m = $gtk.args.inputs.mouse.has_focus ? 'Y' : 'N' # ternary operator (similar to if statement) + k = $gtk.args.inputs.keyboard.has_focus ? 'Y' : 'N' + outputs.labels << [460, 20, "mouse focus: #{m} keyboard focus: #{k}", small_font] + end + + #Sets values for the horizontal separator (divides demo sections) + def horizontal_seperator y, x, x2 + [x, y, x2, y, 150, 150, 150] + end + + #Sets the values for the vertical separator (divides demo sections) + def vertical_seperator x, y, y2 + [x, y, x, y2, 150, 150, 150] + end + + # Outputs vertical and horizontal separators onto the screen to separate each demo section. + def render_seperators + outputs.lines << horizontal_seperator(505, grid.left, 445) + outputs.lines << horizontal_seperator(353, grid.left, 445) + outputs.lines << horizontal_seperator(264, grid.left, 445) + outputs.lines << horizontal_seperator(174, grid.left, 445) + + outputs.lines << vertical_seperator(445, grid.top, grid.bottom) + + outputs.lines << horizontal_seperator(690, 445, 820) + outputs.lines << horizontal_seperator(426, 445, 820) + + outputs.lines << vertical_seperator(820, grid.top, grid.bottom) + end +end + +$tech_demo = TechDemo.new + +def tick args + $tech_demo.inputs = args.inputs + $tech_demo.state = args.state + $tech_demo.grid = args.grid + $tech_demo.args = args + $tech_demo.outputs = args.render_target(:mini_map) + $tech_demo.tick + args.outputs.labels << [830, 715, "Render target:", [-2, 0, 0, 0, 0, 255]] + args.outputs.sprites << [0, 0, 1280, 720, :mini_map] + args.outputs.sprites << [830, 300, 675, 379, :mini_map] + tick_instructions args, "Sample app shows all the rendering apis available." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/01_api_99_tech_demo/license-for-sample.txt b/samples/01_api_99_tech_demo/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/01_api_99_tech_demo/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/01_api_99_tech_demo/replay.txt b/samples/01_api_99_tech_demo/replay.txt new file mode 100644 index 0000000..523261b --- /dev/null +++ b/samples/01_api_99_tech_demo/replay.txt @@ -0,0 +1,1928 @@ +replay_version 2.0 +stopped_at 3543 +seed 100 +recorded_at Sun Sep 29 21:38:13 2019 +[:mouse_move, 610, 140, 2, 1, 44] +[:mouse_move, 600, 140, 2, 2, 45] +[:mouse_move, 588, 140, 2, 3, 46] +[:mouse_move, 549, 140, 2, 4, 47] +[:mouse_move, 537, 140, 2, 5, 48] +[:mouse_move, 488, 140, 2, 6, 49] +[:mouse_move, 468, 140, 2, 7, 50] +[:mouse_move, 429, 138, 2, 8, 51] +[:mouse_move, 412, 135, 2, 9, 52] +[:mouse_move, 360, 127, 2, 10, 53] +[:mouse_move, 338, 124, 2, 11, 54] +[:mouse_move, 302, 122, 2, 12, 55] +[:mouse_move, 281, 121, 2, 13, 56] +[:mouse_move, 242, 121, 2, 14, 57] +[:mouse_move, 208, 120, 2, 15, 58] +[:mouse_move, 178, 117, 2, 16, 59] +[:mouse_move, 159, 115, 2, 17, 60] +[:mouse_move, 142, 112, 2, 18, 61] +[:mouse_move, 112, 102, 2, 19, 62] +[:mouse_move, 99, 96, 2, 20, 63] +[:mouse_move, 85, 85, 2, 21, 64] +[:mouse_move, 82, 83, 2, 22, 65] +[:mouse_move, 75, 78, 2, 23, 66] +[:mouse_move, 73, 75, 2, 24, 67] +[:mouse_move, 72, 75, 2, 25, 79] +[:mouse_move, 67, 70, 2, 26, 80] +[:mouse_move, 64, 65, 2, 27, 81] +[:mouse_move, 57, 56, 2, 28, 82] +[:mouse_move, 54, 52, 2, 29, 83] +[:mouse_move, 50, 46, 2, 30, 84] +[:mouse_move, 47, 43, 2, 31, 85] +[:mouse_move, 43, 38, 2, 32, 86] +[:mouse_move, 42, 37, 2, 33, 87] +[:mouse_move, 41, 36, 2, 34, 88] +[:mouse_move, 39, 36, 2, 35, 89] +[:mouse_move, 37, 36, 2, 36, 90] +[:mouse_move, 35, 36, 2, 37, 91] +[:mouse_move, 34, 36, 2, 38, 92] +[:mouse_move, 32, 36, 2, 39, 93] +[:mouse_move, 31, 36, 2, 40, 94] +[:mouse_move, 30, 36, 2, 41, 95] +[:mouse_move, 29, 36, 2, 42, 96] +[:mouse_move, 28, 36, 2, 43, 97] +[:mouse_move, 27, 36, 2, 44, 98] +[:mouse_move, 25, 36, 2, 45, 99] +[:mouse_move, 22, 35, 2, 46, 101] +[:mouse_move, 21, 34, 2, 47, 102] +[:mouse_move, 19, 33, 2, 48, 103] +[:mouse_move, 18, 32, 2, 49, 104] +[:mouse_move, 15, 30, 2, 50, 105] +[:mouse_move, 14, 30, 2, 51, 106] +[:mouse_move, 12, 29, 2, 52, 107] +[:mouse_move, 12, 28, 2, 53, 108] +[:mouse_move, 11, 28, 2, 54, 109] +[:mouse_move, 11, 27, 2, 55, 124] +[:mouse_move, 10, 27, 2, 56, 128] +[:mouse_move, 11, 27, 2, 57, 135] +[:mouse_move, 19, 28, 2, 58, 136] +[:mouse_move, 26, 29, 2, 59, 137] +[:mouse_move, 39, 31, 2, 60, 138] +[:mouse_move, 45, 31, 2, 61, 139] +[:mouse_move, 62, 32, 2, 62, 140] +[:mouse_move, 70, 32, 2, 63, 141] +[:mouse_move, 78, 32, 2, 64, 142] +[:mouse_move, 94, 32, 2, 65, 143] +[:mouse_move, 100, 31, 2, 66, 144] +[:mouse_move, 112, 30, 2, 67, 145] +[:mouse_move, 118, 30, 2, 68, 146] +[:mouse_move, 131, 29, 2, 69, 147] +[:mouse_move, 141, 29, 2, 70, 148] +[:mouse_move, 159, 32, 2, 71, 149] +[:mouse_move, 170, 34, 2, 72, 150] +[:mouse_move, 186, 40, 2, 73, 151] +[:mouse_move, 194, 43, 2, 74, 152] +[:mouse_move, 208, 49, 2, 75, 153] +[:mouse_move, 214, 51, 2, 76, 154] +[:mouse_move, 224, 54, 2, 77, 155] +[:mouse_move, 229, 55, 2, 78, 156] +[:mouse_move, 236, 56, 2, 79, 157] +[:mouse_move, 240, 56, 2, 80, 158] +[:mouse_move, 246, 57, 2, 81, 159] +[:mouse_move, 249, 57, 2, 82, 160] +[:mouse_move, 255, 58, 2, 83, 161] +[:mouse_move, 257, 59, 2, 84, 162] +[:mouse_move, 261, 61, 2, 85, 163] +[:mouse_move, 264, 63, 2, 86, 164] +[:mouse_move, 268, 67, 2, 87, 165] +[:mouse_move, 271, 71, 2, 88, 166] +[:mouse_move, 278, 79, 2, 89, 167] +[:mouse_move, 282, 86, 2, 90, 168] +[:mouse_move, 288, 99, 2, 91, 169] +[:mouse_move, 290, 107, 2, 92, 170] +[:mouse_move, 292, 116, 2, 93, 171] +[:mouse_move, 295, 138, 2, 94, 172] +[:mouse_move, 296, 149, 2, 95, 173] +[:mouse_move, 296, 164, 2, 96, 174] +[:mouse_move, 296, 168, 2, 97, 175] +[:mouse_move, 293, 180, 2, 98, 176] +[:mouse_move, 292, 183, 2, 99, 177] +[:mouse_move, 291, 188, 2, 100, 178] +[:mouse_move, 291, 189, 2, 101, 179] +[:mouse_move, 291, 192, 2, 102, 180] +[:mouse_move, 293, 193, 2, 103, 181] +[:mouse_move, 303, 198, 2, 104, 182] +[:mouse_move, 311, 202, 2, 105, 183] +[:mouse_move, 332, 211, 2, 106, 184] +[:mouse_move, 356, 221, 2, 107, 185] +[:mouse_move, 382, 232, 2, 108, 186] +[:mouse_move, 397, 237, 2, 109, 187] +[:mouse_move, 415, 242, 2, 110, 188] +[:mouse_move, 424, 243, 2, 111, 189] +[:mouse_move, 438, 243, 2, 112, 190] +[:mouse_move, 445, 239, 2, 113, 191] +[:mouse_move, 452, 221, 2, 114, 192] +[:mouse_move, 454, 208, 2, 115, 193] +[:mouse_move, 458, 184, 2, 116, 194] +[:mouse_move, 459, 170, 2, 117, 195] +[:mouse_move, 461, 147, 2, 118, 196] +[:mouse_move, 461, 137, 2, 119, 197] +[:mouse_move, 461, 122, 2, 120, 198] +[:mouse_move, 461, 103, 2, 121, 199] +[:mouse_move, 459, 93, 2, 122, 200] +[:mouse_move, 454, 81, 2, 123, 201] +[:mouse_move, 451, 73, 2, 124, 202] +[:mouse_move, 444, 59, 2, 125, 203] +[:mouse_move, 439, 52, 2, 126, 204] +[:mouse_move, 427, 35, 2, 127, 205] +[:mouse_move, 420, 30, 2, 128, 206] +[:mouse_move, 409, 22, 2, 129, 207] +[:mouse_move, 402, 18, 2, 130, 208] +[:mouse_move, 381, 6, 2, 131, 209] +[:mouse_move, 372, 2, 2, 132, 210] +[:mouse_move, 334, 0, 2, 133, 211] +[:mouse_move, 73, 5, 2, 134, 226] +[:mouse_move, 69, 10, 2, 135, 227] +[:mouse_move, 61, 21, 2, 136, 228] +[:mouse_move, 58, 25, 2, 137, 229] +[:mouse_move, 53, 35, 2, 138, 230] +[:mouse_move, 51, 40, 2, 139, 231] +[:mouse_move, 48, 55, 2, 140, 232] +[:mouse_move, 48, 60, 2, 141, 233] +[:mouse_move, 47, 77, 2, 142, 234] +[:mouse_move, 47, 84, 2, 143, 235] +[:mouse_move, 47, 100, 2, 144, 236] +[:mouse_move, 47, 108, 2, 145, 237] +[:mouse_move, 50, 122, 2, 146, 238] +[:mouse_move, 51, 129, 2, 147, 239] +[:mouse_move, 57, 150, 2, 148, 240] +[:mouse_move, 60, 158, 2, 149, 241] +[:mouse_move, 64, 169, 2, 150, 242] +[:mouse_move, 65, 172, 2, 151, 243] +[:mouse_move, 69, 181, 2, 152, 244] +[:mouse_move, 72, 186, 2, 153, 245] +[:mouse_move, 81, 194, 2, 154, 246] +[:mouse_move, 89, 196, 2, 155, 247] +[:mouse_move, 109, 202, 2, 156, 248] +[:mouse_move, 122, 206, 2, 157, 249] +[:mouse_move, 149, 213, 2, 158, 250] +[:mouse_move, 162, 216, 2, 159, 251] +[:mouse_move, 176, 218, 2, 160, 252] +[:mouse_move, 204, 222, 2, 161, 253] +[:mouse_move, 216, 222, 2, 162, 254] +[:mouse_move, 242, 224, 2, 163, 255] +[:mouse_move, 254, 224, 2, 164, 256] +[:mouse_move, 272, 225, 2, 165, 257] +[:mouse_move, 282, 225, 2, 166, 258] +[:mouse_move, 300, 225, 2, 167, 259] +[:mouse_move, 309, 223, 2, 168, 260] +[:mouse_move, 323, 220, 2, 169, 261] +[:mouse_move, 328, 219, 2, 170, 262] +[:mouse_move, 341, 216, 2, 171, 263] +[:mouse_move, 347, 214, 2, 172, 264] +[:mouse_move, 358, 212, 2, 173, 265] +[:mouse_move, 364, 211, 2, 174, 266] +[:mouse_move, 373, 209, 2, 175, 267] +[:mouse_move, 378, 208, 2, 176, 268] +[:mouse_move, 385, 205, 2, 177, 269] +[:mouse_move, 388, 204, 2, 178, 270] +[:mouse_move, 395, 201, 2, 179, 271] +[:mouse_move, 395, 200, 2, 180, 272] +[:mouse_move, 399, 197, 2, 181, 273] +[:mouse_move, 401, 196, 2, 182, 274] +[:mouse_move, 403, 194, 2, 183, 275] +[:mouse_move, 404, 192, 2, 184, 276] +[:mouse_move, 405, 191, 2, 185, 277] +[:mouse_move, 406, 190, 2, 186, 278] +[:mouse_move, 406, 189, 2, 187, 279] +[:mouse_move, 407, 188, 2, 188, 281] +[:mouse_move, 407, 185, 2, 189, 282] +[:mouse_move, 407, 184, 2, 190, 283] +[:mouse_move, 406, 180, 2, 191, 284] +[:mouse_move, 405, 178, 2, 192, 285] +[:mouse_move, 404, 177, 2, 193, 285] +[:mouse_move, 404, 176, 2, 194, 286] +[:mouse_move, 403, 175, 2, 195, 287] +[:mouse_move, 402, 174, 2, 196, 288] +[:mouse_move, 402, 173, 2, 197, 289] +[:mouse_move, 401, 172, 2, 198, 291] +[:mouse_move, 396, 171, 2, 199, 309] +[:mouse_move, 391, 168, 2, 200, 310] +[:mouse_move, 372, 160, 2, 201, 311] +[:mouse_move, 359, 156, 2, 202, 312] +[:mouse_move, 330, 147, 2, 203, 313] +[:mouse_move, 314, 141, 2, 204, 314] +[:mouse_move, 280, 129, 2, 205, 315] +[:mouse_move, 274, 127, 2, 206, 316] +[:mouse_move, 259, 120, 2, 207, 317] +[:mouse_move, 252, 117, 2, 208, 318] +[:mouse_move, 240, 110, 2, 209, 319] +[:mouse_move, 236, 107, 2, 210, 320] +[:mouse_move, 233, 104, 2, 211, 321] +[:mouse_move, 231, 102, 2, 212, 322] +[:mouse_move, 225, 97, 2, 213, 323] +[:mouse_move, 223, 96, 2, 214, 324] +[:mouse_move, 217, 91, 2, 215, 325] +[:mouse_move, 213, 89, 2, 216, 326] +[:mouse_move, 209, 86, 2, 217, 327] +[:mouse_move, 201, 82, 2, 218, 328] +[:mouse_move, 193, 80, 2, 219, 329] +[:mouse_move, 188, 78, 2, 220, 330] +[:mouse_move, 177, 75, 2, 221, 331] +[:mouse_move, 172, 73, 2, 222, 332] +[:mouse_move, 167, 72, 2, 223, 333] +[:mouse_move, 158, 70, 2, 224, 334] +[:mouse_move, 156, 70, 2, 225, 335] +[:mouse_move, 147, 67, 2, 226, 336] +[:mouse_move, 144, 67, 2, 227, 337] +[:mouse_move, 140, 65, 2, 228, 338] +[:mouse_move, 138, 65, 2, 229, 339] +[:mouse_move, 137, 65, 2, 230, 340] +[:mouse_move, 139, 65, 2, 231, 345] +[:mouse_move, 148, 70, 2, 232, 346] +[:mouse_move, 154, 73, 2, 233, 347] +[:mouse_move, 165, 78, 2, 234, 348] +[:mouse_move, 172, 82, 2, 235, 349] +[:mouse_move, 186, 87, 2, 236, 350] +[:mouse_move, 192, 90, 2, 237, 351] +[:mouse_move, 204, 94, 2, 238, 352] +[:mouse_move, 210, 97, 2, 239, 353] +[:mouse_move, 218, 100, 2, 240, 354] +[:mouse_move, 222, 101, 2, 241, 355] +[:mouse_move, 230, 104, 2, 242, 356] +[:mouse_move, 234, 106, 2, 243, 357] +[:mouse_move, 241, 108, 2, 244, 358] +[:mouse_move, 245, 110, 2, 245, 359] +[:mouse_move, 253, 112, 2, 246, 360] +[:mouse_move, 257, 114, 2, 247, 361] +[:mouse_move, 261, 116, 2, 248, 362] +[:mouse_move, 270, 119, 2, 249, 363] +[:mouse_move, 274, 120, 2, 250, 364] +[:mouse_move, 283, 122, 2, 251, 365] +[:mouse_move, 287, 124, 2, 252, 366] +[:mouse_move, 296, 127, 2, 253, 367] +[:mouse_move, 300, 128, 2, 254, 368] +[:mouse_move, 308, 131, 2, 255, 369] +[:mouse_move, 312, 132, 2, 256, 370] +[:mouse_move, 321, 135, 2, 257, 371] +[:mouse_move, 325, 137, 2, 258, 372] +[:mouse_move, 333, 142, 2, 259, 373] +[:mouse_move, 337, 144, 2, 260, 374] +[:mouse_move, 342, 147, 2, 261, 375] +[:mouse_move, 344, 148, 2, 262, 376] +[:mouse_move, 348, 150, 2, 263, 377] +[:mouse_move, 350, 151, 2, 264, 378] +[:mouse_move, 352, 152, 2, 265, 379] +[:mouse_move, 353, 153, 2, 266, 380] +[:mouse_move, 354, 153, 2, 267, 381] +[:mouse_move, 355, 153, 2, 268, 384] +[:mouse_move, 354, 153, 2, 269, 399] +[:mouse_move, 349, 153, 2, 270, 400] +[:mouse_move, 346, 153, 2, 271, 401] +[:mouse_move, 332, 153, 2, 272, 402] +[:mouse_move, 325, 152, 2, 273, 403] +[:mouse_move, 304, 148, 2, 274, 404] +[:mouse_move, 294, 146, 2, 275, 405] +[:mouse_move, 266, 141, 2, 276, 406] +[:mouse_move, 260, 140, 2, 277, 407] +[:mouse_move, 249, 137, 2, 278, 408] +[:mouse_move, 239, 135, 2, 279, 409] +[:mouse_move, 230, 133, 2, 280, 410] +[:mouse_move, 228, 132, 2, 281, 411] +[:mouse_move, 226, 130, 2, 282, 412] +[:mouse_move, 226, 129, 2, 283, 415] +[:mouse_move, 226, 128, 2, 284, 417] +[:mouse_move, 226, 127, 2, 285, 418] +[:mouse_move, 226, 124, 2, 286, 419] +[:mouse_move, 226, 122, 2, 287, 420] +[:mouse_move, 226, 115, 2, 288, 421] +[:mouse_move, 225, 112, 2, 289, 422] +[:mouse_move, 223, 108, 2, 290, 423] +[:mouse_move, 222, 105, 2, 291, 424] +[:mouse_move, 220, 102, 2, 292, 425] +[:mouse_move, 219, 100, 2, 293, 426] +[:mouse_move, 216, 97, 2, 294, 427] +[:mouse_move, 215, 96, 2, 295, 428] +[:mouse_move, 215, 95, 2, 296, 429] +[:mouse_move, 214, 95, 2, 297, 430] +[:mouse_move, 214, 96, 2, 298, 435] +[:mouse_move, 214, 98, 2, 299, 436] +[:mouse_move, 214, 104, 2, 300, 437] +[:mouse_move, 214, 106, 2, 301, 438] +[:mouse_move, 214, 113, 2, 302, 439] +[:mouse_move, 214, 115, 2, 303, 440] +[:mouse_move, 215, 121, 2, 304, 441] +[:mouse_move, 215, 124, 2, 305, 442] +[:mouse_move, 215, 128, 2, 306, 443] +[:mouse_move, 215, 132, 2, 307, 444] +[:mouse_move, 215, 134, 2, 308, 445] +[:mouse_move, 215, 138, 2, 309, 446] +[:mouse_move, 215, 139, 2, 310, 447] +[:mouse_move, 215, 142, 2, 311, 448] +[:mouse_move, 216, 143, 2, 312, 449] +[:mouse_move, 216, 144, 2, 313, 450] +[:mouse_move, 216, 145, 2, 314, 451] +[:mouse_move, 216, 147, 2, 315, 452] +[:mouse_move, 216, 148, 2, 316, 453] +[:mouse_move, 216, 150, 2, 317, 454] +[:mouse_move, 216, 152, 2, 318, 455] +[:mouse_move, 216, 155, 2, 319, 456] +[:mouse_move, 216, 157, 2, 320, 457] +[:mouse_move, 216, 161, 2, 321, 458] +[:mouse_move, 216, 163, 2, 322, 459] +[:mouse_move, 216, 168, 2, 323, 460] +[:mouse_move, 216, 172, 2, 324, 461] +[:mouse_move, 214, 177, 2, 325, 462] +[:mouse_move, 213, 181, 2, 326, 463] +[:mouse_move, 211, 192, 2, 327, 464] +[:mouse_move, 211, 195, 2, 328, 465] +[:mouse_move, 210, 202, 2, 329, 466] +[:mouse_move, 209, 206, 2, 330, 467] +[:mouse_move, 209, 209, 2, 331, 468] +[:mouse_move, 208, 212, 2, 332, 469] +[:mouse_move, 208, 214, 2, 333, 470] +[:mouse_move, 208, 215, 2, 334, 471] +[:mouse_move, 208, 216, 2, 335, 473] +[:mouse_move, 208, 215, 2, 336, 518] +[:mouse_move, 203, 213, 2, 337, 520] +[:mouse_move, 198, 211, 2, 338, 521] +[:mouse_move, 186, 206, 2, 339, 522] +[:mouse_move, 178, 201, 2, 340, 523] +[:mouse_move, 167, 195, 2, 341, 524] +[:mouse_move, 161, 190, 2, 342, 525] +[:mouse_move, 154, 185, 2, 343, 526] +[:mouse_move, 144, 176, 2, 344, 527] +[:mouse_move, 139, 172, 2, 345, 528] +[:mouse_move, 132, 162, 2, 346, 529] +[:mouse_move, 128, 157, 2, 347, 530] +[:mouse_move, 122, 147, 2, 348, 531] +[:mouse_move, 121, 144, 2, 349, 532] +[:mouse_move, 116, 135, 2, 350, 533] +[:mouse_move, 114, 132, 2, 351, 534] +[:mouse_move, 110, 124, 2, 352, 535] +[:mouse_move, 109, 119, 2, 353, 536] +[:mouse_move, 106, 114, 2, 354, 537] +[:mouse_move, 104, 110, 2, 355, 538] +[:mouse_move, 99, 101, 2, 356, 539] +[:mouse_move, 97, 97, 2, 357, 540] +[:mouse_move, 80, 79, 2, 358, 541] +[:mouse_move, 70, 68, 2, 359, 542] +[:mouse_move, 62, 63, 2, 360, 543] +[:mouse_move, 51, 57, 2, 361, 544] +[:mouse_move, 34, 51, 2, 362, 545] +[:mouse_move, 32, 51, 2, 363, 546] +[:mouse_move, 23, 51, 2, 364, 547] +[:mouse_move, 20, 51, 2, 365, 548] +[:mouse_move, 18, 51, 2, 366, 549] +[:mouse_move, 15, 53, 2, 367, 550] +[:mouse_move, 13, 54, 2, 368, 551] +[:mouse_move, 11, 57, 2, 369, 552] +[:mouse_move, 10, 58, 2, 370, 553] +[:mouse_move, 8, 61, 2, 371, 554] +[:mouse_move, 7, 62, 2, 372, 555] +[:mouse_move, 6, 64, 2, 373, 556] +[:mouse_move, 6, 65, 2, 374, 557] +[:mouse_move, 5, 67, 2, 375, 558] +[:mouse_move, 5, 68, 2, 376, 559] +[:mouse_move, 3, 70, 2, 377, 560] +[:mouse_move, 3, 71, 2, 378, 561] +[:mouse_move, 1, 74, 2, 379, 562] +[:mouse_move, 0, 75, 2, 380, 564] +[:mouse_move, 0, 76, 2, 381, 566] +[:mouse_move, 1, 76, 2, 382, 570] +[:mouse_move, 2, 77, 2, 383, 586] +[:mouse_move, 6, 79, 2, 384, 587] +[:mouse_move, 8, 81, 2, 385, 588] +[:mouse_move, 13, 86, 2, 386, 589] +[:mouse_move, 15, 89, 2, 387, 590] +[:mouse_move, 21, 96, 2, 388, 591] +[:mouse_move, 22, 98, 2, 389, 592] +[:mouse_move, 25, 103, 2, 390, 593] +[:mouse_move, 26, 105, 2, 391, 594] +[:mouse_move, 27, 108, 2, 392, 595] +[:mouse_move, 28, 109, 2, 393, 596] +[:mouse_move, 28, 110, 2, 394, 597] +[:mouse_move, 28, 111, 2, 395, 599] +[:mouse_move, 28, 112, 2, 396, 618] +[:mouse_move, 28, 113, 2, 397, 619] +[:mouse_move, 29, 117, 2, 398, 620] +[:mouse_move, 29, 120, 2, 399, 621] +[:mouse_move, 30, 125, 2, 400, 622] +[:mouse_move, 30, 128, 2, 401, 623] +[:mouse_move, 31, 132, 2, 402, 624] +[:mouse_move, 31, 133, 2, 403, 625] +[:mouse_move, 31, 135, 2, 404, 626] +[:mouse_move, 32, 136, 2, 405, 628] +[:mouse_move, 32, 137, 2, 406, 630] +[:mouse_move, 32, 138, 2, 407, 651] +[:mouse_move, 32, 139, 2, 408, 652] +[:mouse_move, 32, 144, 2, 409, 653] +[:mouse_move, 32, 149, 2, 410, 654] +[:mouse_move, 32, 156, 2, 411, 655] +[:mouse_move, 32, 158, 2, 412, 656] +[:mouse_move, 32, 163, 2, 413, 657] +[:mouse_move, 32, 165, 2, 414, 658] +[:mouse_move, 32, 166, 2, 415, 659] +[:mouse_move, 32, 167, 2, 416, 661] +[:mouse_move, 33, 167, 2, 417, 662] +[:mouse_move, 33, 170, 2, 418, 680] +[:mouse_move, 33, 173, 2, 419, 681] +[:mouse_move, 34, 178, 2, 420, 682] +[:mouse_move, 34, 181, 2, 421, 683] +[:mouse_move, 36, 187, 2, 422, 684] +[:mouse_move, 36, 189, 2, 423, 685] +[:mouse_move, 36, 191, 2, 424, 686] +[:mouse_move, 37, 193, 2, 425, 687] +[:mouse_move, 37, 194, 2, 426, 688] +[:mouse_move, 38, 194, 2, 427, 689] +[:mouse_move, 38, 195, 2, 428, 720] +[:mouse_move, 38, 198, 2, 429, 721] +[:mouse_move, 36, 203, 2, 430, 722] +[:mouse_move, 35, 204, 2, 431, 723] +[:mouse_move, 33, 209, 2, 432, 724] +[:mouse_move, 32, 211, 2, 433, 725] +[:mouse_move, 27, 216, 2, 434, 726] +[:mouse_move, 25, 218, 2, 435, 727] +[:mouse_move, 20, 223, 2, 436, 728] +[:mouse_move, 17, 226, 2, 437, 729] +[:mouse_move, 16, 228, 2, 438, 730] +[:mouse_move, 12, 232, 2, 439, 731] +[:mouse_move, 9, 235, 2, 440, 732] +[:mouse_move, 9, 236, 2, 441, 733] +[:mouse_move, 8, 238, 2, 442, 734] +[:mouse_move, 8, 239, 2, 443, 735] +[:mouse_move, 8, 240, 2, 444, 736] +[:mouse_move, 8, 241, 2, 445, 737] +[:mouse_move, 8, 242, 2, 446, 738] +[:mouse_move, 8, 243, 2, 447, 739] +[:mouse_move, 8, 244, 2, 448, 740] +[:mouse_move, 9, 245, 2, 449, 743] +[:mouse_move, 10, 245, 2, 450, 746] +[:mouse_move, 15, 246, 2, 451, 747] +[:mouse_move, 17, 246, 2, 452, 748] +[:mouse_move, 25, 247, 2, 453, 749] +[:mouse_move, 29, 247, 2, 454, 750] +[:mouse_move, 39, 248, 2, 455, 751] +[:mouse_move, 45, 249, 2, 456, 752] +[:mouse_move, 57, 250, 2, 457, 753] +[:mouse_move, 64, 250, 2, 458, 754] +[:mouse_move, 76, 251, 2, 459, 755] +[:mouse_move, 82, 252, 2, 460, 756] +[:mouse_move, 88, 252, 2, 461, 757] +[:mouse_move, 93, 253, 2, 462, 758] +[:mouse_move, 103, 254, 2, 463, 759] +[:mouse_move, 111, 255, 2, 464, 761] +[:mouse_move, 126, 257, 2, 465, 762] +[:mouse_move, 138, 258, 2, 466, 763] +[:mouse_move, 153, 259, 2, 467, 764] +[:mouse_move, 166, 260, 2, 468, 765] +[:mouse_move, 172, 260, 2, 469, 766] +[:mouse_move, 178, 260, 2, 470, 767] +[:mouse_move, 190, 260, 2, 471, 768] +[:mouse_move, 196, 260, 2, 472, 769] +[:mouse_move, 207, 260, 2, 473, 770] +[:mouse_move, 213, 260, 2, 474, 771] +[:mouse_move, 224, 259, 2, 475, 772] +[:mouse_move, 230, 259, 2, 476, 773] +[:mouse_move, 240, 258, 2, 477, 774] +[:mouse_move, 246, 258, 2, 478, 775] +[:mouse_move, 255, 258, 2, 479, 776] +[:mouse_move, 261, 258, 2, 480, 777] +[:mouse_move, 273, 258, 2, 481, 778] +[:mouse_move, 279, 258, 2, 482, 779] +[:mouse_move, 291, 259, 2, 483, 780] +[:mouse_move, 297, 259, 2, 484, 781] +[:mouse_move, 308, 259, 2, 485, 782] +[:mouse_move, 310, 259, 2, 486, 783] +[:mouse_move, 322, 258, 2, 487, 784] +[:mouse_move, 323, 257, 2, 488, 785] +[:mouse_move, 329, 255, 2, 489, 786] +[:mouse_move, 331, 255, 2, 490, 787] +[:mouse_move, 335, 253, 2, 491, 788] +[:mouse_move, 337, 253, 2, 492, 789] +[:mouse_move, 340, 252, 2, 493, 790] +[:mouse_move, 341, 252, 2, 494, 792] +[:mouse_move, 342, 252, 2, 495, 793] +[:mouse_move, 341, 252, 2, 496, 810] +[:mouse_move, 337, 253, 2, 497, 811] +[:mouse_move, 332, 254, 2, 498, 812] +[:mouse_move, 318, 257, 2, 499, 813] +[:mouse_move, 306, 258, 2, 500, 814] +[:mouse_move, 278, 262, 2, 501, 815] +[:mouse_move, 270, 262, 2, 502, 816] +[:mouse_move, 255, 264, 2, 503, 817] +[:mouse_move, 248, 265, 2, 504, 818] +[:mouse_move, 238, 266, 2, 505, 819] +[:mouse_move, 231, 266, 2, 506, 820] +[:mouse_move, 228, 266, 2, 507, 821] +[:mouse_move, 219, 267, 2, 508, 822] +[:mouse_move, 215, 267, 2, 509, 823] +[:mouse_move, 209, 268, 2, 510, 824] +[:mouse_move, 203, 268, 2, 511, 825] +[:mouse_move, 195, 268, 2, 512, 826] +[:mouse_move, 190, 268, 2, 513, 827] +[:mouse_move, 180, 268, 2, 514, 828] +[:mouse_move, 178, 268, 2, 515, 829] +[:mouse_move, 171, 268, 2, 516, 830] +[:mouse_move, 168, 268, 2, 517, 831] +[:mouse_move, 163, 268, 2, 518, 832] +[:mouse_move, 159, 268, 2, 519, 833] +[:mouse_move, 151, 268, 2, 520, 834] +[:mouse_move, 148, 268, 2, 521, 835] +[:mouse_move, 138, 269, 2, 522, 836] +[:mouse_move, 134, 270, 2, 523, 837] +[:mouse_move, 128, 270, 2, 524, 838] +[:mouse_move, 123, 271, 2, 525, 839] +[:mouse_move, 115, 272, 2, 526, 840] +[:mouse_move, 112, 272, 2, 527, 841] +[:mouse_move, 107, 273, 2, 528, 842] +[:mouse_move, 104, 273, 2, 529, 843] +[:mouse_move, 100, 273, 2, 530, 844] +[:mouse_move, 98, 273, 2, 531, 845] +[:mouse_move, 96, 273, 2, 532, 846] +[:mouse_move, 95, 273, 2, 533, 847] +[:mouse_move, 92, 273, 2, 534, 848] +[:mouse_move, 91, 273, 2, 535, 849] +[:mouse_move, 90, 273, 2, 536, 850] +[:mouse_move, 89, 273, 2, 537, 851] +[:mouse_move, 88, 273, 2, 538, 852] +[:mouse_move, 87, 273, 2, 539, 854] +[:mouse_move, 88, 273, 2, 540, 862] +[:mouse_move, 89, 273, 2, 541, 863] +[:mouse_move, 91, 273, 2, 542, 865] +[:mouse_move, 92, 273, 2, 543, 866] +[:mouse_move, 93, 273, 2, 544, 867] +[:mouse_move, 94, 273, 2, 545, 868] +[:mouse_move, 95, 273, 2, 546, 869] +[:mouse_move, 96, 273, 2, 547, 870] +[:mouse_move, 95, 273, 2, 548, 875] +[:mouse_move, 93, 273, 2, 549, 876] +[:mouse_move, 92, 273, 2, 550, 877] +[:mouse_move, 90, 273, 2, 551, 878] +[:mouse_move, 89, 273, 2, 552, 879] +[:mouse_move, 88, 273, 2, 553, 880] +[:mouse_move, 87, 273, 2, 554, 881] +[:mouse_move, 88, 273, 2, 555, 885] +[:mouse_move, 90, 273, 2, 556, 886] +[:mouse_move, 92, 273, 2, 557, 887] +[:mouse_move, 95, 273, 2, 558, 888] +[:mouse_move, 96, 273, 2, 559, 889] +[:mouse_move, 98, 273, 2, 560, 890] +[:mouse_move, 99, 272, 2, 561, 892] +[:mouse_move, 98, 272, 2, 562, 894] +[:mouse_move, 97, 272, 2, 563, 895] +[:mouse_move, 93, 272, 2, 564, 896] +[:mouse_move, 92, 272, 2, 565, 897] +[:mouse_move, 89, 272, 2, 566, 898] +[:mouse_move, 88, 273, 2, 567, 900] +[:mouse_move, 87, 273, 2, 568, 901] +[:mouse_move, 88, 273, 2, 569, 904] +[:mouse_move, 90, 273, 2, 570, 905] +[:mouse_move, 91, 273, 2, 571, 907] +[:mouse_move, 92, 273, 2, 572, 909] +[:mouse_move, 89, 273, 2, 573, 927] +[:mouse_move, 88, 275, 2, 574, 929] +[:mouse_move, 81, 277, 2, 575, 930] +[:mouse_move, 77, 279, 2, 576, 931] +[:mouse_move, 66, 282, 2, 577, 932] +[:mouse_move, 61, 283, 2, 578, 933] +[:mouse_move, 55, 284, 2, 579, 934] +[:mouse_move, 52, 286, 2, 580, 935] +[:mouse_move, 47, 288, 2, 581, 936] +[:mouse_move, 44, 290, 2, 582, 937] +[:mouse_move, 40, 292, 2, 583, 938] +[:mouse_move, 39, 294, 2, 584, 939] +[:mouse_move, 36, 296, 2, 585, 940] +[:mouse_move, 35, 297, 2, 586, 941] +[:mouse_move, 34, 298, 2, 587, 942] +[:mouse_move, 33, 299, 2, 588, 943] +[:mouse_move, 34, 299, 2, 589, 949] +[:mouse_move, 36, 299, 2, 590, 950] +[:mouse_move, 52, 297, 2, 591, 951] +[:mouse_move, 64, 296, 2, 592, 952] +[:mouse_move, 101, 293, 2, 593, 953] +[:mouse_move, 135, 292, 2, 594, 954] +[:mouse_move, 153, 292, 2, 595, 955] +[:mouse_move, 177, 292, 2, 596, 956] +[:mouse_move, 190, 292, 2, 597, 957] +[:mouse_move, 220, 292, 2, 598, 958] +[:mouse_move, 225, 292, 2, 599, 959] +[:mouse_move, 233, 292, 2, 600, 960] +[:mouse_move, 248, 292, 2, 601, 961] +[:mouse_move, 254, 292, 2, 602, 962] +[:mouse_move, 261, 292, 2, 603, 963] +[:mouse_move, 264, 292, 2, 604, 964] +[:mouse_move, 270, 292, 2, 605, 965] +[:mouse_move, 272, 292, 2, 606, 966] +[:mouse_move, 274, 292, 2, 607, 967] +[:mouse_move, 275, 292, 2, 608, 968] +[:mouse_move, 276, 292, 2, 609, 969] +[:mouse_move, 278, 292, 2, 610, 970] +[:mouse_move, 280, 292, 2, 611, 971] +[:mouse_move, 281, 292, 2, 612, 972] +[:mouse_move, 283, 292, 2, 613, 973] +[:mouse_move, 284, 292, 2, 614, 974] +[:mouse_move, 286, 292, 2, 615, 975] +[:mouse_move, 287, 292, 2, 616, 976] +[:mouse_move, 288, 292, 2, 617, 978] +[:mouse_move, 285, 292, 2, 618, 982] +[:mouse_move, 273, 292, 2, 619, 983] +[:mouse_move, 256, 292, 2, 620, 984] +[:mouse_move, 246, 292, 2, 621, 985] +[:mouse_move, 214, 292, 2, 622, 986] +[:mouse_move, 197, 294, 2, 623, 987] +[:mouse_move, 164, 299, 2, 624, 988] +[:mouse_move, 148, 302, 2, 625, 989] +[:mouse_move, 118, 307, 2, 626, 990] +[:mouse_move, 112, 309, 2, 627, 991] +[:mouse_move, 92, 313, 2, 628, 992] +[:mouse_move, 89, 313, 2, 629, 993] +[:mouse_move, 75, 316, 2, 630, 994] +[:mouse_move, 67, 317, 2, 631, 995] +[:mouse_move, 58, 319, 2, 632, 996] +[:mouse_move, 54, 319, 2, 633, 997] +[:mouse_move, 45, 320, 2, 634, 998] +[:mouse_move, 41, 320, 2, 635, 999] +[:mouse_move, 35, 321, 2, 636, 1000] +[:mouse_move, 32, 321, 2, 637, 1001] +[:mouse_move, 28, 321, 2, 638, 1002] +[:mouse_move, 27, 321, 2, 639, 1003] +[:mouse_move, 26, 321, 2, 640, 1004] +[:mouse_move, 25, 321, 2, 641, 1005] +[:mouse_move, 25, 320, 2, 642, 1007] +[:mouse_move, 30, 319, 2, 643, 1008] +[:mouse_move, 35, 318, 2, 644, 1009] +[:mouse_move, 42, 316, 2, 645, 1010] +[:mouse_move, 75, 312, 2, 646, 1011] +[:mouse_move, 105, 309, 2, 647, 1012] +[:mouse_move, 123, 308, 2, 648, 1013] +[:mouse_move, 159, 307, 2, 649, 1015] +[:mouse_move, 169, 307, 2, 650, 1016] +[:mouse_move, 188, 307, 2, 651, 1017] +[:mouse_move, 195, 307, 2, 652, 1018] +[:mouse_move, 208, 307, 2, 653, 1019] +[:mouse_move, 214, 307, 2, 654, 1020] +[:mouse_move, 226, 307, 2, 655, 1021] +[:mouse_move, 232, 307, 2, 656, 1022] +[:mouse_move, 244, 307, 2, 657, 1023] +[:mouse_move, 249, 307, 2, 658, 1024] +[:mouse_move, 260, 307, 2, 659, 1025] +[:mouse_move, 262, 307, 2, 660, 1026] +[:mouse_move, 271, 307, 2, 661, 1027] +[:mouse_move, 274, 306, 2, 662, 1028] +[:mouse_move, 279, 306, 2, 663, 1029] +[:mouse_move, 281, 306, 2, 664, 1030] +[:mouse_move, 282, 306, 2, 665, 1031] +[:mouse_move, 283, 306, 2, 666, 1032] +[:mouse_move, 284, 306, 2, 667, 1034] +[:mouse_move, 283, 306, 2, 668, 1042] +[:mouse_move, 280, 306, 2, 669, 1043] +[:mouse_move, 267, 306, 2, 670, 1044] +[:mouse_move, 257, 306, 2, 671, 1045] +[:mouse_move, 222, 310, 2, 672, 1046] +[:mouse_move, 204, 313, 2, 673, 1047] +[:mouse_move, 167, 321, 2, 674, 1048] +[:mouse_move, 150, 325, 2, 675, 1049] +[:mouse_move, 127, 331, 2, 676, 1050] +[:mouse_move, 116, 335, 2, 677, 1051] +[:mouse_move, 99, 340, 2, 678, 1052] +[:mouse_move, 96, 340, 2, 679, 1053] +[:mouse_move, 82, 345, 2, 680, 1054] +[:mouse_move, 78, 346, 2, 681, 1055] +[:mouse_move, 71, 348, 2, 682, 1056] +[:mouse_move, 67, 349, 2, 683, 1057] +[:mouse_move, 59, 352, 2, 684, 1058] +[:mouse_move, 55, 352, 2, 685, 1059] +[:mouse_move, 49, 354, 2, 686, 1060] +[:mouse_move, 46, 354, 2, 687, 1061] +[:mouse_move, 41, 355, 2, 688, 1062] +[:mouse_move, 39, 355, 2, 689, 1063] +[:mouse_move, 31, 355, 2, 690, 1064] +[:mouse_move, 29, 356, 2, 691, 1065] +[:mouse_move, 26, 356, 2, 692, 1066] +[:mouse_move, 21, 356, 2, 693, 1067] +[:mouse_move, 18, 357, 2, 694, 1068] +[:mouse_move, 14, 357, 2, 695, 1069] +[:mouse_move, 13, 357, 2, 696, 1070] +[:mouse_move, 11, 357, 2, 697, 1071] +[:mouse_move, 10, 357, 2, 698, 1072] +[:mouse_move, 17, 356, 2, 699, 1077] +[:mouse_move, 23, 355, 2, 700, 1078] +[:mouse_move, 42, 351, 2, 701, 1079] +[:mouse_move, 47, 350, 2, 702, 1080] +[:mouse_move, 67, 346, 2, 703, 1081] +[:mouse_move, 76, 344, 2, 704, 1082] +[:mouse_move, 92, 341, 2, 705, 1083] +[:mouse_move, 100, 340, 2, 706, 1084] +[:mouse_move, 115, 339, 2, 707, 1085] +[:mouse_move, 123, 338, 2, 708, 1086] +[:mouse_move, 137, 337, 2, 709, 1087] +[:mouse_move, 144, 337, 2, 710, 1088] +[:mouse_move, 157, 336, 2, 711, 1089] +[:mouse_move, 163, 335, 2, 712, 1090] +[:mouse_move, 178, 333, 2, 713, 1091] +[:mouse_move, 182, 332, 2, 714, 1092] +[:mouse_move, 196, 330, 2, 715, 1093] +[:mouse_move, 203, 329, 2, 716, 1094] +[:mouse_move, 210, 328, 2, 717, 1095] +[:mouse_move, 222, 327, 2, 718, 1096] +[:mouse_move, 227, 326, 2, 719, 1097] +[:mouse_move, 237, 324, 2, 720, 1098] +[:mouse_move, 240, 324, 2, 721, 1099] +[:mouse_move, 246, 324, 2, 722, 1100] +[:mouse_move, 249, 324, 2, 723, 1101] +[:mouse_move, 252, 324, 2, 724, 1102] +[:mouse_move, 254, 324, 2, 725, 1103] +[:mouse_move, 256, 324, 2, 726, 1104] +[:mouse_move, 258, 324, 2, 727, 1105] +[:mouse_move, 261, 325, 2, 728, 1106] +[:mouse_move, 263, 325, 2, 729, 1107] +[:mouse_move, 266, 326, 2, 730, 1108] +[:mouse_move, 269, 327, 2, 731, 1109] +[:mouse_move, 275, 328, 2, 732, 1110] +[:mouse_move, 278, 329, 2, 733, 1111] +[:mouse_move, 283, 330, 2, 734, 1112] +[:mouse_move, 286, 332, 2, 735, 1113] +[:mouse_move, 291, 333, 2, 736, 1114] +[:mouse_move, 293, 334, 2, 737, 1115] +[:mouse_move, 297, 334, 2, 738, 1116] +[:mouse_move, 298, 334, 2, 739, 1117] +[:mouse_move, 300, 334, 2, 740, 1118] +[:mouse_move, 301, 334, 2, 741, 1119] +[:mouse_move, 302, 334, 2, 742, 1121] +[:mouse_move, 301, 334, 2, 743, 1135] +[:mouse_move, 301, 335, 2, 744, 1136] +[:mouse_move, 299, 335, 2, 745, 1137] +[:mouse_move, 297, 336, 2, 746, 1138] +[:mouse_move, 286, 340, 2, 747, 1139] +[:mouse_move, 278, 342, 2, 748, 1140] +[:mouse_move, 256, 350, 2, 749, 1141] +[:mouse_move, 244, 353, 2, 750, 1142] +[:mouse_move, 220, 361, 2, 751, 1143] +[:mouse_move, 215, 361, 2, 752, 1144] +[:mouse_move, 194, 364, 2, 753, 1145] +[:mouse_move, 186, 366, 2, 754, 1146] +[:mouse_move, 169, 367, 2, 755, 1147] +[:mouse_move, 163, 367, 2, 756, 1148] +[:mouse_move, 160, 367, 2, 757, 1149] +[:mouse_move, 151, 368, 2, 758, 1150] +[:mouse_move, 147, 368, 2, 759, 1151] +[:mouse_move, 142, 368, 2, 760, 1152] +[:mouse_move, 140, 368, 2, 761, 1153] +[:mouse_move, 137, 369, 2, 762, 1154] +[:mouse_move, 136, 369, 2, 763, 1156] +[:mouse_move, 139, 369, 2, 764, 1160] +[:mouse_move, 144, 368, 2, 765, 1161] +[:mouse_move, 154, 368, 2, 766, 1162] +[:mouse_move, 161, 368, 2, 767, 1163] +[:mouse_move, 174, 367, 2, 768, 1164] +[:mouse_move, 177, 366, 2, 769, 1165] +[:mouse_move, 190, 366, 2, 770, 1166] +[:mouse_move, 193, 366, 2, 771, 1167] +[:mouse_move, 201, 366, 2, 772, 1168] +[:mouse_move, 205, 366, 2, 773, 1169] +[:mouse_move, 210, 366, 2, 774, 1170] +[:mouse_move, 213, 366, 2, 775, 1171] +[:mouse_move, 219, 366, 2, 776, 1172] +[:mouse_move, 222, 366, 2, 777, 1173] +[:mouse_move, 228, 366, 2, 778, 1174] +[:mouse_move, 231, 366, 2, 779, 1175] +[:mouse_move, 234, 366, 2, 780, 1176] +[:mouse_move, 242, 366, 2, 781, 1177] +[:mouse_move, 245, 366, 2, 782, 1178] +[:mouse_move, 253, 367, 2, 783, 1179] +[:mouse_move, 257, 367, 2, 784, 1180] +[:mouse_move, 262, 367, 2, 785, 1181] +[:mouse_move, 265, 367, 2, 786, 1182] +[:mouse_move, 269, 367, 2, 787, 1183] +[:mouse_move, 271, 367, 2, 788, 1184] +[:mouse_move, 274, 368, 2, 789, 1185] +[:mouse_move, 275, 368, 2, 790, 1187] +[:mouse_move, 274, 368, 2, 791, 1255] +[:mouse_move, 270, 369, 2, 792, 1256] +[:mouse_move, 265, 371, 2, 793, 1257] +[:mouse_move, 239, 380, 2, 794, 1258] +[:mouse_move, 231, 383, 2, 795, 1259] +[:mouse_move, 199, 391, 2, 796, 1260] +[:mouse_move, 181, 395, 2, 797, 1261] +[:mouse_move, 146, 400, 2, 798, 1262] +[:mouse_move, 129, 401, 2, 799, 1263] +[:mouse_move, 112, 401, 2, 800, 1264] +[:mouse_move, 109, 401, 2, 801, 1265] +[:mouse_move, 98, 401, 2, 802, 1266] +[:mouse_move, 95, 401, 2, 803, 1267] +[:mouse_move, 90, 401, 2, 804, 1268] +[:mouse_move, 87, 401, 2, 805, 1269] +[:mouse_move, 83, 402, 2, 806, 1270] +[:mouse_move, 80, 403, 2, 807, 1271] +[:mouse_move, 73, 405, 2, 808, 1272] +[:mouse_move, 71, 405, 2, 809, 1273] +[:mouse_move, 63, 408, 2, 810, 1274] +[:mouse_move, 59, 410, 2, 811, 1275] +[:mouse_move, 52, 412, 2, 812, 1276] +[:mouse_move, 50, 412, 2, 813, 1277] +[:mouse_move, 45, 413, 2, 814, 1278] +[:mouse_move, 44, 414, 2, 815, 1279] +[:mouse_move, 41, 414, 2, 816, 1280] +[:mouse_move, 40, 414, 2, 817, 1283] +[:mouse_move, 41, 414, 2, 818, 1289] +[:mouse_move, 41, 415, 2, 819, 1290] +[:mouse_move, 45, 416, 2, 820, 1291] +[:mouse_move, 48, 416, 2, 821, 1292] +[:mouse_move, 56, 417, 2, 822, 1293] +[:mouse_move, 61, 418, 2, 823, 1294] +[:mouse_move, 69, 419, 2, 824, 1295] +[:mouse_move, 71, 419, 2, 825, 1296] +[:mouse_move, 78, 420, 2, 826, 1297] +[:mouse_move, 80, 420, 2, 827, 1298] +[:mouse_move, 83, 420, 2, 828, 1299] +[:mouse_move, 84, 420, 2, 829, 1301] +[:mouse_move, 85, 420, 2, 830, 1302] +[:mouse_move, 86, 420, 2, 831, 1308] +[:mouse_move, 87, 420, 2, 832, 1310] +[:mouse_move, 88, 421, 2, 833, 1311] +[:mouse_move, 92, 422, 2, 834, 1312] +[:mouse_move, 95, 423, 2, 835, 1313] +[:mouse_move, 101, 425, 2, 836, 1314] +[:mouse_move, 105, 425, 2, 837, 1315] +[:mouse_move, 114, 427, 2, 838, 1316] +[:mouse_move, 119, 427, 2, 839, 1317] +[:mouse_move, 125, 427, 2, 840, 1318] +[:mouse_move, 128, 427, 2, 841, 1319] +[:mouse_move, 132, 427, 2, 842, 1320] +[:mouse_move, 133, 427, 2, 843, 1321] +[:mouse_move, 134, 427, 2, 844, 1322] +[:mouse_move, 135, 426, 2, 845, 1323] +[:mouse_move, 136, 425, 2, 846, 1326] +[:mouse_move, 137, 426, 2, 847, 1332] +[:mouse_move, 139, 427, 2, 848, 1333] +[:mouse_move, 145, 432, 2, 849, 1334] +[:mouse_move, 149, 435, 2, 850, 1335] +[:mouse_move, 158, 439, 2, 851, 1336] +[:mouse_move, 162, 440, 2, 852, 1337] +[:mouse_move, 173, 441, 2, 853, 1338] +[:mouse_move, 176, 441, 2, 854, 1339] +[:mouse_move, 185, 435, 2, 855, 1341] +[:mouse_move, 186, 433, 2, 856, 1342] +[:mouse_move, 189, 429, 2, 857, 1343] +[:mouse_move, 190, 428, 2, 858, 1344] +[:mouse_move, 191, 426, 2, 859, 1345] +[:mouse_move, 191, 425, 2, 860, 1346] +[:mouse_move, 192, 425, 2, 861, 1351] +[:mouse_move, 193, 425, 2, 862, 1354] +[:mouse_move, 196, 428, 2, 863, 1355] +[:mouse_move, 198, 429, 2, 864, 1356] +[:mouse_move, 202, 431, 2, 865, 1357] +[:mouse_move, 205, 432, 2, 866, 1358] +[:mouse_move, 209, 432, 2, 867, 1359] +[:mouse_move, 211, 432, 2, 868, 1360] +[:mouse_move, 214, 431, 2, 869, 1361] +[:mouse_move, 216, 430, 2, 870, 1362] +[:mouse_move, 218, 428, 2, 871, 1363] +[:mouse_move, 219, 426, 2, 872, 1364] +[:mouse_move, 220, 425, 2, 873, 1365] +[:mouse_move, 220, 424, 2, 874, 1366] +[:mouse_move, 221, 423, 2, 875, 1368] +[:mouse_move, 222, 424, 2, 876, 1374] +[:mouse_move, 224, 425, 2, 877, 1375] +[:mouse_move, 230, 429, 2, 878, 1376] +[:mouse_move, 234, 431, 2, 879, 1377] +[:mouse_move, 247, 437, 2, 880, 1378] +[:mouse_move, 254, 439, 2, 881, 1379] +[:mouse_move, 266, 440, 2, 882, 1380] +[:mouse_move, 271, 440, 2, 883, 1381] +[:mouse_move, 279, 437, 2, 884, 1382] +[:mouse_move, 282, 435, 2, 885, 1383] +[:mouse_move, 284, 432, 2, 886, 1384] +[:mouse_move, 285, 430, 2, 887, 1385] +[:mouse_move, 285, 429, 2, 888, 1386] +[:mouse_move, 285, 428, 2, 889, 1387] +[:mouse_move, 285, 427, 2, 890, 1388] +[:mouse_move, 285, 428, 2, 891, 1424] +[:mouse_move, 286, 433, 2, 892, 1425] +[:mouse_move, 289, 439, 2, 893, 1426] +[:mouse_move, 291, 442, 2, 894, 1427] +[:mouse_move, 295, 448, 2, 895, 1428] +[:mouse_move, 297, 450, 2, 896, 1429] +[:mouse_move, 304, 453, 2, 897, 1430] +[:mouse_move, 308, 454, 2, 898, 1431] +[:mouse_move, 316, 453, 2, 899, 1432] +[:mouse_move, 320, 450, 2, 900, 1433] +[:mouse_move, 327, 443, 2, 901, 1434] +[:mouse_move, 330, 438, 2, 902, 1435] +[:mouse_move, 332, 432, 2, 903, 1436] +[:mouse_move, 333, 425, 2, 904, 1437] +[:mouse_move, 333, 420, 2, 905, 1438] +[:mouse_move, 332, 418, 2, 906, 1439] +[:mouse_move, 330, 414, 2, 907, 1440] +[:mouse_move, 328, 412, 2, 908, 1441] +[:mouse_move, 325, 409, 2, 909, 1442] +[:mouse_move, 319, 406, 2, 910, 1443] +[:mouse_move, 312, 405, 2, 911, 1444] +[:mouse_move, 308, 404, 2, 912, 1445] +[:mouse_move, 305, 404, 2, 913, 1446] +[:mouse_move, 300, 403, 2, 914, 1447] +[:mouse_move, 296, 403, 2, 915, 1448] +[:mouse_move, 289, 403, 2, 916, 1449] +[:mouse_move, 285, 403, 2, 917, 1450] +[:mouse_move, 279, 404, 2, 918, 1451] +[:mouse_move, 276, 405, 2, 919, 1452] +[:mouse_move, 270, 407, 2, 920, 1453] +[:mouse_move, 268, 409, 2, 921, 1454] +[:mouse_move, 265, 411, 2, 922, 1455] +[:mouse_move, 262, 413, 2, 923, 1456] +[:mouse_move, 259, 417, 2, 924, 1457] +[:mouse_move, 259, 419, 2, 925, 1458] +[:mouse_move, 257, 422, 2, 926, 1459] +[:mouse_move, 256, 424, 2, 927, 1460] +[:mouse_move, 256, 427, 2, 928, 1461] +[:mouse_move, 256, 428, 2, 929, 1462] +[:mouse_move, 256, 430, 2, 930, 1463] +[:mouse_move, 256, 432, 2, 931, 1464] +[:mouse_move, 257, 435, 2, 932, 1465] +[:mouse_move, 258, 436, 2, 933, 1466] +[:mouse_move, 261, 438, 2, 934, 1467] +[:mouse_move, 262, 439, 2, 935, 1468] +[:mouse_move, 265, 442, 2, 936, 1469] +[:mouse_move, 270, 443, 2, 937, 1470] +[:mouse_move, 273, 445, 2, 938, 1471] +[:mouse_move, 277, 446, 2, 939, 1472] +[:mouse_move, 285, 447, 2, 940, 1473] +[:mouse_move, 290, 447, 2, 941, 1474] +[:mouse_move, 298, 447, 2, 942, 1476] +[:mouse_move, 300, 446, 2, 943, 1478] +[:mouse_move, 301, 445, 2, 944, 1479] +[:mouse_move, 301, 444, 2, 945, 1480] +[:mouse_move, 302, 443, 2, 946, 1481] +[:mouse_move, 303, 444, 2, 947, 1539] +[:mouse_move, 304, 450, 2, 948, 1540] +[:mouse_move, 305, 455, 2, 949, 1541] +[:mouse_move, 307, 465, 2, 950, 1542] +[:mouse_move, 308, 471, 2, 951, 1543] +[:mouse_move, 310, 486, 2, 952, 1544] +[:mouse_move, 311, 512, 2, 953, 1546] +[:mouse_move, 311, 529, 2, 954, 1547] +[:mouse_move, 310, 538, 2, 955, 1548] +[:mouse_move, 307, 546, 2, 956, 1549] +[:mouse_move, 305, 553, 2, 957, 1550] +[:mouse_move, 301, 561, 2, 958, 1551] +[:mouse_move, 294, 573, 2, 959, 1553] +[:mouse_move, 280, 588, 2, 960, 1554] +[:mouse_move, 269, 596, 2, 961, 1555] +[:mouse_move, 264, 599, 2, 962, 1556] +[:mouse_move, 258, 602, 2, 963, 1557] +[:mouse_move, 239, 608, 2, 964, 1558] +[:mouse_move, 221, 612, 2, 965, 1559] +[:mouse_move, 211, 613, 2, 966, 1560] +[:mouse_move, 191, 615, 2, 967, 1561] +[:mouse_move, 179, 617, 2, 968, 1562] +[:mouse_move, 162, 618, 2, 969, 1563] +[:mouse_move, 152, 619, 2, 970, 1564] +[:mouse_move, 133, 622, 2, 971, 1565] +[:mouse_move, 124, 624, 2, 972, 1566] +[:mouse_move, 109, 628, 2, 973, 1567] +[:mouse_move, 97, 632, 2, 974, 1568] +[:mouse_move, 92, 634, 2, 975, 1569] +[:mouse_move, 87, 635, 2, 976, 1570] +[:mouse_move, 79, 638, 2, 977, 1571] +[:mouse_move, 71, 640, 2, 978, 1572] +[:mouse_move, 67, 641, 2, 979, 1573] +[:mouse_move, 64, 642, 2, 980, 1574] +[:mouse_move, 59, 642, 2, 981, 1575] +[:mouse_move, 56, 643, 2, 982, 1576] +[:mouse_move, 53, 644, 2, 983, 1577] +[:mouse_move, 51, 644, 2, 984, 1578] +[:mouse_move, 50, 644, 2, 985, 1579] +[:mouse_move, 51, 644, 2, 986, 1582] +[:mouse_move, 53, 645, 2, 987, 1583] +[:mouse_move, 54, 645, 2, 988, 1584] +[:mouse_move, 57, 645, 2, 989, 1585] +[:mouse_move, 64, 647, 2, 990, 1586] +[:mouse_move, 68, 647, 2, 991, 1587] +[:mouse_move, 78, 648, 2, 992, 1588] +[:mouse_move, 84, 648, 2, 993, 1589] +[:mouse_move, 87, 649, 2, 994, 1590] +[:mouse_move, 90, 649, 2, 995, 1591] +[:mouse_move, 98, 649, 2, 996, 1592] +[:mouse_move, 100, 649, 2, 997, 1593] +[:mouse_move, 107, 650, 2, 998, 1594] +[:mouse_move, 110, 650, 2, 999, 1595] +[:mouse_move, 114, 650, 2, 1000, 1596] +[:mouse_move, 116, 650, 2, 1001, 1597] +[:mouse_move, 121, 650, 2, 1002, 1598] +[:mouse_move, 124, 650, 2, 1003, 1599] +[:mouse_move, 130, 650, 2, 1004, 1600] +[:mouse_move, 134, 650, 2, 1005, 1601] +[:mouse_move, 141, 650, 2, 1006, 1602] +[:mouse_move, 143, 650, 2, 1007, 1603] +[:mouse_move, 149, 649, 2, 1008, 1604] +[:mouse_move, 155, 649, 2, 1009, 1605] +[:mouse_move, 162, 648, 2, 1010, 1606] +[:mouse_move, 166, 648, 2, 1011, 1607] +[:mouse_move, 172, 647, 2, 1012, 1608] +[:mouse_move, 175, 647, 2, 1013, 1609] +[:mouse_move, 178, 647, 2, 1014, 1610] +[:mouse_move, 187, 646, 2, 1015, 1611] +[:mouse_move, 195, 646, 2, 1016, 1613] +[:mouse_move, 198, 646, 2, 1017, 1614] +[:mouse_move, 203, 646, 2, 1018, 1615] +[:mouse_move, 209, 646, 2, 1019, 1616] +[:mouse_move, 212, 646, 2, 1020, 1617] +[:mouse_move, 215, 646, 2, 1021, 1618] +[:mouse_move, 220, 646, 2, 1022, 1619] +[:mouse_move, 224, 646, 2, 1023, 1620] +[:mouse_move, 230, 646, 2, 1024, 1621] +[:mouse_move, 233, 646, 2, 1025, 1622] +[:mouse_move, 238, 646, 2, 1026, 1623] +[:mouse_move, 242, 646, 2, 1027, 1624] +[:mouse_move, 248, 646, 2, 1028, 1625] +[:mouse_move, 253, 646, 2, 1029, 1626] +[:mouse_move, 258, 646, 2, 1030, 1627] +[:mouse_move, 262, 646, 2, 1031, 1628] +[:mouse_move, 269, 647, 2, 1032, 1629] +[:mouse_move, 277, 648, 2, 1033, 1630] +[:mouse_move, 281, 648, 2, 1034, 1631] +[:mouse_move, 285, 649, 2, 1035, 1632] +[:mouse_move, 295, 650, 2, 1036, 1633] +[:mouse_move, 300, 650, 2, 1037, 1634] +[:mouse_move, 313, 650, 2, 1038, 1635] +[:mouse_move, 326, 650, 2, 1039, 1636] +[:mouse_move, 332, 650, 2, 1040, 1637] +[:mouse_move, 338, 650, 2, 1041, 1638] +[:mouse_move, 343, 650, 2, 1042, 1639] +[:mouse_move, 354, 650, 2, 1043, 1640] +[:mouse_move, 356, 650, 2, 1044, 1641] +[:mouse_move, 362, 650, 2, 1045, 1642] +[:mouse_move, 364, 650, 2, 1046, 1643] +[:mouse_move, 368, 650, 2, 1047, 1644] +[:mouse_move, 369, 650, 2, 1048, 1645] +[:mouse_move, 370, 650, 2, 1049, 1648] +[:mouse_move, 370, 649, 2, 1050, 1668] +[:mouse_move, 370, 648, 2, 1051, 1669] +[:mouse_move, 370, 647, 2, 1052, 1670] +[:mouse_move, 370, 644, 2, 1053, 1671] +[:mouse_move, 371, 641, 2, 1054, 1672] +[:mouse_move, 378, 627, 2, 1055, 1673] +[:mouse_move, 386, 613, 2, 1056, 1674] +[:mouse_move, 394, 599, 2, 1057, 1675] +[:mouse_move, 400, 589, 2, 1058, 1676] +[:mouse_move, 411, 567, 2, 1059, 1677] +[:mouse_move, 416, 558, 2, 1060, 1678] +[:mouse_move, 427, 537, 2, 1061, 1679] +[:mouse_move, 437, 513, 2, 1062, 1680] +[:mouse_move, 439, 507, 2, 1063, 1681] +[:mouse_move, 445, 496, 2, 1064, 1682] +[:mouse_move, 460, 470, 2, 1065, 1683] +[:mouse_move, 466, 463, 2, 1066, 1684] +[:mouse_move, 482, 445, 2, 1067, 1685] +[:mouse_move, 489, 436, 2, 1068, 1686] +[:mouse_move, 502, 416, 2, 1069, 1687] +[:mouse_move, 507, 405, 2, 1070, 1688] +[:mouse_move, 515, 379, 2, 1071, 1689] +[:mouse_move, 518, 364, 2, 1072, 1690] +[:mouse_move, 526, 334, 2, 1073, 1691] +[:mouse_move, 533, 305, 2, 1074, 1692] +[:mouse_move, 536, 291, 2, 1075, 1693] +[:mouse_move, 540, 276, 2, 1076, 1694] +[:mouse_move, 546, 245, 2, 1077, 1695] +[:mouse_move, 549, 230, 2, 1078, 1696] +[:mouse_move, 551, 211, 2, 1079, 1697] +[:mouse_move, 553, 201, 2, 1080, 1698] +[:mouse_move, 554, 191, 2, 1081, 1699] +[:mouse_move, 555, 172, 2, 1082, 1700] +[:mouse_move, 555, 165, 2, 1083, 1701] +[:mouse_move, 555, 158, 2, 1084, 1702] +[:mouse_move, 555, 150, 2, 1085, 1703] +[:mouse_move, 556, 133, 2, 1086, 1704] +[:mouse_move, 557, 128, 2, 1087, 1705] +[:mouse_move, 558, 118, 2, 1088, 1706] +[:mouse_move, 559, 113, 2, 1089, 1707] +[:mouse_move, 562, 101, 2, 1090, 1708] +[:mouse_move, 563, 94, 2, 1091, 1709] +[:mouse_move, 565, 88, 2, 1092, 1710] +[:mouse_move, 567, 81, 2, 1093, 1711] +[:mouse_move, 570, 73, 2, 1094, 1712] +[:mouse_move, 571, 71, 2, 1095, 1713] +[:mouse_move, 571, 68, 2, 1096, 1714] +[:mouse_move, 572, 68, 2, 1097, 1715] +[:mouse_move, 572, 67, 2, 1098, 1716] +[:mouse_move, 572, 68, 2, 1099, 1726] +[:mouse_move, 571, 68, 2, 1100, 1729] +[:mouse_move, 570, 69, 2, 1101, 1732] +[:mouse_move, 570, 70, 2, 1102, 1734] +[:mouse_move, 570, 71, 2, 1103, 1737] +[:mouse_move, 570, 72, 2, 1104, 1739] +[:key_down_raw, 104, 0, 2, 1105, 1790] +[:key_up_raw, 104, 0, 2, 1106, 1795] +[:key_down_raw, 104, 0, 2, 1107, 1829] +[:key_up_raw, 104, 0, 2, 1108, 1834] +[:key_down_raw, 104, 0, 2, 1109, 1840] +[:key_up_raw, 104, 0, 2, 1110, 1845] +[:key_down_raw, 104, 0, 2, 1111, 1850] +[:key_up_raw, 104, 0, 2, 1112, 1853] +[:key_down_raw, 104, 0, 2, 1113, 1858] +[:key_up_raw, 104, 0, 2, 1114, 1864] +[:mouse_move, 579, 93, 2, 1115, 1898] +[:mouse_move, 607, 151, 2, 1116, 1899] +[:mouse_move, 624, 185, 2, 1117, 1900] +[:mouse_move, 630, 197, 2, 1118, 1901] +[:mouse_move, 637, 214, 2, 1119, 1902] +[:mouse_move, 639, 217, 2, 1120, 1903] +[:mouse_move, 641, 220, 2, 1121, 1904] +[:mouse_move, 644, 215, 2, 1122, 1913] +[:mouse_move, 646, 211, 2, 1123, 1914] +[:mouse_move, 649, 207, 2, 1124, 1915] +[:mouse_move, 652, 201, 2, 1125, 1916] +[:mouse_move, 654, 196, 2, 1126, 1917] +[:mouse_move, 654, 194, 2, 1127, 1918] +[:mouse_move, 655, 192, 2, 1128, 1919] +[:mouse_move, 647, 192, 2, 1129, 1922] +[:mouse_move, 630, 196, 2, 1130, 1923] +[:mouse_move, 623, 197, 2, 1131, 1924] +[:mouse_move, 605, 202, 2, 1132, 1925] +[:mouse_move, 601, 203, 2, 1133, 1926] +[:mouse_move, 596, 204, 2, 1134, 1927] +[:mouse_move, 591, 205, 2, 1135, 1928] +[:mouse_move, 590, 205, 2, 1136, 1929] +[:mouse_move, 599, 205, 2, 1137, 1930] +[:mouse_move, 606, 205, 2, 1138, 1931] +[:mouse_move, 632, 200, 2, 1139, 1932] +[:mouse_move, 657, 192, 2, 1140, 1933] +[:mouse_move, 661, 190, 2, 1141, 1934] +[:mouse_move, 670, 185, 2, 1142, 1935] +[:mouse_move, 672, 184, 2, 1143, 1936] +[:mouse_move, 680, 176, 2, 1144, 1937] +[:mouse_move, 680, 174, 2, 1145, 1938] +[:mouse_move, 676, 172, 2, 1146, 1939] +[:mouse_move, 659, 171, 2, 1147, 1940] +[:mouse_move, 647, 170, 2, 1148, 1941] +[:mouse_move, 638, 169, 2, 1149, 1942] +[:mouse_move, 632, 168, 2, 1150, 1943] +[:mouse_move, 625, 167, 2, 1151, 1944] +[:mouse_move, 623, 167, 2, 1152, 1945] +[:mouse_move, 623, 166, 2, 1153, 1946] +[:mouse_move, 627, 166, 2, 1154, 1948] +[:mouse_move, 646, 169, 2, 1155, 1949] +[:mouse_move, 664, 173, 2, 1156, 1950] +[:mouse_move, 669, 174, 2, 1157, 1951] +[:mouse_move, 677, 175, 2, 1158, 1952] +[:mouse_move, 687, 176, 2, 1159, 1953] +[:mouse_move, 691, 178, 2, 1160, 1955] +[:mouse_move, 686, 179, 2, 1161, 1956] +[:mouse_move, 652, 186, 2, 1162, 1957] +[:mouse_move, 627, 192, 2, 1163, 1958] +[:mouse_move, 606, 197, 2, 1164, 1959] +[:mouse_move, 576, 206, 2, 1165, 1961] +[:mouse_move, 570, 208, 2, 1166, 1962] +[:mouse_move, 564, 209, 2, 1167, 1963] +[:mouse_move, 563, 210, 2, 1168, 1964] +[:mouse_move, 562, 210, 2, 1169, 1965] +[:mouse_move, 561, 210, 2, 1170, 1966] +[:mouse_move, 558, 210, 2, 1171, 1968] +[:mouse_move, 554, 210, 2, 1172, 1969] +[:mouse_move, 546, 209, 2, 1173, 1970] +[:mouse_move, 529, 208, 2, 1174, 1971] +[:mouse_move, 501, 208, 2, 1175, 1972] +[:mouse_move, 472, 208, 2, 1176, 1973] +[:mouse_move, 463, 209, 2, 1177, 1974] +[:mouse_move, 457, 210, 2, 1178, 1975] +[:mouse_move, 448, 211, 2, 1179, 1976] +[:mouse_move, 445, 212, 2, 1180, 1977] +[:mouse_move, 444, 212, 2, 1181, 1978] +[:mouse_move, 446, 212, 2, 1182, 1980] +[:mouse_move, 451, 212, 2, 1183, 1981] +[:mouse_move, 477, 212, 2, 1184, 1982] +[:mouse_move, 539, 206, 2, 1185, 1984] +[:mouse_move, 574, 202, 2, 1186, 1985] +[:mouse_move, 596, 199, 2, 1187, 1986] +[:mouse_move, 621, 196, 2, 1188, 1987] +[:mouse_move, 626, 195, 2, 1189, 1988] +[:mouse_move, 634, 194, 2, 1190, 1989] +[:mouse_move, 644, 193, 2, 1191, 1990] +[:mouse_move, 646, 193, 2, 1192, 1991] +[:mouse_move, 648, 193, 2, 1193, 1992] +[:mouse_move, 649, 193, 2, 1194, 1994] +[:key_down_player_one, 15, 0, 1, 1195, 2050] +[:key_held_player_one, 15, 0, 1, 1196, 2051] +[:key_held_player_one, 15, 0, 1, 1197, 2052] +[:key_held_player_one, 15, 0, 1, 1198, 2053] +[:key_held_player_one, 15, 0, 1, 1199, 2054] +[:key_held_player_one, 15, 0, 1, 1200, 2055] +[:key_held_player_one, 15, 0, 1, 1201, 2056] +[:key_up_player_one, 15, 0, 1, 1202, 2057] +[:key_down_player_one, 15, 0, 1, 1203, 2085] +[:key_held_player_one, 15, 0, 1, 1204, 2086] +[:key_held_player_one, 15, 0, 1, 1205, 2087] +[:key_held_player_one, 15, 0, 1, 1206, 2088] +[:key_held_player_one, 15, 0, 1, 1207, 2089] +[:key_up_player_one, 15, 0, 1, 1208, 2090] +[:key_down_player_one, 15, 0, 1, 1209, 2107] +[:key_held_player_one, 15, 0, 1, 1210, 2108] +[:key_held_player_one, 15, 0, 1, 1211, 2109] +[:key_held_player_one, 15, 0, 1, 1212, 2110] +[:key_held_player_one, 15, 0, 1, 1213, 2111] +[:key_held_player_one, 15, 0, 1, 1214, 2112] +[:key_held_player_one, 15, 0, 1, 1215, 2113] +[:key_held_player_one, 15, 0, 1, 1216, 2114] +[:key_held_player_one, 15, 0, 1, 1217, 2115] +[:key_held_player_one, 15, 0, 1, 1218, 2116] +[:key_held_player_one, 15, 0, 1, 1219, 2117] +[:key_held_player_one, 15, 0, 1, 1220, 2118] +[:key_held_player_one, 15, 0, 1, 1221, 2119] +[:key_held_player_one, 15, 0, 1, 1222, 2120] +[:key_held_player_one, 15, 0, 1, 1223, 2121] +[:key_held_player_one, 15, 0, 1, 1224, 2122] +[:key_held_player_one, 15, 0, 1, 1225, 2123] +[:key_held_player_one, 15, 0, 1, 1226, 2124] +[:key_held_player_one, 15, 0, 1, 1227, 2125] +[:key_held_player_one, 15, 0, 1, 1228, 2126] +[:key_held_player_one, 15, 0, 1, 1229, 2127] +[:key_held_player_one, 15, 0, 1, 1230, 2128] +[:key_held_player_one, 15, 0, 1, 1231, 2129] +[:key_held_player_one, 15, 0, 1, 1232, 2130] +[:key_held_player_one, 15, 0, 1, 1233, 2131] +[:key_held_player_one, 15, 0, 1, 1234, 2132] +[:key_held_player_one, 15, 0, 1, 1235, 2133] +[:key_held_player_one, 15, 0, 1, 1236, 2134] +[:key_held_player_one, 15, 0, 1, 1237, 2135] +[:key_held_player_one, 15, 0, 1, 1238, 2136] +[:key_held_player_one, 15, 0, 1, 1239, 2137] +[:key_held_player_one, 15, 0, 1, 1240, 2138] +[:key_held_player_one, 15, 0, 1, 1241, 2139] +[:key_held_player_one, 15, 0, 1, 1242, 2140] +[:key_held_player_one, 15, 0, 1, 1243, 2141] +[:key_held_player_one, 15, 0, 1, 1244, 2142] +[:key_held_player_one, 15, 0, 1, 1245, 2143] +[:key_held_player_one, 15, 0, 1, 1246, 2144] +[:key_held_player_one, 15, 0, 1, 1247, 2145] +[:key_held_player_one, 15, 0, 1, 1248, 2146] +[:key_held_player_one, 15, 0, 1, 1249, 2147] +[:key_held_player_one, 15, 0, 1, 1250, 2148] +[:key_held_player_one, 15, 0, 1, 1251, 2149] +[:key_held_player_one, 15, 0, 1, 1252, 2150] +[:key_held_player_one, 15, 0, 1, 1253, 2151] +[:key_held_player_one, 15, 0, 1, 1254, 2152] +[:key_held_player_one, 15, 0, 1, 1255, 2153] +[:key_held_player_one, 15, 0, 1, 1256, 2154] +[:key_held_player_one, 15, 0, 1, 1257, 2155] +[:key_held_player_one, 15, 0, 1, 1258, 2156] +[:key_held_player_one, 15, 0, 1, 1259, 2157] +[:key_held_player_one, 15, 0, 1, 1260, 2158] +[:key_held_player_one, 15, 0, 1, 1261, 2159] +[:key_held_player_one, 15, 0, 1, 1262, 2160] +[:key_held_player_one, 15, 0, 1, 1263, 2161] +[:key_held_player_one, 15, 0, 1, 1264, 2162] +[:key_held_player_one, 15, 0, 1, 1265, 2163] +[:key_held_player_one, 15, 0, 1, 1266, 2164] +[:key_held_player_one, 15, 0, 1, 1267, 2165] +[:key_held_player_one, 15, 0, 1, 1268, 2166] +[:key_held_player_one, 15, 0, 1, 1269, 2167] +[:key_held_player_one, 15, 0, 1, 1270, 2168] +[:key_held_player_one, 15, 0, 1, 1271, 2169] +[:key_held_player_one, 15, 0, 1, 1272, 2170] +[:key_held_player_one, 15, 0, 1, 1273, 2171] +[:key_held_player_one, 15, 0, 1, 1274, 2172] +[:key_held_player_one, 15, 0, 1, 1275, 2173] +[:key_held_player_one, 15, 0, 1, 1276, 2174] +[:key_held_player_one, 15, 0, 1, 1277, 2175] +[:key_held_player_one, 15, 0, 1, 1278, 2176] +[:key_up_player_one, 15, 0, 1, 1279, 2177] +[:key_down_player_one, 15, 0, 1, 1280, 2221] +[:key_held_player_one, 15, 0, 1, 1281, 2222] +[:key_held_player_one, 15, 0, 1, 1282, 2223] +[:key_held_player_one, 15, 0, 1, 1283, 2224] +[:key_held_player_one, 15, 0, 1, 1284, 2225] +[:key_held_player_one, 15, 0, 1, 1285, 2226] +[:key_held_player_one, 15, 0, 1, 1286, 2227] +[:key_held_player_one, 15, 0, 1, 1287, 2228] +[:key_held_player_one, 15, 0, 1, 1288, 2229] +[:key_held_player_one, 15, 0, 1, 1289, 2230] +[:key_held_player_one, 15, 0, 1, 1290, 2231] +[:key_held_player_one, 15, 0, 1, 1291, 2232] +[:key_held_player_one, 15, 0, 1, 1292, 2233] +[:key_held_player_one, 15, 0, 1, 1293, 2234] +[:key_held_player_one, 15, 0, 1, 1294, 2235] +[:key_held_player_one, 15, 0, 1, 1295, 2236] +[:key_held_player_one, 15, 0, 1, 1296, 2237] +[:key_held_player_one, 15, 0, 1, 1297, 2238] +[:key_held_player_one, 15, 0, 1, 1298, 2239] +[:key_held_player_one, 15, 0, 1, 1299, 2240] +[:key_held_player_one, 15, 0, 1, 1300, 2241] +[:key_held_player_one, 15, 0, 1, 1301, 2242] +[:key_held_player_one, 15, 0, 1, 1302, 2243] +[:key_held_player_one, 15, 0, 1, 1303, 2244] +[:key_held_player_one, 15, 0, 1, 1304, 2245] +[:key_held_player_one, 15, 0, 1, 1305, 2246] +[:key_held_player_one, 15, 0, 1, 1306, 2247] +[:key_held_player_one, 15, 0, 1, 1307, 2248] +[:key_held_player_one, 15, 0, 1, 1308, 2249] +[:key_held_player_one, 15, 0, 1, 1309, 2250] +[:key_held_player_one, 15, 0, 1, 1310, 2251] +[:key_held_player_one, 15, 0, 1, 1311, 2252] +[:key_held_player_one, 15, 0, 1, 1312, 2253] +[:key_held_player_one, 15, 0, 1, 1313, 2254] +[:key_held_player_one, 15, 0, 1, 1314, 2255] +[:key_held_player_one, 15, 0, 1, 1315, 2256] +[:key_held_player_one, 15, 0, 1, 1316, 2257] +[:key_held_player_one, 15, 0, 1, 1317, 2258] +[:key_held_player_one, 15, 0, 1, 1318, 2259] +[:key_held_player_one, 15, 0, 1, 1319, 2260] +[:key_held_player_one, 15, 0, 1, 1320, 2261] +[:key_held_player_one, 15, 0, 1, 1321, 2262] +[:key_held_player_one, 15, 0, 1, 1322, 2263] +[:key_held_player_one, 15, 0, 1, 1323, 2264] +[:key_held_player_one, 15, 0, 1, 1324, 2265] +[:key_up_player_one, 15, 0, 1, 1325, 2266] +[:mouse_move, 644, 198, 2, 1326, 2321] +[:mouse_move, 544, 260, 2, 1327, 2321] +[:mouse_move, 539, 261, 2, 1328, 2323] +[:mouse_move, 536, 261, 2, 1329, 2325] +[:mouse_move, 531, 262, 2, 1330, 2326] +[:mouse_move, 529, 262, 2, 1331, 2327] +[:mouse_move, 528, 262, 2, 1332, 2328] +[:mouse_move, 527, 261, 2, 1333, 2330] +[:mouse_move, 526, 261, 2, 1334, 2331] +[:mouse_move, 525, 261, 2, 1335, 2333] +[:mouse_move, 526, 261, 2, 1336, 2342] +[:mouse_move, 533, 261, 2, 1337, 2343] +[:mouse_move, 539, 261, 2, 1338, 2344] +[:mouse_move, 555, 261, 2, 1339, 2345] +[:mouse_move, 572, 261, 2, 1340, 2346] +[:mouse_move, 587, 261, 2, 1341, 2347] +[:mouse_move, 597, 261, 2, 1342, 2348] +[:mouse_move, 622, 262, 2, 1343, 2349] +[:mouse_move, 644, 263, 2, 1344, 2350] +[:mouse_move, 670, 266, 2, 1345, 2351] +[:mouse_move, 677, 266, 2, 1346, 2352] +[:mouse_move, 701, 268, 2, 1347, 2353] +[:mouse_move, 710, 269, 2, 1348, 2354] +[:mouse_move, 734, 269, 2, 1349, 2355] +[:mouse_move, 738, 269, 2, 1350, 2356] +[:mouse_move, 751, 267, 2, 1351, 2357] +[:mouse_move, 757, 267, 2, 1352, 2358] +[:mouse_move, 765, 267, 2, 1353, 2359] +[:mouse_move, 769, 266, 2, 1354, 2360] +[:mouse_move, 777, 266, 2, 1355, 2361] +[:mouse_move, 780, 266, 2, 1356, 2362] +[:mouse_move, 782, 266, 2, 1357, 2363] +[:mouse_move, 784, 266, 2, 1358, 2364] +[:mouse_move, 779, 265, 2, 1359, 2366] +[:mouse_move, 764, 263, 2, 1360, 2367] +[:mouse_move, 724, 260, 2, 1361, 2368] +[:mouse_move, 695, 257, 2, 1362, 2369] +[:mouse_move, 629, 250, 2, 1363, 2370] +[:mouse_move, 597, 248, 2, 1364, 2371] +[:mouse_move, 558, 246, 2, 1365, 2372] +[:mouse_move, 534, 246, 2, 1366, 2373] +[:mouse_move, 509, 245, 2, 1367, 2374] +[:mouse_move, 504, 245, 2, 1368, 2375] +[:mouse_move, 487, 245, 2, 1369, 2376] +[:mouse_move, 483, 246, 2, 1370, 2377] +[:mouse_move, 478, 247, 2, 1371, 2378] +[:mouse_move, 477, 247, 2, 1372, 2379] +[:mouse_move, 483, 247, 2, 1373, 2382] +[:mouse_move, 492, 247, 2, 1374, 2383] +[:mouse_move, 526, 249, 2, 1375, 2384] +[:mouse_move, 545, 250, 2, 1376, 2385] +[:mouse_move, 576, 252, 2, 1377, 2386] +[:mouse_move, 585, 253, 2, 1378, 2387] +[:mouse_move, 599, 254, 2, 1379, 2388] +[:mouse_move, 617, 255, 2, 1380, 2389] +[:mouse_move, 624, 255, 2, 1381, 2390] +[:mouse_move, 632, 256, 2, 1382, 2391] +[:mouse_move, 634, 257, 2, 1383, 2392] +[:mouse_move, 636, 257, 2, 1384, 2393] +[:mouse_move, 637, 257, 2, 1385, 2396] +[:mouse_move, 637, 258, 2, 1386, 2397] +[:mouse_move, 638, 258, 2, 1387, 2398] +[:mouse_move, 642, 258, 2, 1388, 2399] +[:mouse_move, 644, 259, 2, 1389, 2400] +[:mouse_move, 648, 259, 2, 1390, 2401] +[:mouse_move, 650, 259, 2, 1391, 2402] +[:mouse_move, 654, 260, 2, 1392, 2403] +[:mouse_move, 655, 260, 2, 1393, 2404] +[:mouse_button_pressed, 1, 0, 1, 1394, 2405] +[:mouse_button_up, 1, 0, 1, 1395, 2413] +[:mouse_button_pressed, 1, 0, 1, 1396, 2434] +[:mouse_button_up, 1, 0, 1, 1397, 2443] +[:mouse_move, 656, 260, 2, 1398, 2447] +[:mouse_move, 659, 260, 2, 1399, 2448] +[:mouse_move, 670, 260, 2, 1400, 2449] +[:mouse_move, 678, 260, 2, 1401, 2450] +[:mouse_move, 699, 260, 2, 1402, 2451] +[:mouse_move, 703, 260, 2, 1403, 2452] +[:mouse_move, 719, 259, 2, 1404, 2453] +[:mouse_move, 727, 259, 2, 1405, 2454] +[:mouse_move, 737, 258, 2, 1406, 2455] +[:mouse_move, 739, 258, 2, 1407, 2456] +[:mouse_move, 746, 257, 2, 1408, 2457] +[:mouse_move, 749, 256, 2, 1409, 2458] +[:mouse_move, 752, 256, 2, 1410, 2459] +[:mouse_move, 754, 255, 2, 1411, 2461] +[:mouse_button_pressed, 1, 0, 1, 1412, 2463] +[:mouse_button_up, 1, 0, 1, 1413, 2472] +[:mouse_move, 753, 255, 2, 1414, 2473] +[:mouse_move, 742, 255, 2, 1415, 2474] +[:mouse_move, 727, 254, 2, 1416, 2475] +[:mouse_move, 694, 248, 2, 1417, 2476] +[:mouse_move, 655, 236, 2, 1418, 2477] +[:mouse_move, 607, 222, 2, 1419, 2478] +[:mouse_move, 577, 214, 2, 1420, 2479] +[:mouse_move, 559, 211, 2, 1421, 2480] +[:mouse_move, 554, 211, 2, 1422, 2481] +[:mouse_move, 537, 209, 2, 1423, 2482] +[:mouse_move, 533, 209, 2, 1424, 2483] +[:mouse_move, 529, 209, 2, 1425, 2484] +[:mouse_button_pressed, 1, 0, 1, 1426, 2487] +[:mouse_button_up, 1, 0, 1, 1427, 2497] +[:mouse_move, 534, 212, 2, 1428, 2500] +[:mouse_move, 553, 223, 2, 1429, 2501] +[:mouse_move, 571, 232, 2, 1430, 2502] +[:mouse_move, 620, 251, 2, 1431, 2503] +[:mouse_move, 681, 272, 2, 1432, 2504] +[:mouse_move, 763, 299, 2, 1433, 2505] +[:mouse_move, 781, 308, 2, 1434, 2506] +[:mouse_move, 846, 344, 2, 1435, 2507] +[:mouse_move, 855, 352, 2, 1436, 2508] +[:mouse_move, 890, 382, 2, 1437, 2509] +[:mouse_move, 902, 396, 2, 1438, 2510] +[:mouse_move, 918, 425, 2, 1439, 2511] +[:mouse_move, 925, 440, 2, 1440, 2512] +[:mouse_move, 930, 461, 2, 1441, 2513] +[:mouse_move, 933, 474, 2, 1442, 2514] +[:mouse_move, 937, 493, 2, 1443, 2515] +[:mouse_move, 937, 496, 2, 1444, 2516] +[:mouse_move, 938, 507, 2, 1445, 2517] +[:mouse_move, 940, 513, 2, 1446, 2518] +[:mouse_move, 940, 519, 2, 1447, 2519] +[:mouse_move, 940, 521, 2, 1448, 2520] +[:mouse_move, 940, 525, 2, 1449, 2521] +[:mouse_move, 940, 527, 2, 1450, 2522] +[:mouse_move, 939, 528, 2, 1451, 2523] +[:mouse_move, 938, 529, 2, 1452, 2524] +[:mouse_move, 937, 529, 2, 1453, 2525] +[:mouse_move, 936, 529, 2, 1454, 2526] +[:mouse_move, 934, 529, 2, 1455, 2527] +[:mouse_move, 930, 526, 2, 1456, 2528] +[:mouse_move, 927, 524, 2, 1457, 2529] +[:mouse_move, 920, 521, 2, 1458, 2530] +[:mouse_move, 915, 520, 2, 1459, 2531] +[:mouse_move, 905, 514, 2, 1460, 2532] +[:mouse_move, 897, 507, 2, 1461, 2533] +[:mouse_move, 876, 480, 2, 1462, 2534] +[:mouse_move, 864, 464, 2, 1463, 2535] +[:mouse_move, 846, 437, 2, 1464, 2536] +[:mouse_move, 841, 431, 2, 1465, 2537] +[:mouse_move, 825, 407, 2, 1466, 2538] +[:mouse_move, 818, 397, 2, 1467, 2539] +[:mouse_move, 801, 372, 2, 1468, 2540] +[:mouse_move, 797, 364, 2, 1469, 2541] +[:mouse_move, 794, 357, 2, 1470, 2542] +[:mouse_move, 792, 352, 2, 1471, 2543] +[:mouse_move, 789, 345, 2, 1472, 2544] +[:mouse_move, 788, 343, 2, 1473, 2545] +[:mouse_move, 788, 340, 2, 1474, 2546] +[:mouse_move, 787, 338, 2, 1475, 2547] +[:mouse_move, 787, 337, 2, 1476, 2548] +[:mouse_move, 787, 336, 2, 1477, 2549] +[:mouse_move, 786, 335, 2, 1478, 2550] +[:mouse_move, 786, 334, 2, 1479, 2551] +[:mouse_move, 786, 333, 2, 1480, 2553] +[:mouse_button_pressed, 1, 0, 1, 1481, 2558] +[:mouse_button_up, 1, 0, 1, 1482, 2567] +[:mouse_move, 784, 333, 2, 1483, 2573] +[:mouse_move, 782, 333, 2, 1484, 2574] +[:mouse_move, 769, 333, 2, 1485, 2575] +[:mouse_move, 762, 333, 2, 1486, 2576] +[:mouse_move, 758, 333, 2, 1487, 2577] +[:mouse_move, 740, 333, 2, 1488, 2578] +[:mouse_move, 733, 333, 2, 1489, 2579] +[:mouse_move, 720, 333, 2, 1490, 2580] +[:mouse_move, 717, 333, 2, 1491, 2581] +[:mouse_move, 710, 333, 2, 1492, 2582] +[:mouse_move, 708, 333, 2, 1493, 2583] +[:mouse_move, 705, 333, 2, 1494, 2584] +[:mouse_move, 704, 333, 2, 1495, 2585] +[:mouse_move, 703, 333, 2, 1496, 2586] +[:mouse_button_pressed, 1, 0, 1, 1497, 2588] +[:mouse_button_up, 1, 0, 1, 1498, 2597] +[:mouse_move, 704, 333, 2, 1499, 2600] +[:mouse_move, 706, 333, 2, 1500, 2601] +[:mouse_move, 715, 333, 2, 1501, 2602] +[:mouse_move, 725, 333, 2, 1502, 2603] +[:mouse_move, 740, 333, 2, 1503, 2604] +[:mouse_move, 749, 333, 2, 1504, 2605] +[:mouse_move, 753, 333, 2, 1505, 2606] +[:mouse_move, 772, 333, 2, 1506, 2607] +[:mouse_move, 781, 333, 2, 1507, 2608] +[:mouse_move, 793, 333, 2, 1508, 2609] +[:mouse_move, 799, 333, 2, 1509, 2610] +[:mouse_move, 805, 333, 2, 1510, 2611] +[:mouse_move, 807, 333, 2, 1511, 2612] +[:mouse_move, 810, 333, 2, 1512, 2613] +[:mouse_move, 811, 333, 2, 1513, 2614] +[:mouse_move, 811, 332, 2, 1514, 2616] +[:mouse_button_pressed, 1, 0, 1, 1515, 2618] +[:mouse_button_up, 1, 0, 1, 1516, 2629] +[:mouse_move, 810, 332, 2, 1517, 2634] +[:mouse_move, 809, 332, 2, 1518, 2635] +[:mouse_move, 804, 335, 2, 1519, 2636] +[:mouse_move, 799, 339, 2, 1520, 2637] +[:mouse_move, 787, 346, 2, 1521, 2638] +[:mouse_move, 778, 349, 2, 1522, 2639] +[:mouse_move, 745, 362, 2, 1523, 2640] +[:mouse_move, 726, 366, 2, 1524, 2641] +[:mouse_move, 698, 374, 2, 1525, 2642] +[:mouse_move, 679, 378, 2, 1526, 2643] +[:mouse_move, 655, 384, 2, 1527, 2644] +[:mouse_move, 641, 387, 2, 1528, 2645] +[:mouse_move, 623, 393, 2, 1529, 2646] +[:mouse_move, 620, 394, 2, 1530, 2647] +[:mouse_move, 611, 397, 2, 1531, 2648] +[:mouse_move, 608, 398, 2, 1532, 2649] +[:mouse_move, 605, 400, 2, 1533, 2650] +[:mouse_move, 604, 401, 2, 1534, 2651] +[:mouse_move, 602, 402, 2, 1535, 2652] +[:mouse_move, 601, 402, 2, 1536, 2653] +[:mouse_move, 600, 403, 2, 1537, 2654] +[:mouse_move, 599, 403, 2, 1538, 2655] +[:mouse_move, 598, 404, 2, 1539, 2656] +[:mouse_button_pressed, 1, 0, 1, 1540, 2659] +[:mouse_move, 597, 404, 2, 1541, 2659] +[:mouse_button_up, 1, 0, 1, 1542, 2669] +[:mouse_move, 598, 404, 2, 1543, 2677] +[:mouse_move, 600, 404, 2, 1544, 2678] +[:mouse_move, 607, 407, 2, 1545, 2679] +[:mouse_move, 612, 409, 2, 1546, 2680] +[:mouse_move, 622, 412, 2, 1547, 2681] +[:mouse_move, 628, 414, 2, 1548, 2682] +[:mouse_move, 639, 416, 2, 1549, 2683] +[:mouse_move, 643, 417, 2, 1550, 2684] +[:mouse_move, 654, 418, 2, 1551, 2685] +[:mouse_move, 658, 418, 2, 1552, 2686] +[:mouse_move, 662, 418, 2, 1553, 2687] +[:mouse_move, 667, 418, 2, 1554, 2688] +[:mouse_move, 671, 418, 2, 1555, 2689] +[:mouse_move, 675, 418, 2, 1556, 2690] +[:mouse_move, 677, 418, 2, 1557, 2691] +[:mouse_move, 679, 418, 2, 1558, 2692] +[:mouse_move, 680, 418, 2, 1559, 2695] +[:mouse_button_pressed, 1, 0, 1, 1560, 2696] +[:mouse_button_up, 1, 0, 1, 1561, 2706] +[:mouse_move, 678, 418, 2, 1562, 2717] +[:mouse_move, 677, 418, 2, 1563, 2718] +[:mouse_move, 670, 418, 2, 1564, 2719] +[:mouse_move, 668, 418, 2, 1565, 2720] +[:mouse_move, 663, 418, 2, 1566, 2721] +[:mouse_move, 661, 418, 2, 1567, 2722] +[:mouse_move, 660, 418, 2, 1568, 2723] +[:mouse_move, 658, 418, 2, 1569, 2731] +[:mouse_move, 657, 418, 2, 1570, 2732] +[:mouse_move, 651, 419, 2, 1571, 2733] +[:mouse_move, 649, 419, 2, 1572, 2734] +[:mouse_move, 645, 420, 2, 1573, 2735] +[:mouse_move, 642, 420, 2, 1574, 2736] +[:mouse_move, 640, 420, 2, 1575, 2737] +[:mouse_move, 639, 420, 2, 1576, 2738] +[:mouse_move, 638, 420, 2, 1577, 2739] +[:mouse_button_pressed, 1, 0, 1, 1578, 2743] +[:mouse_button_up, 1, 0, 1, 1579, 2752] +[:mouse_move, 637, 420, 2, 1580, 2765] +[:mouse_move, 634, 420, 2, 1581, 2766] +[:mouse_move, 631, 420, 2, 1582, 2767] +[:mouse_move, 628, 420, 2, 1583, 2768] +[:mouse_move, 622, 420, 2, 1584, 2769] +[:mouse_move, 619, 420, 2, 1585, 2770] +[:mouse_move, 613, 421, 2, 1586, 2771] +[:mouse_move, 611, 421, 2, 1587, 2772] +[:mouse_move, 609, 421, 2, 1588, 2773] +[:mouse_move, 608, 421, 2, 1589, 2774] +[:mouse_button_pressed, 1, 0, 1, 1590, 2780] +[:mouse_button_up, 1, 0, 1, 1591, 2790] +[:mouse_move, 612, 421, 2, 1592, 2798] +[:mouse_move, 613, 421, 2, 1593, 2799] +[:mouse_move, 617, 421, 2, 1594, 2800] +[:mouse_move, 618, 421, 2, 1595, 2801] +[:mouse_move, 621, 421, 2, 1596, 2802] +[:mouse_move, 622, 421, 2, 1597, 2803] +[:mouse_move, 623, 421, 2, 1598, 2804] +[:mouse_move, 626, 421, 2, 1599, 2816] +[:mouse_move, 629, 420, 2, 1600, 2817] +[:mouse_move, 633, 420, 2, 1601, 2818] +[:mouse_move, 635, 420, 2, 1602, 2819] +[:mouse_move, 638, 420, 2, 1603, 2820] +[:mouse_move, 639, 420, 2, 1604, 2822] +[:mouse_move, 639, 419, 2, 1605, 2827] +[:mouse_move, 638, 419, 2, 1606, 2829] +[:mouse_move, 638, 418, 2, 1607, 2831] +[:mouse_move, 637, 418, 2, 1608, 2832] +[:mouse_button_pressed, 1, 0, 1, 1609, 2836] +[:mouse_button_up, 1, 0, 1, 1610, 2845] +[:mouse_move, 639, 419, 2, 1611, 2859] +[:mouse_move, 644, 421, 2, 1612, 2860] +[:mouse_move, 648, 421, 2, 1613, 2861] +[:mouse_move, 655, 422, 2, 1614, 2862] +[:mouse_move, 657, 423, 2, 1615, 2863] +[:mouse_move, 664, 423, 2, 1616, 2864] +[:mouse_move, 666, 423, 2, 1617, 2865] +[:mouse_move, 669, 423, 2, 1618, 2866] +[:mouse_move, 670, 423, 2, 1619, 2867] +[:mouse_move, 671, 423, 2, 1620, 2868] +[:mouse_button_pressed, 1, 0, 1, 1621, 2869] +[:mouse_button_up, 1, 0, 1, 1622, 2877] +[:mouse_move, 671, 424, 2, 1623, 2889] +[:mouse_move, 671, 427, 2, 1624, 2890] +[:mouse_move, 670, 434, 2, 1625, 2891] +[:mouse_move, 669, 439, 2, 1626, 2892] +[:mouse_move, 665, 459, 2, 1627, 2893] +[:mouse_move, 662, 470, 2, 1628, 2894] +[:mouse_move, 657, 485, 2, 1629, 2895] +[:mouse_move, 654, 495, 2, 1630, 2896] +[:mouse_move, 646, 510, 2, 1631, 2897] +[:mouse_move, 645, 513, 2, 1632, 2898] +[:mouse_move, 640, 520, 2, 1633, 2899] +[:mouse_move, 638, 522, 2, 1634, 2900] +[:mouse_move, 632, 527, 2, 1635, 2901] +[:mouse_move, 631, 528, 2, 1636, 2902] +[:mouse_move, 626, 531, 2, 1637, 2903] +[:mouse_move, 624, 532, 2, 1638, 2904] +[:mouse_move, 622, 533, 2, 1639, 2905] +[:mouse_move, 619, 535, 2, 1640, 2906] +[:mouse_move, 618, 535, 2, 1641, 2907] +[:mouse_move, 617, 536, 2, 1642, 2908] +[:mouse_move, 616, 536, 2, 1643, 2910] +[:mouse_move, 615, 536, 2, 1644, 2913] +[:mouse_button_pressed, 1, 0, 1, 1645, 2916] +[:mouse_button_up, 1, 0, 1, 1646, 2922] +[:mouse_button_pressed, 1, 0, 1, 1647, 2967] +[:mouse_button_up, 1, 0, 1, 1648, 2974] +[:mouse_move, 615, 540, 2, 1649, 2999] +[:mouse_move, 615, 544, 2, 1650, 3000] +[:mouse_move, 613, 554, 2, 1651, 3001] +[:mouse_move, 612, 560, 2, 1652, 3002] +[:mouse_move, 611, 567, 2, 1653, 3003] +[:mouse_move, 610, 571, 2, 1654, 3004] +[:mouse_move, 609, 578, 2, 1655, 3005] +[:mouse_move, 608, 581, 2, 1656, 3006] +[:mouse_move, 607, 585, 2, 1657, 3007] +[:mouse_move, 607, 586, 2, 1658, 3008] +[:mouse_move, 606, 589, 2, 1659, 3009] +[:mouse_move, 606, 590, 2, 1660, 3010] +[:mouse_move, 605, 591, 2, 1661, 3011] +[:mouse_move, 605, 592, 2, 1662, 3013] +[:mouse_move, 604, 592, 2, 1663, 3014] +[:mouse_move, 604, 593, 2, 1664, 3017] +[:mouse_button_pressed, 1, 0, 1, 1665, 3024] +[:mouse_button_up, 1, 0, 1, 1666, 3031] +[:mouse_move, 606, 594, 2, 1667, 3119] +[:mouse_move, 609, 594, 2, 1668, 3120] +[:mouse_move, 615, 594, 2, 1669, 3121] +[:mouse_move, 643, 594, 2, 1670, 3122] +[:mouse_move, 663, 593, 2, 1671, 3123] +[:mouse_move, 713, 585, 2, 1672, 3124] +[:mouse_move, 743, 579, 2, 1673, 3125] +[:mouse_move, 807, 561, 2, 1674, 3126] +[:mouse_move, 837, 548, 2, 1675, 3127] +[:mouse_move, 887, 518, 2, 1676, 3128] +[:mouse_move, 910, 497, 2, 1677, 3129] +[:mouse_move, 947, 446, 2, 1678, 3130] +[:mouse_move, 962, 416, 2, 1679, 3131] +[:mouse_move, 984, 351, 2, 1680, 3132] +[:mouse_move, 991, 319, 2, 1681, 3133] +[:mouse_move, 995, 225, 2, 1682, 3134] +[:mouse_move, 997, 225, 2, 1683, 3151] +[:mouse_move, 1001, 224, 2, 1684, 3152] +[:mouse_move, 1010, 220, 2, 1685, 3153] +[:mouse_move, 1013, 218, 2, 1686, 3154] +[:mouse_move, 1019, 214, 2, 1687, 3155] +[:mouse_move, 1021, 213, 2, 1688, 3156] +[:mouse_move, 1026, 209, 2, 1689, 3157] +[:mouse_move, 1029, 206, 2, 1690, 3158] +[:mouse_move, 1032, 203, 2, 1691, 3159] +[:mouse_move, 1033, 202, 2, 1692, 3160] +[:mouse_move, 1033, 200, 2, 1693, 3161] +[:mouse_move, 1034, 200, 2, 1694, 3162] +[:mouse_move, 1035, 195, 2, 1695, 3163] +[:mouse_move, 1037, 193, 2, 1696, 3164] +[:mouse_move, 1047, 184, 2, 1697, 3165] +[:mouse_move, 1055, 179, 2, 1698, 3166] +[:mouse_move, 1079, 166, 2, 1699, 3167] +[:mouse_move, 1093, 158, 2, 1700, 3168] +[:mouse_move, 1122, 141, 2, 1701, 3169] +[:mouse_move, 1133, 132, 2, 1702, 3170] +[:mouse_move, 1144, 119, 2, 1703, 3171] +[:mouse_move, 1149, 111, 2, 1704, 3172] +[:mouse_move, 1150, 92, 2, 1705, 3173] +[:mouse_move, 1149, 86, 2, 1706, 3174] +[:mouse_move, 1142, 79, 2, 1707, 3175] +[:mouse_move, 1123, 65, 2, 1708, 3176] +[:mouse_move, 1117, 63, 2, 1709, 3177] +[:mouse_move, 1099, 51, 2, 1710, 3178] +[:mouse_move, 1084, 42, 2, 1711, 3179] +[:mouse_move, 1066, 31, 2, 1712, 3180] +[:mouse_move, 1057, 25, 2, 1713, 3181] +[:mouse_move, 1037, 13, 2, 1714, 3182] +[:mouse_move, 1031, 11, 2, 1715, 3183] +[:mouse_move, 1005, 0, 2, 1716, 3184] +[:mouse_move, 994, 0, 2, 1717, 3185] +[:mouse_move, 852, 0, 2, 1718, 3196] +[:mouse_move, 846, 3, 2, 1719, 3197] +[:mouse_move, 837, 9, 2, 1720, 3198] +[:mouse_move, 832, 13, 2, 1721, 3199] +[:mouse_move, 823, 21, 2, 1722, 3200] +[:mouse_move, 815, 29, 2, 1723, 3201] +[:mouse_move, 808, 38, 2, 1724, 3202] +[:mouse_move, 804, 45, 2, 1725, 3203] +[:mouse_move, 802, 47, 2, 1726, 3204] +[:mouse_move, 797, 55, 2, 1727, 3205] +[:mouse_move, 796, 58, 2, 1728, 3206] +[:mouse_move, 794, 62, 2, 1729, 3207] +[:mouse_move, 792, 66, 2, 1730, 3208] +[:mouse_move, 791, 73, 2, 1731, 3209] +[:mouse_move, 790, 77, 2, 1732, 3210] +[:mouse_move, 787, 88, 2, 1733, 3211] +[:mouse_move, 786, 93, 2, 1734, 3212] +[:mouse_move, 784, 104, 2, 1735, 3213] +[:mouse_move, 783, 111, 2, 1736, 3214] +[:mouse_move, 782, 124, 2, 1737, 3215] +[:mouse_move, 782, 131, 2, 1738, 3216] +[:mouse_move, 782, 147, 2, 1739, 3217] +[:mouse_move, 782, 154, 2, 1740, 3218] +[:mouse_move, 782, 162, 2, 1741, 3219] +[:mouse_move, 782, 167, 2, 1742, 3220] +[:mouse_move, 782, 177, 2, 1743, 3221] +[:mouse_move, 783, 181, 2, 1744, 3222] +[:mouse_move, 786, 190, 2, 1745, 3223] +[:mouse_move, 788, 199, 2, 1746, 3224] +[:mouse_move, 791, 208, 2, 1747, 3225] +[:mouse_move, 792, 211, 2, 1748, 3226] +[:mouse_move, 795, 219, 2, 1749, 3227] +[:mouse_move, 796, 223, 2, 1750, 3228] +[:mouse_move, 800, 233, 2, 1751, 3229] +[:mouse_move, 803, 240, 2, 1752, 3230] +[:mouse_move, 806, 247, 2, 1753, 3231] +[:mouse_move, 815, 266, 2, 1754, 3232] +[:mouse_move, 818, 271, 2, 1755, 3233] +[:mouse_move, 825, 288, 2, 1756, 3234] +[:mouse_move, 828, 294, 2, 1757, 3235] +[:mouse_move, 834, 306, 2, 1758, 3236] +[:mouse_move, 836, 310, 2, 1759, 3237] +[:mouse_move, 839, 318, 2, 1760, 3238] +[:mouse_move, 840, 319, 2, 1761, 3239] +[:mouse_move, 843, 324, 2, 1762, 3240] +[:mouse_move, 846, 329, 2, 1763, 3241] +[:mouse_move, 849, 334, 2, 1764, 3242] +[:mouse_move, 852, 336, 2, 1765, 3243] +[:mouse_move, 856, 341, 2, 1766, 3244] +[:mouse_move, 859, 345, 2, 1767, 3245] +[:mouse_move, 868, 353, 2, 1768, 3246] +[:mouse_move, 876, 359, 2, 1769, 3247] +[:mouse_move, 890, 370, 2, 1770, 3248] +[:mouse_move, 899, 376, 2, 1771, 3249] +[:mouse_move, 922, 386, 2, 1772, 3250] +[:mouse_move, 934, 391, 2, 1773, 3251] +[:mouse_move, 951, 396, 2, 1774, 3252] +[:mouse_move, 961, 398, 2, 1775, 3253] +[:mouse_move, 988, 403, 2, 1776, 3254] +[:mouse_move, 993, 403, 2, 1777, 3255] +[:mouse_move, 1010, 405, 2, 1778, 3256] +[:mouse_move, 1019, 406, 2, 1779, 3257] +[:mouse_move, 1026, 407, 2, 1780, 3258] +[:mouse_move, 1045, 408, 2, 1781, 3259] +[:mouse_move, 1060, 408, 2, 1782, 3260] +[:mouse_move, 1078, 408, 2, 1783, 3261] +[:mouse_move, 1099, 404, 2, 1784, 3262] +[:mouse_move, 1105, 403, 2, 1785, 3263] +[:mouse_move, 1122, 399, 2, 1786, 3264] +[:mouse_move, 1136, 394, 2, 1787, 3265] +[:mouse_move, 1151, 387, 2, 1788, 3266] +[:mouse_move, 1166, 373, 2, 1789, 3267] +[:mouse_move, 1169, 367, 2, 1790, 3268] +[:mouse_move, 1180, 352, 2, 1791, 3269] +[:mouse_move, 1186, 343, 2, 1792, 3270] +[:mouse_move, 1194, 329, 2, 1793, 3271] +[:mouse_move, 1197, 322, 2, 1794, 3272] +[:mouse_move, 1206, 300, 2, 1795, 3273] +[:mouse_move, 1208, 289, 2, 1796, 3274] +[:mouse_move, 1212, 271, 2, 1797, 3275] +[:mouse_move, 1214, 260, 2, 1798, 3276] +[:mouse_move, 1217, 242, 2, 1799, 3277] +[:mouse_move, 1218, 232, 2, 1800, 3278] +[:mouse_move, 1220, 209, 2, 1801, 3279] +[:mouse_move, 1221, 199, 2, 1802, 3280] +[:mouse_move, 1221, 185, 2, 1803, 3281] +[:mouse_move, 1221, 177, 2, 1804, 3282] +[:mouse_move, 1221, 167, 2, 1805, 3283] +[:mouse_move, 1221, 157, 2, 1806, 3284] +[:mouse_move, 1220, 151, 2, 1807, 3285] +[:mouse_move, 1214, 142, 2, 1808, 3286] +[:mouse_move, 1210, 137, 2, 1809, 3287] +[:mouse_move, 1200, 128, 2, 1810, 3288] +[:mouse_move, 1194, 123, 2, 1811, 3289] +[:mouse_move, 1182, 114, 2, 1812, 3290] +[:mouse_move, 1169, 105, 2, 1813, 3291] +[:mouse_move, 1153, 95, 2, 1814, 3292] +[:mouse_move, 1145, 91, 2, 1815, 3293] +[:mouse_move, 1133, 87, 2, 1816, 3294] +[:mouse_move, 1125, 84, 2, 1817, 3295] +[:mouse_move, 1109, 79, 2, 1818, 3296] +[:mouse_move, 1101, 78, 2, 1819, 3297] +[:mouse_move, 1080, 73, 2, 1820, 3298] +[:mouse_move, 1071, 71, 2, 1821, 3299] +[:mouse_move, 1059, 69, 2, 1822, 3300] +[:mouse_move, 1052, 68, 2, 1823, 3301] +[:mouse_move, 1044, 68, 2, 1824, 3302] +[:mouse_move, 1040, 68, 2, 1825, 3303] +[:mouse_move, 1030, 68, 2, 1826, 3304] +[:mouse_move, 1027, 68, 2, 1827, 3305] +[:mouse_move, 1021, 68, 2, 1828, 3306] +[:mouse_move, 1017, 68, 2, 1829, 3307] +[:mouse_move, 1010, 70, 2, 1830, 3308] +[:mouse_move, 1005, 71, 2, 1831, 3309] +[:mouse_move, 997, 74, 2, 1832, 3310] +[:mouse_move, 992, 76, 2, 1833, 3311] +[:mouse_move, 986, 78, 2, 1834, 3312] +[:mouse_move, 969, 84, 2, 1835, 3313] +[:mouse_move, 960, 87, 2, 1836, 3314] +[:mouse_move, 943, 94, 2, 1837, 3315] +[:mouse_move, 932, 99, 2, 1838, 3316] +[:mouse_move, 918, 104, 2, 1839, 3317] +[:mouse_move, 911, 107, 2, 1840, 3318] +[:mouse_move, 898, 113, 2, 1841, 3319] +[:mouse_move, 894, 116, 2, 1842, 3320] +[:mouse_move, 884, 123, 2, 1843, 3321] +[:mouse_move, 881, 126, 2, 1844, 3322] +[:mouse_move, 873, 136, 2, 1845, 3323] +[:mouse_move, 869, 141, 2, 1846, 3324] +[:mouse_move, 864, 151, 2, 1847, 3325] +[:mouse_move, 861, 157, 2, 1848, 3326] +[:mouse_move, 855, 173, 2, 1849, 3327] +[:mouse_move, 853, 180, 2, 1850, 3328] +[:mouse_move, 850, 203, 2, 1851, 3329] +[:mouse_move, 849, 215, 2, 1852, 3330] +[:mouse_move, 848, 231, 2, 1853, 3331] +[:mouse_move, 848, 234, 2, 1854, 3332] +[:mouse_move, 848, 244, 2, 1855, 3333] +[:mouse_move, 848, 246, 2, 1856, 3334] +[:mouse_move, 848, 248, 2, 1857, 3335] +[:mouse_move, 848, 232, 2, 1858, 3337] +[:mouse_move, 848, 216, 2, 1859, 3338] +[:mouse_move, 847, 186, 2, 1860, 3339] +[:mouse_move, 846, 168, 2, 1861, 3340] +[:mouse_move, 846, 161, 2, 1862, 3341] +[:mouse_move, 846, 136, 2, 1863, 3342] +[:mouse_move, 846, 126, 2, 1864, 3343] +[:mouse_move, 846, 117, 2, 1865, 3344] +[:mouse_move, 846, 113, 2, 1866, 3345] +[:mouse_move, 846, 106, 2, 1867, 3346] +[:mouse_move, 846, 101, 2, 1868, 3347] +[:mouse_move, 846, 93, 2, 1869, 3348] +[:mouse_move, 846, 90, 2, 1870, 3349] +[:mouse_move, 846, 79, 2, 1871, 3350] +[:mouse_move, 846, 73, 2, 1872, 3351] +[:mouse_move, 846, 60, 2, 1873, 3352] +[:mouse_move, 846, 54, 2, 1874, 3353] +[:mouse_move, 846, 47, 2, 1875, 3354] +[:mouse_move, 846, 44, 2, 1876, 3355] +[:mouse_move, 845, 41, 2, 1877, 3356] +[:mouse_move, 845, 39, 2, 1878, 3357] +[:mouse_move, 843, 37, 2, 1879, 3358] +[:mouse_move, 842, 36, 2, 1880, 3360] +[:mouse_move, 841, 36, 2, 1881, 3361] +[:mouse_move, 840, 35, 2, 1882, 3362] +[:mouse_move, 839, 35, 2, 1883, 3363] +[:mouse_move, 838, 34, 2, 1884, 3364] +[:mouse_move, 837, 34, 2, 1885, 3367] +[:mouse_move, 836, 33, 2, 1886, 3369] +[:mouse_move, 835, 33, 2, 1887, 3372] +[:mouse_move, 835, 32, 2, 1888, 3373] +[:mouse_move, 835, 31, 2, 1889, 3378] +[:mouse_move, 839, 31, 2, 1890, 3385] +[:mouse_move, 843, 31, 2, 1891, 3386] +[:mouse_move, 852, 31, 2, 1892, 3387] +[:mouse_move, 858, 31, 2, 1893, 3388] +[:mouse_move, 872, 30, 2, 1894, 3389] +[:mouse_move, 879, 29, 2, 1895, 3390] +[:mouse_move, 888, 29, 2, 1896, 3391] +[:mouse_move, 892, 29, 2, 1897, 3392] +[:mouse_move, 896, 28, 2, 1898, 3393] +[:mouse_move, 901, 28, 2, 1899, 3394] +[:mouse_move, 903, 28, 2, 1900, 3395] +[:mouse_move, 905, 28, 2, 1901, 3396] +[:mouse_move, 906, 28, 2, 1902, 3397] +[:mouse_move, 909, 28, 2, 1903, 3398] +[:mouse_move, 910, 28, 2, 1904, 3399] +[:mouse_move, 913, 28, 2, 1905, 3400] +[:mouse_move, 915, 28, 2, 1906, 3401] +[:mouse_move, 918, 28, 2, 1907, 3402] +[:mouse_move, 920, 28, 2, 1908, 3403] +[:mouse_move, 924, 28, 2, 1909, 3404] +[:mouse_move, 926, 28, 2, 1910, 3405] +[:mouse_move, 932, 28, 2, 1911, 3406] +[:mouse_move, 935, 28, 2, 1912, 3407] +[:mouse_move, 941, 28, 2, 1913, 3408] +[:mouse_move, 943, 28, 2, 1914, 3409] +[:mouse_move, 949, 28, 2, 1915, 3410] +[:mouse_move, 953, 28, 2, 1916, 3411] +[:mouse_move, 958, 28, 2, 1917, 3412] +[:mouse_move, 960, 28, 2, 1918, 3413] +[:mouse_move, 964, 28, 2, 1919, 3414] +[:mouse_move, 965, 28, 2, 1920, 3415] +[:mouse_move, 966, 28, 2, 1921, 3416] +[:mouse_move, 967, 28, 2, 1922, 3418] +[:key_down_raw, 1073742051, 1024, 2, 1923, 3542] +[:key_down_raw, 113, 1024, 2, 1924, 3542] diff --git a/samples/02_collision_01_simple/app/main.rb b/samples/02_collision_01_simple/app/main.rb new file mode 100644 index 0000000..5e3f9b7 --- /dev/null +++ b/samples/02_collision_01_simple/app/main.rb @@ -0,0 +1,108 @@ +=begin + + Reminders: + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + + - args.outputs.solids: An array. The values generate a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + +=end + +# This sample app shows collisions between two boxes. + +# Runs methods needed for game to run properly. +def tick args + tick_instructions args, "Sample app shows how to move a square over time and determine collision." + defaults args + render args + calc args +end + +# Sets default values. +def defaults args + # These values represent the moving box. + args.state.moving_box_speed = 10 + args.state.moving_box_size = 100 + args.state.moving_box_dx ||= 1 + args.state.moving_box_dy ||= 1 + args.state.moving_box ||= [0, 0, args.state.moving_box_size, args.state.moving_box_size] # moving_box_size is set as the width and height + + # These values represent the center box. + args.state.center_box ||= [540, 260, 200, 200, 180] + args.state.center_box_collision ||= false # initially no collision +end + +def render args + # If the game state denotes that a collision has occured, + # render a solid square, otherwise render a border instead. + if args.state.center_box_collision + args.outputs.solids << args.state.center_box + else + args.outputs.borders << args.state.center_box + end + + # Then render the moving box. + args.outputs.solids << args.state.moving_box +end + +# Generally in a pipeline for a game engine, you have rendering, +# game simulation (calculation), and input processing. +# This fuction represents the game simulation. +def calc args + position_moving_box args + determine_collision_center_box args +end + +# Changes the position of the moving box on the screen by multiplying the change in x (dx) and change in y (dy) by the speed, +# and adding it to the current position. +# dx and dy are positive if the box is moving right and up, respectively +# dx and dy are negative if the box is moving left and down, respectively +def position_moving_box args + args.state.moving_box.x += args.state.moving_box_dx * args.state.moving_box_speed + args.state.moving_box.y += args.state.moving_box_dy * args.state.moving_box_speed + + # 1280x720 are the virtual pixels you work with (essentially 720p). + screen_width = 1280 + screen_height = 720 + + # Position of the box is denoted by the bottom left hand corner, in + # that case, we have to subtract the width of the box so that it stays + # in the scene (you can try deleting the subtraction to see how it + # impacts the box's movement). + if args.state.moving_box.x > screen_width - args.state.moving_box_size + args.state.moving_box_dx = -1 # moves left + elsif args.state.moving_box.x < 0 + args.state.moving_box_dx = 1 # moves right + end + + # Here, we're making sure the moving box remains within the vertical scope of the screen + if args.state.moving_box.y > screen_height - args.state.moving_box_size # if the box moves too high + args.state.moving_box_dy = -1 # moves down + elsif args.state.moving_box.y < 0 # if the box moves too low + args.state.moving_box_dy = 1 # moves up + end +end + +def determine_collision_center_box args + # Collision is handled by the engine. You simply have to call the + # `intersect_rect?` function. + if args.state.moving_box.intersect_rect? args.state.center_box # if the two boxes intersect + args.state.center_box_collision = true # then a collision happened + else + args.state.center_box_collision = false # otherwise, no collision happened + end +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/02_collision_01_simple/license-for-sample.txt b/samples/02_collision_01_simple/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/02_collision_01_simple/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/02_collision_02_moving_objects/app/main.rb b/samples/02_collision_02_moving_objects/app/main.rb new file mode 100644 index 0000000..35eabfb --- /dev/null +++ b/samples/02_collision_02_moving_objects/app/main.rb @@ -0,0 +1,300 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + For example, if we have a "numbers" hash that stores numbers in English as the + key and numbers in Spanish as the value, we'd have a hash that looks like this... + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } + and on it goes. + + Now if we wanted to find the corresponding value of the "one" key, we could say + puts numbers["one"] + which would print "uno" to the console. + + - num1.greater(num2): Returns the greater value. + For example, if we have the command + puts 4.greater(3) + the number 4 would be printed to the console since it has a greater value than 3. + Similar to lesser, which returns the lesser value. + + - num1.lesser(num2): Finds the lower value of the given options. + For example, in the statement + a = 4.lesser(3) + 3 has a lower value than 4, which means that the value of a would be set to 3, + but if the statement had been + a = 4.lesser(5) + 4 has a lower value than 5, which means that the value of a would be set to 4. + + - reject: Removes elements from a collection if they meet certain requirements. + For example, you can derive an array of odd numbers from an original array of + numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). + + - find_all: Finds all values that satisfy specific requirements. + For example, you can find all elements of a collection that are divisible by 2 + or find all objects that have intersected with another object. + + - abs: Returns the absolute value. + For example, the command + (-30).abs + would return 30 as a result. + + - map: Ruby method used to transform data; used in arrays, hashes, and collections. + Can be used to perform an action on every element of a collection, such as multiplying + each element by 2 or declaring every element as a new entity. + + Reminders: + + - args.inputs.keyboard.KEY: Determines if a key has been pressed. + For more information about the keyboard, take a look at mygame/documentation/06-keyboard.md. + + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + + - args.outputs.solids: An array. The values generate a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + +=end + +# Calls methods needed for game to run properly +def tick args + tick_instructions args, "Use LEFT and RIGHT arrow keys to move and SPACE to jump." + defaults args + render args + calc args + input args +end + +# sets default values and creates empty collections +# initialization only happens in the first frame +def defaults args + fiddle args + args.state.enemy.hammers ||= [] + args.state.enemy.hammer_queue ||= [] + args.state.tick_count = args.state.tick_count + args.state.bridge_top = 128 + args.state.player.x ||= 0 # initializes player's properties + args.state.player.y ||= args.state.bridge_top + args.state.player.w ||= 64 + args.state.player.h ||= 64 + args.state.player.dy ||= 0 + args.state.player.dx ||= 0 + args.state.enemy.x ||= 800 # initializes enemy's properties + args.state.enemy.y ||= 0 + args.state.enemy.w ||= 128 + args.state.enemy.h ||= 128 + args.state.enemy.dy ||= 0 + args.state.enemy.dx ||= 0 + args.state.game_over_at ||= 0 +end + +# sets enemy, player, hammer values +def fiddle args + args.state.gravity = -0.3 + args.state.enemy_jump_power = 10 # sets enemy values + args.state.enemy_jump_interval = 60 + args.state.hammer_throw_interval = 40 # sets hammer values + args.state.hammer_launch_power_default = 5 + args.state.hammer_launch_power_near = 2 + args.state.hammer_launch_power_far = 7 + args.state.hammer_upward_launch_power = 15 + args.state.max_hammers_per_volley = 10 + args.state.gap_between_hammers = 10 + args.state.player_jump_power = 10 # sets player values + args.state.player_jump_power_duration = 10 + args.state.player_max_run_speed = 10 + args.state.player_speed_slowdown_rate = 0.9 + args.state.player_acceleration = 1 + args.state.hammer_size = 32 +end + +# outputs objects onto the screen +def render args + args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge + # sets x by multiplying 64 to index to find pixel value (places all squares side by side) + # subtracts 64 from bridge_top because position is denoted by bottom left corner + [i * 64, args.state.bridge_top - 64, 64, 64] + end + + args.outputs.solids << [args.state.x, args.state.y, args.state.w, args.state.h, 255, 0, 0] + args.outputs.solids << [args.state.player.x, args.state.player.y, args.state.player.w, args.state.player.h, 255, 0, 0] # outputs player onto screen (red box) + args.outputs.solids << [args.state.enemy.x, args.state.enemy.y, args.state.enemy.w, args.state.enemy.h, 0, 255, 0] # outputs enemy onto screen (green box) + args.outputs.solids << args.state.enemy.hammers # outputs enemy's hammers onto screen +end + +# Performs calculations to move objects on the screen +def calc args + + # Since velocity is the change in position, the change in x increases by dx. Same with y and dy. + args.state.player.x += args.state.player.dx + args.state.player.y += args.state.player.dy + + # Since acceleration is the change in velocity, the change in y (dy) increases every frame + args.state.player.dy += args.state.gravity + + # player's y position is either current y position or y position of top of + # bridge, whichever has a greater value + # ensures that the player never goes below the bridge + args.state.player.y = args.state.player.y.greater(args.state.bridge_top) + + # player's x position is either the current x position or 0, whichever has a greater value + # ensures that the player doesn't go too far left (out of the screen's scope) + args.state.player.x = args.state.player.x.greater(0) + + # player is not falling if it is located on the top of the bridge + args.state.player.falling = false if args.state.player.y == args.state.bridge_top + args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player + + args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx + args.state.enemy.y += args.state.enemy.dy # same with y and dy + + # ensures that the enemy never goes below the bridge + args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) + + # ensures that the enemy never goes too far left (outside the screen's scope) + args.state.enemy.x = args.state.enemy.x.greater(0) + + # objects that go up must come down because of gravity + args.state.enemy.dy += args.state.gravity + + args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top) + + #sets definition of enemy + args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w] + + if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge + args.state.enemy.dy = 0 # there is no change in y + end + + # if 60 frames have passed and the enemy is not moving vertically + if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0 + args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up + end + + # if 40 frames have passed or 5 frames have passed since the game ended + if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5 + # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded) + # that is why we're adding 1, to include the max possibility + volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations) + + # if the horizontal distance between the player and enemy is less than 128 pixels + if (args.state.player.x - args.state.enemy.x).abs < 128 + # the change in x won't be that great since the enemy and player are closer to each other + volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1 + end + + # if the horizontal distance between the player and enemy is greater than 300 pixels + if (args.state.player.x - args.state.enemy.x).abs > 300 + # change in x will be more drastic since player and enemy are so far apart + volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change + end + + (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i| + args.state.enemy.hammer_queue << { # stores hammer values in a hash + x: args.state.enemy.x, + w: args.state.hammer_size, + h: args.state.hammer_size, + dx: volley_dx, # change in horizontal position + # multiplication operator takes precedence over addition operator + throw_at: args.state.tick_count + i * args.state.gap_between_hammers + } + end + end + + # add elements from hammer_queue collection to the hammers collection by + # finding all hammers that were thrown before the current frame (have already been thrown) + args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h| + h[:throw_at] < args.state.tick_count + end + + args.state.enemy.hammers.each do |h| # sets values for all hammers in collection + h[:y] ||= args.state.enemy.y + 130 + h[:dy] ||= args.state.hammer_upward_launch_power + h[:dy] += args.state.gravity # acceleration is change in gravity + h[:x] += h[:dx] # incremented by change in position + h[:y] += h[:dy] + h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect + end + + # reject hammers that have been thrown before current frame (have already been thrown) + args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h| + h[:throw_at] < args.state.tick_count + end + + # any hammers with a y position less than 0 are rejected from the hammers collection + # since they have gone too far down (outside the scope's screen) + args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 } + + # if there are any hammers that intersect with (or hit) the player, + # the reset_player method is called (so the game can start over) + if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) } + reset_player args + end + + # if the enemy's rect intersects with (or hits) the player, + # the reset_player method is called (so the game can start over) + if args.state.enemy.rect.intersect_rect? args.state.player.rect + reset_player args + end +end + +# Resets the player by changing its properties back to the values they had at initialization +def reset_player args + args.state.player.x = 0 + args.state.player.y = args.state.bridge_top + args.state.player.dy = 0 + args.state.player.dx = 0 + args.state.enemy.hammers.clear # empties hammer collection + args.state.enemy.hammer_queue.clear # empties hammer_queue + args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time) +end + +# Processes input from the user to move the player +def input args + if args.inputs.keyboard.space # if the user presses the space bar + args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame + + # if the time that has passed since the jump is less than the player's jump duration and + # the player is not falling + if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling + args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump + end + end + + # if the space bar is in the "up" state (or not being pressed down) + if args.inputs.keyboard.key_up.space + args.state.player.jumped_at = nil # jumped_at is empty + args.state.player.falling = true # the player is falling + end + + if args.inputs.keyboard.left # if left key is pressed + args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left) + # dx is either set to current dx or the negative max run speed (which would be -10), + # whichever has a greater value + args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed) + elsif args.inputs.keyboard.right # if right key is pressed + args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right) + # dx is either set to current dx or max run speed (which would be 10), + # whichever has a lesser value + args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed) + else + args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down + end +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.space || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/02_collision_02_moving_objects/license-for-sample.txt b/samples/02_collision_02_moving_objects/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/02_collision_02_moving_objects/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/02_collision_02_moving_objects/replay.txt b/samples/02_collision_02_moving_objects/replay.txt new file mode 100644 index 0000000..f6ef481 --- /dev/null +++ b/samples/02_collision_02_moving_objects/replay.txt @@ -0,0 +1,90 @@ +replay_version 2.0 +stopped_at 820 +seed 100 +recorded_at Sun Sep 29 21:39:44 2019 +[:key_down_raw, 1073741903, 0, 2, 1, 142] +[:key_up_raw, 1073741903, 0, 2, 2, 155] +[:key_down_raw, 1073741904, 0, 2, 3, 172] +[:key_down_raw, 1073741903, 0, 2, 4, 187] +[:key_up_raw, 1073741904, 0, 2, 5, 188] +[:key_down_raw, 32, 0, 2, 6, 207] +[:key_down_raw, 1073741904, 0, 2, 7, 207] +[:key_up_raw, 1073741903, 0, 2, 8, 210] +[:key_down_raw, 1073741903, 0, 2, 9, 229] +[:key_up_raw, 1073741904, 0, 2, 10, 233] +[:key_up_raw, 32, 0, 2, 11, 250] +[:key_down_raw, 1073741904, 0, 2, 12, 251] +[:key_up_raw, 1073741903, 0, 2, 13, 251] +[:key_up_raw, 1073741904, 0, 2, 14, 264] +[:key_down_raw, 1073741903, 0, 2, 15, 277] +[:key_up_raw, 1073741903, 0, 2, 16, 284] +[:key_down_raw, 1073741903, 0, 2, 17, 318] +[:key_down_raw, 1073741903, 0, 2, 18, 343] +[:key_down_raw, 1073741903, 0, 2, 19, 345] +[:key_down_raw, 1073741903, 0, 2, 20, 347] +[:key_down_raw, 1073741903, 0, 2, 21, 349] +[:key_down_raw, 1073741903, 0, 2, 22, 351] +[:key_up_raw, 1073741903, 0, 2, 23, 351] +[:key_down_raw, 1073741904, 0, 2, 24, 373] +[:key_up_raw, 1073741904, 0, 2, 25, 381] +[:key_down_raw, 1073741904, 0, 2, 26, 400] +[:key_up_raw, 1073741904, 0, 2, 27, 404] +[:key_down_raw, 1073741904, 0, 2, 28, 412] +[:key_down_raw, 1073741904, 0, 2, 29, 438] +[:key_up_raw, 1073741904, 0, 2, 30, 439] +[:key_down_raw, 1073741903, 0, 2, 31, 467] +[:key_down_raw, 1073741903, 0, 2, 32, 492] +[:key_down_raw, 1073741903, 0, 2, 33, 494] +[:key_down_raw, 1073741903, 0, 2, 34, 496] +[:key_down_raw, 1073741903, 0, 2, 35, 498] +[:key_down_raw, 1073741903, 0, 2, 36, 500] +[:key_down_raw, 1073741903, 0, 2, 37, 502] +[:key_down_raw, 1073741903, 0, 2, 38, 504] +[:key_down_raw, 1073741903, 0, 2, 39, 506] +[:key_down_raw, 1073741903, 0, 2, 40, 509] +[:key_down_raw, 1073741903, 0, 2, 41, 510] +[:key_down_raw, 1073741903, 0, 2, 42, 513] +[:key_down_raw, 1073741903, 0, 2, 43, 515] +[:key_down_raw, 1073741903, 0, 2, 44, 517] +[:key_down_raw, 1073741903, 0, 2, 45, 519] +[:key_down_raw, 1073741903, 0, 2, 46, 521] +[:key_down_raw, 1073741903, 0, 2, 47, 523] +[:key_down_raw, 1073741903, 0, 2, 48, 525] +[:key_down_raw, 1073741903, 0, 2, 49, 527] +[:key_up_raw, 1073741903, 0, 2, 50, 527] +[:key_down_raw, 1073741903, 0, 2, 51, 559] +[:key_down_raw, 1073741903, 0, 2, 52, 584] +[:key_down_raw, 1073741903, 0, 2, 53, 586] +[:key_down_raw, 1073741903, 0, 2, 54, 588] +[:key_down_raw, 1073741903, 0, 2, 55, 590] +[:key_down_raw, 1073741903, 0, 2, 56, 592] +[:key_down_raw, 1073741903, 0, 2, 57, 595] +[:key_down_raw, 1073741903, 0, 2, 58, 597] +[:key_down_raw, 1073741903, 0, 2, 59, 599] +[:key_down_raw, 1073741903, 0, 2, 60, 601] +[:key_down_raw, 32, 0, 2, 61, 601] +[:key_down_raw, 1073741904, 0, 2, 62, 604] +[:key_up_raw, 1073741903, 0, 2, 63, 606] +[:key_down_raw, 1073741903, 0, 2, 64, 620] +[:key_up_raw, 1073741904, 0, 2, 65, 624] +[:key_down_raw, 1073741903, 0, 2, 66, 645] +[:key_down_raw, 1073741903, 0, 2, 67, 647] +[:key_down_raw, 1073741903, 0, 2, 68, 649] +[:key_down_raw, 1073741903, 0, 2, 69, 651] +[:key_down_raw, 1073741903, 0, 2, 70, 654] +[:key_down_raw, 1073741903, 0, 2, 71, 656] +[:key_down_raw, 1073741903, 0, 2, 72, 658] +[:key_up_raw, 32, 0, 2, 73, 658] +[:key_down_raw, 1073741903, 0, 2, 74, 660] +[:key_down_raw, 1073741903, 0, 2, 75, 662] +[:key_down_raw, 1073741903, 0, 2, 76, 664] +[:key_down_raw, 1073741903, 0, 2, 77, 666] +[:key_down_raw, 1073741903, 0, 2, 78, 668] +[:key_down_raw, 1073741903, 0, 2, 79, 670] +[:key_down_raw, 1073741903, 0, 2, 80, 672] +[:key_down_raw, 1073741903, 0, 2, 81, 674] +[:key_down_raw, 1073741903, 0, 2, 82, 676] +[:key_down_raw, 1073741903, 0, 2, 83, 678] +[:key_up_raw, 1073741903, 0, 2, 84, 678] +[:key_down_raw, 1073742051, 1024, 2, 85, 818] +[:key_down_raw, 113, 1024, 2, 86, 819] diff --git a/samples/02_collision_03_entities/app/main.rb b/samples/02_collision_03_entities/app/main.rb new file mode 100644 index 0000000..afbc3df --- /dev/null +++ b/samples/02_collision_03_entities/app/main.rb @@ -0,0 +1,151 @@ +=begin + + Reminders: + + - map: Ruby method used to transform data; used in arrays, hashes, and collections. + Can be used to perform an action on every element of a collection, such as multiplying + each element by 2 or declaring every element as a new entity. + + - reject: Removes elements from a collection if they meet certain requirements. + For example, you can derive an array of odd numbers from an original array of + numbers 1 through 10 by rejecting all elements that are even (or divisible by 2). + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + In this sample app, new_entity is used to define the properties of enemies and bullets. + (Remember, you can use state to define ANY property and it will be retained across frames.) + + - args.outputs.labels: An array. The values generate a label on the screen. + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + + - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect. + + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + +=end + +# This sample app shows enemies that contain an id value and the time they were created. +# These enemies can be removed by shooting at them with bullets. + +# Calls all methods necessary for the game to function properly. +def tick args + tick_instructions args, "Sample app shows how to use args.state.new_entity along with collisions. CLICK to shoot a bullet." + defaults args + render args + calc args + process_inputs args +end + +# Sets default values +# Enemies and bullets start off as empty collections +def defaults args + args.state.enemies ||= [] + args.state.bullets ||= [] +end + +# Provides each enemy in enemies collection with rectangular border, +# as well as a label showing id and when they were created +def render args + # When you're calling a method that takes no arguments, you can use this & syntax on map. + # Numbers are being added to x and y in order to keep the text within the enemy's borders. + args.outputs.borders << args.state.enemies.map(&:rect) + args.outputs.labels << args.state.enemies.flat_map do |enemy| + [ + [enemy.x + 4, enemy.y + 29, "id: #{enemy.entity_id}", -3, 0], + [enemy.x + 4, enemy.y + 17, "created_at: #{enemy.created_at}", -3, 0] # frame enemy was created + ] + end + + # Outputs bullets in bullets collection as rectangular solids + args.outputs.solids << args.state.bullets.map(&:rect) +end + +# Calls all methods necessary for performing calculations +def calc args + add_new_enemies_if_needed args + move_bullets args + calculate_collisions args + remove_bullets_of_screen args +end + +# Adds enemies to the enemies collection and sets their values +def add_new_enemies_if_needed args + return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added + return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added + + args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total + args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity + e.x = 640 + 500 * rand # each enemy is given random position on screen + e.y = 600 * rand + 50 + e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect + end + end +end + +# Moves bullets across screen +# Sets definition of the bullets +def move_bullets args + args.state.bullets.each do |bullet| # perform action on each bullet in collection + bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen) + + # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out + # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to + # see what happens to the bullet's movement. + bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign) + bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect + end +end + +# Determines if a bullet hits an enemy +def calculate_collisions args + args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections + args.state.enemies.each do |enemy| + # if bullet has not exploded yet and the bullet hits an enemy + if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect) + bullet.exploded = true # bullet explodes + enemy.dead = true # enemy is killed + end + end + end + + # All exploded bullets are rejected or removed from the bullets collection + # and any dead enemy is rejected from the enemies collection. + args.state.bullets = args.state.bullets.reject(&:exploded) + args.state.enemies = args.state.enemies.reject(&:dead) +end + +# Bullets are rejected from bullets collection once their position exceeds the width of screen +def remove_bullets_of_screen args + args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280 +end + +# Calls fire_bullet method +def process_inputs args + fire_bullet args +end + +# Once mouse is clicked by the user to fire a bullet, a new bullet is added to bullets collection +def fire_bullet args + return unless args.inputs.mouse.click # return unless mouse is clicked + args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity + bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked + bullet.x = 0 # starts on the left side of the screen + bullet.size = 10 + bullet.speed = 10 * rand + 2 # speed of a bullet is randomized + bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set + end +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.space || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/02_collision_03_entities/license-for-sample.txt b/samples/02_collision_03_entities/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/02_collision_03_entities/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/02_collision_03_entities/replay.txt b/samples/02_collision_03_entities/replay.txt new file mode 100644 index 0000000..95e90be --- /dev/null +++ b/samples/02_collision_03_entities/replay.txt @@ -0,0 +1,682 @@ +replay_version 2.0 +stopped_at 1274 +seed 100 +recorded_at Sun Sep 29 21:40:29 2019 +[:mouse_move, 961, 28, 2, 1, 44] +[:mouse_move, 948, 31, 2, 2, 45] +[:mouse_move, 932, 36, 2, 3, 46] +[:mouse_move, 891, 48, 2, 4, 47] +[:mouse_move, 868, 55, 2, 5, 48] +[:mouse_move, 779, 79, 2, 6, 49] +[:mouse_move, 713, 96, 2, 7, 50] +[:mouse_move, 568, 120, 2, 8, 51] +[:mouse_move, 448, 132, 2, 9, 52] +[:mouse_move, 332, 134, 2, 10, 53] +[:mouse_move, 305, 134, 2, 11, 54] +[:mouse_move, 272, 132, 2, 12, 55] +[:mouse_move, 262, 131, 2, 13, 56] +[:mouse_move, 233, 127, 2, 14, 57] +[:mouse_move, 225, 126, 2, 15, 58] +[:mouse_move, 208, 123, 2, 16, 59] +[:mouse_move, 205, 123, 2, 17, 72] +[:mouse_move, 191, 131, 2, 18, 73] +[:mouse_move, 183, 135, 2, 19, 74] +[:mouse_move, 176, 138, 2, 20, 75] +[:mouse_move, 165, 144, 2, 21, 76] +[:mouse_move, 160, 146, 2, 22, 77] +[:mouse_move, 153, 149, 2, 23, 78] +[:mouse_move, 152, 149, 2, 24, 79] +[:mouse_move, 150, 150, 2, 25, 80] +[:mouse_move, 150, 149, 2, 26, 82] +[:mouse_move, 151, 148, 2, 27, 83] +[:mouse_move, 152, 146, 2, 28, 84] +[:mouse_move, 154, 144, 2, 29, 85] +[:mouse_move, 154, 143, 2, 30, 86] +[:mouse_move, 155, 143, 2, 31, 87] +[:mouse_move, 155, 142, 2, 32, 88] +[:mouse_move, 155, 141, 2, 33, 93] +[:mouse_move, 155, 140, 2, 34, 97] +[:mouse_move, 155, 138, 2, 35, 98] +[:mouse_move, 155, 136, 2, 36, 99] +[:mouse_move, 156, 135, 2, 37, 100] +[:mouse_move, 156, 133, 2, 38, 101] +[:mouse_move, 156, 132, 2, 39, 103] +[:mouse_button_pressed, 1, 0, 1, 40, 119] +[:mouse_button_up, 1, 0, 1, 41, 125] +[:mouse_move, 156, 133, 2, 42, 129] +[:mouse_move, 156, 138, 2, 43, 130] +[:mouse_move, 156, 147, 2, 44, 131] +[:mouse_move, 156, 163, 2, 45, 132] +[:mouse_move, 156, 174, 2, 46, 133] +[:mouse_move, 156, 182, 2, 47, 134] +[:mouse_move, 156, 192, 2, 48, 135] +[:mouse_move, 156, 194, 2, 49, 136] +[:mouse_move, 156, 195, 2, 50, 137] +[:mouse_move, 156, 196, 2, 51, 138] +[:mouse_button_pressed, 1, 0, 1, 52, 138] +[:mouse_button_up, 1, 0, 1, 53, 148] +[:mouse_move, 156, 205, 2, 54, 154] +[:mouse_move, 156, 215, 2, 55, 155] +[:mouse_move, 156, 220, 2, 56, 156] +[:mouse_move, 156, 226, 2, 57, 157] +[:mouse_move, 156, 229, 2, 58, 158] +[:mouse_move, 156, 236, 2, 59, 159] +[:mouse_move, 156, 238, 2, 60, 160] +[:mouse_move, 156, 242, 2, 61, 161] +[:mouse_move, 156, 246, 2, 62, 162] +[:mouse_move, 156, 271, 2, 63, 163] +[:mouse_move, 157, 288, 2, 64, 164] +[:mouse_move, 161, 322, 2, 65, 165] +[:mouse_move, 165, 343, 2, 66, 166] +[:mouse_move, 178, 405, 2, 67, 167] +[:mouse_move, 187, 432, 2, 68, 168] +[:mouse_button_pressed, 1, 0, 1, 69, 181] +[:mouse_move, 187, 440, 2, 70, 191] +[:mouse_move, 188, 466, 2, 71, 192] +[:mouse_move, 188, 476, 2, 72, 193] +[:mouse_move, 188, 486, 2, 73, 194] +[:mouse_move, 188, 501, 2, 74, 195] +[:mouse_move, 189, 512, 2, 75, 196] +[:mouse_move, 190, 516, 2, 76, 197] +[:mouse_move, 190, 517, 2, 77, 198] +[:mouse_move, 190, 518, 2, 78, 199] +[:mouse_move, 190, 519, 2, 79, 200] +[:mouse_move, 190, 520, 2, 80, 202] +[:mouse_move, 191, 520, 2, 81, 206] +[:mouse_move, 191, 521, 2, 82, 207] +[:mouse_move, 193, 523, 2, 83, 208] +[:mouse_move, 193, 524, 2, 84, 209] +[:mouse_move, 194, 526, 2, 85, 210] +[:mouse_move, 194, 527, 2, 86, 211] +[:mouse_move, 195, 528, 2, 87, 212] +[:mouse_move, 195, 529, 2, 88, 221] +[:mouse_move, 195, 528, 2, 89, 224] +[:mouse_button_up, 1, 0, 1, 90, 227] +[:mouse_button_pressed, 1, 0, 1, 91, 245] +[:mouse_button_up, 1, 0, 1, 92, 246] +[:mouse_button_pressed, 1, 0, 1, 93, 255] +[:mouse_button_up, 1, 0, 1, 94, 255] +[:mouse_button_pressed, 1, 0, 1, 95, 260] +[:mouse_button_up, 1, 0, 1, 96, 262] +[:mouse_button_pressed, 1, 0, 1, 97, 268] +[:mouse_button_up, 1, 0, 1, 98, 271] +[:mouse_button_pressed, 1, 0, 1, 99, 281] +[:mouse_button_up, 1, 0, 1, 100, 285] +[:mouse_button_pressed, 1, 0, 1, 101, 288] +[:mouse_button_up, 1, 0, 1, 102, 294] +[:mouse_move, 195, 527, 2, 103, 310] +[:mouse_move, 196, 522, 2, 104, 311] +[:mouse_move, 208, 493, 2, 105, 312] +[:mouse_move, 213, 482, 2, 106, 313] +[:mouse_move, 227, 457, 2, 107, 314] +[:mouse_move, 236, 444, 2, 108, 315] +[:mouse_move, 250, 425, 2, 109, 316] +[:mouse_move, 256, 418, 2, 110, 317] +[:mouse_move, 266, 410, 2, 111, 318] +[:mouse_move, 270, 408, 2, 112, 319] +[:mouse_move, 278, 406, 2, 113, 320] +[:mouse_move, 280, 406, 2, 114, 321] +[:mouse_move, 285, 405, 2, 115, 322] +[:mouse_move, 286, 405, 2, 116, 323] +[:mouse_move, 288, 405, 2, 117, 324] +[:mouse_move, 288, 404, 2, 118, 325] +[:mouse_move, 289, 404, 2, 119, 326] +[:mouse_button_pressed, 1, 0, 1, 120, 330] +[:mouse_button_up, 1, 0, 1, 121, 339] +[:mouse_move, 291, 402, 2, 122, 342] +[:mouse_move, 297, 391, 2, 123, 343] +[:mouse_move, 308, 375, 2, 124, 344] +[:mouse_move, 324, 357, 2, 125, 345] +[:mouse_move, 346, 337, 2, 126, 346] +[:mouse_move, 353, 334, 2, 127, 347] +[:mouse_move, 379, 321, 2, 128, 348] +[:mouse_move, 384, 321, 2, 129, 349] +[:mouse_move, 397, 320, 2, 130, 350] +[:mouse_move, 406, 320, 2, 131, 351] +[:mouse_move, 408, 320, 2, 132, 352] +[:mouse_move, 410, 320, 2, 133, 353] +[:mouse_button_pressed, 1, 0, 1, 134, 353] +[:mouse_move, 411, 320, 2, 135, 353] +[:mouse_button_up, 1, 0, 1, 136, 362] +[:mouse_move, 410, 320, 2, 137, 364] +[:mouse_move, 410, 321, 2, 138, 374] +[:mouse_move, 410, 323, 2, 139, 375] +[:mouse_move, 409, 324, 2, 140, 376] +[:mouse_move, 409, 325, 2, 141, 377] +[:mouse_move, 425, 314, 2, 142, 381] +[:mouse_move, 441, 305, 2, 143, 382] +[:mouse_move, 470, 293, 2, 144, 383] +[:mouse_move, 530, 278, 2, 145, 384] +[:mouse_move, 557, 278, 2, 146, 385] +[:mouse_move, 585, 278, 2, 147, 386] +[:mouse_move, 619, 287, 2, 148, 387] +[:mouse_move, 638, 292, 2, 149, 388] +[:mouse_move, 658, 298, 2, 150, 389] +[:mouse_move, 670, 303, 2, 151, 390] +[:mouse_move, 686, 307, 2, 152, 391] +[:mouse_move, 692, 309, 2, 153, 392] +[:mouse_move, 698, 309, 2, 154, 393] +[:mouse_move, 701, 310, 2, 155, 394] +[:mouse_move, 705, 311, 2, 156, 395] +[:mouse_move, 706, 312, 2, 157, 396] +[:mouse_move, 708, 313, 2, 158, 397] +[:mouse_move, 708, 303, 2, 159, 401] +[:mouse_move, 708, 297, 2, 160, 402] +[:mouse_move, 708, 290, 2, 161, 403] +[:mouse_move, 708, 286, 2, 162, 404] +[:mouse_move, 705, 280, 2, 163, 405] +[:mouse_move, 701, 281, 2, 164, 406] +[:mouse_move, 687, 294, 2, 165, 407] +[:mouse_move, 678, 303, 2, 166, 408] +[:mouse_move, 669, 311, 2, 167, 409] +[:mouse_move, 635, 331, 2, 168, 410] +[:mouse_move, 628, 333, 2, 169, 411] +[:mouse_move, 617, 335, 2, 170, 412] +[:mouse_move, 610, 336, 2, 171, 413] +[:mouse_move, 601, 338, 2, 172, 414] +[:mouse_move, 599, 339, 2, 173, 415] +[:mouse_button_pressed, 1, 0, 1, 174, 415] +[:mouse_move, 598, 339, 2, 175, 415] +[:mouse_button_up, 1, 0, 1, 176, 425] +[:mouse_move, 598, 337, 2, 177, 425] +[:mouse_move, 600, 334, 2, 178, 425] +[:mouse_move, 603, 329, 2, 179, 426] +[:mouse_move, 608, 325, 2, 180, 427] +[:mouse_move, 621, 316, 2, 181, 428] +[:mouse_move, 639, 307, 2, 182, 429] +[:mouse_move, 669, 296, 2, 183, 430] +[:mouse_move, 690, 290, 2, 184, 431] +[:mouse_move, 720, 278, 2, 185, 432] +[:mouse_move, 738, 271, 2, 186, 433] +[:mouse_move, 754, 265, 2, 187, 434] +[:mouse_move, 770, 261, 2, 188, 435] +[:mouse_move, 772, 261, 2, 189, 436] +[:mouse_move, 782, 259, 2, 190, 437] +[:mouse_move, 786, 259, 2, 191, 438] +[:mouse_move, 787, 259, 2, 192, 440] +[:mouse_button_pressed, 1, 0, 1, 193, 440] +[:mouse_button_up, 1, 0, 1, 194, 451] +[:mouse_move, 785, 259, 2, 195, 454] +[:mouse_move, 780, 259, 2, 196, 455] +[:mouse_move, 753, 270, 2, 197, 456] +[:mouse_move, 695, 302, 2, 198, 457] +[:mouse_move, 665, 322, 2, 199, 458] +[:mouse_move, 631, 349, 2, 200, 459] +[:mouse_move, 553, 433, 2, 201, 460] +[:mouse_move, 513, 485, 2, 202, 461] +[:mouse_move, 438, 608, 2, 203, 462] +[:mouse_move, 381, 719, 2, 204, 463] +[:mouse_move, 383, 695, 2, 205, 484] +[:mouse_move, 386, 690, 2, 206, 485] +[:mouse_move, 402, 671, 2, 207, 486] +[:mouse_move, 409, 665, 2, 208, 487] +[:mouse_move, 415, 658, 2, 209, 488] +[:mouse_move, 418, 655, 2, 210, 489] +[:mouse_move, 420, 654, 2, 211, 490] +[:mouse_move, 422, 653, 2, 212, 490] +[:mouse_move, 423, 652, 2, 213, 491] +[:mouse_move, 424, 650, 2, 214, 492] +[:mouse_move, 425, 648, 2, 215, 492] +[:mouse_move, 426, 646, 2, 216, 493] +[:mouse_move, 428, 638, 2, 217, 494] +[:mouse_move, 430, 633, 2, 218, 495] +[:mouse_move, 433, 627, 2, 219, 496] +[:mouse_move, 436, 615, 2, 220, 497] +[:mouse_move, 438, 609, 2, 221, 498] +[:mouse_move, 439, 604, 2, 222, 498] +[:mouse_move, 439, 598, 2, 223, 499] +[:mouse_move, 440, 593, 2, 224, 500] +[:mouse_move, 440, 586, 2, 225, 501] +[:mouse_move, 440, 582, 2, 226, 502] +[:mouse_move, 440, 579, 2, 227, 502] +[:mouse_move, 440, 577, 2, 228, 503] +[:mouse_move, 440, 576, 2, 229, 504] +[:mouse_move, 440, 575, 2, 230, 504] +[:mouse_move, 440, 574, 2, 231, 505] +[:mouse_move, 440, 572, 2, 232, 507] +[:mouse_move, 440, 571, 2, 233, 508] +[:mouse_move, 440, 570, 2, 234, 508] +[:mouse_move, 440, 569, 2, 235, 509] +[:mouse_move, 440, 568, 2, 236, 510] +[:mouse_move, 440, 567, 2, 237, 511] +[:mouse_move, 440, 566, 2, 238, 511] +[:mouse_button_pressed, 1, 0, 1, 239, 512] +[:mouse_move, 441, 566, 2, 240, 512] +[:mouse_button_up, 1, 0, 1, 241, 520] +[:mouse_move, 444, 566, 2, 242, 533] +[:mouse_move, 466, 576, 2, 243, 534] +[:mouse_move, 480, 582, 2, 244, 535] +[:mouse_move, 559, 606, 2, 245, 536] +[:mouse_move, 651, 624, 2, 246, 537] +[:mouse_move, 685, 628, 2, 247, 538] +[:mouse_move, 770, 634, 2, 248, 539] +[:mouse_move, 821, 634, 2, 249, 540] +[:mouse_move, 830, 634, 2, 250, 541] +[:mouse_move, 850, 634, 2, 251, 542] +[:mouse_move, 859, 634, 2, 252, 543] +[:mouse_move, 864, 634, 2, 253, 544] +[:mouse_move, 869, 634, 2, 254, 545] +[:mouse_move, 870, 634, 2, 255, 546] +[:mouse_move, 871, 634, 2, 256, 547] +[:mouse_move, 872, 634, 2, 257, 549] +[:mouse_move, 873, 633, 2, 258, 550] +[:mouse_move, 875, 633, 2, 259, 551] +[:mouse_move, 875, 632, 2, 260, 553] +[:mouse_button_pressed, 1, 0, 1, 261, 553] +[:mouse_move, 876, 632, 2, 262, 553] +[:mouse_button_up, 1, 0, 1, 263, 562] +[:mouse_move, 877, 631, 2, 264, 565] +[:mouse_move, 885, 625, 2, 265, 566] +[:mouse_move, 898, 616, 2, 266, 567] +[:mouse_move, 926, 597, 2, 267, 568] +[:mouse_move, 943, 585, 2, 268, 569] +[:mouse_move, 965, 573, 2, 269, 570] +[:mouse_move, 971, 571, 2, 270, 571] +[:mouse_move, 992, 560, 2, 271, 572] +[:mouse_move, 999, 557, 2, 272, 573] +[:mouse_move, 1005, 555, 2, 273, 574] +[:mouse_move, 1008, 553, 2, 274, 575] +[:mouse_move, 1012, 553, 2, 275, 576] +[:mouse_move, 1013, 553, 2, 276, 577] +[:mouse_move, 1015, 552, 2, 277, 578] +[:mouse_move, 1016, 551, 2, 278, 580] +[:mouse_button_pressed, 1, 0, 1, 279, 581] +[:mouse_button_up, 1, 0, 1, 280, 590] +[:mouse_move, 1013, 551, 2, 281, 601] +[:mouse_move, 1012, 551, 2, 282, 602] +[:mouse_move, 1010, 551, 2, 283, 603] +[:mouse_move, 1009, 550, 2, 284, 604] +[:mouse_move, 1008, 547, 2, 285, 605] +[:mouse_move, 1008, 546, 2, 286, 606] +[:mouse_move, 1007, 543, 2, 287, 607] +[:mouse_move, 1006, 541, 2, 288, 608] +[:mouse_move, 1006, 537, 2, 289, 609] +[:mouse_move, 1006, 534, 2, 290, 610] +[:mouse_move, 1006, 524, 2, 291, 611] +[:mouse_move, 1006, 517, 2, 292, 612] +[:mouse_move, 1010, 495, 2, 293, 613] +[:mouse_move, 1014, 482, 2, 294, 614] +[:mouse_move, 1023, 456, 2, 295, 615] +[:mouse_move, 1026, 449, 2, 296, 616] +[:mouse_move, 1031, 437, 2, 297, 617] +[:mouse_move, 1034, 431, 2, 298, 618] +[:mouse_move, 1038, 423, 2, 299, 619] +[:mouse_move, 1039, 421, 2, 300, 620] +[:mouse_move, 1040, 419, 2, 301, 621] +[:mouse_move, 1041, 418, 2, 302, 622] +[:mouse_move, 1041, 415, 2, 303, 635] +[:mouse_move, 1040, 408, 2, 304, 636] +[:mouse_move, 1039, 403, 2, 305, 637] +[:mouse_move, 1035, 393, 2, 306, 638] +[:mouse_move, 1032, 389, 2, 307, 639] +[:mouse_move, 1028, 385, 2, 308, 640] +[:mouse_move, 1027, 383, 2, 309, 641] +[:mouse_move, 1024, 380, 2, 310, 642] +[:mouse_move, 1023, 379, 2, 311, 643] +[:mouse_button_pressed, 1, 0, 1, 312, 644] +[:mouse_move, 1023, 378, 2, 313, 644] +[:mouse_move, 1017, 378, 2, 314, 654] +[:mouse_button_up, 1, 0, 1, 315, 655] +[:mouse_move, 1008, 377, 2, 316, 655] +[:mouse_move, 998, 376, 2, 317, 656] +[:mouse_move, 965, 371, 2, 318, 657] +[:mouse_move, 918, 364, 2, 319, 658] +[:mouse_move, 895, 357, 2, 320, 659] +[:mouse_move, 885, 355, 2, 321, 660] +[:mouse_move, 860, 346, 2, 322, 661] +[:mouse_move, 848, 342, 2, 323, 662] +[:mouse_move, 833, 334, 2, 324, 663] +[:mouse_move, 831, 333, 2, 325, 664] +[:mouse_move, 826, 328, 2, 326, 665] +[:mouse_move, 825, 327, 2, 327, 666] +[:mouse_move, 823, 324, 2, 328, 667] +[:mouse_move, 821, 322, 2, 329, 669] +[:mouse_move, 821, 321, 2, 330, 670] +[:mouse_move, 814, 321, 2, 331, 671] +[:mouse_move, 802, 327, 2, 332, 672] +[:mouse_move, 758, 366, 2, 333, 673] +[:mouse_move, 724, 393, 2, 334, 674] +[:mouse_move, 684, 422, 2, 335, 675] +[:mouse_move, 625, 453, 2, 336, 676] +[:mouse_move, 583, 471, 2, 337, 677] +[:mouse_move, 559, 479, 2, 338, 678] +[:mouse_move, 539, 485, 2, 339, 679] +[:mouse_move, 503, 488, 2, 340, 680] +[:mouse_move, 484, 488, 2, 341, 681] +[:mouse_move, 450, 482, 2, 342, 682] +[:mouse_move, 432, 476, 2, 343, 683] +[:mouse_move, 397, 457, 2, 344, 684] +[:mouse_move, 391, 457, 2, 345, 700] +[:mouse_move, 366, 457, 2, 346, 701] +[:mouse_move, 301, 457, 2, 347, 702] +[:mouse_move, 265, 457, 2, 348, 703] +[:mouse_move, 231, 457, 2, 349, 704] +[:mouse_move, 99, 457, 2, 350, 705] +[:mouse_move, 74, 456, 2, 351, 706] +[:mouse_move, 42, 454, 2, 352, 707] +[:mouse_move, 34, 453, 2, 353, 708] +[:mouse_move, 6, 449, 2, 354, 709] +[:mouse_move, 0, 447, 2, 355, 710] +[:mouse_move, 0, 446, 2, 356, 711] +[:mouse_move, 0, 445, 2, 357, 717] +[:mouse_move, 0, 446, 2, 358, 720] +[:mouse_move, 1, 446, 2, 359, 723] +[:mouse_move, 12, 446, 2, 360, 844] +[:mouse_move, 34, 438, 2, 361, 845] +[:mouse_move, 58, 428, 2, 362, 845] +[:mouse_move, 113, 406, 2, 363, 846] +[:mouse_move, 211, 360, 2, 364, 847] +[:mouse_move, 364, 270, 2, 365, 848] +[:mouse_move, 398, 247, 2, 366, 849] +[:mouse_move, 448, 214, 2, 367, 850] +[:mouse_move, 462, 204, 2, 368, 851] +[:mouse_move, 497, 180, 2, 369, 852] +[:mouse_move, 510, 171, 2, 370, 853] +[:mouse_move, 518, 164, 2, 371, 853] +[:mouse_move, 523, 160, 2, 372, 854] +[:mouse_move, 527, 155, 2, 373, 855] +[:mouse_move, 531, 145, 2, 374, 856] +[:mouse_move, 533, 138, 2, 375, 857] +[:mouse_move, 537, 127, 2, 376, 858] +[:mouse_move, 540, 119, 2, 377, 859] +[:mouse_move, 548, 105, 2, 378, 860] +[:mouse_move, 561, 105, 2, 379, 874] +[:mouse_move, 587, 105, 2, 380, 874] +[:mouse_move, 626, 105, 2, 381, 875] +[:mouse_move, 677, 106, 2, 382, 876] +[:mouse_move, 837, 122, 2, 383, 876] +[:mouse_move, 910, 133, 2, 384, 877] +[:mouse_move, 1038, 154, 2, 385, 878] +[:mouse_move, 1135, 169, 2, 386, 879] +[:mouse_move, 1165, 173, 2, 387, 880] +[:mouse_move, 1237, 185, 2, 388, 881] +[:mouse_move, 1230, 185, 2, 389, 891] +[:mouse_move, 1221, 185, 2, 390, 892] +[:mouse_move, 1211, 183, 2, 391, 893] +[:mouse_move, 1196, 179, 2, 392, 893] +[:mouse_move, 1166, 172, 2, 393, 894] +[:mouse_move, 1149, 168, 2, 394, 895] +[:mouse_move, 1117, 161, 2, 395, 895] +[:mouse_move, 1084, 156, 2, 396, 896] +[:mouse_move, 1071, 155, 2, 397, 897] +[:mouse_move, 1046, 152, 2, 398, 897] +[:mouse_move, 1025, 151, 2, 399, 898] +[:mouse_move, 1005, 151, 2, 400, 899] +[:mouse_move, 986, 151, 2, 401, 899] +[:mouse_move, 970, 151, 2, 402, 900] +[:mouse_move, 964, 151, 2, 403, 901] +[:mouse_move, 959, 151, 2, 404, 901] +[:mouse_move, 952, 151, 2, 405, 902] +[:mouse_move, 946, 151, 2, 406, 903] +[:mouse_move, 942, 151, 2, 407, 903] +[:mouse_move, 940, 151, 2, 408, 904] +[:mouse_move, 939, 151, 2, 409, 905] +[:mouse_move, 937, 151, 2, 410, 906] +[:mouse_move, 937, 150, 2, 411, 908] +[:mouse_move, 937, 149, 2, 412, 910] +[:mouse_move, 938, 149, 2, 413, 912] +[:mouse_move, 938, 148, 2, 414, 913] +[:mouse_move, 939, 148, 2, 415, 914] +[:mouse_move, 941, 147, 2, 416, 915] +[:mouse_move, 943, 145, 2, 417, 916] +[:mouse_move, 944, 144, 2, 418, 917] +[:mouse_move, 945, 143, 2, 419, 918] +[:mouse_move, 945, 142, 2, 420, 918] +[:mouse_move, 946, 142, 2, 421, 919] +[:mouse_move, 946, 141, 2, 422, 920] +[:mouse_move, 947, 141, 2, 423, 921] +[:mouse_move, 948, 141, 2, 424, 929] +[:mouse_move, 949, 141, 2, 425, 931] +[:mouse_move, 951, 141, 2, 426, 932] +[:mouse_move, 952, 141, 2, 427, 933] +[:mouse_move, 954, 141, 2, 428, 934] +[:mouse_move, 959, 141, 2, 429, 935] +[:mouse_move, 960, 140, 2, 430, 936] +[:mouse_move, 964, 140, 2, 431, 937] +[:mouse_move, 965, 140, 2, 432, 938] +[:mouse_move, 968, 139, 2, 433, 939] +[:mouse_move, 969, 139, 2, 434, 940] +[:mouse_move, 971, 139, 2, 435, 941] +[:mouse_move, 972, 139, 2, 436, 942] +[:mouse_move, 975, 138, 2, 437, 943] +[:mouse_move, 977, 138, 2, 438, 944] +[:mouse_move, 979, 138, 2, 439, 945] +[:mouse_move, 982, 137, 2, 440, 945] +[:mouse_move, 985, 137, 2, 441, 946] +[:mouse_move, 988, 137, 2, 442, 947] +[:mouse_move, 989, 137, 2, 443, 947] +[:mouse_move, 992, 137, 2, 444, 948] +[:mouse_move, 994, 137, 2, 445, 949] +[:mouse_move, 996, 137, 2, 446, 949] +[:mouse_move, 997, 136, 2, 447, 950] +[:mouse_move, 999, 136, 2, 448, 951] +[:mouse_move, 1000, 136, 2, 449, 951] +[:mouse_move, 1001, 136, 2, 450, 952] +[:mouse_move, 1002, 135, 2, 451, 953] +[:mouse_move, 1003, 135, 2, 452, 953] +[:mouse_move, 1004, 134, 2, 453, 954] +[:mouse_move, 1005, 133, 2, 454, 955] +[:mouse_move, 1005, 132, 2, 455, 956] +[:mouse_move, 1006, 132, 2, 456, 957] +[:mouse_move, 1006, 131, 2, 457, 957] +[:mouse_move, 1007, 130, 2, 458, 958] +[:mouse_move, 1007, 128, 2, 459, 960] +[:mouse_move, 1007, 127, 2, 460, 961] +[:mouse_move, 1007, 126, 2, 461, 962] +[:mouse_move, 1007, 125, 2, 462, 963] +[:mouse_move, 1005, 123, 2, 463, 964] +[:mouse_move, 1004, 122, 2, 464, 965] +[:mouse_move, 1001, 120, 2, 465, 966] +[:mouse_move, 999, 118, 2, 466, 967] +[:mouse_move, 993, 116, 2, 467, 968] +[:mouse_move, 990, 115, 2, 468, 969] +[:mouse_move, 984, 114, 2, 469, 970] +[:mouse_move, 981, 113, 2, 470, 971] +[:mouse_move, 976, 112, 2, 471, 972] +[:mouse_move, 975, 112, 2, 472, 973] +[:mouse_move, 972, 112, 2, 473, 974] +[:mouse_move, 971, 111, 2, 474, 974] +[:mouse_move, 969, 111, 2, 475, 975] +[:mouse_move, 966, 111, 2, 476, 976] +[:mouse_move, 963, 111, 2, 477, 976] +[:mouse_move, 961, 111, 2, 478, 977] +[:mouse_move, 959, 111, 2, 479, 978] +[:mouse_move, 956, 111, 2, 480, 978] +[:mouse_move, 954, 111, 2, 481, 979] +[:mouse_move, 952, 112, 2, 482, 980] +[:mouse_move, 950, 112, 2, 483, 980] +[:mouse_move, 948, 112, 2, 484, 981] +[:mouse_move, 947, 113, 2, 485, 982] +[:mouse_move, 946, 113, 2, 486, 982] +[:mouse_move, 945, 113, 2, 487, 983] +[:mouse_move, 945, 114, 2, 488, 984] +[:mouse_move, 944, 115, 2, 489, 984] +[:mouse_move, 943, 115, 2, 490, 985] +[:mouse_move, 942, 116, 2, 491, 986] +[:mouse_move, 942, 117, 2, 492, 986] +[:mouse_move, 942, 118, 2, 493, 988] +[:mouse_move, 941, 119, 2, 494, 989] +[:mouse_move, 941, 121, 2, 495, 991] +[:mouse_move, 941, 122, 2, 496, 992] +[:mouse_move, 941, 123, 2, 497, 993] +[:mouse_move, 941, 124, 2, 498, 994] +[:mouse_move, 941, 127, 2, 499, 995] +[:mouse_move, 941, 129, 2, 500, 996] +[:mouse_move, 941, 132, 2, 501, 997] +[:mouse_move, 942, 134, 2, 502, 998] +[:mouse_move, 944, 136, 2, 503, 999] +[:mouse_move, 945, 138, 2, 504, 1000] +[:mouse_move, 947, 138, 2, 505, 1001] +[:mouse_move, 948, 139, 2, 506, 1001] +[:mouse_move, 949, 140, 2, 507, 1002] +[:mouse_move, 950, 140, 2, 508, 1003] +[:mouse_move, 952, 141, 2, 509, 1003] +[:mouse_move, 954, 141, 2, 510, 1004] +[:mouse_move, 956, 141, 2, 511, 1005] +[:mouse_move, 958, 141, 2, 512, 1005] +[:mouse_move, 960, 141, 2, 513, 1006] +[:mouse_move, 962, 141, 2, 514, 1007] +[:mouse_move, 964, 141, 2, 515, 1007] +[:mouse_move, 969, 141, 2, 516, 1008] +[:mouse_move, 972, 140, 2, 517, 1009] +[:mouse_move, 975, 140, 2, 518, 1009] +[:mouse_move, 978, 139, 2, 519, 1010] +[:mouse_move, 982, 138, 2, 520, 1011] +[:mouse_move, 987, 136, 2, 521, 1012] +[:mouse_move, 991, 135, 2, 522, 1013] +[:mouse_move, 996, 133, 2, 523, 1014] +[:mouse_move, 999, 132, 2, 524, 1015] +[:mouse_move, 1003, 130, 2, 525, 1016] +[:mouse_move, 1005, 128, 2, 526, 1018] +[:mouse_move, 1006, 126, 2, 527, 1020] +[:mouse_move, 1006, 125, 2, 528, 1021] +[:mouse_move, 1006, 124, 2, 529, 1022] +[:mouse_move, 1006, 123, 2, 530, 1023] +[:mouse_move, 1004, 122, 2, 531, 1024] +[:mouse_move, 1002, 121, 2, 532, 1025] +[:mouse_move, 995, 119, 2, 533, 1026] +[:mouse_move, 990, 118, 2, 534, 1027] +[:mouse_move, 985, 117, 2, 535, 1028] +[:mouse_move, 981, 116, 2, 536, 1028] +[:mouse_move, 979, 116, 2, 537, 1029] +[:mouse_move, 975, 115, 2, 538, 1030] +[:mouse_move, 972, 115, 2, 539, 1030] +[:mouse_move, 969, 115, 2, 540, 1031] +[:mouse_move, 966, 115, 2, 541, 1032] +[:mouse_move, 964, 115, 2, 542, 1032] +[:mouse_move, 962, 115, 2, 543, 1033] +[:mouse_move, 961, 116, 2, 544, 1034] +[:mouse_move, 960, 116, 2, 545, 1034] +[:mouse_move, 959, 117, 2, 546, 1035] +[:mouse_move, 958, 118, 2, 547, 1036] +[:mouse_move, 956, 120, 2, 548, 1036] +[:mouse_move, 955, 122, 2, 549, 1037] +[:mouse_move, 955, 125, 2, 550, 1038] +[:mouse_move, 953, 128, 2, 551, 1038] +[:mouse_move, 952, 132, 2, 552, 1039] +[:mouse_move, 951, 134, 2, 553, 1040] +[:mouse_move, 950, 137, 2, 554, 1040] +[:mouse_move, 948, 138, 2, 555, 1041] +[:mouse_move, 947, 140, 2, 556, 1042] +[:mouse_move, 946, 142, 2, 557, 1043] +[:mouse_move, 945, 142, 2, 558, 1044] +[:mouse_move, 944, 143, 2, 559, 1045] +[:mouse_move, 943, 144, 2, 560, 1050] +[:mouse_move, 943, 145, 2, 561, 1052] +[:mouse_move, 943, 146, 2, 562, 1055] +[:mouse_move, 944, 146, 2, 563, 1059] +[:mouse_move, 945, 146, 2, 564, 1061] +[:mouse_move, 947, 146, 2, 565, 1063] +[:mouse_move, 948, 146, 2, 566, 1064] +[:mouse_move, 949, 147, 2, 567, 1065] +[:mouse_move, 950, 147, 2, 568, 1065] +[:mouse_move, 953, 147, 2, 569, 1066] +[:mouse_move, 954, 147, 2, 570, 1067] +[:mouse_move, 958, 147, 2, 571, 1068] +[:mouse_move, 960, 147, 2, 572, 1069] +[:mouse_move, 963, 147, 2, 573, 1070] +[:mouse_move, 966, 147, 2, 574, 1072] +[:mouse_move, 968, 147, 2, 575, 1074] +[:mouse_move, 969, 147, 2, 576, 1075] +[:mouse_move, 971, 147, 2, 577, 1076] +[:mouse_move, 972, 147, 2, 578, 1077] +[:mouse_move, 974, 147, 2, 579, 1078] +[:mouse_move, 976, 147, 2, 580, 1079] +[:mouse_move, 977, 147, 2, 581, 1080] +[:mouse_move, 978, 147, 2, 582, 1080] +[:mouse_move, 980, 147, 2, 583, 1081] +[:mouse_move, 981, 147, 2, 584, 1082] +[:mouse_move, 983, 147, 2, 585, 1082] +[:mouse_move, 984, 147, 2, 586, 1083] +[:mouse_move, 986, 147, 2, 587, 1084] +[:mouse_move, 987, 147, 2, 588, 1084] +[:mouse_move, 988, 147, 2, 589, 1085] +[:mouse_move, 990, 147, 2, 590, 1086] +[:mouse_move, 992, 147, 2, 591, 1086] +[:mouse_move, 993, 147, 2, 592, 1087] +[:mouse_move, 994, 147, 2, 593, 1088] +[:mouse_move, 996, 147, 2, 594, 1088] +[:mouse_move, 997, 147, 2, 595, 1089] +[:mouse_move, 998, 147, 2, 596, 1090] +[:mouse_move, 999, 147, 2, 597, 1090] +[:mouse_move, 1000, 147, 2, 598, 1091] +[:mouse_move, 1001, 147, 2, 599, 1092] +[:mouse_move, 1002, 147, 2, 600, 1092] +[:mouse_move, 1003, 147, 2, 601, 1093] +[:mouse_move, 1004, 147, 2, 602, 1094] +[:mouse_move, 1005, 147, 2, 603, 1094] +[:mouse_move, 1006, 147, 2, 604, 1095] +[:mouse_move, 1008, 147, 2, 605, 1097] +[:mouse_move, 1009, 147, 2, 606, 1098] +[:mouse_move, 1010, 147, 2, 607, 1099] +[:mouse_move, 1011, 147, 2, 608, 1100] +[:mouse_move, 1013, 147, 2, 609, 1101] +[:mouse_move, 1014, 147, 2, 610, 1102] +[:mouse_move, 1016, 147, 2, 611, 1103] +[:mouse_move, 1018, 147, 2, 612, 1105] +[:mouse_move, 1019, 147, 2, 613, 1106] +[:mouse_move, 1020, 147, 2, 614, 1107] +[:mouse_move, 1021, 147, 2, 615, 1109] +[:mouse_move, 1022, 147, 2, 616, 1110] +[:mouse_move, 1023, 147, 2, 617, 1111] +[:mouse_move, 1024, 147, 2, 618, 1113] +[:mouse_move, 1025, 147, 2, 619, 1115] +[:mouse_move, 1026, 147, 2, 620, 1116] +[:mouse_move, 1027, 147, 2, 621, 1117] +[:mouse_move, 1028, 147, 2, 622, 1117] +[:mouse_move, 1029, 147, 2, 623, 1118] +[:mouse_move, 1030, 147, 2, 624, 1119] +[:mouse_move, 1031, 147, 2, 625, 1119] +[:mouse_move, 1032, 147, 2, 626, 1120] +[:mouse_move, 1033, 147, 2, 627, 1121] +[:mouse_move, 1034, 147, 2, 628, 1122] +[:mouse_move, 1036, 147, 2, 629, 1123] +[:mouse_move, 1037, 147, 2, 630, 1124] +[:mouse_move, 1038, 147, 2, 631, 1125] +[:mouse_move, 1040, 147, 2, 632, 1126] +[:mouse_move, 1042, 147, 2, 633, 1128] +[:mouse_move, 1043, 147, 2, 634, 1129] +[:mouse_move, 1044, 147, 2, 635, 1130] +[:mouse_move, 1045, 147, 2, 636, 1131] +[:mouse_move, 1046, 147, 2, 637, 1132] +[:mouse_move, 1047, 147, 2, 638, 1133] +[:mouse_move, 1048, 147, 2, 639, 1134] +[:mouse_move, 1049, 147, 2, 640, 1136] +[:mouse_move, 1049, 146, 2, 641, 1137] +[:mouse_move, 1050, 146, 2, 642, 1138] +[:mouse_move, 1051, 146, 2, 643, 1139] +[:mouse_move, 1052, 146, 2, 644, 1141] +[:mouse_move, 1053, 146, 2, 645, 1142] +[:mouse_move, 1054, 146, 2, 646, 1144] +[:mouse_move, 1055, 146, 2, 647, 1145] +[:mouse_move, 1056, 146, 2, 648, 1146] +[:mouse_move, 1057, 145, 2, 649, 1147] +[:mouse_move, 1059, 145, 2, 650, 1149] +[:mouse_move, 1060, 145, 2, 651, 1151] +[:mouse_move, 1061, 145, 2, 652, 1152] +[:mouse_move, 1062, 145, 2, 653, 1153] +[:mouse_move, 1062, 144, 2, 654, 1154] +[:mouse_move, 1063, 144, 2, 655, 1155] +[:mouse_move, 1064, 144, 2, 656, 1156] +[:mouse_move, 1065, 144, 2, 657, 1157] +[:mouse_move, 1066, 144, 2, 658, 1158] +[:mouse_move, 1067, 144, 2, 659, 1159] +[:mouse_move, 1068, 144, 2, 660, 1160] +[:mouse_move, 1069, 144, 2, 661, 1161] +[:mouse_move, 1070, 144, 2, 662, 1162] +[:mouse_move, 1071, 144, 2, 663, 1163] +[:mouse_move, 1072, 144, 2, 664, 1165] +[:mouse_move, 1073, 144, 2, 665, 1166] +[:mouse_move, 1074, 144, 2, 666, 1168] +[:mouse_move, 1075, 144, 2, 667, 1169] +[:mouse_move, 1076, 144, 2, 668, 1171] +[:mouse_move, 1077, 144, 2, 669, 1171] +[:mouse_move, 1078, 144, 2, 670, 1172] +[:mouse_move, 1079, 144, 2, 671, 1173] +[:mouse_move, 1080, 144, 2, 672, 1173] +[:mouse_move, 1081, 144, 2, 673, 1174] +[:mouse_move, 1082, 144, 2, 674, 1175] +[:mouse_move, 1083, 144, 2, 675, 1176] +[:mouse_move, 1084, 144, 2, 676, 1177] +[:key_down_raw, 1073742051, 1024, 2, 677, 1272] +[:key_down_raw, 113, 1024, 2, 678, 1273] diff --git a/samples/02_collision_04_ramp_with_debugging/app/main.rb b/samples/02_collision_04_ramp_with_debugging/app/main.rb new file mode 100644 index 0000000..6e26e10 --- /dev/null +++ b/samples/02_collision_04_ramp_with_debugging/app/main.rb @@ -0,0 +1,142 @@ +class FallingCircle + attr_gtk + + def fiddle + state.gravity = -0.8 + state.terrain = [ + [0, 300, 600, 20] + ] + end + + def defaults + state.circle.x ||= 30 + state.circle.y ||= 700 + state.circle.dy ||= 0 + end + + def circle_center + [state.circle.x, state.circle.y] + end + + def circle_points center + max_points = 10 + max_points.map_with_index do |i| + p = 360.fdiv(max_points) + center.rect_shift((i * p).vector(25)).point + end + end + + def point_sprite point + [point.rect_shift(-1, -1).point, 2, 2, 'sprites/circle-red.png'] + end + + def render + args.outputs.sprites << [state.circle.x - 25, + state.circle.y - 25, + 50, + 50, + 'sprites/circle-gray.png'] + args.outputs.lines << state.terrain + args.outputs.sprites << point_sprite(circle_center) + args.outputs.sprites << circle_points(circle_center).map do |p| + point_sprite(p) + end + end + + def m line + (line.y2 - line.y).fdiv(line.x2 - line.x) + end + + def b line + # b = y - mx + line.y - m(line) * line.x + end + + def point_on_line line, x + # y = mx+b + # m = y2 - y1 / x2 - x1 + m(line) * x + b(line) + end + + def calc + point_distances = circle_points(circle_center.point).map do |c| + y = point_on_line(state.terrain[0], c.x) + rect_one = [c.x - 5, c.y - 5 + state.circle.dy + state.gravity, 10, state.circle.dy.abs] + rect_two = [c.x, y - 55, 10, 50] + intersect = rect_one.intersect_rect?(rect_two) + if intersect + # debug collision + outputs.borders << [rect_one, 255, 0, 0] + outputs.borders << [rect_two, 255, 0, 0] + else + # debug collision + outputs.borders << rect_one + outputs.borders << rect_two + end + + { + c: c, + point_on_line: y, + distance_y: rect_two.y - rect_one.y, + rect_one: rect_one, + rect_two: rect_two, + intersect: intersect + } + end + + if !state.circle.on_floor + close = point_distances.find_all { |p| p[:intersect] }.first + if close + state.circle.on_floor = true + state.circle.dy += state.gravity + delta = close[:distance_y] - state.circle.dy + state.circle.y += delta + state.circle.dy = 0 + end + end + + if !state.circle.on_floor + state.circle.dy += state.gravity + state.circle.y += state.circle.dy + end + + if state.circle.y < -100 + state.circle.y = 800 + state.circle.dy = 0 + end + end + + def tick + fiddle + defaults + render + calc + end +end + +$falling_circle = FallingCircle.new + +def tick args + # uncomment the line below to slow down the game so you + # can see each tick as it passes + # args.gtk.slowmo! 30 + $falling_circle.args = args + $falling_circle.tick + tick_instructions args, "Sample app shows how to do collisions for a ramp." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end + +$gtk.reset diff --git a/samples/02_collision_04_ramp_with_debugging/sprites/circle-gray.png b/samples/02_collision_04_ramp_with_debugging/sprites/circle-gray.png Binary files differnew file mode 100644 index 0000000..960f191 --- /dev/null +++ b/samples/02_collision_04_ramp_with_debugging/sprites/circle-gray.png diff --git a/samples/02_collision_04_ramp_with_debugging/sprites/circle-red.png b/samples/02_collision_04_ramp_with_debugging/sprites/circle-red.png Binary files differnew file mode 100644 index 0000000..7f17ca6 --- /dev/null +++ b/samples/02_collision_04_ramp_with_debugging/sprites/circle-red.png diff --git a/samples/02_collision_05_ramp_with_debugging_two/app/main.rb b/samples/02_collision_05_ramp_with_debugging_two/app/main.rb new file mode 100644 index 0000000..e75366b --- /dev/null +++ b/samples/02_collision_05_ramp_with_debugging_two/app/main.rb @@ -0,0 +1,99 @@ + +def m line + (line.y2 - line.y).fdiv(line.x2 - line.x) +end + +def b line + # b = y - mx + line.y - m(line) * line.x +end + +def f_y line, x + # y = mx+b + # m = y2 - y1 / x2 - x1 + m(line) * x + b(line) +end + +def f_x line, y + # y = mx+b + # x = (y - b) / m + (y - b(line)) / m(line) +end + +def tragectory body + [body.x, body.y, body.x + body.dx * 1000, body.y + body.dy * 1000] +end + +def intersect line_one, line_two + m1 = m(line_one) + b1 = b(line_one) + m2 = m(line_two) + b2 = b(line_two) + + x = (b1 - b2) / (m2 - m1) + y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2)) + [x, y] +end + +def point_orientation point, other + # if point.x < other.x + # return -1 + # else + return 1 + # end +end + +def tick args + args.state.circle.radius = 50 + args.state.circle.x ||= 10 + args.state.circle.y ||= 500 + args.state.circle.dx ||= 15 + args.state.circle.dy ||= -0.2 + args.state.terrain = [700, 0, 2000, 800] + + args.outputs.sprites << [ + args.state.circle.x - args.state.circle.radius.half, + args.state.circle.y - args.state.circle.radius.half, + args.state.circle.radius, + args.state.circle.radius, + 'sprites/circle-gray.png' + ] + + args.outputs.lines << args.state.line_one if args.state.line_one + args.outputs.lines << args.state.line_two if args.state.line_two + + if args.state.point + args.outputs.borders << [args.state.point.x - 5, args.state.point.y - 5, 10, 10] + args.outputs.borders << [args.state.point.x - 4, args.state.point.y - 4, 8, 8] + end + + args.state.circle.x += args.state.circle.dx + args.state.circle.y += args.state.circle.dy + args.state.circle.dy -= 0.2 + + args.state.line_one = tragectory(args.state.circle) + args.state.line_two = args.state.terrain + args.state.point = intersect args.state.line_one, args.state.line_two + args.state.current_orientation ||= point_orientation(args.state.circle, args.state.point) + next_orientation = point_orientation(args.state.circle, args.state.point) + if(args.state.current_orientation != next_orientation) + args.state.circle.dx = 0 + args.state.circle.dy = 0 + end + + tick_instructions args, "Sample app shows how to calculate the point of collision on a line." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/02_collision_05_ramp_with_debugging_two/sprites/circle-gray.png b/samples/02_collision_05_ramp_with_debugging_two/sprites/circle-gray.png Binary files differnew file mode 100644 index 0000000..960f191 --- /dev/null +++ b/samples/02_collision_05_ramp_with_debugging_two/sprites/circle-gray.png diff --git a/samples/02_collision_05_ramp_with_debugging_two/sprites/circle-red.png b/samples/02_collision_05_ramp_with_debugging_two/sprites/circle-red.png Binary files differnew file mode 100644 index 0000000..7f17ca6 --- /dev/null +++ b/samples/02_collision_05_ramp_with_debugging_two/sprites/circle-red.png diff --git a/samples/02_sprite_animation_and_keyboard_input/app/main.rb b/samples/02_sprite_animation_and_keyboard_input/app/main.rb new file mode 100644 index 0000000..80c40f2 --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/app/main.rb @@ -0,0 +1,131 @@ +=begin + + Reminders: + + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + In this sample app, we're using string interpolation to iterate through images in the + sprites folder using their image path names. + + - args.outputs.sprites: An array. Values in this array generate sprites on the screen. + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.outputs.labels: An array. Values in the array generate labels on the screen. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed. + Stores the frame that key was pressed on. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + +=end + +# This sample app demonstrates how sprite animations work. +# There are two sprites that animate forever and one sprite +# that *only* animates when you press the "f" key on the keyboard. + +# This is the entry point to your game. The `tick` method +# executes at 60 frames per second. There are two methods +# in this tick "entry point": `looping_animation`, and the +# second method is `one_time_animation`. +def tick args + looping_animation args + one_time_animation args +end + +# This function shows how to animate a sprite that loops forever. +def looping_animation args + # Here we define a few local variables that will be sent + # into the magic function that gives us the correct sprite image + # over time. There are four things we need in order to figure + # out which sprite to show. + + # 1. When to start the animation. + start_looping_at = 0 + + # 2. The number of pngs that represent the full animation. + number_of_sprites = 6 + + # 3. How long to show each png. + number_of_frames_to_show_each_sprite = 4 + + # 4. Whether the animation should loop once, or forever. + does_sprite_loop = true + + # With the variables defined above, we can get a number + # which represents the sprite to show by calling the `frame_index` function. + # In this case the number will be between 0, and 5 (you can see the sprites + # in the ./sprites directory). + sprite_index = start_looping_at.frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + # Now that we have `sprite_index, we can present the correct file. + args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + + # Try changing the numbers below to see how the animation changes: + args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] +end + +# This function shows how to animate a sprite that executes +# only once when the "f" key is pressed. +def one_time_animation args + # This is just a label the shows instructions within the game. + args.outputs.labels << [220, 350, "(press f to animate)"] + + # If "f" is pressed on the keyboard... + if args.inputs.keyboard.key_down.f + # Print the frame that "f" was pressed on. + puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" + + # And MOST IMPORTANTLY set the point it time to start the animation, + # equal to "now" which is represented as args.state.tick_count. + + # Also IMPORTANT, you'll notice that the value of when to start looping + # is stored in `args.state`. This construct's values are retained across + # executions of the `tick` method. + args.state.start_looping_at = args.state.tick_count + end + + # These are the same local variables that were defined + # for the `looping_animation` function. + number_of_sprites = 6 + number_of_frames_to_show_each_sprite = 4 + + # Except this sprite does not loop again. If the animation time has passed, + # then the frame_index function returns nil. + does_sprite_loop = false + + sprite_index = args.state + .start_looping_at + .frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + # This line sets the frame index to zero, if + # the animation duration has passed (frame_index returned nil). + + # Remeber: we are not looping forever here. + sprite_index ||= 0 + + # Present the sprite. + args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + + tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/02_sprite_animation_and_keyboard_input/license-for-sample.txt b/samples/02_sprite_animation_and_keyboard_input/license-for-sample.txt new file mode 100644 index 0000000..8fa4d42 --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC (code), Nick Culbertson @mobypixel (art) + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/02_sprite_animation_and_keyboard_input/replay.txt b/samples/02_sprite_animation_and_keyboard_input/replay.txt new file mode 100644 index 0000000..33c47c3 --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/replay.txt @@ -0,0 +1,162 @@ +replay_version 2.0 +stopped_at 780 +seed 100 +recorded_at Sun Sep 29 21:41:16 2019 +[:mouse_move, 1081, 144, 2, 1, 54] +[:mouse_move, 1076, 144, 2, 2, 55] +[:mouse_move, 1061, 145, 2, 3, 56] +[:mouse_move, 1049, 146, 2, 4, 57] +[:mouse_move, 964, 148, 2, 5, 58] +[:mouse_move, 899, 148, 2, 6, 59] +[:mouse_move, 795, 153, 2, 7, 60] +[:mouse_move, 728, 160, 2, 8, 61] +[:mouse_move, 644, 175, 2, 9, 62] +[:mouse_move, 597, 185, 2, 10, 63] +[:mouse_move, 519, 206, 2, 11, 64] +[:mouse_move, 488, 217, 2, 12, 65] +[:mouse_move, 451, 229, 2, 13, 66] +[:mouse_move, 443, 231, 2, 14, 67] +[:mouse_move, 438, 233, 2, 15, 68] +[:mouse_move, 423, 238, 2, 16, 69] +[:mouse_move, 420, 239, 2, 17, 70] +[:mouse_move, 416, 240, 2, 18, 71] +[:mouse_move, 415, 240, 2, 19, 84] +[:mouse_move, 394, 253, 2, 20, 85] +[:mouse_move, 376, 264, 2, 21, 86] +[:mouse_move, 329, 296, 2, 22, 87] +[:mouse_move, 303, 315, 2, 23, 88] +[:mouse_move, 268, 342, 2, 24, 89] +[:mouse_move, 249, 356, 2, 25, 90] +[:mouse_move, 234, 372, 2, 26, 91] +[:mouse_move, 228, 380, 2, 27, 92] +[:mouse_move, 223, 388, 2, 28, 93] +[:mouse_move, 222, 391, 2, 29, 94] +[:mouse_move, 221, 394, 2, 30, 95] +[:mouse_move, 221, 396, 2, 31, 96] +[:mouse_move, 223, 397, 2, 32, 97] +[:mouse_move, 229, 397, 2, 33, 98] +[:mouse_move, 231, 397, 2, 34, 99] +[:mouse_move, 235, 397, 2, 35, 100] +[:mouse_move, 237, 397, 2, 36, 101] +[:mouse_move, 238, 397, 2, 37, 102] +[:mouse_move, 238, 398, 2, 38, 105] +[:mouse_move, 237, 398, 2, 39, 108] +[:mouse_move, 236, 397, 2, 40, 110] +[:mouse_move, 235, 397, 2, 41, 111] +[:mouse_move, 237, 397, 2, 42, 139] +[:mouse_move, 240, 397, 2, 43, 140] +[:mouse_move, 245, 398, 2, 44, 141] +[:mouse_move, 248, 398, 2, 45, 142] +[:mouse_move, 255, 399, 2, 46, 143] +[:mouse_move, 258, 399, 2, 47, 144] +[:mouse_move, 266, 400, 2, 48, 145] +[:mouse_move, 268, 400, 2, 49, 146] +[:mouse_move, 273, 400, 2, 50, 147] +[:mouse_move, 275, 400, 2, 51, 148] +[:mouse_move, 277, 400, 2, 52, 149] +[:mouse_move, 280, 400, 2, 53, 150] +[:mouse_move, 282, 400, 2, 54, 151] +[:mouse_move, 285, 400, 2, 55, 152] +[:mouse_move, 286, 399, 2, 56, 153] +[:mouse_move, 288, 399, 2, 57, 154] +[:mouse_move, 289, 399, 2, 58, 155] +[:mouse_move, 290, 399, 2, 59, 156] +[:mouse_move, 291, 399, 2, 60, 157] +[:mouse_move, 294, 399, 2, 61, 158] +[:mouse_move, 295, 399, 2, 62, 159] +[:mouse_move, 297, 399, 2, 63, 160] +[:mouse_move, 298, 399, 2, 64, 161] +[:mouse_move, 300, 398, 2, 65, 162] +[:mouse_move, 302, 398, 2, 66, 163] +[:mouse_move, 305, 398, 2, 67, 164] +[:mouse_move, 307, 398, 2, 68, 165] +[:mouse_move, 310, 398, 2, 69, 166] +[:mouse_move, 312, 398, 2, 70, 167] +[:mouse_move, 315, 397, 2, 71, 168] +[:mouse_move, 317, 397, 2, 72, 169] +[:mouse_move, 320, 397, 2, 73, 170] +[:mouse_move, 321, 397, 2, 74, 171] +[:mouse_move, 323, 397, 2, 75, 172] +[:mouse_move, 325, 397, 2, 76, 173] +[:mouse_move, 327, 397, 2, 77, 174] +[:mouse_move, 328, 397, 2, 78, 175] +[:mouse_move, 329, 397, 2, 79, 176] +[:mouse_move, 332, 397, 2, 80, 177] +[:mouse_move, 333, 397, 2, 81, 178] +[:mouse_move, 336, 397, 2, 82, 179] +[:mouse_move, 338, 397, 2, 83, 180] +[:mouse_move, 341, 397, 2, 84, 181] +[:mouse_move, 342, 397, 2, 85, 182] +[:mouse_move, 345, 397, 2, 86, 183] +[:mouse_move, 346, 397, 2, 87, 184] +[:mouse_move, 350, 397, 2, 88, 185] +[:mouse_move, 352, 397, 2, 89, 186] +[:mouse_move, 355, 397, 2, 90, 187] +[:mouse_move, 356, 397, 2, 91, 188] +[:mouse_move, 359, 397, 2, 92, 189] +[:mouse_move, 360, 397, 2, 93, 190] +[:mouse_move, 363, 397, 2, 94, 191] +[:mouse_move, 365, 397, 2, 95, 192] +[:mouse_move, 367, 397, 2, 96, 193] +[:mouse_move, 369, 397, 2, 97, 194] +[:mouse_move, 372, 397, 2, 98, 195] +[:mouse_move, 373, 397, 2, 99, 196] +[:mouse_move, 376, 397, 2, 100, 197] +[:mouse_move, 377, 397, 2, 101, 198] +[:mouse_move, 379, 397, 2, 102, 199] +[:mouse_move, 381, 397, 2, 103, 200] +[:mouse_move, 383, 397, 2, 104, 201] +[:mouse_move, 385, 397, 2, 105, 202] +[:mouse_move, 386, 397, 2, 106, 203] +[:mouse_move, 389, 397, 2, 107, 204] +[:mouse_move, 391, 397, 2, 108, 205] +[:mouse_move, 397, 397, 2, 109, 206] +[:mouse_move, 398, 397, 2, 110, 207] +[:mouse_move, 403, 397, 2, 111, 208] +[:mouse_move, 405, 397, 2, 112, 209] +[:mouse_move, 407, 397, 2, 113, 210] +[:mouse_move, 409, 397, 2, 114, 211] +[:mouse_move, 410, 397, 2, 115, 212] +[:mouse_move, 411, 397, 2, 116, 218] +[:mouse_move, 411, 395, 2, 117, 328] +[:mouse_move, 411, 393, 2, 118, 329] +[:mouse_move, 412, 387, 2, 119, 330] +[:mouse_move, 413, 382, 2, 120, 331] +[:mouse_move, 415, 371, 2, 121, 332] +[:mouse_move, 416, 364, 2, 122, 333] +[:mouse_move, 417, 349, 2, 123, 334] +[:mouse_move, 418, 343, 2, 124, 335] +[:mouse_move, 419, 335, 2, 125, 336] +[:mouse_move, 419, 332, 2, 126, 337] +[:mouse_move, 420, 328, 2, 127, 338] +[:mouse_move, 420, 327, 2, 128, 339] +[:mouse_move, 420, 329, 2, 129, 345] +[:mouse_move, 421, 331, 2, 130, 346] +[:mouse_move, 421, 332, 2, 131, 347] +[:mouse_move, 421, 333, 2, 132, 348] +[:mouse_move, 422, 334, 2, 133, 349] +[:key_down_raw, 102, 0, 2, 134, 411] +[:key_up_raw, 102, 0, 2, 135, 417] +[:key_down_raw, 102, 0, 2, 136, 470] +[:key_up_raw, 102, 0, 2, 137, 476] +[:key_down_raw, 102, 0, 2, 138, 526] +[:key_up_raw, 102, 0, 2, 139, 531] +[:key_down_raw, 102, 0, 2, 140, 537] +[:key_up_raw, 102, 0, 2, 141, 541] +[:key_down_raw, 102, 0, 2, 142, 546] +[:key_up_raw, 102, 0, 2, 143, 550] +[:key_down_raw, 102, 0, 2, 144, 555] +[:key_up_raw, 102, 0, 2, 145, 558] +[:key_down_raw, 102, 0, 2, 146, 563] +[:key_up_raw, 102, 0, 2, 147, 567] +[:key_down_raw, 102, 0, 2, 148, 572] +[:key_up_raw, 102, 0, 2, 149, 575] +[:key_down_raw, 102, 0, 2, 150, 579] +[:key_up_raw, 102, 0, 2, 151, 582] +[:key_down_raw, 102, 0, 2, 152, 632] +[:key_up_raw, 102, 0, 2, 153, 657] +[:key_down_raw, 102, 0, 2, 154, 687] +[:key_up_raw, 102, 0, 2, 155, 692] +[:key_down_raw, 1073742051, 1024, 2, 156, 779] +[:key_down_raw, 113, 1024, 2, 157, 779] +[:key_up_raw, 113, 1024, 2, 158, 779] diff --git a/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_0.png b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_0.png Binary files differnew file mode 100644 index 0000000..fb179af --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_0.png diff --git a/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_1.png b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_1.png Binary files differnew file mode 100644 index 0000000..8cfe531 --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_1.png diff --git a/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_2.png b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_2.png Binary files differnew file mode 100644 index 0000000..cb462e1 --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_2.png diff --git a/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_3.png b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_3.png Binary files differnew file mode 100644 index 0000000..04c4977 --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_3.png diff --git a/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_4.png b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_4.png Binary files differnew file mode 100644 index 0000000..b29fa3d --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_4.png diff --git a/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_5.png b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_5.png Binary files differnew file mode 100644 index 0000000..99f4e74 --- /dev/null +++ b/samples/02_sprite_animation_and_keyboard_input/sprites/dragon_fly_5.png diff --git a/samples/03_mouse_click/app/main.rb b/samples/03_mouse_click/app/main.rb new file mode 100644 index 0000000..8969a6e --- /dev/null +++ b/samples/03_mouse_click/app/main.rb @@ -0,0 +1,244 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - product: Returns an array of all combinations of elements from all arrays. + + For example, [1,2].product([1,2]) would return the following array... + [[1,1], [1,2], [2,1], [2,2]] + More than two arrays can be given to product and it will still work, + such as [1,2].product([1,2],[3,4]). What would product return in this case? + + Answer: + [[1,1,3],[1,1,4],[1,2,3],[1,2,4],[2,1,3],[2,1,4],[2,2,3],[2,2,4]] + + - num1.fdiv(num2): Returns the float division (will have a decimal) of the two given numbers. + For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 + + - yield: Allows you to call a method with a code block and yield to that block. + + Reminders: + + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + - args.inputs.mouse.click: This property will be set if the mouse was clicked. + + - Ternary operator (?): Will evaluate a statement (just like an if statement) + and perform an action if the result is true or another action if it is false. + + - reject: Removes elements from a collection if they meet certain requirements. + + - args.outputs.borders: An array. The values generate a border. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about borders, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels. + +=end + +# This sample app is a classic game of Tic Tac Toe. + +class TicTacToe + attr_accessor :_, :state, :outputs, :inputs, :grid, :gtk + + # Starts the game with player x's turn and creates an array (to_a) for space combinations. + # Calls methods necessary for the game to run properly. + def tick + state.current_turn ||= :x + state.space_combinations = [-1, 0, 1].product([-1, 0, 1]).to_a + render_board + input_board + end + + # Uses borders to create grid squares for the game's board. Also outputs the game pieces using labels. + def render_board + square_size = 80 + + # Positions the game's board in the center of the screen. + # Try removing what follows grid.w_half or grid.h_half and see how the position changes! + board_left = grid.w_half - square_size * 1.5 + board_top = grid.h_half - square_size * 1.5 + + # At first glance, the add(1) looks pretty trivial. But if you remove it, + # you'll see that the positioning of the board would be skewed without it! + # Or if you put 2 in the parenthesis, the pieces will be placed in the wrong squares + # due to the change in board placement. + outputs.borders << all_spaces do |x, y, space| # outputs borders for all board spaces + space.border ||= [ + board_left + x.add(1) * square_size, # space.border is initialized using this definition + board_top + y.add(1) * square_size, + square_size, + square_size + ] + end + + # Again, the calculations ensure that the piece is placed in the center of the grid square. + # Remove the '- 20' and the piece will be placed at the top of the grid square instead of the center. + outputs.labels << filled_spaces do |x, y, space| # put label in each filled space of board + label board_left + x.add(1) * square_size + square_size.fdiv(2), + board_top + y.add(1) * square_size + square_size - 20, + space.piece # text of label, either "x" or "o" + end + + # Uses a label to output whether x or o won, or if a draw occurred. + # If the game is ongoing, a label shows whose turn it currently is. + outputs.labels << if state.x_won + label grid.w_half, grid.top - 80, "x won" # the '-80' positions the label 80 pixels lower than top + elsif state.o_won + label grid.w_half, grid.top - 80, "o won" # grid.w_half positions the label in the center horizontally + elsif state.draw + label grid.w_half, grid.top - 80, "a draw" + else # if no one won and the game is ongoing + label grid.w_half, grid.top - 80, "turn: #{state.current_turn}" + end + end + + # Calls the methods responsible for handling user input and determining the winner. + # Does nothing unless the mouse is clicked. + def input_board + return unless inputs.mouse.click + input_place_piece + input_restart_game + determine_winner + end + + # Handles user input for placing pieces on the board. + def input_place_piece + return if state.game_over + + # Checks to find the space that the mouse was clicked inside of, and makes sure the space does not already + # have a piece in it. + __, __, space = all_spaces.find do |__, __, space| + inputs.mouse.click.point.inside_rect?(space.border) && !space.piece + end + + # The piece that goes into the space belongs to the player whose turn it currently is. + return unless space + space.piece = state.current_turn + + # This ternary operator statement allows us to change the current player's turn. + # If it is currently x's turn, it becomes o's turn. If it is not x's turn, it become's x's turn. + state.current_turn = state.current_turn == :x ? :o : :x + end + + # Resets the game. + def input_restart_game + return unless state.game_over + gtk.reset + end + + # Checks if x or o won the game. + # If neither player wins and all nine squares are filled, a draw happens. + # Once a player is chosen as the winner or a draw happens, the game is over. + def determine_winner + state.x_won = won? :x # evaluates to either true or false (boolean values) + state.o_won = won? :o + state.draw = true if filled_spaces.length == 9 && !state.x_won && !state.o_won + state.game_over = state.x_won || state.o_won || state.draw + end + + # Determines if a player won by checking if there is a horizontal match or vertical match. + # Horizontal_match and vertical_match have boolean values. If either is true, the game has been won. + def won? piece + # performs action on all space combinations + won = [[-1, 0, 1]].product([-1, 0, 1]).map do |xs, y| + + # Checks if the 3 grid spaces with the same y value (or same row) and + # x values that are next to each other have pieces that belong to the same player. + # Remember, the value of piece is equal to the current turn (which is the player). + horizontal_match = state.spaces[xs[0]][y].piece == piece && + state.spaces[xs[1]][y].piece == piece && + state.spaces[xs[2]][y].piece == piece + + # Checks if the 3 grid spaces with the same x value (or same column) and + # y values that are next to each other have pieces that belong to the same player. + # The && represents an "and" statement: if even one part of the statement is false, + # the entire statement evaluates to false. + vertical_match = state.spaces[y][xs[0]].piece == piece && + state.spaces[y][xs[1]].piece == piece && + state.spaces[y][xs[2]].piece == piece + + horizontal_match || vertical_match # if either is true, true is returned + end + + # Sees if there is a diagonal match, starting from the bottom left and ending at the top right. + # Is added to won regardless of whether the statement is true or false. + won << (state.spaces[-1][-1].piece == piece && # bottom left + state.spaces[ 0][ 0].piece == piece && # center + state.spaces[ 1][ 1].piece == piece) # top right + + # Sees if there is a diagonal match, starting at the bottom right and ending at the top left + # and is added to won. + won << (state.spaces[ 1][-1].piece == piece && # bottom right + state.spaces[ 0][ 0].piece == piece && # center + state.spaces[-1][ 1].piece == piece) # top left + + # Any false statements (meaning false diagonal matches) are rejected from won + won.reject_false.any? + end + + # Defines filled spaces on the board by rejecting all spaces that do not have game pieces in them. + # The ! before a statement means "not". For example, we are rejecting any space combinations that do + # NOT have pieces in them. + def filled_spaces + state.space_combinations + .reject { |x, y| !state.spaces[x][y].piece } # reject spaces with no pieces in them + .map do |x, y| + if block_given? + yield x, y, state.spaces[x][y] + else + [x, y, state.spaces[x][y]] # sets definition of space + end + end + end + + # Defines all spaces on the board. + def all_spaces + if !block_given? + state.space_combinations.map do |x, y| + [x, y, state.spaces[x][y]] # sets definition of space + end + else # if a block is given (block_given? is true) + state.space_combinations.map do |x, y| + yield x, y, state.spaces[x][y] # yield if a block is given + end + end + end + + # Sets values for a label, such as the position, value, size, alignment, and color. + def label x, y, value + [x, y + 10, value, 20, 1, 0, 0, 0] + end +end + +$tic_tac_toe = TicTacToe.new + +def tick args + $tic_tac_toe._ = args + $tic_tac_toe.state = args.state + $tic_tac_toe.outputs = args.outputs + $tic_tac_toe.inputs = args.inputs + $tic_tac_toe.grid = args.grid + $tic_tac_toe.gtk = args.gtk + $tic_tac_toe.tick + tick_instructions args, "Sample app shows how to work with mouse clicks." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/03_mouse_click/license-for-sample.txt b/samples/03_mouse_click/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/03_mouse_click/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/03_mouse_click/replay.txt b/samples/03_mouse_click/replay.txt new file mode 100644 index 0000000..1ea08dc --- /dev/null +++ b/samples/03_mouse_click/replay.txt @@ -0,0 +1,870 @@ +replay_version 2.0 +stopped_at 1699 +seed 100 +recorded_at Sun Sep 29 21:49:02 2019 +[:mouse_move, 297, 112, 2, 1, 34] +[:mouse_move, 305, 112, 2, 2, 35] +[:mouse_move, 311, 112, 2, 3, 36] +[:mouse_move, 337, 111, 2, 4, 38] +[:mouse_move, 359, 110, 2, 5, 40] +[:mouse_move, 398, 112, 2, 6, 41] +[:mouse_move, 415, 118, 2, 7, 42] +[:mouse_move, 422, 124, 2, 8, 43] +[:mouse_move, 441, 140, 2, 9, 44] +[:mouse_move, 448, 148, 2, 10, 45] +[:mouse_move, 455, 163, 2, 11, 46] +[:mouse_move, 457, 174, 2, 12, 47] +[:mouse_move, 450, 183, 2, 13, 48] +[:mouse_move, 441, 187, 2, 14, 49] +[:mouse_move, 420, 190, 2, 15, 50] +[:mouse_move, 414, 190, 2, 16, 51] +[:mouse_move, 409, 190, 2, 17, 52] +[:mouse_move, 398, 188, 2, 18, 53] +[:mouse_move, 395, 187, 2, 19, 54] +[:mouse_move, 390, 185, 2, 20, 55] +[:mouse_move, 390, 184, 2, 21, 57] +[:mouse_move, 401, 189, 2, 22, 121] +[:mouse_move, 444, 221, 2, 23, 123] +[:mouse_move, 485, 255, 2, 24, 124] +[:mouse_move, 510, 280, 2, 25, 125] +[:mouse_move, 526, 296, 2, 26, 126] +[:mouse_move, 530, 301, 2, 27, 127] +[:mouse_move, 545, 317, 2, 28, 128] +[:mouse_move, 548, 321, 2, 29, 129] +[:mouse_move, 550, 324, 2, 30, 130] +[:mouse_move, 550, 326, 2, 31, 131] +[:mouse_move, 548, 324, 2, 32, 133] +[:mouse_move, 546, 319, 2, 33, 134] +[:mouse_move, 546, 306, 2, 34, 136] +[:mouse_move, 546, 301, 2, 35, 137] +[:mouse_move, 553, 282, 2, 36, 138] +[:mouse_move, 557, 271, 2, 37, 139] +[:mouse_move, 566, 232, 2, 38, 140] +[:mouse_move, 567, 215, 2, 39, 142] +[:mouse_move, 567, 203, 2, 40, 143] +[:mouse_move, 565, 184, 2, 41, 144] +[:mouse_move, 560, 177, 2, 42, 145] +[:mouse_move, 547, 163, 2, 43, 146] +[:mouse_move, 540, 159, 2, 44, 148] +[:mouse_move, 539, 157, 2, 45, 149] +[:mouse_move, 536, 156, 2, 46, 150] +[:mouse_move, 535, 154, 2, 47, 151] +[:mouse_move, 534, 153, 2, 48, 153] +[:mouse_move, 534, 152, 2, 49, 155] +[:mouse_move, 534, 151, 2, 50, 156] +[:mouse_move, 534, 150, 2, 51, 158] +[:mouse_move, 537, 150, 2, 52, 159] +[:mouse_move, 542, 149, 2, 53, 160] +[:mouse_move, 587, 152, 2, 54, 161] +[:mouse_move, 612, 155, 2, 55, 162] +[:mouse_move, 669, 161, 2, 56, 163] +[:mouse_move, 681, 161, 2, 57, 164] +[:mouse_move, 713, 160, 2, 58, 165] +[:mouse_move, 741, 155, 2, 59, 167] +[:mouse_move, 744, 154, 2, 60, 168] +[:mouse_move, 758, 151, 2, 61, 169] +[:mouse_move, 759, 151, 2, 62, 170] +[:mouse_move, 760, 151, 2, 63, 171] +[:mouse_move, 761, 151, 2, 64, 172] +[:mouse_move, 761, 152, 2, 65, 187] +[:mouse_move, 757, 160, 2, 66, 188] +[:mouse_move, 724, 198, 2, 67, 190] +[:mouse_move, 706, 214, 2, 68, 191] +[:mouse_move, 659, 243, 2, 69, 192] +[:mouse_move, 617, 259, 2, 70, 194] +[:mouse_move, 603, 264, 2, 71, 195] +[:mouse_move, 597, 265, 2, 72, 196] +[:mouse_move, 589, 268, 2, 73, 197] +[:mouse_move, 578, 271, 2, 74, 198] +[:mouse_move, 572, 272, 2, 75, 199] +[:mouse_move, 571, 272, 2, 76, 200] +[:mouse_move, 570, 272, 2, 77, 201] +[:mouse_move, 568, 273, 2, 78, 202] +[:mouse_move, 565, 273, 2, 79, 204] +[:mouse_move, 562, 275, 2, 80, 205] +[:mouse_move, 560, 276, 2, 81, 206] +[:mouse_move, 558, 276, 2, 82, 207] +[:mouse_move, 555, 277, 2, 83, 208] +[:mouse_move, 554, 278, 2, 84, 209] +[:mouse_move, 552, 279, 2, 85, 210] +[:mouse_move, 551, 279, 2, 86, 212] +[:mouse_button_pressed, 1, 0, 1, 87, 217] +[:mouse_button_up, 1, 0, 1, 88, 225] +[:mouse_move, 551, 280, 2, 89, 270] +[:mouse_move, 551, 283, 2, 90, 271] +[:mouse_move, 552, 296, 2, 91, 272] +[:mouse_move, 553, 314, 2, 92, 273] +[:mouse_move, 560, 391, 2, 93, 274] +[:mouse_move, 562, 409, 2, 94, 275] +[:mouse_move, 566, 440, 2, 95, 276] +[:mouse_move, 567, 448, 2, 96, 277] +[:mouse_move, 568, 464, 2, 97, 278] +[:mouse_move, 570, 482, 2, 98, 279] +[:mouse_move, 571, 488, 2, 99, 280] +[:mouse_move, 571, 489, 2, 100, 281] +[:mouse_move, 570, 489, 2, 101, 285] +[:mouse_move, 570, 488, 2, 102, 286] +[:mouse_move, 570, 487, 2, 103, 287] +[:mouse_move, 570, 486, 2, 104, 288] +[:mouse_move, 569, 483, 2, 105, 289] +[:mouse_move, 569, 475, 2, 106, 290] +[:mouse_move, 568, 473, 2, 107, 291] +[:mouse_move, 568, 467, 2, 108, 292] +[:mouse_move, 567, 464, 2, 109, 293] +[:mouse_move, 567, 461, 2, 110, 294] +[:mouse_move, 567, 460, 2, 111, 295] +[:mouse_move, 567, 459, 2, 112, 296] +[:mouse_move, 567, 458, 2, 113, 298] +[:mouse_move, 567, 457, 2, 114, 300] +[:mouse_move, 567, 456, 2, 115, 301] +[:mouse_move, 567, 455, 2, 116, 303] +[:mouse_button_pressed, 1, 0, 1, 117, 305] +[:mouse_button_up, 1, 0, 1, 118, 311] +[:mouse_move, 576, 455, 2, 119, 325] +[:mouse_move, 585, 455, 2, 120, 326] +[:mouse_move, 592, 455, 2, 121, 327] +[:mouse_move, 616, 457, 2, 122, 328] +[:mouse_move, 637, 458, 2, 123, 329] +[:mouse_move, 656, 458, 2, 124, 331] +[:mouse_move, 665, 458, 2, 125, 332] +[:mouse_move, 670, 458, 2, 126, 333] +[:mouse_move, 673, 458, 2, 127, 334] +[:mouse_move, 679, 458, 2, 128, 335] +[:mouse_move, 680, 458, 2, 129, 336] +[:mouse_move, 685, 458, 2, 130, 337] +[:mouse_move, 686, 458, 2, 131, 338] +[:mouse_move, 687, 458, 2, 132, 339] +[:mouse_move, 691, 458, 2, 133, 340] +[:mouse_move, 693, 458, 2, 134, 341] +[:mouse_move, 696, 458, 2, 135, 342] +[:mouse_move, 700, 458, 2, 136, 343] +[:mouse_move, 702, 458, 2, 137, 344] +[:mouse_move, 706, 458, 2, 138, 345] +[:mouse_move, 707, 458, 2, 139, 346] +[:mouse_move, 708, 458, 2, 140, 347] +[:mouse_move, 709, 458, 2, 141, 349] +[:mouse_button_pressed, 1, 0, 1, 142, 351] +[:mouse_button_up, 1, 0, 1, 143, 358] +[:mouse_move, 708, 458, 2, 144, 365] +[:mouse_move, 704, 455, 2, 145, 366] +[:mouse_move, 702, 454, 2, 146, 367] +[:mouse_move, 696, 448, 2, 147, 368] +[:mouse_move, 693, 444, 2, 148, 369] +[:mouse_move, 686, 437, 2, 149, 370] +[:mouse_move, 683, 433, 2, 150, 371] +[:mouse_move, 673, 419, 2, 151, 372] +[:mouse_move, 666, 410, 2, 152, 373] +[:mouse_move, 660, 402, 2, 153, 374] +[:mouse_move, 654, 394, 2, 154, 375] +[:mouse_move, 651, 390, 2, 155, 376] +[:mouse_move, 646, 384, 2, 156, 377] +[:mouse_move, 644, 381, 2, 157, 378] +[:mouse_move, 643, 379, 2, 158, 379] +[:mouse_move, 640, 375, 2, 159, 380] +[:mouse_move, 639, 374, 2, 160, 381] +[:mouse_move, 638, 371, 2, 161, 382] +[:mouse_move, 637, 369, 2, 162, 383] +[:mouse_move, 637, 367, 2, 163, 385] +[:mouse_move, 636, 366, 2, 164, 386] +[:mouse_move, 636, 365, 2, 165, 387] +[:mouse_button_pressed, 1, 0, 1, 166, 389] +[:mouse_button_up, 1, 0, 1, 167, 395] +[:mouse_move, 638, 364, 2, 168, 409] +[:mouse_move, 648, 356, 2, 169, 410] +[:mouse_move, 655, 350, 2, 170, 411] +[:mouse_move, 664, 342, 2, 171, 412] +[:mouse_move, 673, 334, 2, 172, 413] +[:mouse_move, 685, 325, 2, 173, 414] +[:mouse_move, 692, 319, 2, 174, 415] +[:mouse_move, 699, 312, 2, 175, 416] +[:mouse_move, 708, 304, 2, 176, 417] +[:mouse_move, 712, 301, 2, 177, 418] +[:mouse_move, 713, 300, 2, 178, 419] +[:mouse_move, 716, 297, 2, 179, 420] +[:mouse_move, 718, 296, 2, 180, 421] +[:mouse_move, 720, 293, 2, 181, 422] +[:mouse_move, 721, 292, 2, 182, 423] +[:mouse_move, 722, 292, 2, 183, 426] +[:mouse_move, 722, 291, 2, 184, 427] +[:mouse_button_pressed, 1, 0, 1, 185, 443] +[:mouse_button_up, 1, 0, 1, 186, 450] +[:mouse_move, 719, 291, 2, 187, 488] +[:mouse_move, 716, 290, 2, 188, 489] +[:mouse_move, 707, 288, 2, 189, 490] +[:mouse_move, 696, 287, 2, 190, 491] +[:mouse_move, 689, 286, 2, 191, 492] +[:mouse_move, 677, 286, 2, 192, 493] +[:mouse_move, 672, 286, 2, 193, 494] +[:mouse_move, 664, 286, 2, 194, 495] +[:mouse_move, 660, 286, 2, 195, 496] +[:mouse_move, 654, 286, 2, 196, 497] +[:mouse_move, 650, 286, 2, 197, 499] +[:mouse_move, 648, 286, 2, 198, 501] +[:mouse_button_pressed, 1, 0, 1, 199, 503] +[:mouse_button_up, 1, 0, 1, 200, 509] +[:mouse_move, 648, 287, 2, 201, 514] +[:mouse_move, 648, 288, 2, 202, 515] +[:mouse_move, 648, 289, 2, 203, 518] +[:mouse_move, 648, 290, 2, 204, 521] +[:mouse_move, 652, 296, 2, 205, 522] +[:mouse_move, 657, 303, 2, 206, 523] +[:mouse_move, 667, 314, 2, 207, 524] +[:mouse_move, 676, 323, 2, 208, 526] +[:mouse_move, 688, 334, 2, 209, 527] +[:mouse_move, 694, 340, 2, 210, 528] +[:mouse_move, 697, 342, 2, 211, 529] +[:mouse_move, 700, 344, 2, 212, 530] +[:mouse_move, 703, 346, 2, 213, 531] +[:mouse_move, 705, 347, 2, 214, 532] +[:mouse_move, 707, 348, 2, 215, 533] +[:mouse_move, 708, 349, 2, 216, 534] +[:mouse_move, 708, 350, 2, 217, 535] +[:mouse_move, 709, 352, 2, 218, 536] +[:mouse_move, 710, 353, 2, 219, 537] +[:mouse_move, 711, 354, 2, 220, 538] +[:mouse_move, 712, 354, 2, 221, 539] +[:mouse_move, 712, 355, 2, 222, 540] +[:mouse_move, 713, 355, 2, 223, 543] +[:mouse_button_pressed, 1, 0, 1, 224, 543] +[:mouse_button_up, 1, 0, 1, 225, 550] +[:mouse_move, 713, 353, 2, 226, 572] +[:mouse_move, 715, 341, 2, 227, 574] +[:mouse_move, 716, 333, 2, 228, 575] +[:mouse_move, 718, 310, 2, 229, 576] +[:mouse_move, 719, 290, 2, 230, 577] +[:mouse_move, 717, 259, 2, 231, 578] +[:mouse_move, 711, 247, 2, 232, 580] +[:mouse_move, 701, 233, 2, 233, 581] +[:mouse_move, 696, 227, 2, 234, 582] +[:mouse_move, 689, 222, 2, 235, 583] +[:mouse_move, 668, 208, 2, 236, 584] +[:mouse_move, 656, 201, 2, 237, 585] +[:mouse_move, 650, 197, 2, 238, 586] +[:mouse_move, 638, 189, 2, 239, 587] +[:mouse_move, 627, 181, 2, 240, 588] +[:mouse_move, 623, 179, 2, 241, 589] +[:mouse_move, 605, 164, 2, 242, 590] +[:mouse_move, 600, 160, 2, 243, 591] +[:mouse_move, 592, 153, 2, 244, 592] +[:mouse_move, 583, 145, 2, 245, 593] +[:mouse_move, 580, 143, 2, 246, 594] +[:mouse_move, 576, 140, 2, 247, 595] +[:mouse_move, 572, 139, 2, 248, 597] +[:mouse_move, 571, 138, 2, 249, 598] +[:mouse_move, 586, 146, 2, 250, 603] +[:mouse_move, 600, 152, 2, 251, 604] +[:mouse_move, 636, 161, 2, 252, 605] +[:mouse_move, 665, 164, 2, 253, 607] +[:mouse_move, 672, 164, 2, 254, 608] +[:mouse_move, 704, 162, 2, 255, 609] +[:mouse_move, 715, 156, 2, 256, 611] +[:mouse_move, 723, 148, 2, 257, 612] +[:mouse_move, 725, 144, 2, 258, 613] +[:mouse_move, 729, 135, 2, 259, 614] +[:mouse_move, 730, 131, 2, 260, 615] +[:mouse_move, 730, 126, 2, 261, 616] +[:mouse_move, 730, 117, 2, 262, 617] +[:mouse_move, 721, 101, 2, 263, 618] +[:mouse_move, 713, 92, 2, 264, 619] +[:mouse_move, 705, 83, 2, 265, 620] +[:mouse_move, 691, 71, 2, 266, 621] +[:mouse_move, 682, 65, 2, 267, 622] +[:mouse_move, 666, 55, 2, 268, 623] +[:mouse_move, 657, 52, 2, 269, 624] +[:mouse_move, 635, 48, 2, 270, 625] +[:mouse_move, 621, 48, 2, 271, 626] +[:mouse_move, 613, 48, 2, 272, 627] +[:mouse_move, 589, 52, 2, 273, 628] +[:mouse_move, 570, 61, 2, 274, 630] +[:mouse_move, 544, 85, 2, 275, 632] +[:mouse_move, 540, 90, 2, 276, 633] +[:mouse_move, 532, 101, 2, 277, 634] +[:mouse_move, 525, 116, 2, 278, 636] +[:mouse_move, 523, 123, 2, 279, 637] +[:mouse_move, 523, 127, 2, 280, 638] +[:mouse_move, 526, 139, 2, 281, 639] +[:mouse_move, 531, 145, 2, 282, 640] +[:mouse_move, 550, 159, 2, 283, 641] +[:mouse_move, 563, 166, 2, 284, 642] +[:mouse_move, 587, 175, 2, 285, 643] +[:mouse_move, 655, 186, 2, 286, 644] +[:mouse_move, 674, 186, 2, 287, 645] +[:mouse_move, 718, 186, 2, 288, 646] +[:mouse_move, 745, 183, 2, 289, 647] +[:mouse_move, 757, 180, 2, 290, 648] +[:mouse_move, 760, 178, 2, 291, 649] +[:mouse_move, 773, 173, 2, 292, 650] +[:mouse_move, 778, 169, 2, 293, 651] +[:mouse_move, 781, 161, 2, 294, 652] +[:mouse_move, 782, 154, 2, 295, 653] +[:mouse_move, 780, 146, 2, 296, 654] +[:mouse_move, 765, 125, 2, 297, 655] +[:mouse_move, 730, 95, 2, 298, 657] +[:mouse_move, 713, 84, 2, 299, 658] +[:mouse_move, 678, 69, 2, 300, 659] +[:mouse_move, 658, 65, 2, 301, 661] +[:mouse_move, 636, 63, 2, 302, 662] +[:mouse_move, 609, 65, 2, 303, 663] +[:mouse_move, 601, 68, 2, 304, 664] +[:mouse_move, 594, 71, 2, 305, 665] +[:mouse_move, 587, 76, 2, 306, 666] +[:mouse_move, 573, 92, 2, 307, 667] +[:mouse_move, 561, 125, 2, 308, 668] +[:mouse_move, 557, 145, 2, 309, 669] +[:mouse_move, 555, 168, 2, 310, 670] +[:mouse_move, 557, 220, 2, 311, 671] +[:mouse_move, 566, 247, 2, 312, 672] +[:mouse_move, 595, 302, 2, 313, 673] +[:mouse_move, 603, 311, 2, 314, 674] +[:mouse_move, 620, 337, 2, 315, 675] +[:mouse_move, 629, 348, 2, 316, 676] +[:mouse_move, 633, 353, 2, 317, 677] +[:mouse_move, 635, 356, 2, 318, 678] +[:mouse_move, 637, 358, 2, 319, 679] +[:mouse_move, 638, 359, 2, 320, 681] +[:mouse_button_pressed, 1, 0, 1, 321, 685] +[:mouse_button_up, 1, 0, 1, 322, 691] +[:mouse_move, 631, 359, 2, 323, 707] +[:mouse_move, 626, 358, 2, 324, 708] +[:mouse_move, 622, 357, 2, 325, 709] +[:mouse_move, 618, 354, 2, 326, 710] +[:mouse_move, 612, 347, 2, 327, 711] +[:mouse_move, 608, 342, 2, 328, 712] +[:mouse_move, 598, 325, 2, 329, 713] +[:mouse_move, 593, 313, 2, 330, 714] +[:mouse_move, 588, 303, 2, 331, 715] +[:mouse_move, 586, 296, 2, 332, 716] +[:mouse_move, 580, 284, 2, 333, 717] +[:mouse_move, 577, 279, 2, 334, 719] +[:mouse_move, 576, 278, 2, 335, 720] +[:mouse_move, 574, 277, 2, 336, 721] +[:mouse_move, 572, 276, 2, 337, 722] +[:mouse_move, 569, 276, 2, 338, 723] +[:mouse_move, 567, 275, 2, 339, 724] +[:mouse_move, 566, 275, 2, 340, 725] +[:mouse_move, 565, 275, 2, 341, 726] +[:mouse_move, 564, 275, 2, 342, 729] +[:mouse_button_pressed, 1, 0, 1, 343, 736] +[:mouse_button_up, 1, 0, 1, 344, 743] +[:mouse_move, 572, 275, 2, 345, 761] +[:mouse_move, 577, 275, 2, 346, 762] +[:mouse_move, 591, 275, 2, 347, 763] +[:mouse_move, 596, 275, 2, 348, 764] +[:mouse_move, 603, 274, 2, 349, 765] +[:mouse_move, 606, 274, 2, 350, 766] +[:mouse_move, 619, 273, 2, 351, 767] +[:mouse_move, 620, 273, 2, 352, 768] +[:mouse_move, 623, 273, 2, 353, 769] +[:mouse_move, 625, 273, 2, 354, 771] +[:mouse_move, 626, 273, 2, 355, 774] +[:mouse_button_pressed, 1, 0, 1, 356, 781] +[:mouse_button_up, 1, 0, 1, 357, 788] +[:mouse_move, 629, 273, 2, 358, 795] +[:mouse_move, 637, 273, 2, 359, 796] +[:mouse_move, 646, 273, 2, 360, 797] +[:mouse_move, 654, 273, 2, 361, 798] +[:mouse_move, 664, 273, 2, 362, 799] +[:mouse_move, 677, 273, 2, 363, 800] +[:mouse_move, 687, 273, 2, 364, 801] +[:mouse_move, 692, 273, 2, 365, 802] +[:mouse_move, 697, 273, 2, 366, 803] +[:mouse_move, 702, 273, 2, 367, 804] +[:mouse_move, 704, 273, 2, 368, 805] +[:mouse_move, 705, 273, 2, 369, 806] +[:mouse_move, 707, 273, 2, 370, 807] +[:mouse_move, 708, 273, 2, 371, 808] +[:mouse_move, 711, 274, 2, 372, 809] +[:mouse_move, 713, 274, 2, 373, 810] +[:mouse_move, 715, 274, 2, 374, 811] +[:mouse_move, 716, 274, 2, 375, 812] +[:mouse_move, 717, 274, 2, 376, 814] +[:mouse_move, 718, 274, 2, 377, 815] +[:mouse_button_pressed, 1, 0, 1, 378, 817] +[:mouse_button_up, 1, 0, 1, 379, 825] +[:mouse_move, 717, 274, 2, 380, 829] +[:mouse_move, 711, 276, 2, 381, 830] +[:mouse_move, 708, 277, 2, 382, 831] +[:mouse_move, 701, 280, 2, 383, 832] +[:mouse_move, 697, 283, 2, 384, 833] +[:mouse_move, 693, 284, 2, 385, 834] +[:mouse_move, 679, 291, 2, 386, 835] +[:mouse_move, 672, 296, 2, 387, 836] +[:mouse_move, 668, 299, 2, 388, 837] +[:mouse_move, 662, 305, 2, 389, 838] +[:mouse_move, 658, 308, 2, 390, 839] +[:mouse_move, 653, 314, 2, 391, 840] +[:mouse_move, 649, 321, 2, 392, 842] +[:mouse_move, 648, 323, 2, 393, 843] +[:mouse_move, 647, 325, 2, 394, 844] +[:mouse_move, 645, 329, 2, 395, 845] +[:mouse_move, 644, 331, 2, 396, 846] +[:mouse_move, 642, 336, 2, 397, 847] +[:mouse_move, 641, 337, 2, 398, 848] +[:mouse_move, 639, 341, 2, 399, 849] +[:mouse_move, 638, 343, 2, 400, 850] +[:mouse_move, 637, 344, 2, 401, 851] +[:mouse_move, 636, 345, 2, 402, 852] +[:mouse_move, 635, 346, 2, 403, 853] +[:mouse_move, 635, 347, 2, 404, 854] +[:mouse_move, 634, 348, 2, 405, 855] +[:mouse_move, 634, 349, 2, 406, 857] +[:mouse_button_pressed, 1, 0, 1, 407, 858] +[:mouse_button_up, 1, 0, 1, 408, 866] +[:mouse_move, 634, 350, 2, 409, 887] +[:mouse_move, 634, 351, 2, 410, 889] +[:mouse_move, 633, 352, 2, 411, 891] +[:mouse_move, 632, 352, 2, 412, 893] +[:mouse_move, 628, 352, 2, 413, 894] +[:mouse_move, 625, 353, 2, 414, 895] +[:mouse_move, 617, 354, 2, 415, 896] +[:mouse_move, 613, 356, 2, 416, 897] +[:mouse_move, 605, 359, 2, 417, 898] +[:mouse_move, 603, 360, 2, 418, 899] +[:mouse_move, 600, 362, 2, 419, 900] +[:mouse_move, 596, 364, 2, 420, 901] +[:mouse_move, 592, 366, 2, 421, 902] +[:mouse_move, 590, 367, 2, 422, 904] +[:mouse_move, 588, 367, 2, 423, 905] +[:mouse_move, 581, 367, 2, 424, 906] +[:mouse_move, 579, 366, 2, 425, 907] +[:mouse_move, 577, 366, 2, 426, 908] +[:mouse_move, 575, 365, 2, 427, 909] +[:mouse_move, 571, 364, 2, 428, 910] +[:mouse_move, 570, 363, 2, 429, 911] +[:mouse_move, 568, 362, 2, 430, 912] +[:mouse_button_pressed, 1, 0, 1, 431, 913] +[:mouse_button_up, 1, 0, 1, 432, 921] +[:mouse_move, 568, 366, 2, 433, 927] +[:mouse_move, 568, 369, 2, 434, 928] +[:mouse_move, 568, 373, 2, 435, 929] +[:mouse_move, 568, 376, 2, 436, 930] +[:mouse_move, 569, 384, 2, 437, 931] +[:mouse_move, 571, 388, 2, 438, 932] +[:mouse_move, 580, 401, 2, 439, 933] +[:mouse_move, 592, 413, 2, 440, 934] +[:mouse_move, 596, 416, 2, 441, 935] +[:mouse_move, 607, 426, 2, 442, 936] +[:mouse_move, 612, 431, 2, 443, 937] +[:mouse_move, 618, 435, 2, 444, 938] +[:mouse_move, 620, 437, 2, 445, 939] +[:mouse_move, 625, 441, 2, 446, 940] +[:mouse_move, 627, 442, 2, 447, 941] +[:mouse_move, 630, 444, 2, 448, 942] +[:mouse_move, 631, 444, 2, 449, 943] +[:mouse_move, 634, 445, 2, 450, 944] +[:mouse_move, 635, 446, 2, 451, 945] +[:mouse_move, 636, 446, 2, 452, 946] +[:mouse_move, 638, 447, 2, 453, 947] +[:mouse_move, 639, 447, 2, 454, 949] +[:mouse_button_pressed, 1, 0, 1, 455, 953] +[:mouse_button_up, 1, 0, 1, 456, 961] +[:mouse_move, 639, 446, 2, 457, 977] +[:mouse_move, 640, 443, 2, 458, 978] +[:mouse_move, 641, 438, 2, 459, 979] +[:mouse_move, 641, 430, 2, 460, 980] +[:mouse_move, 644, 395, 2, 461, 981] +[:mouse_move, 645, 373, 2, 462, 982] +[:mouse_move, 645, 315, 2, 463, 983] +[:mouse_move, 644, 275, 2, 464, 984] +[:mouse_move, 642, 266, 2, 465, 985] +[:mouse_move, 636, 236, 2, 466, 986] +[:mouse_move, 633, 226, 2, 467, 987] +[:mouse_move, 630, 217, 2, 468, 988] +[:mouse_move, 618, 200, 2, 469, 989] +[:mouse_move, 610, 192, 2, 470, 990] +[:mouse_move, 604, 188, 2, 471, 991] +[:mouse_move, 594, 181, 2, 472, 992] +[:mouse_move, 591, 180, 2, 473, 993] +[:mouse_move, 584, 176, 2, 474, 994] +[:mouse_move, 579, 174, 2, 475, 995] +[:mouse_move, 576, 173, 2, 476, 996] +[:mouse_move, 571, 172, 2, 477, 997] +[:mouse_move, 569, 172, 2, 478, 998] +[:mouse_move, 565, 171, 2, 479, 999] +[:mouse_move, 564, 170, 2, 480, 1000] +[:mouse_move, 562, 170, 2, 481, 1001] +[:mouse_move, 565, 172, 2, 482, 1005] +[:mouse_move, 570, 175, 2, 483, 1006] +[:mouse_move, 599, 185, 2, 484, 1007] +[:mouse_move, 616, 189, 2, 485, 1008] +[:mouse_move, 647, 192, 2, 486, 1009] +[:mouse_move, 665, 193, 2, 487, 1010] +[:mouse_move, 685, 193, 2, 488, 1011] +[:mouse_move, 719, 186, 2, 489, 1012] +[:mouse_move, 735, 177, 2, 490, 1013] +[:mouse_move, 751, 167, 2, 491, 1014] +[:mouse_move, 755, 161, 2, 492, 1015] +[:mouse_move, 758, 156, 2, 493, 1016] +[:mouse_move, 761, 145, 2, 494, 1017] +[:mouse_move, 762, 139, 2, 495, 1018] +[:mouse_move, 762, 133, 2, 496, 1019] +[:mouse_move, 757, 123, 2, 497, 1020] +[:mouse_move, 753, 117, 2, 498, 1021] +[:mouse_move, 739, 101, 2, 499, 1022] +[:mouse_move, 722, 88, 2, 500, 1023] +[:mouse_move, 711, 81, 2, 501, 1024] +[:mouse_move, 685, 65, 2, 502, 1025] +[:mouse_move, 671, 57, 2, 503, 1026] +[:mouse_move, 656, 49, 2, 504, 1027] +[:mouse_move, 637, 40, 2, 505, 1028] +[:mouse_move, 627, 36, 2, 506, 1029] +[:mouse_move, 617, 33, 2, 507, 1030] +[:mouse_move, 602, 31, 2, 508, 1031] +[:mouse_move, 589, 31, 2, 509, 1032] +[:mouse_move, 582, 31, 2, 510, 1033] +[:mouse_move, 570, 36, 2, 511, 1034] +[:mouse_move, 554, 47, 2, 512, 1035] +[:mouse_move, 547, 53, 2, 513, 1036] +[:mouse_move, 540, 59, 2, 514, 1037] +[:mouse_move, 533, 66, 2, 515, 1038] +[:mouse_move, 517, 84, 2, 516, 1039] +[:mouse_move, 516, 87, 2, 517, 1040] +[:mouse_move, 511, 95, 2, 518, 1041] +[:mouse_move, 506, 107, 2, 519, 1042] +[:mouse_move, 506, 114, 2, 520, 1043] +[:mouse_move, 506, 122, 2, 521, 1044] +[:mouse_move, 515, 139, 2, 522, 1045] +[:mouse_move, 521, 148, 2, 523, 1046] +[:mouse_move, 550, 169, 2, 524, 1047] +[:mouse_move, 576, 178, 2, 525, 1048] +[:mouse_move, 593, 182, 2, 526, 1049] +[:mouse_move, 613, 184, 2, 527, 1050] +[:mouse_move, 650, 184, 2, 528, 1051] +[:mouse_move, 683, 180, 2, 529, 1052] +[:mouse_move, 696, 176, 2, 530, 1053] +[:mouse_move, 709, 171, 2, 531, 1054] +[:mouse_move, 723, 162, 2, 532, 1055] +[:mouse_move, 731, 156, 2, 533, 1056] +[:mouse_move, 744, 142, 2, 534, 1057] +[:mouse_move, 748, 136, 2, 535, 1058] +[:mouse_move, 752, 123, 2, 536, 1059] +[:mouse_move, 753, 117, 2, 537, 1060] +[:mouse_move, 754, 112, 2, 538, 1061] +[:mouse_move, 754, 102, 2, 539, 1062] +[:mouse_move, 750, 93, 2, 540, 1063] +[:mouse_move, 745, 85, 2, 541, 1064] +[:mouse_move, 733, 76, 2, 542, 1065] +[:mouse_move, 728, 73, 2, 543, 1066] +[:mouse_move, 721, 69, 2, 544, 1067] +[:mouse_move, 700, 59, 2, 545, 1068] +[:mouse_move, 678, 51, 2, 546, 1069] +[:mouse_move, 666, 48, 2, 547, 1070] +[:mouse_move, 639, 44, 2, 548, 1071] +[:mouse_move, 627, 42, 2, 549, 1072] +[:mouse_move, 620, 42, 2, 550, 1073] +[:mouse_move, 600, 42, 2, 551, 1074] +[:mouse_move, 590, 44, 2, 552, 1075] +[:mouse_move, 568, 52, 2, 553, 1076] +[:mouse_move, 557, 58, 2, 554, 1077] +[:mouse_move, 550, 62, 2, 555, 1078] +[:mouse_move, 545, 66, 2, 556, 1079] +[:mouse_move, 535, 75, 2, 557, 1080] +[:mouse_move, 526, 87, 2, 558, 1081] +[:mouse_move, 522, 95, 2, 559, 1082] +[:mouse_move, 517, 108, 2, 560, 1083] +[:mouse_move, 515, 116, 2, 561, 1084] +[:mouse_move, 512, 127, 2, 562, 1085] +[:mouse_move, 510, 138, 2, 563, 1086] +[:mouse_move, 510, 143, 2, 564, 1087] +[:mouse_move, 517, 163, 2, 565, 1088] +[:mouse_move, 542, 181, 2, 566, 1089] +[:mouse_move, 552, 185, 2, 567, 1090] +[:mouse_move, 605, 204, 2, 568, 1091] +[:mouse_move, 668, 208, 2, 569, 1093] +[:mouse_move, 677, 208, 2, 570, 1094] +[:mouse_move, 694, 207, 2, 571, 1095] +[:mouse_move, 710, 207, 2, 572, 1096] +[:mouse_move, 714, 207, 2, 573, 1097] +[:mouse_move, 720, 214, 2, 574, 1098] +[:mouse_move, 720, 223, 2, 575, 1099] +[:mouse_move, 720, 240, 2, 576, 1100] +[:mouse_move, 712, 280, 2, 577, 1101] +[:mouse_move, 707, 293, 2, 578, 1102] +[:mouse_move, 696, 319, 2, 579, 1103] +[:mouse_move, 684, 341, 2, 580, 1104] +[:mouse_move, 682, 343, 2, 581, 1105] +[:mouse_move, 677, 350, 2, 582, 1106] +[:mouse_move, 672, 356, 2, 583, 1107] +[:mouse_move, 670, 359, 2, 584, 1108] +[:mouse_move, 669, 359, 2, 585, 1109] +[:mouse_move, 668, 360, 2, 586, 1110] +[:mouse_move, 668, 361, 2, 587, 1112] +[:mouse_button_pressed, 1, 0, 1, 588, 1113] +[:mouse_button_up, 1, 0, 1, 589, 1124] +[:mouse_move, 667, 361, 2, 590, 1141] +[:mouse_move, 661, 356, 2, 591, 1142] +[:mouse_move, 648, 343, 2, 592, 1143] +[:mouse_move, 639, 335, 2, 593, 1144] +[:mouse_move, 625, 324, 2, 594, 1145] +[:mouse_move, 603, 311, 2, 595, 1147] +[:mouse_move, 597, 308, 2, 596, 1148] +[:mouse_move, 585, 302, 2, 597, 1149] +[:mouse_move, 580, 299, 2, 598, 1150] +[:mouse_move, 575, 297, 2, 599, 1151] +[:mouse_move, 574, 296, 2, 600, 1152] +[:mouse_move, 569, 293, 2, 601, 1153] +[:mouse_move, 568, 292, 2, 602, 1154] +[:mouse_move, 567, 291, 2, 603, 1155] +[:mouse_move, 566, 291, 2, 604, 1156] +[:mouse_button_pressed, 1, 0, 1, 605, 1168] +[:mouse_button_up, 1, 0, 1, 606, 1175] +[:mouse_move, 567, 291, 2, 607, 1188] +[:mouse_move, 575, 302, 2, 608, 1189] +[:mouse_move, 580, 307, 2, 609, 1190] +[:mouse_move, 586, 314, 2, 610, 1191] +[:mouse_move, 601, 329, 2, 611, 1192] +[:mouse_move, 609, 337, 2, 612, 1193] +[:mouse_move, 623, 349, 2, 613, 1194] +[:mouse_move, 625, 351, 2, 614, 1195] +[:mouse_move, 633, 358, 2, 615, 1196] +[:mouse_move, 637, 361, 2, 616, 1197] +[:mouse_move, 638, 362, 2, 617, 1198] +[:mouse_move, 639, 363, 2, 618, 1199] +[:mouse_move, 640, 363, 2, 619, 1200] +[:mouse_move, 640, 364, 2, 620, 1201] +[:mouse_move, 640, 365, 2, 621, 1213] +[:mouse_move, 641, 365, 2, 622, 1218] +[:mouse_button_pressed, 1, 0, 1, 623, 1238] +[:mouse_button_up, 1, 0, 1, 624, 1245] +[:mouse_move, 644, 369, 2, 625, 1258] +[:mouse_move, 652, 380, 2, 626, 1259] +[:mouse_move, 656, 384, 2, 627, 1260] +[:mouse_move, 663, 394, 2, 628, 1261] +[:mouse_move, 669, 402, 2, 629, 1262] +[:mouse_move, 682, 415, 2, 630, 1263] +[:mouse_move, 688, 421, 2, 631, 1264] +[:mouse_move, 692, 424, 2, 632, 1265] +[:mouse_move, 694, 427, 2, 633, 1266] +[:mouse_move, 698, 430, 2, 634, 1267] +[:mouse_move, 699, 431, 2, 635, 1268] +[:mouse_move, 700, 432, 2, 636, 1269] +[:mouse_move, 701, 433, 2, 637, 1270] +[:mouse_move, 702, 434, 2, 638, 1271] +[:mouse_move, 703, 435, 2, 639, 1274] +[:mouse_button_pressed, 1, 0, 1, 640, 1279] +[:mouse_button_up, 1, 0, 1, 641, 1285] +[:mouse_move, 701, 435, 2, 642, 1297] +[:mouse_move, 695, 435, 2, 643, 1298] +[:mouse_move, 685, 435, 2, 644, 1299] +[:mouse_move, 680, 435, 2, 645, 1300] +[:mouse_move, 669, 437, 2, 646, 1301] +[:mouse_move, 663, 439, 2, 647, 1302] +[:mouse_move, 661, 439, 2, 648, 1303] +[:mouse_move, 657, 440, 2, 649, 1304] +[:mouse_move, 651, 441, 2, 650, 1305] +[:mouse_move, 646, 442, 2, 651, 1306] +[:mouse_move, 645, 442, 2, 652, 1307] +[:mouse_move, 643, 443, 2, 653, 1308] +[:mouse_move, 642, 443, 2, 654, 1309] +[:mouse_move, 641, 443, 2, 655, 1311] +[:mouse_button_pressed, 1, 0, 1, 656, 1314] +[:mouse_button_up, 1, 0, 1, 657, 1322] +[:mouse_move, 641, 441, 2, 658, 1324] +[:mouse_move, 641, 433, 2, 659, 1325] +[:mouse_move, 641, 425, 2, 660, 1326] +[:mouse_move, 641, 408, 2, 661, 1327] +[:mouse_move, 641, 398, 2, 662, 1328] +[:mouse_move, 641, 373, 2, 663, 1329] +[:mouse_move, 641, 358, 2, 664, 1330] +[:mouse_move, 641, 337, 2, 665, 1331] +[:mouse_move, 641, 323, 2, 666, 1332] +[:mouse_move, 641, 312, 2, 667, 1333] +[:mouse_move, 641, 305, 2, 668, 1334] +[:mouse_move, 641, 301, 2, 669, 1335] +[:mouse_move, 641, 294, 2, 670, 1336] +[:mouse_move, 641, 292, 2, 671, 1337] +[:mouse_move, 641, 290, 2, 672, 1338] +[:mouse_move, 641, 289, 2, 673, 1339] +[:mouse_move, 641, 288, 2, 674, 1341] +[:mouse_move, 641, 287, 2, 675, 1344] +[:mouse_move, 640, 286, 2, 676, 1345] +[:mouse_move, 640, 285, 2, 677, 1346] +[:mouse_move, 640, 284, 2, 678, 1348] +[:mouse_button_pressed, 1, 0, 1, 679, 1349] +[:mouse_button_up, 1, 0, 1, 680, 1356] +[:mouse_move, 642, 284, 2, 681, 1360] +[:mouse_move, 651, 284, 2, 682, 1361] +[:mouse_move, 660, 284, 2, 683, 1362] +[:mouse_move, 671, 284, 2, 684, 1363] +[:mouse_move, 684, 284, 2, 685, 1364] +[:mouse_move, 702, 284, 2, 686, 1365] +[:mouse_move, 714, 284, 2, 687, 1366] +[:mouse_move, 718, 284, 2, 688, 1367] +[:mouse_move, 722, 284, 2, 689, 1368] +[:mouse_move, 726, 284, 2, 690, 1369] +[:mouse_move, 727, 284, 2, 691, 1371] +[:mouse_button_pressed, 1, 0, 1, 692, 1378] +[:mouse_button_up, 1, 0, 1, 693, 1385] +[:mouse_move, 725, 288, 2, 694, 1389] +[:mouse_move, 717, 298, 2, 695, 1390] +[:mouse_move, 710, 306, 2, 696, 1391] +[:mouse_move, 696, 322, 2, 697, 1392] +[:mouse_move, 689, 332, 2, 698, 1393] +[:mouse_move, 674, 353, 2, 699, 1394] +[:mouse_move, 660, 373, 2, 700, 1395] +[:mouse_move, 652, 384, 2, 701, 1396] +[:mouse_move, 650, 387, 2, 702, 1397] +[:mouse_move, 640, 400, 2, 703, 1398] +[:mouse_move, 639, 402, 2, 704, 1399] +[:mouse_move, 634, 409, 2, 705, 1400] +[:mouse_move, 632, 411, 2, 706, 1401] +[:mouse_move, 630, 414, 2, 707, 1402] +[:mouse_move, 629, 415, 2, 708, 1403] +[:mouse_move, 628, 416, 2, 709, 1404] +[:mouse_move, 626, 417, 2, 710, 1405] +[:mouse_move, 626, 418, 2, 711, 1406] +[:mouse_move, 623, 420, 2, 712, 1408] +[:mouse_move, 619, 423, 2, 713, 1409] +[:mouse_move, 618, 424, 2, 714, 1410] +[:mouse_move, 615, 427, 2, 715, 1411] +[:mouse_move, 610, 430, 2, 716, 1412] +[:mouse_move, 604, 433, 2, 717, 1413] +[:mouse_move, 603, 433, 2, 718, 1414] +[:mouse_move, 598, 435, 2, 719, 1415] +[:mouse_move, 595, 437, 2, 720, 1417] +[:mouse_move, 594, 437, 2, 721, 1418] +[:mouse_move, 591, 438, 2, 722, 1419] +[:mouse_move, 590, 439, 2, 723, 1420] +[:mouse_move, 587, 440, 2, 724, 1421] +[:mouse_move, 586, 440, 2, 725, 1422] +[:mouse_move, 585, 440, 2, 726, 1423] +[:mouse_move, 585, 441, 2, 727, 1424] +[:mouse_move, 584, 441, 2, 728, 1425] +[:mouse_button_pressed, 1, 0, 1, 729, 1427] +[:mouse_button_up, 1, 0, 1, 730, 1437] +[:mouse_move, 584, 439, 2, 731, 1446] +[:mouse_move, 584, 438, 2, 732, 1447] +[:mouse_move, 584, 430, 2, 733, 1448] +[:mouse_move, 583, 421, 2, 734, 1449] +[:mouse_move, 582, 416, 2, 735, 1450] +[:mouse_move, 579, 405, 2, 736, 1451] +[:mouse_move, 577, 398, 2, 737, 1452] +[:mouse_move, 570, 381, 2, 738, 1453] +[:mouse_move, 567, 374, 2, 739, 1454] +[:mouse_move, 563, 365, 2, 740, 1455] +[:mouse_move, 560, 357, 2, 741, 1456] +[:mouse_move, 558, 352, 2, 742, 1457] +[:mouse_move, 556, 345, 2, 743, 1458] +[:mouse_move, 555, 343, 2, 744, 1459] +[:mouse_move, 554, 341, 2, 745, 1460] +[:mouse_move, 554, 340, 2, 746, 1461] +[:mouse_move, 553, 340, 2, 747, 1468] +[:mouse_button_pressed, 1, 0, 1, 748, 1476] +[:mouse_button_up, 1, 0, 1, 749, 1484] +[:mouse_move, 554, 340, 2, 750, 1489] +[:mouse_move, 557, 340, 2, 751, 1490] +[:mouse_move, 576, 343, 2, 752, 1491] +[:mouse_move, 582, 344, 2, 753, 1492] +[:mouse_move, 608, 350, 2, 754, 1493] +[:mouse_move, 622, 352, 2, 755, 1494] +[:mouse_move, 639, 353, 2, 756, 1495] +[:mouse_move, 660, 355, 2, 757, 1496] +[:mouse_move, 668, 355, 2, 758, 1497] +[:mouse_move, 684, 355, 2, 759, 1498] +[:mouse_move, 696, 355, 2, 760, 1500] +[:mouse_move, 697, 355, 2, 761, 1501] +[:mouse_move, 705, 355, 2, 762, 1502] +[:mouse_move, 708, 355, 2, 763, 1503] +[:mouse_move, 714, 355, 2, 764, 1504] +[:mouse_move, 716, 355, 2, 765, 1505] +[:mouse_move, 720, 355, 2, 766, 1506] +[:mouse_move, 722, 355, 2, 767, 1507] +[:mouse_move, 724, 355, 2, 768, 1508] +[:mouse_move, 725, 355, 2, 769, 1509] +[:mouse_move, 726, 354, 2, 770, 1510] +[:mouse_button_pressed, 1, 0, 1, 771, 1513] +[:mouse_button_up, 1, 0, 1, 772, 1520] +[:mouse_move, 726, 350, 2, 773, 1539] +[:mouse_move, 726, 344, 2, 774, 1540] +[:mouse_move, 724, 328, 2, 775, 1541] +[:mouse_move, 721, 319, 2, 776, 1542] +[:mouse_move, 707, 271, 2, 777, 1543] +[:mouse_move, 698, 248, 2, 778, 1544] +[:mouse_move, 679, 209, 2, 779, 1545] +[:mouse_move, 674, 201, 2, 780, 1546] +[:mouse_move, 656, 171, 2, 781, 1547] +[:mouse_move, 647, 161, 2, 782, 1548] +[:mouse_move, 640, 153, 2, 783, 1549] +[:mouse_move, 618, 136, 2, 784, 1550] +[:mouse_move, 613, 132, 2, 785, 1551] +[:mouse_move, 609, 130, 2, 786, 1552] +[:mouse_move, 607, 130, 2, 787, 1553] +[:mouse_move, 596, 126, 2, 788, 1554] +[:mouse_move, 593, 125, 2, 789, 1555] +[:mouse_move, 585, 124, 2, 790, 1556] +[:mouse_move, 581, 124, 2, 791, 1557] +[:mouse_move, 575, 124, 2, 792, 1558] +[:mouse_move, 571, 124, 2, 793, 1559] +[:mouse_move, 565, 124, 2, 794, 1560] +[:mouse_move, 560, 124, 2, 795, 1561] +[:mouse_move, 558, 124, 2, 796, 1562] +[:mouse_move, 556, 124, 2, 797, 1563] +[:mouse_move, 555, 124, 2, 798, 1564] +[:mouse_move, 555, 126, 2, 799, 1565] +[:mouse_move, 555, 128, 2, 800, 1566] +[:mouse_move, 555, 130, 2, 801, 1567] +[:mouse_move, 561, 137, 2, 802, 1568] +[:mouse_move, 567, 141, 2, 803, 1569] +[:mouse_move, 586, 148, 2, 804, 1570] +[:mouse_move, 599, 152, 2, 805, 1571] +[:mouse_move, 630, 155, 2, 806, 1572] +[:mouse_move, 661, 156, 2, 807, 1573] +[:mouse_move, 670, 156, 2, 808, 1574] +[:mouse_move, 728, 151, 2, 809, 1575] +[:mouse_move, 743, 147, 2, 810, 1576] +[:mouse_move, 762, 140, 2, 811, 1577] +[:mouse_move, 773, 135, 2, 812, 1578] +[:mouse_move, 781, 130, 2, 813, 1579] +[:mouse_move, 795, 120, 2, 814, 1580] +[:mouse_move, 800, 115, 2, 815, 1581] +[:mouse_move, 804, 109, 2, 816, 1582] +[:mouse_move, 810, 97, 2, 817, 1583] +[:mouse_move, 812, 91, 2, 818, 1584] +[:mouse_move, 812, 74, 2, 819, 1585] +[:mouse_move, 811, 72, 2, 820, 1586] +[:mouse_move, 802, 60, 2, 821, 1587] +[:mouse_move, 793, 52, 2, 822, 1588] +[:mouse_move, 775, 44, 2, 823, 1589] +[:mouse_move, 763, 40, 2, 824, 1590] +[:mouse_move, 737, 33, 2, 825, 1591] +[:mouse_move, 708, 28, 2, 826, 1592] +[:mouse_move, 694, 27, 2, 827, 1593] +[:mouse_move, 679, 26, 2, 828, 1594] +[:mouse_move, 651, 26, 2, 829, 1595] +[:mouse_move, 646, 26, 2, 830, 1596] +[:mouse_move, 616, 31, 2, 831, 1597] +[:mouse_move, 611, 33, 2, 832, 1598] +[:mouse_move, 585, 43, 2, 833, 1599] +[:mouse_move, 581, 46, 2, 834, 1600] +[:mouse_move, 565, 56, 2, 835, 1601] +[:mouse_move, 558, 60, 2, 836, 1602] +[:mouse_move, 542, 76, 2, 837, 1603] +[:mouse_move, 536, 84, 2, 838, 1604] +[:mouse_move, 527, 104, 2, 839, 1605] +[:mouse_move, 522, 115, 2, 840, 1606] +[:mouse_move, 520, 129, 2, 841, 1607] +[:mouse_move, 519, 137, 2, 842, 1608] +[:mouse_move, 519, 145, 2, 843, 1609] +[:mouse_move, 526, 162, 2, 844, 1610] +[:mouse_move, 545, 172, 2, 845, 1611] +[:mouse_move, 564, 180, 2, 846, 1612] +[:mouse_move, 574, 181, 2, 847, 1613] +[:mouse_move, 629, 191, 2, 848, 1614] +[:mouse_move, 658, 192, 2, 849, 1615] +[:mouse_move, 716, 193, 2, 850, 1616] +[:mouse_move, 729, 193, 2, 851, 1617] +[:mouse_move, 773, 183, 2, 852, 1618] +[:mouse_move, 779, 179, 2, 853, 1619] +[:mouse_move, 800, 168, 2, 854, 1620] +[:mouse_move, 806, 163, 2, 855, 1621] +[:mouse_move, 812, 154, 2, 856, 1622] +[:mouse_move, 813, 149, 2, 857, 1623] +[:mouse_move, 814, 140, 2, 858, 1624] +[:mouse_move, 815, 134, 2, 859, 1625] +[:mouse_move, 815, 123, 2, 860, 1626] +[:mouse_move, 815, 121, 2, 861, 1627] +[:mouse_move, 815, 115, 2, 862, 1628] +[:mouse_move, 815, 113, 2, 863, 1629] +[:mouse_move, 816, 111, 2, 864, 1630] +[:key_down_raw, 1073742051, 1024, 2, 865, 1698] +[:key_down_raw, 113, 1024, 2, 866, 1698] diff --git a/samples/04_sounds/app/main.rb b/samples/04_sounds/app/main.rb new file mode 100644 index 0000000..b6d0c3a --- /dev/null +++ b/samples/04_sounds/app/main.rb @@ -0,0 +1,189 @@ +=begin + + APIs Listing that haven't been encountered in previous sample apps: + + - sample: Chooses random element from array. + In this sample app, the target note is set by taking a sample from the collection + of available notes. + + Reminders: + - args.grid.(left|right|top|bottom): Pixel value for the boundaries of the virtual + 720 p screen (Dragon Ruby Game Toolkits's virtual resolution is always 1280x720). + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + For example, if we want to create a new button, we would declare it as a new entity and + then define its properties. + + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - reject: Removes elements from a collection if they meet certain requirements. + + - first: Returns the first element of an array. + + - inside_rect: Returns true or false depending on if the point is inside the rect. + + - to_sym: Returns symbol corresponding to string. Will create a symbol if it does + not already exist. + +=end + +# This sample app allows users to test their musical skills by matching the piano sound that plays in each +# level to the correct note. + +# Runs all the methods necessary for the game to function properly. +def tick args + defaults args + render args + calc args + input_mouse args + tick_instructions args, "Sample app shows how to play sounds. args.outputs.sounds << \"path_to_wav.wav\"" +end + +# Sets default values and creates empty collections +# Initialization happens in the first frame only +def defaults _ + _.state.notes ||= [] + _.state.click_feedbacks ||= [] + _.state.current_level ||= 1 + _.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet +end + +# Uses a label to display current level, and shows the score +# Creates a button to play the sample note, and displays the available notes that could be a potential match +def render _ + + # grid.w_half positions the label in the horizontal center of the screen. + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(40), "Hole #{_.state.current_level} of 9", 0, 1, 0, 0, 0] + + render_score _ # shows score on screen + + if _.state.game_over # if game is over, a "play again" button is shown + # Calculations ensure that Play Again label is displayed in center of border + # Remove calculations from y parameters and see what happens to border and label placement + _.state.play_again_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'again') # array definition, text/title + _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Again", 0, 1, 0, 0, 0] # outputs label + _.outputs.borders << _.state.play_again_border # outputs border + else # otherwise, if game is not over + # Calculations ensure that label appears in center of border + _.state.play_note_border ||= _.state.with_meta([560, _.grid.h * 3 / 4 - 40, 160, 60], 'play') # array definition, text/title + _.outputs.labels << [_.grid.w_half, _.grid.h * 3 / 4, "Play Note ##{_.state.current_level}", 0, 1, 0, 0, 0] # outputs label + _.outputs.borders << _.state.play_note_border # outputs border + end + + return if _.state.game_over # return if game is over + + _.outputs.labels << [_.grid.w_half, 400, "I think the note is a(n)...", 0, 1, 0, 0, 0] # outputs label + + # Shows all of the available notes that can be potential matches. + available_notes.each_with_index do |note, i| + _.state.notes[i] ||= piano_button(_, note, i + 1) # calls piano_button method on each note (creates label and border) + _.outputs.labels << _.state.notes[i].label # outputs note on screen with a label and a border + _.outputs.borders << _.state.notes[i].border + end + + # Shows whether or not the user is correct by filling the screen with either red or green + _.outputs.solids << _.state.click_feedbacks.map { |c| c.solid } +end + +# Shows the score (number of times the user guesses wrong) onto the screen using labels. +def render_score _ + if _.state.times_wrong == 0 # if the user has guessed wrong zero times, the score is par + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: PAR", 0, 1, 0, 0, 0] + else # otherwise, number of times the user has guessed wrong is shown + _.outputs.labels << [_.grid.w_half, _.grid.top.shift_down(80), "Score: +#{_.state.times_wrong}", 0, 1, 0, 0, 0] # shows score using string interpolation + end +end + +# Sets the target note for the level and performs calculations on click_feedbacks. +def calc _ + _.state.target_note ||= available_notes.sample # chooses a note from available_notes collection as target note + _.state.click_feedbacks.each { |c| c.solid[-1] -= 5 } # remove this line and solid color will remain on screen indefinitely + # comment this line out and the solid color will keep flashing on screen instead of being removed from click_feedbacks collection + _.state.click_feedbacks.reject! { |c| c.solid[-1] <= 0 } +end + +# Uses input from the user to play the target note, as well as the other notes that could be a potential match. +def input_mouse _ + return unless _.inputs.mouse.click # return unless the mouse is clicked + + # finds button that was clicked by user + button_clicked = _.outputs.borders.find_all do |b| # go through borders collection to find all borders that meet requirements + _.inputs.mouse.click.point.inside_rect? b # find button border that mouse was clicked inside of + end.reject {|b| !_.state.meta(b)}.first # reject, return first element + + return unless button_clicked # return unless button_clicked as a value (a button was clicked) + + queue_click_feedback _, # calls queue_click_feedback method on the button that was clicked + button_clicked.x, + button_clicked.y, + button_clicked.w, + button_clicked.h, + 150, 100, 200 # sets color of button to shade of purple + + if _.state.meta(button_clicked) == 'play' # if "play note" button is pressed + _.outputs.sounds << "sounds/#{_.state.target_note}.wav" # sound of target note is output + elsif _.state.meta(button_clicked) == 'again' # if "play game again" button is pressed + _.state.target_note = nil # no target note + _.state.current_level = 1 # starts at level 1 again + _.state.times_wrong = 0 # starts off with 0 wrong guesses + _.state.game_over = false # the game is not over (because it has just been restarted) + else # otherwise if neither of those buttons were pressed + _.outputs.sounds << "sounds/#{_.state.meta(button_clicked)}.wav" # sound of clicked note is played + if _.state.meta(button_clicked).to_sym == _.state.target_note # if clicked note is target note + _.state.target_note = nil # target note is emptied + + if _.state.current_level < 9 # if game hasn't reached level 9 + _.state.current_level += 1 # game goes to next level + else # otherwise, if game has reached level 9 + _.state.game_over = true # the game is over + end + + queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 100, 200, 100 # green shown if user guesses correctly + else # otherwise, if clicked note is not target note + _.state.times_wrong += 1 # increments times user guessed wrong + queue_click_feedback _, 0, 0, _.grid.w, _.grid.h, 200, 100, 100 # red shown is user guesses wrong + end + end +end + +# Creates a collection of all of the available notes as symbols +def available_notes + [:C3, :D3, :E3, :F3, :G3, :A3, :B3, :C4] +end + +# Creates buttons for each note, and sets a label (the note's name) and border for each note's button. +def piano_button _, note, position + _.state.new_entity(:button) do |b| # declares button as new entity + b.label = [460 + 40.mult(position), _.grid.h * 0.4, "#{note}", 0, 1, 0, 0, 0] # label definition + b.border = _.state.with_meta([460 + 40.mult(position) - 20, _.grid.h * 0.4 - 32, 40, 40], note) # border definition, text/title; 20 subtracted so label is in center of border + end +end + +# Color of click feedback changes depending on what button was clicked, and whether the guess is right or wrong +# If a button is clicked, the inside of button is purple (see input_mouse method) +# If correct note is clicked, screen turns green +# If incorrect note is clicked, screen turns red (again, see input_mouse method) +def queue_click_feedback _, x, y, w, h, *color + _.state.click_feedbacks << _.state.new_entity(:click_feedback) do |c| # declares feedback as new entity + c.solid = [x, y, w, h, *color, 255] # sets color + end +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/04_sounds/license-for-sample.txt b/samples/04_sounds/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/04_sounds/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/04_sounds/replay.txt b/samples/04_sounds/replay.txt new file mode 100644 index 0000000..ba1b5a6 --- /dev/null +++ b/samples/04_sounds/replay.txt @@ -0,0 +1,965 @@ +replay_version 2.0 +stopped_at 2343 +seed 100 +recorded_at Sun Sep 29 22:15:31 2019 +[:mouse_move, 1039, 23, 2, 1, 71] +[:mouse_move, 1005, 37, 2, 2, 72] +[:mouse_move, 862, 94, 2, 3, 73] +[:mouse_move, 791, 114, 2, 4, 74] +[:mouse_move, 664, 128, 2, 5, 75] +[:mouse_move, 610, 128, 2, 6, 76] +[:mouse_move, 577, 121, 2, 7, 77] +[:mouse_move, 566, 117, 2, 8, 78] +[:mouse_move, 566, 115, 2, 9, 90] +[:mouse_move, 566, 110, 2, 10, 91] +[:mouse_move, 566, 104, 2, 11, 91] +[:mouse_move, 566, 98, 2, 12, 92] +[:mouse_move, 567, 92, 2, 13, 93] +[:mouse_move, 567, 85, 2, 14, 94] +[:mouse_move, 567, 83, 2, 15, 95] +[:mouse_move, 568, 78, 2, 16, 96] +[:mouse_move, 568, 77, 2, 17, 97] +[:mouse_move, 568, 76, 2, 18, 97] +[:mouse_move, 568, 75, 2, 19, 98] +[:mouse_move, 567, 75, 2, 20, 102] +[:mouse_move, 566, 74, 2, 21, 103] +[:mouse_move, 565, 74, 2, 22, 106] +[:mouse_move, 565, 73, 2, 23, 106] +[:mouse_move, 565, 72, 2, 24, 110] +[:mouse_move, 565, 71, 2, 25, 111] +[:mouse_move, 565, 70, 2, 26, 112] +[:mouse_move, 567, 69, 2, 27, 112] +[:mouse_move, 569, 67, 2, 28, 114] +[:mouse_move, 571, 66, 2, 29, 114] +[:mouse_move, 577, 65, 2, 30, 115] +[:mouse_move, 581, 64, 2, 31, 116] +[:mouse_move, 584, 64, 2, 32, 116] +[:mouse_move, 589, 64, 2, 33, 117] +[:mouse_move, 592, 63, 2, 34, 118] +[:mouse_move, 597, 63, 2, 35, 118] +[:mouse_move, 601, 62, 2, 36, 119] +[:mouse_move, 605, 62, 2, 37, 120] +[:mouse_move, 610, 61, 2, 38, 120] +[:mouse_move, 613, 61, 2, 39, 121] +[:mouse_move, 617, 61, 2, 40, 122] +[:mouse_move, 620, 60, 2, 41, 122] +[:mouse_move, 622, 60, 2, 42, 123] +[:mouse_move, 627, 60, 2, 43, 124] +[:mouse_move, 632, 60, 2, 44, 125] +[:mouse_move, 635, 60, 2, 45, 126] +[:mouse_move, 638, 59, 2, 46, 126] +[:mouse_move, 640, 59, 2, 47, 127] +[:mouse_move, 642, 59, 2, 48, 129] +[:mouse_move, 644, 59, 2, 49, 129] +[:mouse_move, 650, 58, 2, 50, 130] +[:mouse_move, 655, 57, 2, 51, 131] +[:mouse_move, 657, 57, 2, 52, 132] +[:mouse_move, 661, 56, 2, 53, 133] +[:mouse_move, 665, 55, 2, 54, 134] +[:mouse_move, 671, 54, 2, 55, 135] +[:mouse_move, 673, 54, 2, 56, 136] +[:mouse_move, 677, 54, 2, 57, 137] +[:mouse_move, 680, 54, 2, 58, 138] +[:mouse_move, 684, 54, 2, 59, 139] +[:mouse_move, 686, 54, 2, 60, 140] +[:mouse_move, 688, 54, 2, 61, 141] +[:mouse_move, 690, 54, 2, 62, 141] +[:mouse_move, 691, 54, 2, 63, 142] +[:mouse_move, 694, 54, 2, 64, 143] +[:mouse_move, 696, 54, 2, 65, 144] +[:mouse_move, 698, 54, 2, 66, 146] +[:mouse_move, 699, 55, 2, 67, 147] +[:mouse_move, 700, 55, 2, 68, 149] +[:mouse_move, 700, 56, 2, 69, 176] +[:mouse_move, 700, 57, 2, 70, 176] +[:mouse_move, 701, 58, 2, 71, 177] +[:mouse_move, 701, 60, 2, 72, 178] +[:mouse_move, 702, 65, 2, 73, 179] +[:mouse_move, 702, 69, 2, 74, 180] +[:mouse_move, 702, 75, 2, 75, 181] +[:mouse_move, 700, 79, 2, 76, 182] +[:mouse_move, 689, 88, 2, 77, 183] +[:mouse_move, 682, 91, 2, 78, 184] +[:mouse_move, 663, 98, 2, 79, 185] +[:mouse_move, 651, 100, 2, 80, 186] +[:mouse_move, 626, 105, 2, 81, 187] +[:mouse_move, 612, 108, 2, 82, 188] +[:mouse_move, 600, 108, 2, 83, 189] +[:mouse_move, 595, 109, 2, 84, 189] +[:mouse_move, 586, 109, 2, 85, 190] +[:mouse_move, 577, 110, 2, 86, 191] +[:mouse_move, 572, 110, 2, 87, 192] +[:mouse_move, 569, 110, 2, 88, 193] +[:mouse_move, 567, 110, 2, 89, 194] +[:mouse_move, 564, 110, 2, 90, 196] +[:mouse_move, 562, 110, 2, 91, 197] +[:mouse_move, 561, 110, 2, 92, 197] +[:mouse_move, 558, 110, 2, 93, 198] +[:mouse_move, 557, 110, 2, 94, 199] +[:mouse_move, 556, 110, 2, 95, 199] +[:mouse_move, 555, 110, 2, 96, 200] +[:mouse_move, 554, 110, 2, 97, 201] +[:mouse_move, 553, 110, 2, 98, 203] +[:mouse_move, 555, 110, 2, 99, 206] +[:mouse_move, 556, 110, 2, 100, 207] +[:mouse_move, 560, 110, 2, 101, 208] +[:mouse_move, 562, 110, 2, 102, 209] +[:mouse_move, 566, 110, 2, 103, 209] +[:mouse_move, 569, 110, 2, 104, 210] +[:mouse_move, 572, 110, 2, 105, 211] +[:mouse_move, 579, 110, 2, 106, 212] +[:mouse_move, 582, 110, 2, 107, 213] +[:mouse_move, 590, 110, 2, 108, 215] +[:mouse_move, 597, 110, 2, 109, 216] +[:mouse_move, 601, 110, 2, 110, 216] +[:mouse_move, 605, 110, 2, 111, 217] +[:mouse_move, 612, 110, 2, 112, 218] +[:mouse_move, 614, 110, 2, 113, 219] +[:mouse_move, 620, 110, 2, 114, 220] +[:mouse_move, 622, 110, 2, 115, 220] +[:mouse_move, 627, 110, 2, 116, 221] +[:mouse_move, 633, 110, 2, 117, 222] +[:mouse_move, 635, 110, 2, 118, 223] +[:mouse_move, 640, 110, 2, 119, 224] +[:mouse_move, 643, 110, 2, 120, 224] +[:mouse_move, 644, 110, 2, 121, 225] +[:mouse_move, 647, 110, 2, 122, 226] +[:mouse_move, 649, 110, 2, 123, 226] +[:mouse_move, 653, 109, 2, 124, 227] +[:mouse_move, 656, 109, 2, 125, 228] +[:mouse_move, 659, 109, 2, 126, 229] +[:mouse_move, 662, 109, 2, 127, 230] +[:mouse_move, 668, 109, 2, 128, 231] +[:mouse_move, 671, 109, 2, 129, 232] +[:mouse_move, 673, 109, 2, 130, 232] +[:mouse_move, 678, 109, 2, 131, 233] +[:mouse_move, 681, 109, 2, 132, 234] +[:mouse_move, 686, 109, 2, 133, 235] +[:mouse_move, 689, 109, 2, 134, 236] +[:mouse_move, 692, 109, 2, 135, 236] +[:mouse_move, 694, 110, 2, 136, 237] +[:mouse_move, 696, 110, 2, 137, 238] +[:mouse_move, 698, 110, 2, 138, 238] +[:mouse_move, 699, 110, 2, 139, 239] +[:mouse_move, 700, 110, 2, 140, 240] +[:mouse_move, 702, 110, 2, 141, 241] +[:mouse_move, 703, 110, 2, 142, 242] +[:mouse_move, 704, 110, 2, 143, 245] +[:mouse_move, 704, 111, 2, 144, 290] +[:mouse_move, 695, 111, 2, 145, 347] +[:mouse_move, 691, 111, 2, 146, 348] +[:mouse_move, 689, 111, 2, 147, 348] +[:mouse_move, 687, 111, 2, 148, 349] +[:mouse_move, 685, 111, 2, 149, 350] +[:mouse_move, 684, 111, 2, 150, 351] +[:mouse_move, 683, 112, 2, 151, 353] +[:mouse_move, 683, 114, 2, 152, 365] +[:mouse_move, 684, 114, 2, 153, 366] +[:mouse_move, 684, 116, 2, 154, 367] +[:mouse_move, 686, 118, 2, 155, 368] +[:mouse_move, 686, 119, 2, 156, 369] +[:mouse_move, 687, 120, 2, 157, 370] +[:mouse_move, 687, 121, 2, 158, 371] +[:mouse_move, 687, 122, 2, 159, 374] +[:mouse_move, 682, 121, 2, 160, 378] +[:mouse_move, 678, 120, 2, 161, 379] +[:mouse_move, 668, 118, 2, 162, 380] +[:mouse_move, 660, 117, 2, 163, 381] +[:mouse_move, 653, 115, 2, 164, 382] +[:mouse_move, 628, 111, 2, 165, 383] +[:mouse_move, 619, 110, 2, 166, 384] +[:mouse_move, 609, 109, 2, 167, 384] +[:mouse_move, 604, 109, 2, 168, 385] +[:mouse_move, 596, 109, 2, 169, 385] +[:mouse_move, 586, 109, 2, 170, 387] +[:mouse_move, 581, 110, 2, 171, 388] +[:mouse_move, 574, 112, 2, 172, 388] +[:mouse_move, 571, 113, 2, 173, 389] +[:mouse_move, 567, 115, 2, 174, 390] +[:mouse_move, 562, 120, 2, 175, 391] +[:mouse_move, 559, 123, 2, 176, 392] +[:mouse_move, 556, 126, 2, 177, 392] +[:mouse_move, 553, 130, 2, 178, 393] +[:mouse_move, 550, 135, 2, 179, 394] +[:mouse_move, 547, 139, 2, 180, 394] +[:mouse_move, 545, 143, 2, 181, 395] +[:mouse_move, 543, 148, 2, 182, 396] +[:mouse_move, 540, 156, 2, 183, 397] +[:mouse_move, 539, 161, 2, 184, 398] +[:mouse_move, 537, 171, 2, 185, 399] +[:mouse_move, 537, 177, 2, 186, 400] +[:mouse_move, 537, 179, 2, 187, 400] +[:mouse_move, 536, 183, 2, 188, 401] +[:mouse_move, 536, 188, 2, 189, 402] +[:mouse_move, 536, 197, 2, 190, 403] +[:mouse_move, 538, 202, 2, 191, 404] +[:mouse_move, 541, 206, 2, 192, 405] +[:mouse_move, 544, 211, 2, 193, 405] +[:mouse_move, 548, 216, 2, 194, 406] +[:mouse_move, 557, 226, 2, 195, 407] +[:mouse_move, 566, 233, 2, 196, 408] +[:mouse_move, 575, 238, 2, 197, 409] +[:mouse_move, 583, 241, 2, 198, 409] +[:mouse_move, 591, 245, 2, 199, 410] +[:mouse_move, 602, 248, 2, 200, 411] +[:mouse_move, 613, 250, 2, 201, 411] +[:mouse_move, 625, 251, 2, 202, 412] +[:mouse_move, 637, 253, 2, 203, 413] +[:mouse_move, 650, 254, 2, 204, 413] +[:mouse_move, 663, 254, 2, 205, 414] +[:mouse_move, 669, 254, 2, 206, 415] +[:mouse_move, 680, 254, 2, 207, 415] +[:mouse_move, 690, 252, 2, 208, 416] +[:mouse_move, 699, 250, 2, 209, 417] +[:mouse_move, 707, 247, 2, 210, 417] +[:mouse_move, 714, 244, 2, 211, 418] +[:mouse_move, 720, 241, 2, 212, 419] +[:mouse_move, 726, 238, 2, 213, 419] +[:mouse_move, 730, 235, 2, 214, 420] +[:mouse_move, 734, 232, 2, 215, 421] +[:mouse_move, 741, 225, 2, 216, 422] +[:mouse_move, 744, 221, 2, 217, 423] +[:mouse_move, 747, 216, 2, 218, 424] +[:mouse_move, 748, 213, 2, 219, 425] +[:mouse_move, 751, 206, 2, 220, 426] +[:mouse_move, 751, 203, 2, 221, 427] +[:mouse_move, 750, 196, 2, 222, 428] +[:mouse_move, 748, 193, 2, 223, 429] +[:mouse_move, 740, 184, 2, 224, 430] +[:mouse_move, 735, 180, 2, 225, 431] +[:mouse_move, 726, 171, 2, 226, 432] +[:mouse_move, 722, 169, 2, 227, 432] +[:mouse_move, 710, 160, 2, 228, 433] +[:mouse_move, 691, 149, 2, 229, 434] +[:mouse_move, 680, 144, 2, 230, 435] +[:mouse_move, 663, 137, 2, 231, 436] +[:mouse_move, 652, 134, 2, 232, 437] +[:mouse_move, 642, 131, 2, 233, 438] +[:mouse_move, 634, 130, 2, 234, 438] +[:mouse_move, 624, 128, 2, 235, 439] +[:mouse_move, 616, 127, 2, 236, 440] +[:mouse_move, 608, 126, 2, 237, 440] +[:mouse_move, 594, 126, 2, 238, 441] +[:mouse_move, 586, 126, 2, 239, 442] +[:mouse_move, 573, 127, 2, 240, 443] +[:mouse_move, 566, 129, 2, 241, 444] +[:mouse_move, 559, 132, 2, 242, 444] +[:mouse_move, 553, 135, 2, 243, 445] +[:mouse_move, 548, 138, 2, 244, 446] +[:mouse_move, 543, 142, 2, 245, 446] +[:mouse_move, 539, 146, 2, 246, 447] +[:mouse_move, 536, 150, 2, 247, 448] +[:mouse_move, 529, 158, 2, 248, 449] +[:mouse_move, 527, 162, 2, 249, 450] +[:mouse_move, 525, 170, 2, 250, 451] +[:mouse_move, 524, 183, 2, 251, 453] +[:mouse_move, 524, 187, 2, 252, 454] +[:mouse_move, 525, 192, 2, 253, 455] +[:mouse_move, 528, 197, 2, 254, 456] +[:mouse_move, 532, 202, 2, 255, 457] +[:mouse_move, 536, 204, 2, 256, 458] +[:mouse_move, 549, 212, 2, 257, 459] +[:mouse_move, 558, 216, 2, 258, 460] +[:mouse_move, 583, 223, 2, 259, 461] +[:mouse_move, 597, 226, 2, 260, 462] +[:mouse_move, 616, 228, 2, 261, 463] +[:mouse_move, 627, 228, 2, 262, 464] +[:mouse_move, 636, 228, 2, 263, 465] +[:mouse_move, 643, 227, 2, 264, 465] +[:mouse_move, 645, 226, 2, 265, 466] +[:mouse_move, 649, 225, 2, 266, 467] +[:mouse_move, 652, 224, 2, 267, 467] +[:mouse_move, 654, 223, 2, 268, 468] +[:mouse_move, 655, 222, 2, 269, 469] +[:mouse_move, 656, 222, 2, 270, 469] +[:mouse_move, 657, 221, 2, 271, 470] +[:mouse_move, 657, 220, 2, 272, 480] +[:mouse_move, 657, 219, 2, 273, 481] +[:mouse_move, 657, 218, 2, 274, 481] +[:mouse_move, 656, 215, 2, 275, 482] +[:mouse_move, 655, 212, 2, 276, 483] +[:mouse_move, 653, 207, 2, 277, 484] +[:mouse_move, 652, 205, 2, 278, 485] +[:mouse_move, 651, 201, 2, 279, 486] +[:mouse_move, 650, 200, 2, 280, 487] +[:mouse_move, 650, 198, 2, 281, 488] +[:mouse_button_pressed, 1, 0, 1, 282, 500] +[:mouse_button_up, 1, 0, 1, 283, 509] +[:mouse_move, 650, 199, 2, 284, 581] +[:mouse_move, 649, 202, 2, 285, 582] +[:mouse_move, 646, 214, 2, 286, 583] +[:mouse_move, 643, 223, 2, 287, 584] +[:mouse_move, 637, 245, 2, 288, 585] +[:mouse_move, 633, 257, 2, 289, 586] +[:mouse_move, 627, 282, 2, 290, 587] +[:mouse_move, 625, 294, 2, 291, 588] +[:mouse_move, 621, 312, 2, 292, 589] +[:mouse_move, 618, 320, 2, 293, 590] +[:mouse_move, 613, 337, 2, 294, 591] +[:mouse_move, 611, 343, 2, 295, 592] +[:mouse_move, 607, 349, 2, 296, 593] +[:mouse_move, 602, 359, 2, 297, 594] +[:mouse_move, 599, 363, 2, 298, 595] +[:mouse_move, 592, 371, 2, 299, 596] +[:mouse_move, 589, 375, 2, 300, 597] +[:mouse_move, 581, 382, 2, 301, 598] +[:mouse_move, 577, 385, 2, 302, 599] +[:mouse_move, 569, 390, 2, 303, 600] +[:mouse_move, 564, 393, 2, 304, 601] +[:mouse_move, 556, 398, 2, 305, 602] +[:mouse_move, 552, 399, 2, 306, 603] +[:mouse_move, 542, 403, 2, 307, 604] +[:mouse_move, 538, 405, 2, 308, 605] +[:mouse_move, 528, 408, 2, 309, 606] +[:mouse_move, 523, 410, 2, 310, 607] +[:mouse_move, 515, 414, 2, 311, 608] +[:mouse_move, 510, 415, 2, 312, 609] +[:mouse_move, 502, 419, 2, 313, 610] +[:mouse_move, 500, 420, 2, 314, 611] +[:mouse_move, 495, 424, 2, 315, 612] +[:mouse_move, 490, 427, 2, 316, 613] +[:mouse_move, 488, 428, 2, 317, 614] +[:mouse_move, 486, 431, 2, 318, 615] +[:mouse_move, 484, 434, 2, 319, 616] +[:mouse_move, 483, 435, 2, 320, 617] +[:mouse_move, 483, 436, 2, 321, 618] +[:mouse_move, 483, 437, 2, 322, 619] +[:mouse_move, 483, 438, 2, 323, 620] +[:mouse_move, 483, 439, 2, 324, 621] +[:mouse_move, 483, 440, 2, 325, 624] +[:mouse_move, 484, 440, 2, 326, 625] +[:mouse_move, 485, 441, 2, 327, 628] +[:mouse_move, 486, 441, 2, 328, 629] +[:mouse_move, 487, 441, 2, 329, 630] +[:mouse_move, 488, 441, 2, 330, 631] +[:mouse_move, 490, 442, 2, 331, 633] +[:mouse_move, 492, 442, 2, 332, 635] +[:mouse_move, 494, 442, 2, 333, 637] +[:mouse_move, 496, 442, 2, 334, 639] +[:mouse_move, 498, 442, 2, 335, 641] +[:mouse_move, 499, 442, 2, 336, 643] +[:mouse_move, 501, 442, 2, 337, 644] +[:mouse_move, 504, 442, 2, 338, 645] +[:mouse_move, 506, 442, 2, 339, 646] +[:mouse_move, 510, 442, 2, 340, 647] +[:mouse_move, 512, 442, 2, 341, 648] +[:mouse_move, 513, 442, 2, 342, 649] +[:mouse_move, 515, 442, 2, 343, 650] +[:mouse_move, 516, 442, 2, 344, 651] +[:mouse_move, 517, 442, 2, 345, 653] +[:mouse_move, 518, 442, 2, 346, 658] +[:mouse_move, 520, 442, 2, 347, 660] +[:mouse_move, 521, 442, 2, 348, 661] +[:mouse_move, 524, 442, 2, 349, 662] +[:mouse_move, 526, 442, 2, 350, 663] +[:mouse_move, 528, 442, 2, 351, 664] +[:mouse_move, 530, 442, 2, 352, 665] +[:mouse_move, 531, 442, 2, 353, 666] +[:mouse_move, 532, 442, 2, 354, 667] +[:mouse_move, 533, 442, 2, 355, 668] +[:mouse_move, 534, 442, 2, 356, 671] +[:mouse_move, 533, 442, 2, 357, 676] +[:mouse_move, 528, 442, 2, 358, 677] +[:mouse_move, 525, 442, 2, 359, 678] +[:mouse_move, 518, 442, 2, 360, 679] +[:mouse_move, 515, 442, 2, 361, 680] +[:mouse_move, 508, 442, 2, 362, 681] +[:mouse_move, 506, 442, 2, 363, 682] +[:mouse_move, 504, 442, 2, 364, 683] +[:mouse_move, 503, 442, 2, 365, 684] +[:mouse_button_pressed, 1, 0, 1, 366, 698] +[:mouse_button_up, 1, 0, 1, 367, 703] +[:mouse_move, 502, 444, 2, 368, 780] +[:mouse_move, 501, 446, 2, 369, 781] +[:mouse_move, 497, 451, 2, 370, 782] +[:mouse_move, 495, 453, 2, 371, 783] +[:mouse_move, 493, 455, 2, 372, 784] +[:mouse_move, 492, 457, 2, 373, 785] +[:mouse_move, 490, 460, 2, 374, 786] +[:mouse_move, 496, 456, 2, 375, 787] +[:mouse_move, 513, 441, 2, 376, 788] +[:mouse_move, 517, 437, 2, 377, 789] +[:mouse_move, 527, 429, 2, 378, 790] +[:mouse_move, 529, 427, 2, 379, 791] +[:mouse_move, 528, 428, 2, 380, 792] +[:mouse_move, 504, 456, 2, 381, 793] +[:mouse_move, 498, 462, 2, 382, 794] +[:mouse_move, 490, 471, 2, 383, 795] +[:mouse_move, 483, 477, 2, 384, 796] +[:mouse_move, 489, 468, 2, 385, 797] +[:mouse_move, 495, 461, 2, 386, 798] +[:mouse_move, 502, 454, 2, 387, 799] +[:mouse_move, 505, 450, 2, 388, 800] +[:mouse_move, 511, 445, 2, 389, 801] +[:mouse_move, 511, 446, 2, 390, 802] +[:mouse_move, 508, 450, 2, 391, 803] +[:mouse_move, 507, 452, 2, 392, 804] +[:mouse_move, 505, 454, 2, 393, 809] +[:mouse_move, 504, 455, 2, 394, 810] +[:mouse_move, 503, 457, 2, 395, 811] +[:mouse_move, 504, 454, 2, 396, 813] +[:mouse_move, 505, 452, 2, 397, 814] +[:mouse_move, 507, 450, 2, 398, 815] +[:mouse_move, 508, 449, 2, 399, 816] +[:mouse_move, 508, 448, 2, 400, 817] +[:mouse_move, 509, 448, 2, 401, 818] +[:mouse_move, 509, 447, 2, 402, 819] +[:mouse_move, 509, 446, 2, 403, 821] +[:mouse_move, 509, 445, 2, 404, 824] +[:mouse_move, 509, 442, 2, 405, 826] +[:mouse_move, 509, 440, 2, 406, 827] +[:mouse_move, 510, 428, 2, 407, 828] +[:mouse_move, 512, 419, 2, 408, 829] +[:mouse_move, 524, 385, 2, 409, 830] +[:mouse_move, 531, 366, 2, 410, 831] +[:mouse_move, 546, 332, 2, 411, 832] +[:mouse_move, 554, 311, 2, 412, 833] +[:mouse_move, 571, 269, 2, 413, 834] +[:mouse_move, 579, 250, 2, 414, 835] +[:mouse_move, 592, 215, 2, 415, 836] +[:mouse_move, 598, 202, 2, 416, 837] +[:mouse_move, 601, 189, 2, 417, 838] +[:mouse_move, 605, 172, 2, 418, 839] +[:mouse_move, 609, 154, 2, 419, 840] +[:mouse_move, 610, 151, 2, 420, 841] +[:mouse_move, 612, 136, 2, 421, 842] +[:mouse_move, 613, 130, 2, 422, 843] +[:mouse_move, 613, 126, 2, 423, 844] +[:mouse_move, 614, 116, 2, 424, 845] +[:mouse_move, 614, 111, 2, 425, 846] +[:mouse_move, 614, 105, 2, 426, 847] +[:mouse_move, 614, 102, 2, 427, 848] +[:mouse_move, 614, 97, 2, 428, 849] +[:mouse_move, 614, 96, 2, 429, 850] +[:mouse_move, 614, 95, 2, 430, 851] +[:mouse_move, 614, 94, 2, 431, 852] +[:mouse_move, 614, 92, 2, 432, 853] +[:mouse_move, 613, 92, 2, 433, 854] +[:mouse_move, 612, 91, 2, 434, 855] +[:mouse_move, 611, 91, 2, 435, 856] +[:mouse_move, 607, 91, 2, 436, 857] +[:mouse_move, 605, 91, 2, 437, 858] +[:mouse_move, 601, 93, 2, 438, 859] +[:mouse_move, 600, 94, 2, 439, 860] +[:mouse_move, 598, 96, 2, 440, 861] +[:mouse_move, 597, 96, 2, 441, 862] +[:mouse_move, 596, 97, 2, 442, 863] +[:mouse_move, 596, 99, 2, 443, 865] +[:mouse_move, 596, 100, 2, 444, 866] +[:mouse_move, 597, 104, 2, 445, 867] +[:mouse_move, 599, 106, 2, 446, 868] +[:mouse_move, 605, 110, 2, 447, 869] +[:mouse_move, 609, 113, 2, 448, 870] +[:mouse_move, 618, 116, 2, 449, 871] +[:mouse_move, 624, 118, 2, 450, 872] +[:mouse_move, 629, 119, 2, 451, 873] +[:mouse_move, 638, 121, 2, 452, 874] +[:mouse_move, 642, 123, 2, 453, 875] +[:mouse_move, 651, 124, 2, 454, 876] +[:mouse_move, 655, 124, 2, 455, 877] +[:mouse_move, 662, 125, 2, 456, 878] +[:mouse_move, 665, 125, 2, 457, 879] +[:mouse_move, 673, 125, 2, 458, 880] +[:mouse_move, 676, 125, 2, 459, 881] +[:mouse_move, 681, 123, 2, 460, 882] +[:mouse_move, 684, 123, 2, 461, 883] +[:mouse_move, 688, 120, 2, 462, 884] +[:mouse_move, 690, 118, 2, 463, 885] +[:mouse_move, 694, 115, 2, 464, 886] +[:mouse_move, 695, 113, 2, 465, 887] +[:mouse_move, 696, 110, 2, 466, 888] +[:mouse_move, 697, 108, 2, 467, 889] +[:mouse_move, 698, 106, 2, 468, 890] +[:mouse_move, 698, 105, 2, 469, 891] +[:mouse_move, 698, 103, 2, 470, 892] +[:mouse_move, 698, 102, 2, 471, 893] +[:mouse_move, 698, 99, 2, 472, 894] +[:mouse_move, 698, 98, 2, 473, 895] +[:mouse_move, 695, 94, 2, 474, 896] +[:mouse_move, 693, 91, 2, 475, 897] +[:mouse_move, 686, 85, 2, 476, 898] +[:mouse_move, 682, 83, 2, 477, 899] +[:mouse_move, 680, 82, 2, 478, 900] +[:mouse_move, 671, 76, 2, 479, 901] +[:mouse_move, 667, 75, 2, 480, 902] +[:mouse_move, 652, 71, 2, 481, 903] +[:mouse_move, 643, 71, 2, 482, 904] +[:mouse_move, 621, 69, 2, 483, 905] +[:mouse_move, 615, 69, 2, 484, 906] +[:mouse_move, 595, 69, 2, 485, 907] +[:mouse_move, 586, 69, 2, 486, 908] +[:mouse_move, 568, 71, 2, 487, 909] +[:mouse_move, 556, 74, 2, 488, 910] +[:mouse_move, 547, 79, 2, 489, 911] +[:mouse_move, 541, 81, 2, 490, 912] +[:mouse_move, 532, 89, 2, 491, 913] +[:mouse_move, 529, 93, 2, 492, 914] +[:mouse_move, 527, 98, 2, 493, 915] +[:mouse_move, 524, 109, 2, 494, 916] +[:mouse_move, 524, 128, 2, 495, 917] +[:mouse_move, 527, 132, 2, 496, 918] +[:mouse_move, 536, 143, 2, 497, 919] +[:mouse_move, 542, 147, 2, 498, 920] +[:mouse_move, 558, 155, 2, 499, 921] +[:mouse_move, 566, 156, 2, 500, 922] +[:mouse_move, 585, 156, 2, 501, 923] +[:mouse_move, 594, 156, 2, 502, 924] +[:mouse_move, 617, 154, 2, 503, 925] +[:mouse_move, 622, 153, 2, 504, 926] +[:mouse_move, 632, 150, 2, 505, 927] +[:mouse_move, 648, 143, 2, 506, 928] +[:mouse_move, 655, 139, 2, 507, 929] +[:mouse_move, 667, 131, 2, 508, 930] +[:mouse_move, 673, 127, 2, 509, 931] +[:mouse_move, 681, 119, 2, 510, 932] +[:mouse_move, 684, 115, 2, 511, 933] +[:mouse_move, 688, 110, 2, 512, 934] +[:mouse_move, 690, 107, 2, 513, 935] +[:mouse_move, 692, 101, 2, 514, 936] +[:mouse_move, 693, 99, 2, 515, 937] +[:mouse_move, 694, 93, 2, 516, 938] +[:mouse_move, 693, 90, 2, 517, 939] +[:mouse_move, 683, 82, 2, 518, 940] +[:mouse_move, 677, 79, 2, 519, 941] +[:mouse_move, 660, 72, 2, 520, 942] +[:mouse_move, 648, 70, 2, 521, 943] +[:mouse_move, 632, 67, 2, 522, 944] +[:mouse_move, 623, 66, 2, 523, 945] +[:mouse_move, 608, 66, 2, 524, 946] +[:mouse_move, 602, 66, 2, 525, 947] +[:mouse_move, 591, 68, 2, 526, 948] +[:mouse_move, 587, 70, 2, 527, 949] +[:mouse_move, 579, 77, 2, 528, 950] +[:mouse_move, 572, 85, 2, 529, 951] +[:mouse_move, 566, 94, 2, 530, 952] +[:mouse_move, 563, 101, 2, 531, 954] +[:mouse_move, 558, 117, 2, 532, 955] +[:mouse_move, 555, 131, 2, 533, 956] +[:mouse_move, 555, 141, 2, 534, 957] +[:mouse_move, 555, 147, 2, 535, 958] +[:mouse_move, 558, 155, 2, 536, 959] +[:mouse_move, 561, 159, 2, 537, 960] +[:mouse_move, 569, 167, 2, 538, 961] +[:mouse_move, 575, 171, 2, 539, 962] +[:mouse_move, 588, 178, 2, 540, 963] +[:mouse_move, 593, 182, 2, 541, 964] +[:mouse_move, 604, 187, 2, 542, 965] +[:mouse_move, 609, 191, 2, 543, 966] +[:mouse_move, 618, 194, 2, 544, 967] +[:mouse_move, 622, 196, 2, 545, 968] +[:mouse_move, 630, 199, 2, 546, 969] +[:mouse_move, 635, 200, 2, 547, 970] +[:mouse_move, 642, 201, 2, 548, 971] +[:mouse_move, 651, 202, 2, 549, 973] +[:mouse_move, 658, 202, 2, 550, 974] +[:mouse_move, 662, 200, 2, 551, 975] +[:mouse_move, 664, 199, 2, 552, 976] +[:mouse_move, 666, 198, 2, 553, 977] +[:mouse_move, 667, 198, 2, 554, 980] +[:mouse_move, 667, 197, 2, 555, 985] +[:mouse_button_pressed, 1, 0, 1, 556, 992] +[:mouse_button_up, 1, 0, 1, 557, 1000] +[:mouse_move, 671, 212, 2, 558, 1043] +[:mouse_move, 678, 231, 2, 559, 1044] +[:mouse_move, 698, 290, 2, 560, 1045] +[:mouse_move, 702, 304, 2, 561, 1046] +[:mouse_move, 712, 341, 2, 562, 1047] +[:mouse_move, 717, 358, 2, 563, 1048] +[:mouse_move, 721, 382, 2, 564, 1049] +[:mouse_move, 722, 391, 2, 565, 1050] +[:mouse_move, 723, 398, 2, 566, 1051] +[:mouse_move, 723, 410, 2, 567, 1052] +[:mouse_move, 720, 426, 2, 568, 1053] +[:mouse_move, 714, 439, 2, 569, 1054] +[:mouse_move, 705, 453, 2, 570, 1055] +[:mouse_move, 694, 464, 2, 571, 1056] +[:mouse_move, 670, 474, 2, 572, 1057] +[:mouse_move, 654, 476, 2, 573, 1058] +[:mouse_move, 635, 476, 2, 574, 1059] +[:mouse_move, 606, 476, 2, 575, 1060] +[:mouse_move, 589, 476, 2, 576, 1061] +[:mouse_move, 568, 476, 2, 577, 1062] +[:mouse_move, 556, 476, 2, 578, 1063] +[:mouse_move, 545, 476, 2, 579, 1064] +[:mouse_move, 536, 476, 2, 580, 1065] +[:mouse_move, 524, 476, 2, 581, 1066] +[:mouse_move, 522, 476, 2, 582, 1067] +[:mouse_move, 519, 476, 2, 583, 1068] +[:mouse_move, 518, 476, 2, 584, 1069] +[:mouse_move, 517, 476, 2, 585, 1071] +[:mouse_move, 516, 475, 2, 586, 1072] +[:mouse_move, 515, 473, 2, 587, 1074] +[:mouse_move, 514, 472, 2, 588, 1075] +[:mouse_move, 512, 469, 2, 589, 1076] +[:mouse_move, 512, 468, 2, 590, 1077] +[:mouse_move, 510, 465, 2, 591, 1078] +[:mouse_move, 509, 463, 2, 592, 1079] +[:mouse_move, 508, 460, 2, 593, 1080] +[:mouse_move, 507, 459, 2, 594, 1081] +[:mouse_move, 507, 457, 2, 595, 1082] +[:mouse_move, 506, 456, 2, 596, 1083] +[:mouse_move, 506, 455, 2, 597, 1084] +[:mouse_move, 505, 455, 2, 598, 1085] +[:mouse_move, 507, 454, 2, 599, 1097] +[:mouse_move, 510, 452, 2, 600, 1098] +[:mouse_move, 516, 449, 2, 601, 1099] +[:mouse_move, 521, 446, 2, 602, 1100] +[:mouse_move, 533, 440, 2, 603, 1101] +[:mouse_move, 539, 437, 2, 604, 1102] +[:mouse_move, 547, 434, 2, 605, 1103] +[:mouse_move, 551, 433, 2, 606, 1104] +[:mouse_move, 557, 432, 2, 607, 1105] +[:mouse_move, 559, 432, 2, 608, 1106] +[:mouse_move, 560, 432, 2, 609, 1107] +[:mouse_move, 561, 433, 2, 610, 1108] +[:mouse_move, 561, 434, 2, 611, 1109] +[:mouse_move, 561, 437, 2, 612, 1110] +[:mouse_move, 561, 438, 2, 613, 1111] +[:mouse_move, 561, 440, 2, 614, 1112] +[:mouse_move, 561, 441, 2, 615, 1113] +[:mouse_move, 561, 443, 2, 616, 1114] +[:mouse_move, 560, 446, 2, 617, 1116] +[:mouse_move, 560, 447, 2, 618, 1117] +[:mouse_move, 560, 448, 2, 619, 1118] +[:mouse_move, 560, 449, 2, 620, 1119] +[:mouse_move, 559, 450, 2, 621, 1122] +[:mouse_move, 560, 449, 2, 622, 1129] +[:mouse_move, 563, 448, 2, 623, 1130] +[:mouse_move, 565, 447, 2, 624, 1131] +[:mouse_move, 566, 446, 2, 625, 1132] +[:mouse_move, 569, 445, 2, 626, 1133] +[:mouse_move, 572, 444, 2, 627, 1134] +[:mouse_move, 574, 444, 2, 628, 1135] +[:mouse_move, 575, 444, 2, 629, 1136] +[:mouse_move, 579, 444, 2, 630, 1137] +[:mouse_move, 582, 444, 2, 631, 1138] +[:mouse_move, 584, 444, 2, 632, 1139] +[:mouse_move, 591, 444, 2, 633, 1140] +[:mouse_move, 593, 444, 2, 634, 1141] +[:mouse_move, 598, 445, 2, 635, 1142] +[:mouse_move, 600, 446, 2, 636, 1143] +[:mouse_move, 603, 446, 2, 637, 1144] +[:mouse_move, 605, 447, 2, 638, 1145] +[:mouse_move, 606, 448, 2, 639, 1146] +[:mouse_move, 607, 448, 2, 640, 1147] +[:mouse_move, 607, 449, 2, 641, 1148] +[:mouse_move, 608, 449, 2, 642, 1149] +[:mouse_move, 608, 450, 2, 643, 1152] +[:mouse_move, 608, 451, 2, 644, 1155] +[:mouse_move, 607, 451, 2, 645, 1167] +[:mouse_move, 605, 451, 2, 646, 1168] +[:mouse_move, 600, 450, 2, 647, 1169] +[:mouse_move, 591, 449, 2, 648, 1170] +[:mouse_move, 587, 449, 2, 649, 1171] +[:mouse_move, 580, 449, 2, 650, 1172] +[:mouse_move, 578, 448, 2, 651, 1173] +[:mouse_move, 575, 448, 2, 652, 1174] +[:mouse_move, 574, 448, 2, 653, 1175] +[:mouse_move, 574, 447, 2, 654, 1178] +[:mouse_move, 575, 447, 2, 655, 1179] +[:mouse_move, 576, 447, 2, 656, 1180] +[:mouse_move, 580, 446, 2, 657, 1181] +[:mouse_move, 586, 446, 2, 658, 1182] +[:mouse_move, 589, 446, 2, 659, 1183] +[:mouse_move, 594, 446, 2, 660, 1184] +[:mouse_move, 597, 446, 2, 661, 1185] +[:mouse_move, 601, 446, 2, 662, 1186] +[:mouse_move, 603, 446, 2, 663, 1187] +[:mouse_move, 604, 446, 2, 664, 1188] +[:mouse_move, 605, 447, 2, 665, 1190] +[:mouse_move, 606, 447, 2, 666, 1192] +[:mouse_move, 608, 447, 2, 667, 1194] +[:mouse_move, 609, 447, 2, 668, 1196] +[:mouse_move, 610, 448, 2, 669, 1197] +[:mouse_move, 612, 449, 2, 670, 1198] +[:mouse_move, 614, 449, 2, 671, 1199] +[:mouse_move, 615, 449, 2, 672, 1200] +[:mouse_move, 617, 450, 2, 673, 1201] +[:mouse_move, 618, 450, 2, 674, 1202] +[:mouse_move, 619, 451, 2, 675, 1203] +[:mouse_move, 620, 451, 2, 676, 1210] +[:mouse_button_pressed, 1, 0, 1, 677, 1226] +[:mouse_button_up, 1, 0, 1, 678, 1233] +[:mouse_move, 615, 449, 2, 679, 1295] +[:mouse_move, 607, 447, 2, 680, 1296] +[:mouse_move, 605, 447, 2, 681, 1297] +[:mouse_move, 600, 445, 2, 682, 1298] +[:mouse_move, 597, 445, 2, 683, 1299] +[:mouse_move, 595, 444, 2, 684, 1300] +[:mouse_move, 594, 444, 2, 685, 1301] +[:mouse_button_pressed, 1, 0, 1, 686, 1307] +[:mouse_button_up, 1, 0, 1, 687, 1317] +[:mouse_move, 595, 444, 2, 688, 1343] +[:mouse_move, 602, 444, 2, 689, 1344] +[:mouse_move, 606, 445, 2, 690, 1345] +[:mouse_move, 617, 445, 2, 691, 1346] +[:mouse_move, 622, 445, 2, 692, 1347] +[:mouse_move, 633, 445, 2, 693, 1348] +[:mouse_move, 635, 445, 2, 694, 1349] +[:mouse_move, 642, 446, 2, 695, 1350] +[:mouse_move, 645, 446, 2, 696, 1351] +[:mouse_move, 648, 447, 2, 697, 1352] +[:mouse_move, 649, 447, 2, 698, 1353] +[:mouse_move, 651, 447, 2, 699, 1354] +[:mouse_move, 652, 447, 2, 700, 1356] +[:mouse_move, 652, 448, 2, 701, 1357] +[:mouse_move, 653, 448, 2, 702, 1361] +[:mouse_move, 654, 448, 2, 703, 1363] +[:mouse_move, 656, 448, 2, 704, 1365] +[:mouse_move, 657, 448, 2, 705, 1366] +[:mouse_move, 659, 448, 2, 706, 1367] +[:mouse_move, 660, 448, 2, 707, 1368] +[:mouse_move, 661, 448, 2, 708, 1369] +[:mouse_move, 661, 449, 2, 709, 1370] +[:mouse_move, 662, 449, 2, 710, 1371] +[:mouse_button_pressed, 1, 0, 1, 711, 1388] +[:mouse_button_up, 1, 0, 1, 712, 1396] +[:mouse_move, 662, 441, 2, 713, 1555] +[:mouse_move, 664, 434, 2, 714, 1556] +[:mouse_move, 669, 398, 2, 715, 1557] +[:mouse_move, 671, 349, 2, 716, 1558] +[:mouse_move, 673, 289, 2, 717, 1559] +[:mouse_move, 675, 248, 2, 718, 1560] +[:mouse_move, 675, 222, 2, 719, 1561] +[:mouse_move, 675, 199, 2, 720, 1562] +[:mouse_move, 675, 167, 2, 721, 1563] +[:mouse_move, 675, 157, 2, 722, 1564] +[:mouse_move, 670, 144, 2, 723, 1565] +[:mouse_move, 668, 139, 2, 724, 1566] +[:mouse_move, 664, 136, 2, 725, 1567] +[:mouse_move, 655, 129, 2, 726, 1568] +[:mouse_move, 651, 126, 2, 727, 1569] +[:mouse_move, 641, 120, 2, 728, 1570] +[:mouse_move, 633, 116, 2, 729, 1571] +[:mouse_move, 628, 115, 2, 730, 1572] +[:mouse_move, 624, 113, 2, 731, 1573] +[:mouse_move, 617, 111, 2, 732, 1574] +[:mouse_move, 612, 110, 2, 733, 1575] +[:mouse_move, 604, 110, 2, 734, 1576] +[:mouse_move, 594, 110, 2, 735, 1577] +[:mouse_move, 591, 110, 2, 736, 1578] +[:mouse_move, 588, 110, 2, 737, 1579] +[:mouse_move, 587, 110, 2, 738, 1580] +[:mouse_move, 586, 110, 2, 739, 1581] +[:mouse_move, 587, 110, 2, 740, 1585] +[:mouse_move, 589, 110, 2, 741, 1586] +[:mouse_move, 595, 110, 2, 742, 1587] +[:mouse_move, 599, 111, 2, 743, 1588] +[:mouse_move, 607, 112, 2, 744, 1589] +[:mouse_move, 613, 112, 2, 745, 1590] +[:mouse_move, 623, 113, 2, 746, 1591] +[:mouse_move, 625, 114, 2, 747, 1592] +[:mouse_move, 634, 114, 2, 748, 1593] +[:mouse_move, 637, 114, 2, 749, 1594] +[:mouse_move, 645, 114, 2, 750, 1595] +[:mouse_move, 649, 114, 2, 751, 1596] +[:mouse_move, 656, 113, 2, 752, 1597] +[:mouse_move, 660, 113, 2, 753, 1598] +[:mouse_move, 663, 113, 2, 754, 1599] +[:mouse_move, 671, 113, 2, 755, 1600] +[:mouse_move, 679, 113, 2, 756, 1601] +[:mouse_move, 683, 113, 2, 757, 1602] +[:mouse_move, 687, 114, 2, 758, 1603] +[:mouse_move, 692, 115, 2, 759, 1604] +[:mouse_move, 695, 115, 2, 760, 1605] +[:mouse_move, 699, 116, 2, 761, 1606] +[:mouse_move, 701, 116, 2, 762, 1607] +[:mouse_move, 704, 116, 2, 763, 1608] +[:mouse_move, 705, 116, 2, 764, 1609] +[:mouse_move, 707, 116, 2, 765, 1610] +[:mouse_move, 708, 117, 2, 766, 1612] +[:mouse_move, 709, 117, 2, 767, 1613] +[:mouse_move, 703, 112, 2, 768, 1645] +[:mouse_move, 699, 109, 2, 769, 1646] +[:mouse_move, 671, 93, 2, 770, 1647] +[:mouse_move, 655, 86, 2, 771, 1648] +[:mouse_move, 628, 75, 2, 772, 1649] +[:mouse_move, 612, 70, 2, 773, 1650] +[:mouse_move, 592, 66, 2, 774, 1651] +[:mouse_move, 582, 64, 2, 775, 1652] +[:mouse_move, 579, 63, 2, 776, 1653] +[:mouse_move, 568, 61, 2, 777, 1654] +[:mouse_move, 564, 61, 2, 778, 1655] +[:mouse_move, 560, 60, 2, 779, 1656] +[:mouse_move, 559, 60, 2, 780, 1657] +[:mouse_move, 557, 59, 2, 781, 1658] +[:mouse_move, 558, 59, 2, 782, 1664] +[:mouse_move, 559, 59, 2, 783, 1665] +[:mouse_move, 562, 59, 2, 784, 1666] +[:mouse_move, 564, 59, 2, 785, 1667] +[:mouse_move, 571, 60, 2, 786, 1668] +[:mouse_move, 574, 60, 2, 787, 1669] +[:mouse_move, 580, 60, 2, 788, 1670] +[:mouse_move, 586, 60, 2, 789, 1671] +[:mouse_move, 593, 60, 2, 790, 1672] +[:mouse_move, 597, 61, 2, 791, 1673] +[:mouse_move, 604, 61, 2, 792, 1674] +[:mouse_move, 607, 61, 2, 793, 1675] +[:mouse_move, 614, 62, 2, 794, 1676] +[:mouse_move, 617, 62, 2, 795, 1677] +[:mouse_move, 623, 63, 2, 796, 1678] +[:mouse_move, 627, 63, 2, 797, 1679] +[:mouse_move, 629, 64, 2, 798, 1680] +[:mouse_move, 637, 64, 2, 799, 1681] +[:mouse_move, 640, 65, 2, 800, 1682] +[:mouse_move, 648, 65, 2, 801, 1683] +[:mouse_move, 650, 65, 2, 802, 1684] +[:mouse_move, 657, 65, 2, 803, 1685] +[:mouse_move, 663, 65, 2, 804, 1686] +[:mouse_move, 670, 65, 2, 805, 1687] +[:mouse_move, 673, 65, 2, 806, 1688] +[:mouse_move, 681, 66, 2, 807, 1689] +[:mouse_move, 685, 66, 2, 808, 1690] +[:mouse_move, 691, 67, 2, 809, 1691] +[:mouse_move, 694, 67, 2, 810, 1692] +[:mouse_move, 698, 67, 2, 811, 1693] +[:mouse_move, 700, 68, 2, 812, 1694] +[:mouse_move, 702, 68, 2, 813, 1695] +[:mouse_move, 703, 68, 2, 814, 1696] +[:mouse_move, 704, 68, 2, 815, 1699] +[:mouse_move, 703, 75, 2, 816, 1708] +[:mouse_move, 702, 81, 2, 817, 1709] +[:mouse_move, 697, 101, 2, 818, 1710] +[:mouse_move, 696, 106, 2, 819, 1711] +[:mouse_move, 691, 122, 2, 820, 1712] +[:mouse_move, 687, 129, 2, 821, 1713] +[:mouse_move, 681, 142, 2, 822, 1714] +[:mouse_move, 679, 147, 2, 823, 1715] +[:mouse_move, 674, 156, 2, 824, 1716] +[:mouse_move, 674, 158, 2, 825, 1717] +[:mouse_move, 670, 166, 2, 826, 1718] +[:mouse_move, 669, 169, 2, 827, 1719] +[:mouse_move, 666, 177, 2, 828, 1720] +[:mouse_move, 665, 182, 2, 829, 1721] +[:mouse_move, 663, 189, 2, 830, 1722] +[:mouse_move, 662, 193, 2, 831, 1723] +[:mouse_move, 660, 199, 2, 832, 1724] +[:mouse_move, 660, 201, 2, 833, 1725] +[:mouse_move, 659, 202, 2, 834, 1726] +[:mouse_move, 658, 203, 2, 835, 1727] +[:mouse_move, 658, 202, 2, 836, 1733] +[:mouse_move, 658, 201, 2, 837, 1734] +[:mouse_move, 658, 199, 2, 838, 1735] +[:mouse_move, 658, 197, 2, 839, 1736] +[:mouse_move, 658, 196, 2, 840, 1737] +[:mouse_move, 658, 195, 2, 841, 1739] +[:mouse_button_pressed, 1, 0, 1, 842, 1739] +[:mouse_button_up, 1, 0, 1, 843, 1746] +[:mouse_move, 662, 207, 2, 844, 1794] +[:mouse_move, 668, 224, 2, 845, 1795] +[:mouse_move, 672, 238, 2, 846, 1796] +[:mouse_move, 686, 283, 2, 847, 1797] +[:mouse_move, 702, 338, 2, 848, 1798] +[:mouse_move, 705, 353, 2, 849, 1799] +[:mouse_move, 713, 382, 2, 850, 1800] +[:mouse_move, 717, 398, 2, 851, 1801] +[:mouse_move, 721, 419, 2, 852, 1802] +[:mouse_move, 722, 426, 2, 853, 1803] +[:mouse_move, 723, 435, 2, 854, 1804] +[:mouse_move, 724, 437, 2, 855, 1805] +[:mouse_move, 725, 443, 2, 856, 1806] +[:mouse_move, 725, 444, 2, 857, 1807] +[:mouse_move, 726, 447, 2, 858, 1808] +[:mouse_move, 727, 448, 2, 859, 1809] +[:mouse_move, 727, 449, 2, 860, 1811] +[:mouse_move, 728, 449, 2, 861, 1812] +[:mouse_move, 729, 450, 2, 862, 1815] +[:mouse_move, 730, 450, 2, 863, 1817] +[:mouse_move, 731, 450, 2, 864, 1818] +[:mouse_move, 732, 450, 2, 865, 1819] +[:mouse_move, 733, 449, 2, 866, 1820] +[:mouse_move, 734, 449, 2, 867, 1821] +[:mouse_move, 734, 448, 2, 868, 1822] +[:mouse_move, 735, 448, 2, 869, 1823] +[:mouse_move, 736, 447, 2, 870, 1825] +[:mouse_button_pressed, 1, 0, 1, 871, 1835] +[:mouse_button_up, 1, 0, 1, 872, 1843] +[:mouse_move, 737, 447, 2, 873, 1876] +[:mouse_move, 735, 447, 2, 874, 1886] +[:mouse_move, 734, 447, 2, 875, 1887] +[:mouse_move, 730, 446, 2, 876, 1888] +[:mouse_move, 726, 445, 2, 877, 1889] +[:mouse_move, 719, 445, 2, 878, 1890] +[:mouse_move, 716, 444, 2, 879, 1891] +[:mouse_move, 713, 444, 2, 880, 1892] +[:mouse_move, 709, 444, 2, 881, 1893] +[:mouse_move, 708, 443, 2, 882, 1894] +[:mouse_button_pressed, 1, 0, 1, 883, 1914] +[:mouse_button_up, 1, 0, 1, 884, 1923] +[:mouse_move, 707, 442, 2, 885, 1971] +[:mouse_move, 702, 432, 2, 886, 1972] +[:mouse_move, 695, 416, 2, 887, 1973] +[:mouse_move, 677, 373, 2, 888, 1974] +[:mouse_move, 671, 360, 2, 889, 1975] +[:mouse_move, 666, 351, 2, 890, 1976] +[:mouse_move, 658, 334, 2, 891, 1977] +[:mouse_move, 648, 318, 2, 892, 1978] +[:mouse_move, 643, 313, 2, 893, 1979] +[:key_down_raw, 92, 0, 2, 894, 2046] +[:key_up_raw, 92, 0, 2, 895, 2046] +[:key_down_raw, 92, 0, 2, 896, 2050] +[:key_down_raw, 92, 0, 2, 897, 2075] +[:key_down_raw, 92, 0, 2, 898, 2077] +[:key_down_raw, 92, 0, 2, 899, 2079] +[:key_down_raw, 92, 0, 2, 900, 2081] +[:key_down_raw, 92, 0, 2, 901, 2083] +[:key_down_raw, 92, 0, 2, 902, 2085] +[:key_down_raw, 92, 0, 2, 903, 2087] +[:key_down_raw, 92, 0, 2, 904, 2089] +[:key_down_raw, 92, 0, 2, 905, 2091] +[:key_down_raw, 92, 0, 2, 906, 2093] +[:key_down_raw, 92, 0, 2, 907, 2095] +[:key_down_raw, 92, 0, 2, 908, 2097] +[:key_down_raw, 92, 0, 2, 909, 2099] +[:key_down_raw, 92, 0, 2, 910, 2100] +[:key_down_raw, 92, 0, 2, 911, 2102] +[:key_down_raw, 92, 0, 2, 912, 2105] +[:key_down_raw, 92, 0, 2, 913, 2107] +[:key_down_raw, 92, 0, 2, 914, 2108] +[:key_down_raw, 92, 0, 2, 915, 2110] +[:key_down_raw, 92, 0, 2, 916, 2112] +[:key_down_raw, 92, 0, 2, 917, 2114] +[:key_down_raw, 92, 0, 2, 918, 2116] +[:key_down_raw, 92, 0, 2, 919, 2118] +[:key_down_raw, 92, 0, 2, 920, 2120] +[:key_down_raw, 92, 0, 2, 921, 2122] +[:key_down_raw, 92, 0, 2, 922, 2124] +[:key_down_raw, 92, 0, 2, 923, 2127] +[:key_down_raw, 92, 0, 2, 924, 2128] +[:key_down_raw, 92, 0, 2, 925, 2130] +[:key_down_raw, 92, 0, 2, 926, 2132] +[:key_down_raw, 92, 0, 2, 927, 2134] +[:key_down_raw, 92, 0, 2, 928, 2136] +[:key_down_raw, 92, 0, 2, 929, 2138] +[:key_down_raw, 92, 0, 2, 930, 2140] +[:key_down_raw, 92, 0, 2, 931, 2142] +[:key_down_raw, 113, 0, 2, 932, 2143] +[:key_up_raw, 113, 0, 2, 933, 2149] +[:key_up_raw, 92, 0, 2, 934, 2217] +[:mouse_move, 643, 310, 2, 935, 2263] +[:mouse_move, 643, 295, 2, 936, 2264] +[:mouse_move, 643, 289, 2, 937, 2265] +[:mouse_move, 643, 279, 2, 938, 2266] +[:mouse_move, 644, 274, 2, 939, 2267] +[:mouse_move, 644, 269, 2, 940, 2268] +[:mouse_move, 645, 267, 2, 941, 2269] +[:mouse_move, 647, 256, 2, 942, 2270] +[:mouse_move, 648, 248, 2, 943, 2271] +[:mouse_move, 652, 227, 2, 944, 2272] +[:mouse_move, 653, 219, 2, 945, 2273] +[:mouse_move, 655, 204, 2, 946, 2274] +[:mouse_move, 659, 188, 2, 947, 2275] +[:mouse_move, 661, 178, 2, 948, 2276] +[:mouse_move, 664, 169, 2, 949, 2277] +[:mouse_move, 667, 160, 2, 950, 2278] +[:mouse_move, 669, 158, 2, 951, 2279] +[:mouse_move, 671, 153, 2, 952, 2280] +[:mouse_move, 674, 146, 2, 953, 2281] +[:mouse_move, 675, 141, 2, 954, 2282] +[:mouse_move, 677, 133, 2, 955, 2283] +[:mouse_move, 678, 129, 2, 956, 2284] +[:mouse_move, 679, 123, 2, 957, 2285] +[:mouse_move, 679, 120, 2, 958, 2286] +[:mouse_move, 680, 116, 2, 959, 2287] +[:key_down_raw, 1073742051, 1024, 2, 960, 2340] +[:key_down_raw, 113, 1024, 2, 961, 2342] diff --git a/samples/04_sounds/sounds/A3.wav b/samples/04_sounds/sounds/A3.wav Binary files differnew file mode 100644 index 0000000..9848caf --- /dev/null +++ b/samples/04_sounds/sounds/A3.wav diff --git a/samples/04_sounds/sounds/B3.wav b/samples/04_sounds/sounds/B3.wav Binary files differnew file mode 100644 index 0000000..96ca3d2 --- /dev/null +++ b/samples/04_sounds/sounds/B3.wav diff --git a/samples/04_sounds/sounds/C3.wav b/samples/04_sounds/sounds/C3.wav Binary files differnew file mode 100644 index 0000000..804fa99 --- /dev/null +++ b/samples/04_sounds/sounds/C3.wav diff --git a/samples/04_sounds/sounds/C4.wav b/samples/04_sounds/sounds/C4.wav Binary files differnew file mode 100644 index 0000000..1a0ac75 --- /dev/null +++ b/samples/04_sounds/sounds/C4.wav diff --git a/samples/04_sounds/sounds/D3.wav b/samples/04_sounds/sounds/D3.wav Binary files differnew file mode 100644 index 0000000..2db46fc --- /dev/null +++ b/samples/04_sounds/sounds/D3.wav diff --git a/samples/04_sounds/sounds/E3.wav b/samples/04_sounds/sounds/E3.wav Binary files differnew file mode 100644 index 0000000..5765098 --- /dev/null +++ b/samples/04_sounds/sounds/E3.wav diff --git a/samples/04_sounds/sounds/F3.wav b/samples/04_sounds/sounds/F3.wav Binary files differnew file mode 100644 index 0000000..484270f --- /dev/null +++ b/samples/04_sounds/sounds/F3.wav diff --git a/samples/04_sounds/sounds/G3.wav b/samples/04_sounds/sounds/G3.wav Binary files differnew file mode 100644 index 0000000..324e620 --- /dev/null +++ b/samples/04_sounds/sounds/G3.wav diff --git a/samples/05_mouse_move/app/main.rb b/samples/05_mouse_move/app/main.rb new file mode 100644 index 0000000..97edbe7 --- /dev/null +++ b/samples/05_mouse_move/app/main.rb @@ -0,0 +1,296 @@ +=begin + + Reminders: + + - num1.greater(num2): Returns the greater value. + For example, if we have the command + puts 4.greater(3) + the number 4 would be printed to the console since it has a greater value than 3. + Similar to lesser, which returns the lesser value. + + - find_all: Finds all elements of a collection that meet certain requirements. + For example, in this sample app, we're using find_all to find all zombies that have intersected + or hit the player's sprite since these zombies have been killed. + + - args.inputs.keyboard.key_down.KEY: Determines if a key is being held or pressed. + Stores the frame the "down" event occurred. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + When we want to create a new object, we can declare it as a new entity and then define + its properties. (Remember, you can use state to define ANY property and it will + be retained across frames.) + + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + - map: Ruby method used to transform data; used in arrays, hashes, and collections. + Can be used to perform an action on every element of a collection, such as multiplying + each element by 2 or declaring every element as a new entity. + + - sample: Chooses a random element from the array. + + - reject: Removes elements that meet certain requirements. + In this sample app, we're removing/rejecting zombies that reach the center of the screen. We're also + rejecting zombies that were killed more than 30 frames ago. + +=end + +# This sample app allows users to move around the screen in order to kill zombies. Zombies appear from every direction so the goal +# is to kill the zombies as fast as possible! + +class ProtectThePuppiesFromTheZombies + attr_accessor :grid, :inputs, :state, :outputs + + # Calls the methods necessary for the game to run properly. + def tick + defaults + render + calc + input + end + + # Sets default values for the zombies and for the player. + # Initialization happens only in the first frame. + def defaults + state.flash_at ||= 0 + state.zombie_min_spawn_rate ||= 60 + state.zombie_spawn_countdown ||= random_spawn_countdown state.zombie_min_spawn_rate + state.zombies ||= [] + state.killed_zombies ||= [] + + # Declares player as a new entity and sets its properties. + # The player begins the game in the center of the screen, not moving in any direction. + state.player ||= state.new_entity(:player, { x: 640, + y: 360, + attack_angle: 0, + dx: 0, + dy: 0 }) + end + + # Outputs a gray background. + # Calls the methods needed to output the player, zombies, etc onto the screen. + def render + outputs.solids << [grid.rect, 100, 100, 100] + render_zombies + render_killed_zombies + render_player + render_flash + end + + # Outputs the zombies on the screen and sets values for the sprites, such as the position, width, height, and animation. + def render_zombies + outputs.sprites << state.zombies.map do |z| # performs action on all zombies in the collection + z.sprite = [z.x, z.y, 4 * 3, 8 * 3, animation_sprite(z)].sprite # sets definition for sprite, calls animation_sprite method + z.sprite + end + end + + # Outputs sprites of killed zombies, and displays a slash image to show that a zombie has been killed. + def render_killed_zombies + outputs.sprites << state.killed_zombies.map do |z| # performs action on all killed zombies in collection + z.sprite = [z.x, + z.y, + 4 * 3, + 8 * 3, + animation_sprite(z, z.death_at), # calls animation_sprite method + 0, # angle + 255 * z.death_at.ease(30, :flip)].sprite # transparency of a zombie changes when they die + # change the value of 30 and see what happens when a zombie is killed + + # Sets values to output the slash over the zombie's sprite when a zombie is killed. + # The slash is tilted 45 degrees from the angle of the player's attack. + # Change the 3 inside scale_rect to 30 and the slash will be HUGE! Scale_rect positions + # the slash over the killed zombie's sprite. + [z.sprite, [z.sprite.rect, 'sprites/slash.png', 45 + state.player.attack_angle_on_click, z.sprite.a].scale_rect(3, 0.5, 0.5)] + end + end + + # Outputs the player sprite using the images in the sprites folder. + def render_player + state.player_sprite = [state.player.x, + state.player.y, + 4 * 3, + 8 * 3, "sprites/player-#{animation_index(state.player.created_at_elapsed)}.png"] # string interpolation + outputs.sprites << state.player_sprite + + # Outputs a small red square that previews the angles that the player can attack in. + # It can be moved in a perfect circle around the player to show possible movements. + # Change the 60 in the parenthesis and see what happens to the movement of the red square. + outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60), + state.player.y + state.player.attack_angle.vector_y(60), + 3, 3, 255, 0, 0] + end + + # Renders flash as a solid. The screen turns white for 10 frames when a zombie is killed. + def render_flash + return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash. + # Transparency gradually changes (or eases) during the 10 frames of flash. + outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid + end + + # Calls all methods necessary for performing calculations. + def calc + calc_spawn_zombie + calc_move_zombies + calc_player + calc_kill_zombie + end + + # Decreases the zombie spawn countdown by 1 if it has a value greater than 0. + def calc_spawn_zombie + if state.zombie_spawn_countdown > 0 + state.zombie_spawn_countdown -= 1 + return + end + + # New zombies are created, positioned on the screen, and added to the zombies collection. + state.zombies << state.new_entity(:zombie) do |z| # each zombie is declared a new entity + if rand > 0.5 + z.x = grid.rect.w.randomize(:ratio) # random x position on screen (within grid scope) + z.y = [-10, 730].sample # y position is set to either -10 or 730 (randomly chosen) + # the possible values exceed the screen's scope so zombies appear to be coming from far away + else + z.x = [-10, 1290].sample # x position is set to either -10 or 1290 (randomly chosen) + z.y = grid.rect.w.randomize(:ratio) # random y position on screen + end + end + + # Calls random_spawn_countdown method (determines how fast new zombies appear) + state.zombie_spawn_countdown = random_spawn_countdown state.zombie_min_spawn_rate + state.zombie_min_spawn_rate -= 1 + # set to either the current zombie_min_spawn_rate or 0, depending on which value is greater + state.zombie_min_spawn_rate = state.zombie_min_spawn_rate.greater(0) + end + + # Moves all zombies towards the center of the screen. + # All zombies that reach the center (640, 360) are rejected from the zombies collection and disappear. + def calc_move_zombies + state.zombies.each do |z| # for each zombie in the collection + z.y = z.y.towards(360, 0.1) # move the zombie towards the center (640, 360) at a rate of 0.1 + z.x = z.x.towards(640, 0.1) # change 0.1 to 1.1 and see how much faster the zombies move to the center + end + state.zombies = state.zombies.reject { |z| z.y == 360 && z.x == 640 } # remove zombies that are in center + end + + # Calculates the position and movement of the player on the screen. + def calc_player + state.player.x += state.player.dx # changes x based on dx (change in x) + state.player.y += state.player.dy # changes y based on dy (change in y) + + state.player.dx *= 0.9 # scales dx down + state.player.dy *= 0.9 # scales dy down + + # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value. + # This ensures that the player remains within the screen's scope. + state.player.x = state.player.x.lesser(1280).greater(0) + state.player.y = state.player.y.lesser(720).greater(0) # same with player's y + end + + # Finds all zombies that intersect with the player's sprite. These zombies are removed from the zombies collection + # and added to the killed_zombies collection since any zombie that intersects with the player is killed. + def calc_kill_zombie + + # Find all zombies that intersect with the player. They are considered killed. + killed_this_frame = state.zombies.find_all { |z| z.sprite.intersect_rect? state.player_sprite } + state.zombies = state.zombies - killed_this_frame # remove newly killed zombies from zombies collection + state.killed_zombies += killed_this_frame # add newly killed zombies to killed zombies + + if killed_this_frame.length > 0 # if atleast one zombie was killed in the frame + state.flash_at = state.tick_count # flash_at set to the frame when the zombie was killed + # Don't forget, the rendered flash lasts for 10 frames after the zombie is killed (look at render_flash method) + end + + # Sets the tick_count (passage of time) as the value of the death_at variable for each killed zombie. + # Death_at stores the frame a zombie was killed. + killed_this_frame.each do |z| + z.death_at = state.tick_count + end + + # Zombies are rejected from the killed_zombies collection depending on when they were killed. + # They are rejected if more than 30 frames have passed since their death. + state.killed_zombies = state.killed_zombies.reject { |z| state.tick_count - z.death_at > 30 } + end + + # Uses input from the user to move the player around the screen. + def input + + # If the "a" key or left key is pressed, the x position of the player decreases. + # Otherwise, if the "d" key or right key is pressed, the x position of the player increases. + if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left + state.player.x -= 5 + elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right + state.player.x += 5 + end + + # If the "w" or up key is pressed, the y position of the player increases. + # Otherwise, if the "s" or down key is pressed, the y position of the player decreases. + if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up + state.player.y += 5 + elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down + state.player.y -= 5 + end + + # Sets the attack angle so the player can move and attack in the precise direction it wants to go. + # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position). + # Attack angle also contributes to the position of red square. + if inputs.mouse.moved + state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y] + end + + if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5 + state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y] + state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set + state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position + state.player.dy = state.player.attack_angle.vector_y(25) + end + end + + # Sets the zombie spawn's countdown to a random number. + # How fast zombies appear (change the 60 to 6 and too many zombies will appear at once!) + def random_spawn_countdown minimum + 10.randomize(:ratio, :sign).to_i + 60 + end + + # Helps to iterate through the images in the sprites folder by setting the animation index. + # 3 frames is how long to show an image, and 6 is how many images to flip through. + def animation_index at + at.idiv(3).mod(6) + end + + # Animates the zombies by using the animation index to go through the images in the sprites folder. + def animation_sprite zombie, at = nil + at ||= zombie.created_at_elapsed # how long it is has been since a zombie was created + index = animation_index at + "sprites/zombie-#{index}.png" # string interpolation to iterate through images + end +end + +$protect_the_puppies_from_the_zombies = ProtectThePuppiesFromTheZombies.new + +def tick args + $protect_the_puppies_from_the_zombies.grid = args.grid + $protect_the_puppies_from_the_zombies.inputs = args.inputs + $protect_the_puppies_from_the_zombies.state = args.state + $protect_the_puppies_from_the_zombies.outputs = args.outputs + $protect_the_puppies_from_the_zombies.tick + tick_instructions args, "How to get the mouse position and translate it to an x, y position using .vector_x and .vector_y. CLICK to play." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/05_mouse_move/app/repl.rb b/samples/05_mouse_move/app/repl.rb new file mode 100644 index 0000000..791e505 --- /dev/null +++ b/samples/05_mouse_move/app/repl.rb @@ -0,0 +1,5 @@ +begin + $gtk.reset +rescue Exception => e + puts e +end diff --git a/samples/05_mouse_move/license-for-sample.txt b/samples/05_mouse_move/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/05_mouse_move/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/05_mouse_move/replay.txt b/samples/05_mouse_move/replay.txt new file mode 100644 index 0000000..78c183c --- /dev/null +++ b/samples/05_mouse_move/replay.txt @@ -0,0 +1,550 @@ +replay_version 2.0 +stopped_at 1127 +seed 100 +recorded_at Sun Sep 29 23:57:44 2019 +[:mouse_move, 1057, 15, 2, 1, 74] +[:mouse_move, 1029, 68, 2, 2, 75] +[:mouse_move, 1014, 86, 2, 3, 76] +[:mouse_move, 1014, 105, 2, 4, 89] +[:mouse_move, 1009, 132, 2, 5, 92] +[:mouse_move, 984, 181, 2, 6, 93] +[:mouse_move, 966, 213, 2, 7, 93] +[:mouse_move, 945, 245, 2, 8, 94] +[:mouse_move, 922, 276, 2, 9, 95] +[:mouse_move, 899, 305, 2, 10, 95] +[:mouse_move, 889, 316, 2, 11, 96] +[:mouse_move, 868, 336, 2, 12, 97] +[:mouse_move, 849, 353, 2, 13, 97] +[:mouse_move, 831, 365, 2, 14, 98] +[:mouse_move, 801, 384, 2, 15, 99] +[:mouse_move, 792, 386, 2, 16, 99] +[:mouse_move, 760, 399, 2, 17, 100] +[:mouse_move, 750, 400, 2, 18, 101] +[:mouse_move, 732, 403, 2, 19, 101] +[:mouse_move, 697, 406, 2, 20, 102] +[:mouse_move, 676, 406, 2, 21, 103] +[:mouse_move, 666, 406, 2, 22, 103] +[:mouse_move, 647, 401, 2, 23, 104] +[:mouse_move, 628, 395, 2, 24, 105] +[:mouse_move, 610, 388, 2, 25, 105] +[:mouse_move, 594, 378, 2, 26, 106] +[:mouse_move, 565, 360, 2, 27, 107] +[:mouse_move, 546, 346, 2, 28, 107] +[:mouse_move, 538, 339, 2, 29, 108] +[:mouse_move, 523, 326, 2, 30, 109] +[:mouse_move, 518, 322, 2, 31, 109] +[:mouse_move, 515, 318, 2, 32, 110] +[:mouse_move, 509, 312, 2, 33, 111] +[:mouse_move, 507, 311, 2, 34, 111] +[:mouse_move, 501, 305, 2, 35, 112] +[:mouse_move, 499, 302, 2, 36, 113] +[:mouse_move, 497, 300, 2, 37, 114] +[:mouse_move, 497, 299, 2, 38, 115] +[:mouse_move, 497, 295, 2, 39, 116] +[:mouse_move, 498, 290, 2, 40, 131] +[:mouse_move, 498, 287, 2, 41, 132] +[:mouse_move, 498, 284, 2, 42, 132] +[:mouse_move, 497, 279, 2, 43, 133] +[:mouse_move, 490, 240, 2, 44, 135] +[:mouse_move, 486, 221, 2, 45, 136] +[:mouse_move, 480, 198, 2, 46, 136] +[:mouse_move, 477, 187, 2, 47, 137] +[:mouse_move, 469, 165, 2, 48, 138] +[:mouse_move, 458, 146, 2, 49, 138] +[:mouse_move, 436, 115, 2, 50, 139] +[:mouse_move, 416, 99, 2, 51, 140] +[:mouse_move, 369, 82, 2, 52, 141] +[:mouse_move, 341, 79, 2, 53, 142] +[:mouse_move, 288, 79, 2, 54, 143] +[:mouse_move, 277, 82, 2, 55, 144] +[:mouse_move, 238, 97, 2, 56, 145] +[:mouse_move, 224, 107, 2, 57, 146] +[:mouse_move, 196, 130, 2, 58, 147] +[:mouse_move, 187, 143, 2, 59, 148] +[:mouse_move, 179, 159, 2, 60, 149] +[:mouse_move, 175, 176, 2, 61, 149] +[:mouse_move, 175, 192, 2, 62, 150] +[:mouse_move, 175, 207, 2, 63, 151] +[:mouse_move, 175, 213, 2, 64, 151] +[:mouse_move, 178, 223, 2, 65, 152] +[:mouse_move, 181, 232, 2, 66, 153] +[:mouse_move, 184, 238, 2, 67, 153] +[:mouse_move, 187, 242, 2, 68, 154] +[:mouse_move, 191, 247, 2, 69, 155] +[:mouse_move, 196, 251, 2, 70, 155] +[:mouse_move, 202, 254, 2, 71, 156] +[:mouse_move, 206, 257, 2, 72, 157] +[:mouse_move, 208, 258, 2, 73, 157] +[:mouse_move, 212, 260, 2, 74, 158] +[:mouse_move, 213, 261, 2, 75, 159] +[:mouse_move, 215, 262, 2, 76, 159] +[:mouse_move, 216, 262, 2, 77, 160] +[:mouse_move, 217, 262, 2, 78, 161] +[:mouse_move, 217, 263, 2, 79, 161] +[:mouse_button_pressed, 1, 0, 1, 80, 168] +[:mouse_button_up, 1, 0, 1, 81, 175] +[:mouse_move, 218, 263, 2, 82, 193] +[:mouse_move, 219, 264, 2, 83, 194] +[:mouse_move, 221, 267, 2, 84, 195] +[:mouse_move, 222, 270, 2, 85, 196] +[:mouse_move, 222, 281, 2, 86, 197] +[:mouse_move, 222, 286, 2, 87, 198] +[:mouse_move, 212, 299, 2, 88, 199] +[:mouse_move, 207, 302, 2, 89, 200] +[:mouse_move, 184, 304, 2, 90, 201] +[:mouse_move, 171, 298, 2, 91, 202] +[:mouse_move, 154, 284, 2, 92, 203] +[:mouse_move, 130, 255, 2, 93, 204] +[:mouse_move, 116, 237, 2, 94, 205] +[:mouse_move, 104, 213, 2, 95, 206] +[:mouse_move, 98, 201, 2, 96, 207] +[:mouse_move, 90, 181, 2, 97, 208] +[:mouse_move, 87, 166, 2, 98, 209] +[:mouse_move, 83, 154, 2, 99, 210] +[:mouse_move, 81, 147, 2, 100, 211] +[:mouse_move, 79, 139, 2, 101, 212] +[:mouse_move, 78, 136, 2, 102, 213] +[:mouse_move, 76, 132, 2, 103, 214] +[:mouse_move, 76, 131, 2, 104, 215] +[:mouse_move, 75, 130, 2, 105, 216] +[:mouse_move, 74, 130, 2, 106, 218] +[:mouse_move, 73, 130, 2, 107, 219] +[:mouse_move, 71, 132, 2, 108, 220] +[:mouse_move, 69, 133, 2, 109, 221] +[:mouse_move, 66, 138, 2, 110, 222] +[:mouse_move, 65, 140, 2, 111, 223] +[:mouse_move, 63, 147, 2, 112, 224] +[:mouse_move, 62, 150, 2, 113, 225] +[:mouse_move, 62, 161, 2, 114, 226] +[:mouse_move, 62, 165, 2, 115, 227] +[:mouse_move, 62, 173, 2, 116, 228] +[:mouse_move, 62, 177, 2, 117, 229] +[:mouse_move, 62, 180, 2, 118, 230] +[:mouse_move, 62, 184, 2, 119, 231] +[:mouse_move, 62, 185, 2, 120, 232] +[:mouse_move, 62, 187, 2, 121, 233] +[:mouse_move, 62, 188, 2, 122, 234] +[:mouse_move, 62, 190, 2, 123, 235] +[:mouse_move, 61, 191, 2, 124, 236] +[:mouse_move, 60, 193, 2, 125, 237] +[:mouse_move, 60, 194, 2, 126, 238] +[:mouse_move, 59, 195, 2, 127, 239] +[:mouse_move, 59, 196, 2, 128, 240] +[:mouse_move, 59, 197, 2, 129, 243] +[:mouse_move, 59, 196, 2, 130, 252] +[:mouse_move, 59, 195, 2, 131, 257] +[:mouse_move, 59, 194, 2, 132, 258] +[:mouse_move, 59, 193, 2, 133, 260] +[:mouse_move, 58, 193, 2, 134, 267] +[:mouse_move, 57, 193, 2, 135, 272] +[:mouse_move, 56, 194, 2, 136, 274] +[:mouse_move, 55, 195, 2, 137, 276] +[:mouse_move, 54, 195, 2, 138, 278] +[:mouse_button_pressed, 1, 0, 1, 139, 281] +[:mouse_button_up, 1, 0, 1, 140, 289] +[:mouse_move, 53, 195, 2, 141, 318] +[:mouse_move, 51, 195, 2, 142, 319] +[:mouse_move, 47, 195, 2, 143, 320] +[:mouse_move, 45, 195, 2, 144, 321] +[:mouse_move, 42, 195, 2, 145, 322] +[:mouse_move, 41, 194, 2, 146, 323] +[:mouse_move, 40, 194, 2, 147, 324] +[:mouse_move, 40, 193, 2, 148, 325] +[:mouse_move, 39, 193, 2, 149, 326] +[:mouse_move, 38, 192, 2, 150, 328] +[:mouse_button_pressed, 1, 0, 1, 151, 330] +[:mouse_button_up, 1, 0, 1, 152, 338] +[:mouse_move, 38, 193, 2, 153, 347] +[:mouse_move, 39, 197, 2, 154, 348] +[:mouse_move, 47, 216, 2, 155, 349] +[:mouse_move, 61, 246, 2, 156, 350] +[:mouse_move, 93, 319, 2, 157, 351] +[:mouse_move, 116, 361, 2, 158, 352] +[:mouse_move, 145, 412, 2, 159, 353] +[:mouse_move, 164, 440, 2, 160, 354] +[:mouse_move, 192, 468, 2, 161, 355] +[:mouse_move, 209, 480, 2, 162, 356] +[:mouse_move, 227, 487, 2, 163, 357] +[:mouse_move, 243, 489, 2, 164, 358] +[:mouse_move, 269, 479, 2, 165, 359] +[:mouse_move, 282, 466, 2, 166, 360] +[:mouse_move, 295, 451, 2, 167, 361] +[:mouse_move, 309, 437, 2, 168, 362] +[:mouse_move, 315, 431, 2, 169, 363] +[:mouse_move, 320, 427, 2, 170, 364] +[:mouse_move, 327, 421, 2, 171, 365] +[:mouse_move, 328, 421, 2, 172, 366] +[:mouse_button_pressed, 1, 0, 1, 173, 367] +[:mouse_move, 329, 420, 2, 174, 367] +[:mouse_button_up, 1, 0, 1, 175, 375] +[:mouse_move, 326, 423, 2, 176, 388] +[:mouse_move, 316, 431, 2, 177, 389] +[:mouse_move, 290, 450, 2, 178, 390] +[:mouse_move, 266, 463, 2, 179, 391] +[:mouse_move, 180, 494, 2, 180, 392] +[:mouse_move, 159, 497, 2, 181, 393] +[:mouse_move, 121, 504, 2, 182, 394] +[:mouse_move, 93, 509, 2, 183, 395] +[:mouse_move, 70, 514, 2, 184, 396] +[:mouse_move, 52, 517, 2, 185, 397] +[:mouse_move, 44, 518, 2, 186, 398] +[:mouse_move, 36, 519, 2, 187, 399] +[:mouse_move, 34, 519, 2, 188, 400] +[:mouse_move, 32, 519, 2, 189, 401] +[:mouse_move, 31, 518, 2, 190, 404] +[:mouse_move, 31, 516, 2, 191, 405] +[:mouse_move, 30, 515, 2, 192, 406] +[:mouse_move, 28, 509, 2, 193, 407] +[:mouse_move, 27, 506, 2, 194, 408] +[:mouse_move, 23, 500, 2, 195, 409] +[:mouse_move, 22, 498, 2, 196, 410] +[:mouse_move, 19, 494, 2, 197, 411] +[:mouse_move, 18, 492, 2, 198, 412] +[:mouse_move, 17, 491, 2, 199, 413] +[:mouse_move, 16, 490, 2, 200, 414] +[:mouse_move, 15, 490, 2, 201, 415] +[:mouse_button_pressed, 1, 0, 1, 202, 421] +[:mouse_button_up, 1, 0, 1, 203, 431] +[:mouse_move, 16, 490, 2, 204, 443] +[:mouse_move, 17, 490, 2, 205, 444] +[:mouse_move, 20, 491, 2, 206, 445] +[:mouse_move, 22, 493, 2, 207, 446] +[:mouse_move, 24, 493, 2, 208, 447] +[:mouse_move, 25, 494, 2, 209, 448] +[:mouse_move, 26, 495, 2, 210, 449] +[:mouse_move, 27, 495, 2, 211, 450] +[:mouse_move, 27, 496, 2, 212, 453] +[:mouse_move, 28, 496, 2, 213, 455] +[:mouse_move, 30, 497, 2, 214, 465] +[:mouse_move, 32, 498, 2, 215, 466] +[:mouse_move, 43, 505, 2, 216, 467] +[:mouse_move, 50, 510, 2, 217, 468] +[:mouse_move, 74, 526, 2, 218, 469] +[:mouse_move, 87, 536, 2, 219, 470] +[:mouse_move, 100, 545, 2, 220, 471] +[:mouse_move, 126, 565, 2, 221, 472] +[:mouse_move, 150, 584, 2, 222, 473] +[:mouse_move, 160, 594, 2, 223, 474] +[:mouse_move, 165, 598, 2, 224, 475] +[:mouse_move, 185, 622, 2, 225, 476] +[:mouse_move, 187, 626, 2, 226, 477] +[:mouse_move, 192, 637, 2, 227, 478] +[:mouse_move, 194, 642, 2, 228, 479] +[:mouse_move, 196, 647, 2, 229, 480] +[:mouse_move, 197, 649, 2, 230, 481] +[:mouse_move, 197, 650, 2, 231, 482] +[:mouse_move, 198, 651, 2, 232, 483] +[:mouse_button_pressed, 1, 0, 1, 233, 484] +[:mouse_button_up, 1, 0, 1, 234, 495] +[:mouse_move, 201, 649, 2, 235, 510] +[:mouse_move, 231, 638, 2, 236, 511] +[:mouse_move, 265, 631, 2, 237, 512] +[:mouse_move, 312, 622, 2, 238, 513] +[:mouse_move, 474, 600, 2, 239, 514] +[:mouse_move, 528, 593, 2, 240, 515] +[:mouse_move, 544, 590, 2, 241, 516] +[:mouse_move, 555, 589, 2, 242, 517] +[:mouse_move, 559, 589, 2, 243, 530] +[:mouse_move, 567, 592, 2, 244, 531] +[:mouse_move, 594, 607, 2, 245, 532] +[:mouse_move, 602, 612, 2, 246, 533] +[:mouse_move, 624, 627, 2, 247, 534] +[:mouse_move, 645, 640, 2, 248, 536] +[:mouse_move, 651, 644, 2, 249, 537] +[:mouse_move, 666, 654, 2, 250, 538] +[:mouse_move, 672, 659, 2, 251, 539] +[:mouse_move, 680, 668, 2, 252, 540] +[:mouse_move, 682, 670, 2, 253, 541] +[:mouse_move, 687, 675, 2, 254, 542] +[:mouse_move, 689, 677, 2, 255, 543] +[:mouse_move, 691, 680, 2, 256, 544] +[:mouse_move, 692, 680, 2, 257, 545] +[:mouse_move, 693, 681, 2, 258, 546] +[:mouse_move, 694, 682, 2, 259, 547] +[:mouse_move, 695, 682, 2, 260, 548] +[:mouse_button_pressed, 1, 0, 1, 261, 549] +[:mouse_move, 695, 683, 2, 262, 549] +[:mouse_button_up, 1, 0, 1, 263, 560] +[:mouse_move, 696, 683, 2, 264, 565] +[:mouse_move, 698, 683, 2, 265, 566] +[:mouse_move, 705, 683, 2, 266, 567] +[:mouse_move, 716, 683, 2, 267, 568] +[:mouse_move, 726, 683, 2, 268, 569] +[:mouse_move, 734, 683, 2, 269, 570] +[:mouse_move, 748, 683, 2, 270, 571] +[:mouse_move, 761, 683, 2, 271, 573] +[:mouse_move, 765, 683, 2, 272, 574] +[:mouse_move, 771, 683, 2, 273, 575] +[:mouse_move, 774, 683, 2, 274, 577] +[:mouse_move, 777, 683, 2, 275, 578] +[:mouse_move, 779, 683, 2, 276, 579] +[:mouse_move, 780, 683, 2, 277, 582] +[:mouse_move, 781, 683, 2, 278, 586] +[:mouse_button_pressed, 1, 0, 1, 279, 590] +[:mouse_button_up, 1, 0, 1, 280, 600] +[:mouse_move, 781, 679, 2, 281, 646] +[:mouse_move, 780, 675, 2, 282, 647] +[:mouse_move, 777, 659, 2, 283, 648] +[:mouse_move, 775, 648, 2, 284, 649] +[:mouse_move, 760, 580, 2, 285, 650] +[:mouse_move, 750, 537, 2, 286, 651] +[:mouse_move, 715, 420, 2, 287, 652] +[:mouse_move, 700, 393, 2, 288, 653] +[:mouse_move, 644, 307, 2, 289, 654] +[:mouse_move, 599, 268, 2, 290, 656] +[:mouse_move, 569, 248, 2, 291, 657] +[:mouse_move, 555, 240, 2, 292, 658] +[:mouse_button_pressed, 1, 0, 1, 293, 659] +[:mouse_move, 546, 236, 2, 294, 659] +[:mouse_button_up, 1, 0, 1, 295, 670] +[:mouse_move, 540, 236, 2, 296, 675] +[:mouse_move, 535, 236, 2, 297, 676] +[:mouse_move, 524, 232, 2, 298, 677] +[:mouse_move, 506, 224, 2, 299, 678] +[:mouse_move, 495, 219, 2, 300, 679] +[:mouse_move, 483, 213, 2, 301, 680] +[:mouse_move, 457, 202, 2, 302, 681] +[:mouse_move, 433, 193, 2, 303, 682] +[:mouse_move, 427, 193, 2, 304, 683] +[:mouse_move, 424, 192, 2, 305, 684] +[:mouse_move, 418, 191, 2, 306, 685] +[:mouse_move, 412, 189, 2, 307, 686] +[:mouse_move, 406, 187, 2, 308, 687] +[:mouse_move, 401, 186, 2, 309, 688] +[:mouse_button_pressed, 1, 0, 1, 310, 689] +[:mouse_move, 400, 185, 2, 311, 689] +[:mouse_button_up, 1, 0, 1, 312, 698] +[:mouse_move, 400, 182, 2, 313, 714] +[:mouse_move, 400, 176, 2, 314, 715] +[:mouse_move, 395, 157, 2, 315, 716] +[:mouse_move, 391, 146, 2, 316, 717] +[:mouse_move, 386, 130, 2, 317, 718] +[:mouse_move, 384, 127, 2, 318, 719] +[:mouse_move, 380, 114, 2, 319, 720] +[:mouse_move, 376, 103, 2, 320, 721] +[:mouse_move, 375, 101, 2, 321, 722] +[:mouse_move, 373, 95, 2, 322, 723] +[:mouse_move, 372, 94, 2, 323, 724] +[:mouse_move, 371, 92, 2, 324, 725] +[:mouse_button_pressed, 1, 0, 1, 325, 726] +[:mouse_button_up, 1, 0, 1, 326, 735] +[:mouse_move, 371, 90, 2, 327, 747] +[:mouse_move, 371, 89, 2, 328, 748] +[:mouse_move, 371, 88, 2, 329, 749] +[:mouse_move, 371, 86, 2, 330, 750] +[:mouse_move, 370, 84, 2, 331, 752] +[:mouse_move, 370, 83, 2, 332, 753] +[:mouse_move, 368, 80, 2, 333, 754] +[:mouse_move, 367, 76, 2, 334, 755] +[:mouse_move, 365, 74, 2, 335, 756] +[:mouse_move, 363, 70, 2, 336, 757] +[:mouse_move, 358, 61, 2, 337, 758] +[:mouse_move, 356, 56, 2, 338, 759] +[:mouse_move, 352, 48, 2, 339, 760] +[:mouse_move, 351, 45, 2, 340, 761] +[:mouse_move, 348, 40, 2, 341, 762] +[:mouse_move, 347, 38, 2, 342, 763] +[:mouse_move, 346, 37, 2, 343, 764] +[:mouse_move, 345, 36, 2, 344, 765] +[:mouse_move, 344, 36, 2, 345, 766] +[:mouse_move, 343, 36, 2, 346, 768] +[:mouse_move, 342, 36, 2, 347, 770] +[:mouse_move, 341, 36, 2, 348, 772] +[:mouse_move, 340, 36, 2, 349, 774] +[:mouse_move, 339, 35, 2, 350, 777] +[:mouse_move, 338, 33, 2, 351, 778] +[:mouse_move, 338, 32, 2, 352, 779] +[:mouse_move, 337, 32, 2, 353, 780] +[:mouse_move, 337, 31, 2, 354, 781] +[:mouse_move, 336, 30, 2, 355, 783] +[:mouse_button_pressed, 1, 0, 1, 356, 784] +[:mouse_button_up, 1, 0, 1, 357, 795] +[:mouse_move, 336, 31, 2, 358, 825] +[:mouse_move, 335, 32, 2, 359, 827] +[:mouse_move, 335, 33, 2, 360, 828] +[:mouse_move, 334, 35, 2, 361, 829] +[:mouse_move, 333, 35, 2, 362, 830] +[:mouse_move, 332, 37, 2, 363, 831] +[:mouse_move, 332, 39, 2, 364, 832] +[:mouse_move, 332, 41, 2, 365, 833] +[:mouse_move, 332, 46, 2, 366, 834] +[:mouse_move, 332, 59, 2, 367, 835] +[:mouse_move, 335, 85, 2, 368, 836] +[:mouse_move, 336, 111, 2, 369, 837] +[:mouse_move, 336, 133, 2, 370, 838] +[:mouse_move, 336, 188, 2, 371, 839] +[:mouse_move, 335, 220, 2, 372, 840] +[:mouse_move, 335, 266, 2, 373, 841] +[:mouse_move, 335, 291, 2, 374, 842] +[:mouse_move, 347, 327, 2, 375, 843] +[:mouse_move, 361, 352, 2, 376, 844] +[:mouse_move, 403, 378, 2, 377, 845] +[:mouse_move, 435, 385, 2, 378, 846] +[:mouse_move, 523, 396, 2, 379, 847] +[:mouse_move, 544, 396, 2, 380, 848] +[:mouse_move, 585, 395, 2, 381, 849] +[:mouse_move, 600, 390, 2, 382, 850] +[:mouse_move, 647, 367, 2, 383, 851] +[:mouse_move, 662, 355, 2, 384, 852] +[:mouse_move, 679, 316, 2, 385, 853] +[:mouse_move, 679, 302, 2, 386, 854] +[:mouse_move, 654, 244, 2, 387, 855] +[:mouse_move, 603, 180, 2, 388, 857] +[:mouse_move, 552, 131, 2, 389, 858] +[:mouse_move, 531, 116, 2, 390, 859] +[:mouse_move, 512, 104, 2, 391, 860] +[:mouse_move, 477, 91, 2, 392, 861] +[:mouse_move, 460, 89, 2, 393, 862] +[:mouse_move, 442, 88, 2, 394, 863] +[:mouse_move, 409, 88, 2, 395, 864] +[:mouse_move, 402, 88, 2, 396, 865] +[:mouse_move, 373, 92, 2, 397, 866] +[:mouse_move, 363, 96, 2, 398, 867] +[:mouse_move, 335, 105, 2, 399, 868] +[:mouse_move, 326, 110, 2, 400, 869] +[:mouse_move, 314, 115, 2, 401, 870] +[:mouse_move, 306, 120, 2, 402, 871] +[:mouse_move, 293, 129, 2, 403, 872] +[:mouse_move, 288, 134, 2, 404, 873] +[:mouse_move, 277, 151, 2, 405, 874] +[:mouse_move, 272, 172, 2, 406, 875] +[:mouse_move, 272, 185, 2, 407, 876] +[:mouse_move, 273, 210, 2, 408, 877] +[:mouse_move, 282, 224, 2, 409, 878] +[:mouse_move, 288, 235, 2, 410, 879] +[:mouse_move, 294, 243, 2, 411, 880] +[:mouse_move, 298, 247, 2, 412, 881] +[:mouse_move, 302, 251, 2, 413, 882] +[:mouse_move, 304, 252, 2, 414, 883] +[:mouse_button_pressed, 1, 0, 1, 415, 885] +[:mouse_move, 305, 252, 2, 416, 885] +[:mouse_move, 306, 252, 2, 417, 895] +[:mouse_button_up, 1, 0, 1, 418, 896] +[:mouse_move, 314, 252, 2, 419, 896] +[:mouse_move, 337, 252, 2, 420, 896] +[:mouse_move, 364, 252, 2, 421, 897] +[:mouse_move, 402, 252, 2, 422, 898] +[:mouse_move, 494, 266, 2, 423, 899] +[:mouse_move, 597, 295, 2, 424, 900] +[:mouse_move, 629, 309, 2, 425, 901] +[:mouse_move, 753, 372, 2, 426, 902] +[:mouse_move, 788, 393, 2, 427, 903] +[:mouse_move, 800, 400, 2, 428, 904] +[:mouse_move, 827, 414, 2, 429, 905] +[:mouse_move, 840, 420, 2, 430, 906] +[:mouse_move, 846, 425, 2, 431, 907] +[:mouse_move, 851, 428, 2, 432, 908] +[:mouse_move, 854, 433, 2, 433, 909] +[:mouse_move, 854, 434, 2, 434, 910] +[:mouse_move, 849, 434, 2, 435, 912] +[:mouse_move, 846, 434, 2, 436, 913] +[:mouse_move, 834, 430, 2, 437, 914] +[:mouse_move, 827, 426, 2, 438, 915] +[:mouse_move, 798, 409, 2, 439, 916] +[:mouse_move, 779, 401, 2, 440, 917] +[:mouse_move, 726, 384, 2, 441, 918] +[:mouse_move, 659, 371, 2, 442, 919] +[:mouse_move, 599, 364, 2, 443, 920] +[:mouse_move, 538, 356, 2, 444, 922] +[:mouse_move, 525, 353, 2, 445, 923] +[:mouse_move, 454, 338, 2, 446, 924] +[:mouse_move, 416, 324, 2, 447, 925] +[:mouse_move, 407, 319, 2, 448, 926] +[:mouse_move, 391, 314, 2, 449, 927] +[:mouse_move, 379, 307, 2, 450, 928] +[:mouse_move, 373, 305, 2, 451, 929] +[:mouse_move, 367, 301, 2, 452, 930] +[:mouse_move, 366, 300, 2, 453, 931] +[:mouse_move, 366, 294, 2, 454, 932] +[:mouse_move, 370, 291, 2, 455, 933] +[:mouse_move, 396, 277, 2, 456, 934] +[:mouse_move, 405, 272, 2, 457, 935] +[:mouse_move, 426, 260, 2, 458, 936] +[:mouse_move, 447, 246, 2, 459, 937] +[:mouse_move, 457, 236, 2, 460, 938] +[:mouse_move, 466, 222, 2, 461, 939] +[:mouse_move, 474, 206, 2, 462, 940] +[:mouse_move, 476, 185, 2, 463, 941] +[:mouse_move, 476, 173, 2, 464, 942] +[:mouse_move, 466, 139, 2, 465, 943] +[:mouse_move, 461, 133, 2, 466, 944] +[:mouse_move, 440, 114, 2, 467, 945] +[:mouse_move, 428, 106, 2, 468, 946] +[:mouse_move, 400, 96, 2, 469, 947] +[:mouse_move, 385, 93, 2, 470, 948] +[:mouse_move, 355, 92, 2, 471, 949] +[:mouse_move, 324, 92, 2, 472, 950] +[:mouse_move, 309, 92, 2, 473, 951] +[:mouse_move, 302, 92, 2, 474, 952] +[:mouse_move, 271, 101, 2, 475, 953] +[:mouse_move, 260, 105, 2, 476, 954] +[:mouse_move, 245, 113, 2, 477, 955] +[:mouse_move, 224, 129, 2, 478, 956] +[:mouse_move, 218, 137, 2, 479, 957] +[:mouse_move, 203, 157, 2, 480, 958] +[:mouse_move, 195, 170, 2, 481, 959] +[:mouse_move, 187, 183, 2, 482, 960] +[:mouse_move, 174, 209, 2, 483, 961] +[:mouse_move, 169, 221, 2, 484, 962] +[:mouse_move, 161, 244, 2, 485, 963] +[:mouse_move, 158, 258, 2, 486, 964] +[:mouse_move, 156, 272, 2, 487, 965] +[:mouse_move, 160, 327, 2, 488, 966] +[:mouse_move, 163, 334, 2, 489, 967] +[:mouse_move, 177, 367, 2, 490, 968] +[:mouse_move, 195, 387, 2, 491, 970] +[:mouse_move, 231, 416, 2, 492, 971] +[:mouse_move, 251, 429, 2, 493, 972] +[:mouse_move, 272, 442, 2, 494, 973] +[:mouse_move, 301, 458, 2, 495, 974] +[:mouse_move, 319, 467, 2, 496, 975] +[:mouse_move, 352, 478, 2, 497, 976] +[:mouse_move, 381, 482, 2, 498, 977] +[:mouse_move, 405, 482, 2, 499, 978] +[:mouse_move, 420, 480, 2, 500, 979] +[:mouse_move, 453, 461, 2, 501, 980] +[:mouse_move, 479, 431, 2, 502, 981] +[:mouse_move, 492, 413, 2, 503, 982] +[:mouse_move, 510, 383, 2, 504, 983] +[:mouse_move, 521, 362, 2, 505, 984] +[:mouse_move, 528, 346, 2, 506, 985] +[:mouse_move, 538, 314, 2, 507, 986] +[:mouse_move, 540, 299, 2, 508, 987] +[:mouse_move, 541, 285, 2, 509, 988] +[:mouse_move, 541, 256, 2, 510, 989] +[:mouse_move, 538, 241, 2, 511, 990] +[:mouse_move, 526, 211, 2, 512, 991] +[:mouse_move, 516, 192, 2, 513, 993] +[:mouse_move, 507, 179, 2, 514, 994] +[:mouse_move, 492, 164, 2, 515, 995] +[:mouse_move, 484, 156, 2, 516, 996] +[:mouse_move, 466, 144, 2, 517, 997] +[:mouse_move, 455, 139, 2, 518, 998] +[:mouse_move, 430, 132, 2, 519, 999] +[:mouse_move, 405, 128, 2, 520, 1000] +[:mouse_move, 365, 127, 2, 521, 1001] +[:mouse_move, 341, 127, 2, 522, 1002] +[:mouse_move, 304, 129, 2, 523, 1003] +[:mouse_move, 283, 132, 2, 524, 1004] +[:mouse_move, 247, 141, 2, 525, 1005] +[:mouse_move, 231, 146, 2, 526, 1006] +[:mouse_move, 205, 159, 2, 527, 1007] +[:mouse_move, 194, 167, 2, 528, 1008] +[:mouse_move, 166, 197, 2, 529, 1009] +[:mouse_move, 156, 215, 2, 530, 1010] +[:mouse_move, 140, 260, 2, 531, 1011] +[:mouse_move, 135, 286, 2, 532, 1012] +[:mouse_move, 133, 325, 2, 533, 1013] +[:mouse_move, 134, 348, 2, 534, 1014] +[:mouse_move, 161, 410, 2, 535, 1015] +[:mouse_move, 239, 475, 2, 536, 1016] +[:mouse_move, 283, 495, 2, 537, 1017] +[:mouse_move, 304, 500, 2, 538, 1018] +[:mouse_move, 345, 504, 2, 539, 1019] +[:mouse_move, 409, 503, 2, 540, 1020] +[:mouse_move, 420, 495, 2, 541, 1021] +[:mouse_move, 475, 456, 2, 542, 1022] +[:mouse_move, 492, 436, 2, 543, 1023] +[:key_down_raw, 1073742051, 1024, 2, 544, 1126] +[:key_down_raw, 113, 1024, 2, 545, 1126] +[:key_up_raw, 113, 1024, 2, 546, 1126] diff --git a/samples/05_mouse_move/sprites/player-0.png b/samples/05_mouse_move/sprites/player-0.png Binary files differnew file mode 100644 index 0000000..c34dbed --- /dev/null +++ b/samples/05_mouse_move/sprites/player-0.png diff --git a/samples/05_mouse_move/sprites/player-1.png b/samples/05_mouse_move/sprites/player-1.png Binary files differnew file mode 100644 index 0000000..54fce3e --- /dev/null +++ b/samples/05_mouse_move/sprites/player-1.png diff --git a/samples/05_mouse_move/sprites/player-2.png b/samples/05_mouse_move/sprites/player-2.png Binary files differnew file mode 100644 index 0000000..0007c28 --- /dev/null +++ b/samples/05_mouse_move/sprites/player-2.png diff --git a/samples/05_mouse_move/sprites/player-3.png b/samples/05_mouse_move/sprites/player-3.png Binary files differnew file mode 100644 index 0000000..c34dbed --- /dev/null +++ b/samples/05_mouse_move/sprites/player-3.png diff --git a/samples/05_mouse_move/sprites/player-4.png b/samples/05_mouse_move/sprites/player-4.png Binary files differnew file mode 100644 index 0000000..9897a29 --- /dev/null +++ b/samples/05_mouse_move/sprites/player-4.png diff --git a/samples/05_mouse_move/sprites/player-5.png b/samples/05_mouse_move/sprites/player-5.png Binary files differnew file mode 100644 index 0000000..69d9c7b --- /dev/null +++ b/samples/05_mouse_move/sprites/player-5.png diff --git a/samples/05_mouse_move/sprites/slash.png b/samples/05_mouse_move/sprites/slash.png Binary files differnew file mode 100644 index 0000000..33c45e9 --- /dev/null +++ b/samples/05_mouse_move/sprites/slash.png diff --git a/samples/05_mouse_move/sprites/zombie-0.png b/samples/05_mouse_move/sprites/zombie-0.png Binary files differnew file mode 100644 index 0000000..2fcc35d --- /dev/null +++ b/samples/05_mouse_move/sprites/zombie-0.png diff --git a/samples/05_mouse_move/sprites/zombie-1.png b/samples/05_mouse_move/sprites/zombie-1.png Binary files differnew file mode 100644 index 0000000..2b631ef --- /dev/null +++ b/samples/05_mouse_move/sprites/zombie-1.png diff --git a/samples/05_mouse_move/sprites/zombie-2.png b/samples/05_mouse_move/sprites/zombie-2.png Binary files differnew file mode 100644 index 0000000..10e0491 --- /dev/null +++ b/samples/05_mouse_move/sprites/zombie-2.png diff --git a/samples/05_mouse_move/sprites/zombie-3.png b/samples/05_mouse_move/sprites/zombie-3.png Binary files differnew file mode 100644 index 0000000..2fcc35d --- /dev/null +++ b/samples/05_mouse_move/sprites/zombie-3.png diff --git a/samples/05_mouse_move/sprites/zombie-4.png b/samples/05_mouse_move/sprites/zombie-4.png Binary files differnew file mode 100644 index 0000000..cbd3f79 --- /dev/null +++ b/samples/05_mouse_move/sprites/zombie-4.png diff --git a/samples/05_mouse_move/sprites/zombie-5.png b/samples/05_mouse_move/sprites/zombie-5.png Binary files differnew file mode 100644 index 0000000..f146666 --- /dev/null +++ b/samples/05_mouse_move/sprites/zombie-5.png diff --git a/samples/05_mouse_move_paint_app/app/main.rb b/samples/05_mouse_move_paint_app/app/main.rb new file mode 100644 index 0000000..9303949 --- /dev/null +++ b/samples/05_mouse_move_paint_app/app/main.rb @@ -0,0 +1,240 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - Floor: Method that returns an integer number smaller than or equal to the original with no decimal. + + For example, if we have a variable, a = 13.7, and we called floor on it, it would look like this... + puts a.floor() + which would print out 13. + (There is also a ceil method, which returns an integer number greater than or equal to the original + with no decimal. If we had called ceil on the variable a, the result would have been 14.) + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + For example, if we have a "numbers" hash that stores numbers in English as the + key and numbers in Spanish as the value, we'd have a hash that looks like this... + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } + and on it goes. + + Now if we wanted to find the corresponding value of the "one" key, we could say + puts numbers["one"] + which would print "uno" to the console. + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + In this sample app, new_entity is used to create a new button that clears the grid. + (Remember, you can use state to define ANY property and it will be retained across frames.) + + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + + - args.inputs.mouse.click.point.created_at: The frame the mouse click occurred in. + + - args.outputs.labels: An array. The values in the array generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + +=end + +# This sample app shows an empty grid that the user can paint on. +# To paint, the user must keep their mouse presssed and drag it around the grid. +# The "clear" button allows users to clear the grid so they can start over. + +class PaintApp + attr_accessor :inputs, :state, :outputs, :grid, :args + + # Runs methods necessary for the game to function properly. + def tick + print_title + add_grid + check_click + draw_buttons + end + + # Prints the title onto the screen by using a label. + # Also separates the title from the grid with a line as a horizontal separator. + def print_title + args.outputs.labels << [ 640, 700, 'Paint!', 0, 1 ] + outputs.lines << horizontal_separator(660, 0, 1280) + end + + # Sets the starting position, ending position, and color for the horizontal separator. + # The starting and ending positions have the same y values. + def horizontal_separator y, x, x2 + [x, y, x2, y, 150, 150, 150] + end + + # Sets the starting position, ending position, and color for the vertical separator. + # The starting and ending positions have the same x values. + def vertical_separator x, y, y2 + [x, y, x, y2, 150, 150, 150] + end + + # Outputs a border and a grid containing empty squares onto the screen. + def add_grid + + # Sets the x, y, height, and width of the grid. + # There are 31 horizontal lines and 31 vertical lines in the grid. + # Feel free to count them yourself before continuing! + x, y, h, w = 640 - 500/2, 640 - 500, 500, 500 # calculations done so the grid appears in screen's center + lines_h = 31 + lines_v = 31 + + # Sets values for the grid's border, grid lines, and filled squares. + # The filled_squares variable is initially set to an empty array. + state.grid_border ||= [ x, y, h, w ] # definition of grid's outer border + state.grid_lines ||= draw_grid(x, y, h, w, lines_h, lines_v) # calls draw_grid method + state.filled_squares ||= [] # there are no filled squares until the user fills them in + + # Outputs the grid lines, border, and filled squares onto the screen. + outputs.lines.concat state.grid_lines + outputs.borders << state.grid_border + outputs.solids << state.filled_squares + end + + # Draws the grid by adding in vertical and horizontal separators. + def draw_grid x, y, h, w, lines_h, lines_v + + # The grid starts off empty. + grid = [] + + # Calculates the placement and adds horizontal lines or separators into the grid. + curr_y = y # start at the bottom of the box + dist_y = h / (lines_h + 1) # finds distance to place horizontal lines evenly throughout 500 height of grid + lines_h.times do + curr_y += dist_y # increment curr_y by the distance between the horizontal lines + grid << horizontal_separator(curr_y, x, x + w - 1) # add a separator into the grid + end + + # Calculates the placement and adds vertical lines or separators into the grid. + curr_x = x # now start at the left of the box + dist_x = w / (lines_v + 1) # finds distance to place vertical lines evenly throughout 500 width of grid + lines_v.times do + curr_x += dist_x # increment curr_x by the distance between the vertical lines + grid << vertical_separator(curr_x, y + 1, y + h) # add separator + end + + # paint_grid uses a hash to assign values to keys. + state.paint_grid ||= {"x" => x, "y" => y, "h" => h, "w" => w, "lines_h" => lines_h, + "lines_v" => lines_v, "dist_x" => dist_x, + "dist_y" => dist_y } + + return grid + end + + # Checks if the user is keeping the mouse pressed down and sets the mouse_hold variable accordingly using boolean values. + # If the mouse is up, the user cannot drag the mouse. + def check_click + if inputs.mouse.down #is mouse up or down? + state.mouse_held = true # mouse is being held down + elsif inputs.mouse.up # if mouse is up + state.mouse_held = false # mouse is not being held down or dragged + state.mouse_dragging = false + end + + if state.mouse_held && # mouse needs to be down + !inputs.mouse.click && # must not be first click + ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15) # Need to move 15 pixels before "drag" + state.mouse_dragging = true + end + + # If the user clicks their mouse inside the grid, the search_lines method is called with a click input type. + if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) + search_lines(inputs.mouse.click.point, :click) + + # If the user drags their mouse inside the grid, the search_lines method is called with a drag input type. + elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) + search_lines(inputs.mouse.position, :drag) + end + end + + # Sets the definition of a grid box and handles user input to fill in or clear grid boxes. + def search_lines (point, input_type) + point.x -= state.paint_grid["x"] # subtracts the value assigned to the "x" key in the paint_grid hash + point.y -= state.paint_grid["y"] # subtracts the value assigned to the "y" key in the paint_grid hash + + # Remove code following the .floor and see what happens when you try to fill in grid squares + point.x = (point.x / state.paint_grid["dist_x"]).floor * state.paint_grid["dist_x"] + point.y = (point.y / state.paint_grid["dist_y"]).floor * state.paint_grid["dist_y"] + + point.x += state.paint_grid["x"] + point.y += state.paint_grid["y"] + + # Sets definition of a grid box, meaning its x, y, width, and height. + # Floor is called on the point.x and point.y variables. + # Ceil method is called on values of the distance hash keys, setting the width and height of a box. + grid_box = [ point.x.floor, point.y.floor, state.paint_grid["dist_x"].ceil, state.paint_grid["dist_y"].ceil ] + + if input_type == :click # if user clicks their mouse + if state.filled_squares.include? grid_box # if grid box is already filled in + state.filled_squares.delete grid_box # box is cleared and removed from filled_squares + else + state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares + end + elsif input_type == :drag # if user drags mouse + unless state.filled_squares.include? grid_box # unless the grid box dragged over is already filled in + state.filled_squares << grid_box # the box is filled in and added to filled_squares + end + end + end + + # Creates and outputs a "Clear" button on the screen using a label and a border. + # If the button is clicked, the filled squares are cleared, making the filled_squares collection empty. + def draw_buttons + x, y, w, h = 390, 50, 240, 50 + state.clear_button ||= state.new_entity(:button_with_fade) + + # The x and y positions are set to display the label in the center of the button. + # Try changing the first two parameters to simply x, y and see what happens to the text placement! + state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] # placed in center of border + state.clear_button.border ||= [x, y, w, h] + + # If the mouse is clicked inside the borders of the clear button, + # the filled_squares collection is emptied and the squares are cleared. + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) + state.clear_button.clicked_at = inputs.mouse.click.created_at # time (frame) the click occurred + state.filled_squares.clear + inputs.mouse.previous_click = nil + end + + outputs.labels << state.clear_button.label + outputs.borders << state.clear_button.border + + # When the clear button is clicked, the color of the button changes + # and the transparency changes, as well. If you change the time from + # 0.25.seconds to 1.25.seconds or more, the change will last longer. + if state.clear_button.clicked_at + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] + end + end +end + +$paint_app = PaintApp.new + +def tick args + $paint_app.inputs = args.inputs + $paint_app.state = args.state + $paint_app.grid = args.grid + $paint_app.args = args + $paint_app.outputs = args.outputs + $paint_app.tick + tick_instructions args, "How to create a simple paint app. CLICK and HOLD to draw." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/05_mouse_move_paint_app/app/repl.rb b/samples/05_mouse_move_paint_app/app/repl.rb new file mode 100644 index 0000000..9416675 --- /dev/null +++ b/samples/05_mouse_move_paint_app/app/repl.rb @@ -0,0 +1,2 @@ +# save this file and this code will be run once +puts 1 + 2 diff --git a/samples/05_mouse_move_paint_app/app/tests.rb b/samples/05_mouse_move_paint_app/app/tests.rb new file mode 100644 index 0000000..925f321 --- /dev/null +++ b/samples/05_mouse_move_paint_app/app/tests.rb @@ -0,0 +1,24 @@ +# For advanced users: +# You can put some quick verification tests here, any method +# that starts with the `test_` will be run when you save this file. + +# here is an example test and game + +class MySuperHappyFunGame + attr_gtk + + def tick + outputs.solids << [100, 100, 300, 300] + end +end + +def test_universe args, assert + game = MySuperHappyFunGame.new + game.args = args + game.tick + assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick" + assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending" + puts "test_universe completed successfully" +end + +$gtk.tests.start diff --git a/samples/05_mouse_move_paint_app/license-for-sample.txt b/samples/05_mouse_move_paint_app/license-for-sample.txt new file mode 100644 index 0000000..5c0563d --- /dev/null +++ b/samples/05_mouse_move_paint_app/license-for-sample.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 DragonRuby LLC, Ananth Vivekanand, Sahil Jain + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/samples/05_mouse_move_paint_app/replay.txt b/samples/05_mouse_move_paint_app/replay.txt new file mode 100644 index 0000000..2f4753c --- /dev/null +++ b/samples/05_mouse_move_paint_app/replay.txt @@ -0,0 +1,238 @@ +replay_version 2.0 +stopped_at 629 +seed 100 +recorded_at Sun Sep 29 22:17:52 2019 +[:mouse_move, 539, 647, 2, 1, 151] +[:mouse_move, 545, 636, 2, 2, 152] +[:mouse_move, 552, 618, 2, 3, 153] +[:mouse_move, 556, 607, 2, 4, 154] +[:mouse_move, 572, 557, 2, 5, 155] +[:mouse_move, 576, 542, 2, 6, 156] +[:mouse_move, 593, 468, 2, 7, 157] +[:mouse_move, 594, 454, 2, 8, 158] +[:mouse_move, 600, 410, 2, 9, 159] +[:mouse_move, 602, 354, 2, 10, 160] +[:mouse_move, 603, 327, 2, 11, 161] +[:mouse_move, 605, 290, 2, 12, 162] +[:mouse_move, 605, 281, 2, 13, 163] +[:mouse_move, 606, 265, 2, 14, 164] +[:mouse_move, 606, 256, 2, 15, 165] +[:mouse_move, 606, 246, 2, 16, 166] +[:mouse_move, 606, 242, 2, 17, 167] +[:mouse_move, 606, 240, 2, 18, 168] +[:mouse_move, 606, 239, 2, 19, 171] +[:mouse_move, 606, 238, 2, 20, 174] +[:mouse_move, 606, 239, 2, 21, 191] +[:mouse_move, 606, 241, 2, 22, 199] +[:mouse_move, 606, 243, 2, 23, 200] +[:mouse_move, 606, 249, 2, 24, 201] +[:mouse_move, 605, 253, 2, 25, 203] +[:mouse_move, 603, 254, 2, 26, 204] +[:mouse_move, 601, 257, 2, 27, 205] +[:mouse_move, 599, 258, 2, 28, 206] +[:mouse_move, 595, 259, 2, 29, 207] +[:mouse_move, 594, 260, 2, 30, 208] +[:mouse_move, 589, 260, 2, 31, 209] +[:mouse_move, 587, 260, 2, 32, 210] +[:mouse_move, 580, 259, 2, 33, 211] +[:mouse_move, 579, 258, 2, 34, 212] +[:mouse_move, 576, 257, 2, 35, 214] +[:mouse_move, 575, 257, 2, 36, 215] +[:mouse_move, 574, 257, 2, 37, 216] +[:mouse_move, 573, 257, 2, 38, 217] +[:mouse_move, 570, 257, 2, 39, 218] +[:mouse_move, 566, 257, 2, 40, 219] +[:mouse_move, 562, 258, 2, 41, 220] +[:mouse_move, 558, 259, 2, 42, 222] +[:mouse_move, 557, 259, 2, 43, 223] +[:mouse_move, 554, 260, 2, 44, 224] +[:mouse_move, 553, 260, 2, 45, 226] +[:mouse_move, 552, 260, 2, 46, 228] +[:mouse_move, 551, 260, 2, 47, 229] +[:mouse_move, 550, 260, 2, 48, 230] +[:mouse_move, 548, 259, 2, 49, 232] +[:mouse_move, 547, 259, 2, 50, 234] +[:mouse_move, 546, 259, 2, 51, 235] +[:mouse_move, 545, 259, 2, 52, 239] +[:mouse_move, 544, 259, 2, 53, 242] +[:mouse_move, 542, 259, 2, 54, 243] +[:mouse_move, 540, 259, 2, 55, 245] +[:mouse_move, 539, 259, 2, 56, 246] +[:mouse_move, 537, 259, 2, 57, 247] +[:mouse_move, 536, 259, 2, 58, 248] +[:mouse_move, 535, 259, 2, 59, 249] +[:mouse_move, 534, 259, 2, 60, 250] +[:mouse_move, 533, 259, 2, 61, 251] +[:mouse_button_pressed, 1, 0, 1, 62, 257] +[:mouse_button_up, 1, 0, 1, 63, 265] +[:mouse_move, 535, 261, 2, 64, 278] +[:mouse_move, 544, 266, 2, 65, 279] +[:mouse_move, 550, 270, 2, 66, 280] +[:mouse_move, 559, 274, 2, 67, 281] +[:mouse_move, 581, 280, 2, 68, 282] +[:mouse_move, 606, 287, 2, 69, 283] +[:mouse_move, 635, 291, 2, 70, 284] +[:mouse_move, 654, 293, 2, 71, 285] +[:mouse_move, 677, 293, 2, 72, 286] +[:mouse_move, 691, 293, 2, 73, 287] +[:mouse_move, 721, 290, 2, 74, 288] +[:mouse_move, 734, 286, 2, 75, 290] +[:mouse_move, 740, 283, 2, 76, 291] +[:mouse_move, 746, 279, 2, 77, 292] +[:mouse_move, 748, 277, 2, 78, 293] +[:mouse_move, 752, 273, 2, 79, 294] +[:mouse_move, 753, 271, 2, 80, 295] +[:mouse_move, 754, 268, 2, 81, 296] +[:mouse_move, 755, 265, 2, 82, 297] +[:mouse_move, 756, 265, 2, 83, 298] +[:mouse_move, 756, 263, 2, 84, 299] +[:mouse_move, 757, 262, 2, 85, 300] +[:mouse_move, 757, 261, 2, 86, 302] +[:mouse_move, 756, 260, 2, 87, 311] +[:mouse_move, 755, 260, 2, 88, 312] +[:mouse_move, 752, 259, 2, 89, 313] +[:mouse_move, 751, 258, 2, 90, 314] +[:mouse_move, 748, 258, 2, 91, 315] +[:mouse_move, 747, 258, 2, 92, 316] +[:mouse_move, 746, 257, 2, 93, 317] +[:mouse_move, 745, 257, 2, 94, 318] +[:mouse_move, 743, 257, 2, 95, 330] +[:mouse_move, 742, 258, 2, 96, 331] +[:mouse_move, 738, 259, 2, 97, 332] +[:mouse_move, 736, 260, 2, 98, 334] +[:mouse_move, 735, 260, 2, 99, 335] +[:mouse_move, 734, 260, 2, 100, 336] +[:mouse_move, 733, 260, 2, 101, 338] +[:mouse_move, 732, 260, 2, 102, 340] +[:mouse_move, 731, 260, 2, 103, 341] +[:mouse_move, 730, 260, 2, 104, 343] +[:mouse_move, 729, 260, 2, 105, 347] +[:mouse_move, 727, 260, 2, 106, 349] +[:mouse_move, 723, 260, 2, 107, 351] +[:mouse_move, 721, 260, 2, 108, 353] +[:mouse_move, 720, 260, 2, 109, 354] +[:mouse_button_pressed, 1, 0, 1, 110, 363] +[:mouse_button_up, 1, 0, 1, 111, 368] +[:mouse_move, 720, 271, 2, 112, 382] +[:mouse_move, 720, 279, 2, 113, 383] +[:mouse_move, 714, 297, 2, 114, 384] +[:mouse_move, 710, 307, 2, 115, 385] +[:mouse_move, 687, 346, 2, 116, 386] +[:mouse_move, 670, 365, 2, 117, 387] +[:mouse_move, 632, 399, 2, 118, 388] +[:mouse_move, 612, 411, 2, 119, 389] +[:mouse_move, 584, 420, 2, 120, 390] +[:mouse_move, 577, 420, 2, 121, 391] +[:mouse_move, 548, 422, 2, 122, 392] +[:mouse_move, 537, 416, 2, 123, 394] +[:mouse_move, 533, 411, 2, 124, 395] +[:mouse_move, 526, 401, 2, 125, 396] +[:mouse_move, 524, 396, 2, 126, 397] +[:mouse_move, 520, 386, 2, 127, 398] +[:mouse_move, 518, 381, 2, 128, 399] +[:mouse_move, 514, 371, 2, 129, 400] +[:mouse_move, 513, 370, 2, 130, 401] +[:mouse_move, 510, 366, 2, 131, 402] +[:mouse_move, 509, 364, 2, 132, 403] +[:mouse_move, 507, 362, 2, 133, 404] +[:mouse_move, 501, 362, 2, 134, 405] +[:mouse_move, 496, 362, 2, 135, 406] +[:mouse_move, 487, 362, 2, 136, 407] +[:mouse_move, 482, 362, 2, 137, 408] +[:mouse_move, 475, 362, 2, 138, 409] +[:mouse_move, 472, 362, 2, 139, 410] +[:mouse_move, 468, 363, 2, 140, 411] +[:mouse_move, 467, 363, 2, 141, 412] +[:mouse_move, 466, 363, 2, 142, 413] +[:mouse_move, 470, 363, 2, 143, 442] +[:mouse_move, 473, 363, 2, 144, 443] +[:mouse_move, 474, 362, 2, 145, 444] +[:mouse_move, 474, 361, 2, 146, 445] +[:mouse_move, 476, 360, 2, 147, 446] +[:mouse_move, 477, 358, 2, 148, 447] +[:mouse_move, 478, 355, 2, 149, 448] +[:mouse_move, 479, 354, 2, 150, 449] +[:mouse_move, 480, 351, 2, 151, 450] +[:mouse_move, 481, 350, 2, 152, 452] +[:mouse_move, 481, 349, 2, 153, 453] +[:mouse_button_pressed, 1, 0, 1, 154, 474] +[:mouse_move, 481, 350, 2, 155, 474] +[:mouse_move, 483, 354, 2, 156, 475] +[:mouse_move, 484, 359, 2, 157, 476] +[:mouse_move, 491, 374, 2, 158, 477] +[:mouse_move, 495, 383, 2, 159, 479] +[:mouse_move, 497, 388, 2, 160, 480] +[:mouse_move, 499, 391, 2, 161, 481] +[:mouse_move, 503, 398, 2, 162, 482] +[:mouse_move, 509, 408, 2, 163, 483] +[:mouse_move, 511, 411, 2, 164, 485] +[:mouse_move, 515, 417, 2, 165, 486] +[:mouse_move, 517, 421, 2, 166, 487] +[:mouse_move, 521, 425, 2, 167, 488] +[:mouse_move, 523, 428, 2, 168, 489] +[:mouse_move, 526, 431, 2, 169, 490] +[:mouse_move, 528, 433, 2, 170, 491] +[:mouse_move, 533, 437, 2, 171, 492] +[:mouse_move, 536, 440, 2, 172, 493] +[:mouse_move, 546, 447, 2, 173, 494] +[:mouse_move, 551, 451, 2, 174, 495] +[:mouse_move, 566, 461, 2, 175, 496] +[:mouse_move, 582, 470, 2, 176, 497] +[:mouse_move, 590, 473, 2, 177, 498] +[:mouse_move, 597, 476, 2, 178, 499] +[:mouse_move, 611, 482, 2, 179, 500] +[:mouse_move, 622, 486, 2, 180, 501] +[:mouse_move, 628, 488, 2, 181, 502] +[:mouse_move, 632, 489, 2, 182, 503] +[:mouse_move, 638, 491, 2, 183, 504] +[:mouse_move, 644, 491, 2, 184, 505] +[:mouse_move, 651, 492, 2, 185, 506] +[:mouse_move, 660, 492, 2, 186, 507] +[:mouse_move, 665, 492, 2, 187, 508] +[:mouse_move, 669, 491, 2, 188, 509] +[:mouse_move, 681, 489, 2, 189, 510] +[:mouse_move, 685, 489, 2, 190, 512] +[:mouse_move, 692, 487, 2, 191, 513] +[:mouse_move, 697, 485, 2, 192, 514] +[:mouse_move, 705, 482, 2, 193, 515] +[:mouse_move, 709, 480, 2, 194, 516] +[:mouse_move, 717, 475, 2, 195, 517] +[:mouse_move, 721, 473, 2, 196, 518] +[:mouse_move, 730, 467, 2, 197, 519] +[:mouse_move, 733, 464, 2, 198, 520] +[:mouse_move, 741, 458, 2, 199, 521] +[:mouse_move, 746, 455, 2, 200, 522] +[:mouse_move, 753, 448, 2, 201, 523] +[:mouse_move, 761, 440, 2, 202, 524] +[:mouse_move, 763, 438, 2, 203, 525] +[:mouse_move, 767, 434, 2, 204, 526] +[:mouse_move, 772, 426, 2, 205, 527] +[:mouse_move, 774, 423, 2, 206, 528] +[:mouse_move, 778, 415, 2, 207, 529] +[:mouse_move, 782, 407, 2, 208, 530] +[:mouse_move, 783, 402, 2, 209, 531] +[:mouse_move, 785, 396, 2, 210, 532] +[:mouse_move, 789, 385, 2, 211, 533] +[:mouse_move, 791, 377, 2, 212, 534] +[:mouse_move, 791, 373, 2, 213, 535] +[:mouse_move, 792, 369, 2, 214, 536] +[:mouse_move, 793, 357, 2, 215, 537] +[:mouse_move, 794, 354, 2, 216, 539] +[:mouse_move, 795, 348, 2, 217, 540] +[:mouse_move, 795, 346, 2, 218, 541] +[:mouse_move, 796, 342, 2, 219, 542] +[:mouse_move, 796, 341, 2, 220, 543] +[:mouse_move, 796, 340, 2, 221, 544] +[:mouse_move, 796, 339, 2, 222, 545] +[:mouse_move, 797, 339, 2, 223, 546] +[:mouse_move, 797, 338, 2, 224, 547] +[:mouse_button_up, 1, 0, 1, 225, 564] +[:mouse_move, 807, 344, 2, 226, 564] +[:mouse_move, 834, 357, 2, 227, 566] +[:mouse_move, 858, 367, 2, 228, 567] +[:mouse_move, 870, 370, 2, 229, 568] +[:mouse_move, 912, 379, 2, 230, 569] +[:mouse_move, 929, 380, 2, 231, 570] +[:key_down_raw, 1073742051, 1024, 2, 232, 627] +[:key_down_raw, 113, 1024, 2, 233, 628] +[:key_up_raw, 113, 1024, 2, 234, 628] diff --git a/samples/05_mouse_move_tile_editor/app/main.rb b/samples/05_mouse_move_tile_editor/app/main.rb new file mode 100644 index 0000000..95ccfdf --- /dev/null +++ b/samples/05_mouse_move_tile_editor/app/main.rb @@ -0,0 +1,391 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - to_s: Returns a string representation of an object. + For example, if we had + 500.to_s + the string "500" would be returned. + Similar to to_i, which returns an integer representation of an object. + + - Ceil: Returns an integer number greater than or equal to the original + with no decimal. + + Reminders: + + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside a rect. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.outputs.solids: An array. The values generate a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.lines: An array. The values generate a line. + The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] + For more information about lines, go to mygame/documentation/04-lines.md. + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + In this sample app, new_entity is used to create a new button that clears the grid. + (Remember, you can use state to define ANY property and it will be retained across frames.) + +=end + +# This sample app shows an empty grid that the user can paint in. There are different image tiles that +# the user can use to fill the grid, and the "Clear" button can be pressed to clear the grid boxes. + +class TileEditor + attr_accessor :inputs, :state, :outputs, :grid, :args + + # Runs all the methods necessary for the game to function properly. + def tick + defaults + render + check_click + draw_buttons + end + + # Sets default values + # Initialization only happens in the first frame + # NOTE: The values of some of these variables may seem confusingly large at first. + # The gridSize is 1600 but it seems a lot smaller on the screen, for example. + # But keep in mind that by using the "W", "A", "S", and "D" keys, you can + # move the grid's view in all four directions for more grid spaces. + def defaults + state.tileCords ||= [] + state.tileQuantity ||= 6 + state.tileSize ||= 50 + state.tileSelected ||= 1 + state.tempX ||= 50 + state.tempY ||= 500 + state.speed ||= 4 + state.centerX ||= 4000 + state.centerY ||= 4000 + state.originalCenter ||= [state.centerX, state.centerY] + state.gridSize ||= 1600 + state.lineQuantity ||= 50 + state.increment ||= state.gridSize / state.lineQuantity + state.gridX ||= [] + state.gridY ||= [] + state.filled_squares ||= [] + state.grid_border ||= [390, 140, 500, 500] + + get_grid unless state.tempX == 0 # calls get_grid in the first frame only + determineTileCords unless state.tempX == 0 # calls determineTileCords in first frame + state.tempX = 0 # sets tempX to 0; the two methods aren't called again + end + + # Calculates the placement of lines or separators in the grid + def get_grid + curr_x = state.centerX - (state.gridSize / 2) # starts at left of grid + deltaX = state.gridSize / state.lineQuantity # finds distance to place vertical lines evenly through width of grid + (state.lineQuantity + 2).times do + state.gridX << curr_x # adds curr_x to gridX collection + curr_x += deltaX # increment curr_x by the distance between vertical lines + end + + curr_y = state.centerY - (state.gridSize / 2) # starts at bottom of grid + deltaY = state.gridSize / state.lineQuantity # finds distance to place horizontal lines evenly through height of grid + (state.lineQuantity + 2).times do + state.gridY << curr_y # adds curr_y to gridY collection + curr_y += deltaY # increments curr_y to distance between horizontal lines + end + end + + # Determines coordinate positions of patterned tiles (on the left side of the grid) + def determineTileCords + state.tempCounter ||= 1 # initializes tempCounter to 1 + state.tileQuantity.times do # there are 6 different kinds of tiles + state.tileCords += [[state.tempX, state.tempY, state.tempCounter]] # adds tile definition to collection + state.tempX += 75 # increments tempX to put horizontal space between the patterned tiles + state.tempCounter += 1 # increments tempCounter + if state.tempX > 200 # if tempX exceeds 200 pixels + state.tempX = 50 # a new row of patterned tiles begins + state.tempY -= 75 # the new row is 75 pixels lower than the previous row + end + end + end + + # Outputs objects (grid, tiles, etc) onto the screen + def render + outputs.sprites << state.tileCords.map do # outputs tileCords collection using images in sprites folder + |x, y, order| + [x, y, state.tileSize, state.tileSize, 'sprites/image' + order.to_s + ".png"] + end + outputs.solids << [0, 0, 1280, 720, 255, 255, 255] # outputs white background + add_grid # outputs grid + print_title # outputs title and current tile pattern + end + + # Creates a grid by outputting vertical and horizontal grid lines onto the screen. + # Outputs sprites for the filled_squares collection onto the screen. + def add_grid + + # Outputs the grid's border. + outputs.borders << state.grid_border + temp = 0 + + # Before looking at the code that outputs the vertical and horizontal lines in the + # grid, take note of the fact that: + # grid_border[1] refers to the border's bottom line (running horizontally), + # grid_border[2] refers to the border's top line (running (horizontally), + # grid_border[0] refers to the border's left line (running vertically), + # and grid_border[3] refers to the border's right line (running vertically). + + # [2] + # ---------- + # | | + # [0] | | [3] + # | | + # ---------- + # [1] + + # Calculates the positions and outputs the x grid lines in the color gray. + state.gridX.map do # perform an action on all elements of the gridX collection + |x| + temp += 1 # increment temp + + # if x's value is greater than (or equal to) the x value of the border's left side + # and less than (or equal to) the x value of the border's right side + if x >= state.centerX - (state.grid_border[2] / 2) && x <= state.centerX + (state.grid_border[2] / 2) + delta = state.centerX - 640 + # vertical lines have the same starting and ending x positions + # starting y and ending y positions lead from the bottom of the border to the top of the border + outputs.lines << [x - delta, state.grid_border[1], x - delta, state.grid_border[1] + state.grid_border[2], 150, 150, 150] # sets definition of vertical line and outputs it + end + end + temp = 0 + + # Calculates the positions and outputs the y grid lines in the color gray. + state.gridY.map do # perform an action on all elements of the gridY collection + |y| + temp += 1 # increment temp + + # if y's value is greater than (or equal to) the y value of the border's bottom side + # and less than (or equal to) the y value of the border's top side + if y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + delta = state.centerY - 393 + # horizontal lines have the same starting and ending y positions + # starting x and ending x positions lead from the left side of the border to the right side of the border + outputs.lines << [state.grid_border[0], y - delta, state.grid_border[0] + state.grid_border[3], y - delta, 150, 150, 150] # sets definition of horizontal line and outputs it + end + end + + # Sets values and outputs sprites for the filled_squares collection. + state.filled_squares.map do # perform an action on every element of the filled_squares collection + |x, y, w, h, sprite| + # if x's value is greater than (or equal to) the x value of 17 pixels to the left of the border's left side + # and less than (or equal to) the x value of the border's right side + # and y's value is greater than (or equal to) the y value of the border's bottom side + # and less than (or equal to) the y value of 25 pixels above the border's top side + # NOTE: The allowance of 17 pixels and 25 pixels is due to the fact that a grid box may be slightly cut off or + # not entirely visible in the grid's view (until it is moved using "W", "A", "S", "D") + if x >= state.centerX - (state.grid_border[2] / 2) - 17 && x <= state.centerX + (state.grid_border[2] / 2) && + y >= state.centerY - (state.grid_border[3] / 2) && y <= state.centerY + (state.grid_border[3] / 2) + 25 + # calculations done to place sprites in grid spaces that are meant to filled in + # mess around with the x and y values and see how the sprite placement changes + outputs.sprites << [x - state.centerX + 630, y - state.centerY + 360, w, h, sprite] + end + end + + # outputs a white solid along the left side of the grid (change the color and you'll be able to see it against the white background) + # state.increment subtracted in x parameter because solid's position is denoted by bottom left corner + # state.increment subtracted in y parameter to avoid covering the title label + outputs.primitives << [state.grid_border[0] - state.increment, + state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), + 255, 255, 255].solid + + # outputs a white solid along the right side of the grid + # state.increment subtracted from y parameter to avoid covering title label + outputs.primitives << [state.grid_border[0] + state.grid_border[2], + state.grid_border[1] - state.increment, state.increment, state.grid_border[3] + (state.increment * 2), + 255, 255, 255].solid + + # outputs a white solid along the bottom of the grid + # state.increment subtracted from y parameter to avoid covering last row of grid boxes + outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] - state.increment, + state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid + + # outputs a white solid along the top of the grid + outputs.primitives << [state.grid_border[0] - state.increment, state.grid_border[1] + state.grid_border[3], + state.grid_border[2] + (2 * state.increment), state.increment, 255, 255, 255].solid + + end + + # Outputs title and current tile pattern + def print_title + outputs.labels << [640, 700, 'Mouse to Place Tile, WASD to Move Around', 7, 1] # title label + outputs.lines << horizontal_separator(660, 0, 1280) # outputs horizontal separator + outputs.labels << [1050, 500, 'Current:', 3, 1] # outputs Current label + outputs.sprites << [1110, 474, state.tileSize / 2, state.tileSize / 2, 'sprites/image' + state.tileSelected.to_s + ".png"] # outputs sprite of current tile pattern using images in sprites folder; output is half the size of a tile + end + + # Sets the starting position, ending position, and color for the horizontal separator. + def horizontal_separator y, x, x2 + [x, y, x2, y, 150, 150, 150] # definition of separator; horizontal line means same starting/ending y + end + + # Checks if the mouse is being clicked or dragged + def check_click + if inputs.keyboard.key_down.r # if the "r" key is pressed down + $dragon.reset + end + + if inputs.mouse.down #is mouse up or down? + state.mouse_held = true + if inputs.mouse.position.x < state.grid_border[0] # if mouse's x position is inside the grid's borders + state.tileCords.map do # perform action on all elements of tileCords collection + |x, y, order| + # if mouse's x position is greater than (or equal to) the starting x position of a tile + # and the mouse's x position is also less than (or equal to) the ending x position of that tile, + # and the mouse's y position is greater than (or equal to) the starting y position of that tile, + # and the mouse's y position is also less than (or equal to) the ending y position of that tile, + # (BASICALLY, IF THE MOUSE'S POSITION IS WITHIN THE STARTING AND ENDING POSITIONS OF A TILE) + if inputs.mouse.position.x >= x && inputs.mouse.position.x <= x + state.tileSize && + inputs.mouse.position.y >= y && inputs.mouse.position.y <= y + state.tileSize + state.tileSelected = order # that tile is selected + end + end + end + elsif inputs.mouse.up # otherwise, if the mouse is in the "up" state + state.mouse_held = false # mouse is not held down or dragged + state.mouse_dragging = false + end + + if state.mouse_held && # mouse needs to be down + !inputs.mouse.click && # must not be first click + ((inputs.mouse.previous_click.point.x - inputs.mouse.position.x).abs > 15 || + (inputs.mouse.previous_click.point.y - inputs.mouse.position.y).abs > 15) # Need to move 15 pixels before "drag" + state.mouse_dragging = true + end + + # if mouse is clicked inside grid's border, search_lines method is called with click input type + if ((inputs.mouse.click) && (inputs.mouse.click.point.inside_rect? state.grid_border)) + search_lines(inputs.mouse.click.point, :click) + + # if mouse is dragged inside grid's border, search_lines method is called with drag input type + elsif ((state.mouse_dragging) && (inputs.mouse.position.inside_rect? state.grid_border)) + search_lines(inputs.mouse.position, :drag) + end + + # Changes grid's position on screen by moving it up, down, left, or right. + + # centerX is incremented by speed if the "d" key is pressed and if that sum is less than + # the original left side of the center plus half the grid, minus half the top border of grid. + # MOVES GRID RIGHT (increasing x) + state.centerX += state.speed if inputs.keyboard.key_held.d && + (state.centerX + state.speed) < state.originalCenter[0] + (state.gridSize / 2) - (state.grid_border[2] / 2) + # centerX is decremented by speed if the "a" key is pressed and if that difference is greater than + # the original left side of the center minus half the grid, plus half the top border of grid. + # MOVES GRID LEFT (decreasing x) + state.centerX -= state.speed if inputs.keyboard.key_held.a && + (state.centerX - state.speed) > state.originalCenter[0] - (state.gridSize / 2) + (state.grid_border[2] / 2) + # centerY is incremented by speed if the "w" key is pressed and if that sum is less than + # the original bottom of the center plus half the grid, minus half the right border of grid. + # MOVES GRID UP (increasing y) + state.centerY += state.speed if inputs.keyboard.key_held.w && + (state.centerY + state.speed) < state.originalCenter[1] + (state.gridSize / 2) - (state.grid_border[3] / 2) + # centerY is decremented by speed if the "s" key is pressed and if the difference is greater than + # the original bottom of the center minus half the grid, plus half the right border of grid. + # MOVES GRID DOWN (decreasing y) + state.centerY -= state.speed if inputs.keyboard.key_held.s && + (state.centerY - state.speed) > state.originalCenter[1] - (state.gridSize / 2) + (state.grid_border[3] / 2) + end + + # Performs calculations on the gridX and gridY collections, and sets values. + # Sets the definition of a grid box, including the image that it is filled with. + def search_lines (point, input_type) + point.x += state.centerX - 630 # increments x and y + point.y += state.centerY - 360 + findX = 0 + findY = 0 + increment = state.gridSize / state.lineQuantity # divides grid by number of separators + + state.gridX.map do # perform an action on every element of collection + |x| + # findX increments x by 10 if point.x is less than that sum and findX is currently 0 + findX = x + 10 if point.x < (x + 10) && findX == 0 + end + + state.gridY.map do + |y| + # findY is set to y if point.y is less than that value and findY is currently 0 + findY = y if point.y < (y) && findY == 0 + end + # position of a box is denoted by bottom left corner, which is why the increment is being subtracted + grid_box = [findX - (increment.ceil), findY - (increment.ceil), increment.ceil, increment.ceil, + "sprites/image" + state.tileSelected.to_s + ".png"] # sets sprite definition + + if input_type == :click # if user clicks their mouse + if state.filled_squares.include? grid_box # if grid box is already filled in + state.filled_squares.delete grid_box # box is cleared and removed from filled_squares + else + state.filled_squares << grid_box # otherwise, box is filled in and added to filled_squares + end + elsif input_type == :drag # if user drags mouse + unless state.filled_squares.include? grid_box # unless grid box dragged over is already filled in + state.filled_squares << grid_box # box is filled in and added to filled_squares + end + end + end + + # Creates a "Clear" button using labels and borders. + def draw_buttons + x, y, w, h = 390, 50, 240, 50 + state.clear_button ||= state.new_entity(:button_with_fade) + + # x and y positions are set to display "Clear" label in center of the button + # Try changing first two parameters to simply x, y and see what happens to the text placement + state.clear_button.label ||= [x + w.half, y + h.half + 10, "Clear", 0, 1] + state.clear_button.border ||= [x, y, w, h] # definition of button's border + + # If the mouse is clicked inside the borders of the clear button + if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.clear_button.border) + state.clear_button.clicked_at = inputs.mouse.click.created_at # value is frame of mouse click + state.filled_squares.clear # filled squares collection is emptied (squares are cleared) + inputs.mouse.previous_click = nil # no previous click + end + + outputs.labels << state.clear_button.label # outputs clear button + outputs.borders << state.clear_button.border + + # When the clear button is clicked, the color of the button changes + # and the transparency changes, as well. If you change the time from + # 0.25.seconds to 1.25.seconds or more, the change will last longer. + if state.clear_button.clicked_at + outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.clear_button.clicked_at.ease(0.25.seconds, :flip)] + end + end +end + +$tile_editor = TileEditor.new + +def tick args + $tile_editor.inputs = args.inputs + $tile_editor.grid = args.grid + $tile_editor.args = args + $tile_editor.outputs = args.outputs + $tile_editor.state = args.state + $tile_editor.tick + tick_instructions args, "Roll your own tile editor. CLICK to select a sprite. CLICK in grid to place sprite. WASD to move around." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/05_mouse_move_tile_editor/app/repl.rb b/samples/05_mouse_move_tile_editor/app/repl.rb new file mode 100644 index 0000000..9416675 --- /dev/null +++ b/samples/05_mouse_move_tile_editor/app/repl.rb @@ -0,0 +1,2 @@ +# save this file and this code will be run once +puts 1 + 2 diff --git a/samples/05_mouse_move_tile_editor/app/tests.rb b/samples/05_mouse_move_tile_editor/app/tests.rb new file mode 100644 index 0000000..925f321 --- /dev/null +++ b/samples/05_mouse_move_tile_editor/app/tests.rb @@ -0,0 +1,24 @@ +# For advanced users: +# You can put some quick verification tests here, any method +# that starts with the `test_` will be run when you save this file. + +# here is an example test and game + +class MySuperHappyFunGame + attr_gtk + + def tick + outputs.solids << [100, 100, 300, 300] + end +end + +def test_universe args, assert + game = MySuperHappyFunGame.new + game.args = args + game.tick + assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick" + assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending" + puts "test_universe completed successfully" +end + +$gtk.tests.start diff --git a/samples/05_mouse_move_tile_editor/license-for-sample.txt b/samples/05_mouse_move_tile_editor/license-for-sample.txt new file mode 100644 index 0000000..5c0563d --- /dev/null +++ b/samples/05_mouse_move_tile_editor/license-for-sample.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 DragonRuby LLC, Ananth Vivekanand, Sahil Jain + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/samples/05_mouse_move_tile_editor/replay.txt b/samples/05_mouse_move_tile_editor/replay.txt new file mode 100644 index 0000000..7321a9f --- /dev/null +++ b/samples/05_mouse_move_tile_editor/replay.txt @@ -0,0 +1,1035 @@ +replay_version 2.0 +stopped_at 1811 +seed 100 +recorded_at Sun Sep 29 22:18:46 2019 +[:mouse_move, 902, 366, 2, 1, 50] +[:mouse_move, 866, 338, 2, 2, 51] +[:mouse_move, 851, 324, 2, 3, 52] +[:mouse_move, 817, 291, 2, 4, 53] +[:mouse_move, 781, 257, 2, 5, 54] +[:mouse_move, 721, 201, 2, 6, 55] +[:mouse_move, 649, 136, 2, 7, 56] +[:mouse_move, 618, 110, 2, 8, 57] +[:mouse_move, 607, 101, 2, 9, 58] +[:mouse_move, 533, 50, 2, 10, 59] +[:mouse_move, 505, 36, 2, 11, 60] +[:mouse_move, 444, 14, 2, 12, 61] +[:mouse_move, 421, 8, 2, 13, 62] +[:mouse_move, 414, 7, 2, 14, 63] +[:mouse_move, 402, 4, 2, 15, 64] +[:mouse_move, 394, 3, 2, 16, 65] +[:mouse_move, 381, 3, 2, 17, 66] +[:mouse_move, 381, 5, 2, 18, 67] +[:mouse_move, 380, 12, 2, 19, 68] +[:mouse_move, 380, 15, 2, 20, 69] +[:mouse_move, 380, 19, 2, 21, 70] +[:mouse_move, 380, 21, 2, 22, 71] +[:mouse_move, 380, 26, 2, 23, 72] +[:mouse_move, 380, 28, 2, 24, 73] +[:mouse_move, 376, 36, 2, 25, 74] +[:mouse_move, 373, 43, 2, 26, 75] +[:mouse_move, 367, 52, 2, 27, 76] +[:mouse_move, 363, 57, 2, 28, 77] +[:mouse_move, 357, 62, 2, 29, 78] +[:mouse_move, 354, 65, 2, 30, 79] +[:mouse_move, 349, 67, 2, 31, 80] +[:mouse_move, 347, 67, 2, 32, 81] +[:mouse_move, 342, 67, 2, 33, 82] +[:mouse_move, 340, 67, 2, 34, 83] +[:mouse_move, 337, 65, 2, 35, 84] +[:mouse_move, 335, 64, 2, 36, 85] +[:mouse_move, 331, 61, 2, 37, 86] +[:mouse_move, 329, 60, 2, 38, 87] +[:mouse_move, 326, 58, 2, 39, 88] +[:mouse_move, 325, 57, 2, 40, 89] +[:mouse_move, 324, 56, 2, 41, 90] +[:mouse_move, 321, 55, 2, 42, 91] +[:mouse_move, 320, 55, 2, 43, 93] +[:mouse_move, 323, 55, 2, 44, 99] +[:mouse_move, 327, 56, 2, 45, 100] +[:mouse_move, 336, 57, 2, 46, 101] +[:mouse_move, 343, 57, 2, 47, 102] +[:mouse_move, 361, 59, 2, 48, 103] +[:mouse_move, 375, 59, 2, 49, 105] +[:mouse_move, 382, 59, 2, 50, 106] +[:mouse_move, 393, 59, 2, 51, 107] +[:mouse_move, 395, 59, 2, 52, 108] +[:mouse_move, 403, 59, 2, 53, 109] +[:mouse_move, 409, 59, 2, 54, 110] +[:mouse_move, 416, 59, 2, 55, 111] +[:mouse_move, 421, 58, 2, 56, 112] +[:mouse_move, 428, 57, 2, 57, 113] +[:mouse_move, 432, 57, 2, 58, 114] +[:mouse_move, 442, 57, 2, 59, 115] +[:mouse_move, 446, 57, 2, 60, 116] +[:mouse_move, 450, 57, 2, 61, 117] +[:mouse_move, 459, 57, 2, 62, 118] +[:mouse_move, 463, 57, 2, 63, 119] +[:mouse_move, 473, 57, 2, 64, 120] +[:mouse_move, 478, 57, 2, 65, 121] +[:mouse_move, 489, 57, 2, 66, 122] +[:mouse_move, 502, 57, 2, 67, 123] +[:mouse_move, 509, 57, 2, 68, 124] +[:mouse_move, 516, 57, 2, 69, 125] +[:mouse_move, 536, 57, 2, 70, 126] +[:mouse_move, 546, 57, 2, 71, 127] +[:mouse_move, 560, 57, 2, 72, 128] +[:mouse_move, 576, 57, 2, 73, 129] +[:mouse_move, 584, 58, 2, 74, 130] +[:mouse_move, 592, 59, 2, 75, 131] +[:mouse_move, 606, 60, 2, 76, 132] +[:mouse_move, 613, 60, 2, 77, 133] +[:mouse_move, 632, 60, 2, 78, 134] +[:mouse_move, 640, 60, 2, 79, 135] +[:mouse_move, 659, 60, 2, 80, 136] +[:mouse_move, 669, 59, 2, 81, 137] +[:mouse_move, 692, 56, 2, 82, 138] +[:mouse_move, 697, 54, 2, 83, 139] +[:mouse_move, 715, 52, 2, 84, 140] +[:mouse_move, 724, 51, 2, 85, 141] +[:mouse_move, 736, 50, 2, 86, 142] +[:mouse_move, 738, 50, 2, 87, 143] +[:mouse_move, 742, 50, 2, 88, 144] +[:mouse_move, 749, 50, 2, 89, 145] +[:mouse_move, 751, 50, 2, 90, 146] +[:mouse_move, 757, 50, 2, 91, 147] +[:mouse_move, 761, 51, 2, 92, 148] +[:mouse_move, 765, 51, 2, 93, 149] +[:mouse_move, 772, 51, 2, 94, 150] +[:mouse_move, 775, 51, 2, 95, 151] +[:mouse_move, 779, 51, 2, 96, 152] +[:mouse_move, 788, 49, 2, 97, 153] +[:mouse_move, 792, 49, 2, 98, 154] +[:mouse_move, 801, 47, 2, 99, 155] +[:mouse_move, 807, 47, 2, 100, 156] +[:mouse_move, 819, 46, 2, 101, 157] +[:mouse_move, 825, 46, 2, 102, 158] +[:mouse_move, 837, 46, 2, 103, 159] +[:mouse_move, 842, 47, 2, 104, 160] +[:mouse_move, 853, 48, 2, 105, 161] +[:mouse_move, 855, 48, 2, 106, 184] +[:mouse_move, 857, 49, 2, 107, 185] +[:mouse_move, 868, 54, 2, 108, 186] +[:mouse_move, 884, 61, 2, 109, 187] +[:mouse_move, 908, 70, 2, 110, 188] +[:mouse_move, 915, 72, 2, 111, 189] +[:mouse_move, 928, 75, 2, 112, 190] +[:mouse_move, 934, 77, 2, 113, 191] +[:mouse_move, 941, 78, 2, 114, 192] +[:mouse_move, 943, 79, 2, 115, 193] +[:mouse_move, 944, 79, 2, 116, 194] +[:mouse_move, 942, 80, 2, 117, 215] +[:mouse_move, 937, 80, 2, 118, 216] +[:mouse_move, 895, 80, 2, 119, 217] +[:mouse_move, 859, 80, 2, 120, 218] +[:mouse_move, 753, 80, 2, 121, 219] +[:mouse_move, 688, 80, 2, 122, 220] +[:mouse_move, 559, 81, 2, 123, 221] +[:mouse_move, 532, 83, 2, 124, 222] +[:mouse_move, 480, 85, 2, 125, 223] +[:mouse_move, 479, 85, 2, 126, 242] +[:mouse_move, 474, 85, 2, 127, 243] +[:mouse_move, 448, 85, 2, 128, 244] +[:mouse_move, 431, 85, 2, 129, 245] +[:mouse_move, 383, 87, 2, 130, 246] +[:mouse_move, 352, 90, 2, 131, 247] +[:mouse_move, 282, 98, 2, 132, 248] +[:mouse_move, 244, 104, 2, 133, 249] +[:mouse_move, 169, 123, 2, 134, 250] +[:mouse_move, 136, 135, 2, 135, 251] +[:mouse_move, 107, 151, 2, 136, 252] +[:mouse_move, 74, 174, 2, 137, 253] +[:mouse_move, 58, 190, 2, 138, 254] +[:mouse_move, 35, 224, 2, 139, 255] +[:mouse_move, 30, 240, 2, 140, 256] +[:mouse_move, 26, 259, 2, 141, 257] +[:mouse_move, 26, 262, 2, 142, 258] +[:mouse_move, 24, 275, 2, 143, 259] +[:mouse_move, 23, 279, 2, 144, 260] +[:mouse_move, 22, 285, 2, 145, 261] +[:mouse_move, 22, 287, 2, 146, 262] +[:mouse_move, 21, 288, 2, 147, 263] +[:mouse_move, 21, 289, 2, 148, 265] +[:mouse_move, 20, 289, 2, 149, 266] +[:mouse_move, 20, 287, 2, 150, 267] +[:mouse_move, 21, 284, 2, 151, 268] +[:mouse_move, 25, 277, 2, 152, 269] +[:mouse_move, 28, 272, 2, 153, 270] +[:mouse_move, 33, 264, 2, 154, 271] +[:mouse_move, 36, 260, 2, 155, 272] +[:mouse_move, 45, 245, 2, 156, 273] +[:mouse_move, 48, 241, 2, 157, 274] +[:mouse_move, 53, 231, 2, 158, 275] +[:mouse_move, 56, 226, 2, 159, 276] +[:mouse_move, 59, 220, 2, 160, 277] +[:mouse_move, 60, 218, 2, 161, 278] +[:mouse_move, 61, 216, 2, 162, 279] +[:mouse_move, 60, 216, 2, 163, 283] +[:mouse_move, 59, 216, 2, 164, 284] +[:mouse_move, 57, 216, 2, 165, 286] +[:mouse_move, 55, 215, 2, 166, 288] +[:mouse_move, 54, 215, 2, 167, 289] +[:mouse_move, 52, 215, 2, 168, 290] +[:mouse_move, 51, 215, 2, 169, 291] +[:mouse_move, 50, 215, 2, 170, 292] +[:mouse_move, 50, 216, 2, 171, 293] +[:mouse_move, 51, 219, 2, 172, 294] +[:mouse_move, 54, 222, 2, 173, 295] +[:mouse_move, 63, 228, 2, 174, 296] +[:mouse_move, 72, 232, 2, 175, 297] +[:mouse_move, 84, 234, 2, 176, 298] +[:mouse_move, 92, 234, 2, 177, 299] +[:mouse_move, 103, 230, 2, 178, 300] +[:mouse_move, 112, 221, 2, 179, 301] +[:mouse_move, 116, 210, 2, 180, 302] +[:mouse_move, 118, 202, 2, 181, 303] +[:mouse_move, 119, 189, 2, 182, 304] +[:mouse_move, 119, 183, 2, 183, 305] +[:mouse_move, 117, 171, 2, 184, 306] +[:mouse_move, 110, 159, 2, 185, 307] +[:mouse_move, 105, 154, 2, 186, 308] +[:mouse_move, 95, 145, 2, 187, 309] +[:mouse_move, 84, 139, 2, 188, 310] +[:mouse_move, 76, 138, 2, 189, 311] +[:mouse_move, 69, 137, 2, 190, 312] +[:mouse_move, 51, 138, 2, 191, 313] +[:mouse_move, 43, 143, 2, 192, 315] +[:mouse_move, 39, 146, 2, 193, 316] +[:mouse_move, 33, 154, 2, 194, 317] +[:mouse_move, 33, 158, 2, 195, 318] +[:mouse_move, 35, 173, 2, 196, 319] +[:mouse_move, 39, 181, 2, 197, 321] +[:mouse_move, 41, 185, 2, 198, 322] +[:mouse_move, 45, 190, 2, 199, 323] +[:mouse_move, 47, 191, 2, 200, 324] +[:mouse_move, 50, 193, 2, 201, 325] +[:mouse_move, 52, 193, 2, 202, 326] +[:mouse_move, 54, 193, 2, 203, 327] +[:mouse_move, 55, 192, 2, 204, 328] +[:mouse_move, 56, 191, 2, 205, 329] +[:mouse_move, 63, 194, 2, 206, 342] +[:mouse_move, 69, 198, 2, 207, 343] +[:mouse_move, 89, 208, 2, 208, 344] +[:mouse_move, 98, 211, 2, 209, 345] +[:mouse_move, 101, 212, 2, 210, 346] +[:mouse_move, 108, 214, 2, 211, 347] +[:mouse_move, 117, 215, 2, 212, 348] +[:mouse_move, 119, 215, 2, 213, 349] +[:mouse_move, 122, 214, 2, 214, 350] +[:mouse_move, 123, 213, 2, 215, 351] +[:mouse_move, 123, 210, 2, 216, 352] +[:mouse_move, 123, 209, 2, 217, 353] +[:mouse_move, 123, 207, 2, 218, 354] +[:mouse_move, 122, 206, 2, 219, 355] +[:mouse_move, 121, 205, 2, 220, 356] +[:mouse_move, 120, 204, 2, 221, 357] +[:mouse_move, 121, 204, 2, 222, 361] +[:mouse_move, 125, 207, 2, 223, 362] +[:mouse_move, 135, 212, 2, 224, 363] +[:mouse_move, 142, 215, 2, 225, 364] +[:mouse_move, 163, 219, 2, 226, 365] +[:mouse_move, 169, 219, 2, 227, 366] +[:mouse_move, 187, 220, 2, 228, 367] +[:mouse_move, 194, 220, 2, 229, 368] +[:mouse_move, 203, 214, 2, 230, 369] +[:mouse_move, 206, 210, 2, 231, 370] +[:mouse_move, 208, 203, 2, 232, 371] +[:mouse_move, 209, 193, 2, 233, 372] +[:mouse_move, 209, 187, 2, 234, 373] +[:mouse_move, 209, 178, 2, 235, 374] +[:mouse_move, 204, 168, 2, 236, 375] +[:mouse_move, 200, 164, 2, 237, 376] +[:mouse_move, 191, 157, 2, 238, 377] +[:mouse_move, 182, 152, 2, 239, 378] +[:mouse_move, 165, 151, 2, 240, 379] +[:mouse_move, 157, 151, 2, 241, 380] +[:mouse_move, 149, 151, 2, 242, 381] +[:mouse_move, 144, 152, 2, 243, 382] +[:mouse_move, 138, 154, 2, 244, 383] +[:mouse_move, 136, 155, 2, 245, 384] +[:mouse_move, 132, 160, 2, 246, 385] +[:mouse_move, 132, 164, 2, 247, 386] +[:mouse_move, 132, 176, 2, 248, 387] +[:mouse_move, 134, 184, 2, 249, 388] +[:mouse_move, 135, 188, 2, 250, 389] +[:mouse_move, 138, 196, 2, 251, 390] +[:mouse_move, 140, 199, 2, 252, 391] +[:mouse_move, 142, 203, 2, 253, 392] +[:mouse_move, 143, 204, 2, 254, 393] +[:mouse_move, 144, 205, 2, 255, 394] +[:mouse_move, 145, 205, 2, 256, 395] +[:mouse_move, 145, 204, 2, 257, 397] +[:mouse_move, 144, 204, 2, 258, 398] +[:mouse_move, 144, 203, 2, 259, 399] +[:mouse_move, 142, 203, 2, 260, 400] +[:mouse_move, 141, 203, 2, 261, 401] +[:mouse_move, 140, 203, 2, 262, 402] +[:mouse_move, 139, 203, 2, 263, 403] +[:mouse_move, 138, 204, 2, 264, 404] +[:mouse_move, 137, 209, 2, 265, 405] +[:mouse_move, 137, 215, 2, 266, 406] +[:mouse_move, 137, 220, 2, 267, 407] +[:mouse_move, 148, 233, 2, 268, 408] +[:mouse_move, 155, 239, 2, 269, 409] +[:mouse_move, 172, 247, 2, 270, 410] +[:mouse_move, 181, 248, 2, 271, 411] +[:mouse_move, 195, 249, 2, 272, 412] +[:mouse_move, 205, 246, 2, 273, 413] +[:mouse_move, 210, 244, 2, 274, 414] +[:mouse_move, 214, 239, 2, 275, 415] +[:mouse_move, 215, 238, 2, 276, 416] +[:mouse_move, 216, 235, 2, 277, 417] +[:mouse_move, 216, 233, 2, 278, 418] +[:mouse_move, 215, 232, 2, 279, 419] +[:mouse_move, 214, 231, 2, 280, 420] +[:mouse_move, 212, 229, 2, 281, 421] +[:mouse_move, 214, 228, 2, 282, 424] +[:mouse_move, 228, 227, 2, 283, 425] +[:mouse_move, 246, 224, 2, 284, 426] +[:mouse_move, 251, 222, 2, 285, 427] +[:mouse_move, 266, 212, 2, 286, 428] +[:mouse_move, 270, 206, 2, 287, 429] +[:mouse_move, 277, 196, 2, 288, 430] +[:mouse_move, 277, 177, 2, 289, 431] +[:mouse_move, 275, 170, 2, 290, 432] +[:mouse_move, 262, 155, 2, 291, 433] +[:mouse_move, 252, 150, 2, 292, 434] +[:mouse_move, 232, 145, 2, 293, 435] +[:mouse_move, 226, 145, 2, 294, 436] +[:mouse_move, 209, 145, 2, 295, 437] +[:mouse_move, 207, 145, 2, 296, 438] +[:mouse_move, 200, 147, 2, 297, 439] +[:mouse_move, 197, 148, 2, 298, 440] +[:mouse_move, 194, 153, 2, 299, 441] +[:mouse_move, 194, 157, 2, 300, 442] +[:mouse_move, 194, 167, 2, 301, 443] +[:mouse_move, 196, 173, 2, 302, 444] +[:mouse_move, 198, 179, 2, 303, 445] +[:mouse_move, 203, 190, 2, 304, 446] +[:mouse_move, 206, 194, 2, 305, 447] +[:mouse_move, 214, 201, 2, 306, 448] +[:mouse_move, 219, 204, 2, 307, 449] +[:mouse_move, 226, 206, 2, 308, 450] +[:mouse_move, 229, 207, 2, 309, 451] +[:mouse_move, 234, 208, 2, 310, 452] +[:mouse_move, 235, 209, 2, 311, 453] +[:mouse_move, 236, 209, 2, 312, 454] +[:mouse_move, 227, 211, 2, 313, 456] +[:mouse_move, 220, 214, 2, 314, 457] +[:mouse_move, 190, 230, 2, 315, 458] +[:mouse_move, 173, 240, 2, 316, 459] +[:mouse_move, 128, 264, 2, 317, 460] +[:mouse_move, 116, 269, 2, 318, 461] +[:mouse_move, 90, 280, 2, 319, 462] +[:mouse_move, 76, 285, 2, 320, 463] +[:mouse_move, 70, 287, 2, 321, 464] +[:mouse_move, 66, 288, 2, 322, 465] +[:mouse_move, 63, 289, 2, 323, 466] +[:mouse_move, 63, 290, 2, 324, 468] +[:mouse_move, 63, 292, 2, 325, 469] +[:mouse_move, 63, 293, 2, 326, 470] +[:mouse_move, 64, 295, 2, 327, 471] +[:mouse_move, 65, 297, 2, 328, 472] +[:mouse_move, 66, 299, 2, 329, 473] +[:mouse_move, 66, 301, 2, 330, 475] +[:mouse_move, 65, 301, 2, 331, 476] +[:mouse_move, 63, 302, 2, 332, 477] +[:mouse_move, 62, 302, 2, 333, 478] +[:mouse_move, 60, 302, 2, 334, 479] +[:mouse_move, 59, 302, 2, 335, 481] +[:mouse_move, 60, 302, 2, 336, 485] +[:mouse_move, 62, 302, 2, 337, 486] +[:mouse_move, 73, 302, 2, 338, 487] +[:mouse_move, 82, 303, 2, 339, 488] +[:mouse_move, 107, 303, 2, 340, 489] +[:mouse_move, 135, 303, 2, 341, 490] +[:mouse_move, 164, 303, 2, 342, 491] +[:mouse_move, 170, 303, 2, 343, 492] +[:mouse_move, 197, 303, 2, 344, 493] +[:mouse_move, 208, 303, 2, 345, 494] +[:mouse_move, 222, 303, 2, 346, 495] +[:mouse_move, 228, 303, 2, 347, 496] +[:mouse_move, 237, 303, 2, 348, 497] +[:mouse_move, 238, 304, 2, 349, 498] +[:mouse_move, 240, 304, 2, 350, 499] +[:mouse_move, 243, 305, 2, 351, 500] +[:mouse_move, 244, 305, 2, 352, 501] +[:mouse_move, 245, 305, 2, 353, 502] +[:mouse_move, 248, 305, 2, 354, 518] +[:mouse_move, 294, 315, 2, 355, 519] +[:mouse_move, 334, 324, 2, 356, 520] +[:mouse_move, 418, 344, 2, 357, 521] +[:mouse_move, 625, 383, 2, 358, 522] +[:mouse_move, 732, 394, 2, 359, 523] +[:mouse_move, 881, 397, 2, 360, 524] +[:mouse_move, 1037, 378, 2, 361, 525] +[:mouse_move, 1062, 374, 2, 362, 526] +[:mouse_move, 1118, 361, 2, 363, 527] +[:mouse_move, 1128, 359, 2, 364, 528] +[:mouse_move, 1134, 358, 2, 365, 529] +[:mouse_move, 1149, 355, 2, 366, 530] +[:mouse_move, 1163, 350, 2, 367, 531] +[:mouse_move, 1166, 350, 2, 368, 532] +[:mouse_move, 1170, 348, 2, 369, 533] +[:mouse_move, 1171, 348, 2, 370, 534] +[:mouse_move, 1173, 344, 2, 371, 535] +[:mouse_move, 1175, 341, 2, 372, 536] +[:mouse_move, 1179, 325, 2, 373, 537] +[:mouse_move, 1180, 316, 2, 374, 538] +[:mouse_move, 1182, 306, 2, 375, 539] +[:mouse_move, 1182, 300, 2, 376, 540] +[:mouse_move, 1184, 287, 2, 377, 541] +[:mouse_move, 1184, 283, 2, 378, 542] +[:mouse_move, 1174, 271, 2, 379, 543] +[:mouse_move, 1163, 266, 2, 380, 544] +[:mouse_move, 1137, 257, 2, 381, 545] +[:mouse_move, 1129, 254, 2, 382, 546] +[:mouse_move, 1113, 250, 2, 383, 547] +[:mouse_move, 1105, 247, 2, 384, 548] +[:mouse_move, 1096, 245, 2, 385, 549] +[:mouse_move, 1093, 245, 2, 386, 550] +[:mouse_move, 1089, 245, 2, 387, 551] +[:mouse_move, 1088, 247, 2, 388, 552] +[:mouse_move, 1088, 253, 2, 389, 553] +[:mouse_move, 1089, 272, 2, 390, 554] +[:mouse_move, 1094, 283, 2, 391, 555] +[:mouse_move, 1103, 298, 2, 392, 556] +[:mouse_move, 1109, 305, 2, 393, 557] +[:mouse_move, 1130, 320, 2, 394, 558] +[:mouse_move, 1139, 321, 2, 395, 559] +[:mouse_move, 1160, 319, 2, 396, 560] +[:mouse_move, 1172, 313, 2, 397, 561] +[:mouse_move, 1192, 290, 2, 398, 562] +[:mouse_move, 1200, 277, 2, 399, 563] +[:mouse_move, 1208, 250, 2, 400, 564] +[:mouse_move, 1208, 238, 2, 401, 565] +[:mouse_move, 1200, 216, 2, 402, 566] +[:mouse_move, 1190, 207, 2, 403, 567] +[:mouse_move, 1167, 193, 2, 404, 568] +[:mouse_move, 1161, 190, 2, 405, 569] +[:mouse_move, 1140, 183, 2, 406, 570] +[:mouse_move, 1130, 181, 2, 407, 571] +[:mouse_move, 1113, 179, 2, 408, 572] +[:mouse_move, 1104, 179, 2, 409, 573] +[:mouse_move, 1092, 179, 2, 410, 574] +[:mouse_move, 1089, 180, 2, 411, 575] +[:mouse_move, 1080, 191, 2, 412, 576] +[:mouse_move, 1078, 199, 2, 413, 577] +[:mouse_move, 1077, 218, 2, 414, 578] +[:mouse_move, 1077, 229, 2, 415, 579] +[:mouse_move, 1081, 241, 2, 416, 580] +[:mouse_move, 1102, 275, 2, 417, 581] +[:mouse_move, 1118, 288, 2, 418, 582] +[:mouse_move, 1144, 303, 2, 419, 583] +[:mouse_move, 1161, 310, 2, 420, 584] +[:mouse_move, 1180, 313, 2, 421, 585] +[:mouse_move, 1189, 313, 2, 422, 586] +[:mouse_move, 1201, 310, 2, 423, 587] +[:mouse_move, 1201, 306, 2, 424, 588] +[:mouse_move, 1188, 288, 2, 425, 589] +[:mouse_move, 1157, 271, 2, 426, 590] +[:mouse_move, 1080, 255, 2, 427, 591] +[:mouse_move, 1023, 251, 2, 428, 592] +[:mouse_move, 899, 251, 2, 429, 593] +[:mouse_move, 837, 254, 2, 430, 594] +[:mouse_move, 793, 258, 2, 431, 595] +[:mouse_move, 757, 262, 2, 432, 596] +[:mouse_move, 741, 264, 2, 433, 597] +[:mouse_move, 712, 269, 2, 434, 598] +[:mouse_move, 705, 270, 2, 435, 610] +[:mouse_move, 693, 273, 2, 436, 611] +[:mouse_move, 666, 283, 2, 437, 612] +[:mouse_move, 655, 286, 2, 438, 613] +[:mouse_move, 638, 291, 2, 439, 614] +[:mouse_move, 632, 292, 2, 440, 615] +[:mouse_move, 618, 294, 2, 441, 616] +[:mouse_move, 612, 294, 2, 442, 617] +[:mouse_move, 605, 291, 2, 443, 618] +[:mouse_move, 605, 290, 2, 444, 619] +[:mouse_move, 603, 286, 2, 445, 620] +[:mouse_move, 603, 285, 2, 446, 621] +[:mouse_move, 603, 282, 2, 447, 622] +[:mouse_move, 603, 281, 2, 448, 623] +[:mouse_move, 604, 279, 2, 449, 624] +[:mouse_move, 605, 278, 2, 450, 625] +[:mouse_move, 609, 277, 2, 451, 626] +[:mouse_move, 610, 277, 2, 452, 627] +[:mouse_move, 612, 276, 2, 453, 628] +[:mouse_move, 613, 275, 2, 454, 629] +[:mouse_move, 614, 275, 2, 455, 630] +[:mouse_move, 614, 274, 2, 456, 635] +[:mouse_move, 614, 273, 2, 457, 637] +[:mouse_move, 614, 272, 2, 458, 638] +[:mouse_move, 614, 270, 2, 459, 639] +[:mouse_move, 614, 269, 2, 460, 640] +[:mouse_move, 614, 266, 2, 461, 641] +[:mouse_move, 614, 265, 2, 462, 642] +[:mouse_move, 613, 263, 2, 463, 643] +[:mouse_move, 613, 261, 2, 464, 644] +[:mouse_move, 613, 259, 2, 465, 645] +[:mouse_move, 613, 258, 2, 466, 646] +[:mouse_move, 614, 256, 2, 467, 647] +[:mouse_move, 615, 254, 2, 468, 648] +[:mouse_move, 617, 252, 2, 469, 649] +[:mouse_move, 617, 251, 2, 470, 650] +[:mouse_move, 618, 249, 2, 471, 651] +[:mouse_move, 619, 249, 2, 472, 652] +[:mouse_move, 619, 248, 2, 473, 654] +[:mouse_button_pressed, 1, 0, 1, 474, 662] +[:mouse_button_up, 1, 0, 1, 475, 668] +[:mouse_move, 619, 249, 2, 476, 714] +[:mouse_move, 619, 251, 2, 477, 715] +[:mouse_move, 619, 254, 2, 478, 716] +[:mouse_move, 619, 256, 2, 479, 717] +[:mouse_move, 619, 259, 2, 480, 718] +[:mouse_move, 619, 261, 2, 481, 719] +[:mouse_move, 619, 264, 2, 482, 720] +[:mouse_move, 619, 267, 2, 483, 721] +[:mouse_move, 620, 272, 2, 484, 722] +[:mouse_move, 620, 273, 2, 485, 723] +[:mouse_move, 622, 277, 2, 486, 724] +[:mouse_move, 622, 278, 2, 487, 725] +[:mouse_move, 622, 279, 2, 488, 726] +[:mouse_move, 623, 279, 2, 489, 727] +[:mouse_move, 623, 280, 2, 490, 728] +[:mouse_button_pressed, 1, 0, 1, 491, 747] +[:mouse_move, 623, 281, 2, 492, 747] +[:mouse_move, 623, 283, 2, 493, 748] +[:mouse_move, 623, 290, 2, 494, 749] +[:mouse_move, 622, 295, 2, 495, 750] +[:mouse_move, 622, 302, 2, 496, 751] +[:mouse_move, 621, 305, 2, 497, 752] +[:mouse_move, 621, 311, 2, 498, 753] +[:mouse_move, 621, 314, 2, 499, 754] +[:mouse_move, 620, 322, 2, 500, 755] +[:mouse_move, 620, 326, 2, 501, 756] +[:mouse_move, 619, 334, 2, 502, 757] +[:mouse_move, 619, 339, 2, 503, 758] +[:mouse_move, 618, 350, 2, 504, 759] +[:mouse_move, 618, 356, 2, 505, 760] +[:mouse_move, 618, 368, 2, 506, 761] +[:mouse_move, 618, 372, 2, 507, 762] +[:mouse_move, 617, 381, 2, 508, 763] +[:mouse_move, 617, 384, 2, 509, 764] +[:mouse_move, 617, 389, 2, 510, 765] +[:mouse_move, 617, 391, 2, 511, 766] +[:mouse_move, 617, 393, 2, 512, 767] +[:mouse_move, 617, 394, 2, 513, 768] +[:mouse_move, 617, 395, 2, 514, 769] +[:mouse_move, 617, 397, 2, 515, 770] +[:mouse_move, 616, 398, 2, 516, 771] +[:mouse_move, 616, 400, 2, 517, 772] +[:mouse_move, 616, 401, 2, 518, 773] +[:mouse_move, 616, 403, 2, 519, 774] +[:mouse_move, 616, 404, 2, 520, 775] +[:mouse_move, 616, 405, 2, 521, 776] +[:mouse_move, 616, 406, 2, 522, 778] +[:mouse_move, 615, 406, 2, 523, 779] +[:mouse_move, 615, 407, 2, 524, 782] +[:mouse_move, 616, 407, 2, 525, 789] +[:mouse_move, 617, 407, 2, 526, 790] +[:mouse_move, 618, 407, 2, 527, 793] +[:mouse_move, 620, 407, 2, 528, 794] +[:mouse_move, 621, 406, 2, 529, 795] +[:mouse_move, 623, 406, 2, 530, 796] +[:mouse_move, 627, 406, 2, 531, 797] +[:mouse_move, 628, 406, 2, 532, 798] +[:mouse_move, 634, 407, 2, 533, 799] +[:mouse_move, 635, 407, 2, 534, 800] +[:mouse_move, 639, 408, 2, 535, 801] +[:mouse_move, 642, 408, 2, 536, 802] +[:mouse_move, 648, 409, 2, 537, 803] +[:mouse_move, 650, 409, 2, 538, 804] +[:mouse_move, 655, 408, 2, 539, 805] +[:mouse_move, 657, 408, 2, 540, 806] +[:mouse_move, 662, 407, 2, 541, 807] +[:mouse_move, 664, 407, 2, 542, 808] +[:mouse_move, 669, 407, 2, 543, 809] +[:mouse_move, 672, 407, 2, 544, 810] +[:mouse_move, 677, 407, 2, 545, 811] +[:mouse_move, 681, 407, 2, 546, 812] +[:mouse_move, 687, 407, 2, 547, 813] +[:mouse_move, 689, 407, 2, 548, 814] +[:mouse_move, 694, 407, 2, 549, 815] +[:mouse_move, 697, 407, 2, 550, 816] +[:mouse_move, 704, 407, 2, 551, 817] +[:mouse_move, 707, 407, 2, 552, 818] +[:mouse_move, 712, 406, 2, 553, 819] +[:mouse_move, 715, 406, 2, 554, 820] +[:mouse_move, 719, 406, 2, 555, 821] +[:mouse_move, 722, 405, 2, 556, 822] +[:mouse_move, 724, 405, 2, 557, 823] +[:mouse_move, 728, 405, 2, 558, 824] +[:mouse_move, 730, 405, 2, 559, 825] +[:mouse_move, 734, 405, 2, 560, 826] +[:mouse_move, 736, 405, 2, 561, 827] +[:mouse_move, 740, 405, 2, 562, 828] +[:mouse_move, 741, 405, 2, 563, 829] +[:mouse_move, 744, 405, 2, 564, 830] +[:mouse_move, 746, 405, 2, 565, 831] +[:mouse_move, 748, 405, 2, 566, 832] +[:mouse_move, 750, 405, 2, 567, 833] +[:mouse_move, 752, 404, 2, 568, 834] +[:mouse_move, 753, 404, 2, 569, 835] +[:mouse_move, 754, 404, 2, 570, 836] +[:mouse_move, 755, 404, 2, 571, 837] +[:mouse_move, 756, 404, 2, 572, 839] +[:mouse_move, 757, 403, 2, 573, 840] +[:mouse_move, 758, 403, 2, 574, 841] +[:mouse_move, 759, 403, 2, 575, 842] +[:mouse_move, 760, 403, 2, 576, 845] +[:mouse_move, 759, 403, 2, 577, 848] +[:mouse_move, 758, 403, 2, 578, 850] +[:mouse_move, 757, 403, 2, 579, 851] +[:mouse_button_up, 1, 0, 1, 580, 865] +[:mouse_move, 742, 394, 2, 581, 866] +[:mouse_move, 685, 363, 2, 582, 867] +[:mouse_move, 647, 347, 2, 583, 868] +[:mouse_move, 554, 310, 2, 584, 869] +[:mouse_move, 536, 303, 2, 585, 870] +[:mouse_move, 466, 279, 2, 586, 871] +[:mouse_move, 454, 276, 2, 587, 872] +[:mouse_move, 408, 261, 2, 588, 873] +[:mouse_move, 388, 255, 2, 589, 874] +[:mouse_move, 366, 247, 2, 590, 875] +[:mouse_move, 353, 243, 2, 591, 876] +[:mouse_move, 336, 234, 2, 592, 877] +[:mouse_move, 329, 230, 2, 593, 878] +[:mouse_move, 322, 226, 2, 594, 879] +[:mouse_move, 319, 224, 2, 595, 880] +[:mouse_move, 317, 222, 2, 596, 881] +[:mouse_move, 311, 219, 2, 597, 882] +[:mouse_move, 308, 218, 2, 598, 883] +[:mouse_move, 299, 215, 2, 599, 884] +[:mouse_move, 292, 212, 2, 600, 885] +[:mouse_move, 281, 208, 2, 601, 886] +[:mouse_move, 274, 206, 2, 602, 887] +[:mouse_move, 266, 203, 2, 603, 888] +[:mouse_move, 261, 202, 2, 604, 889] +[:mouse_move, 255, 200, 2, 605, 890] +[:mouse_move, 253, 199, 2, 606, 891] +[:mouse_move, 250, 198, 2, 607, 892] +[:mouse_move, 248, 197, 2, 608, 893] +[:mouse_move, 246, 197, 2, 609, 894] +[:mouse_move, 244, 197, 2, 610, 895] +[:mouse_move, 242, 197, 2, 611, 896] +[:mouse_move, 241, 196, 2, 612, 898] +[:mouse_move, 240, 196, 2, 613, 899] +[:mouse_move, 239, 196, 2, 614, 900] +[:mouse_move, 238, 196, 2, 615, 904] +[:mouse_button_pressed, 1, 0, 1, 616, 905] +[:mouse_button_up, 1, 0, 1, 617, 911] +[:mouse_move, 239, 196, 2, 618, 917] +[:mouse_move, 242, 196, 2, 619, 918] +[:mouse_move, 257, 199, 2, 620, 919] +[:mouse_move, 264, 202, 2, 621, 920] +[:mouse_move, 303, 216, 2, 622, 921] +[:mouse_move, 323, 223, 2, 623, 922] +[:mouse_move, 414, 252, 2, 624, 923] +[:mouse_move, 459, 266, 2, 625, 924] +[:mouse_move, 532, 284, 2, 626, 925] +[:mouse_move, 549, 289, 2, 627, 926] +[:mouse_move, 592, 298, 2, 628, 927] +[:mouse_move, 612, 302, 2, 629, 928] +[:mouse_move, 632, 305, 2, 630, 929] +[:mouse_move, 641, 308, 2, 631, 930] +[:mouse_move, 651, 309, 2, 632, 931] +[:mouse_move, 653, 310, 2, 633, 932] +[:mouse_move, 655, 310, 2, 634, 933] +[:mouse_move, 658, 311, 2, 635, 934] +[:mouse_move, 661, 311, 2, 636, 935] +[:mouse_move, 665, 312, 2, 637, 936] +[:mouse_move, 669, 313, 2, 638, 937] +[:mouse_move, 677, 315, 2, 639, 938] +[:mouse_move, 681, 316, 2, 640, 939] +[:mouse_move, 695, 317, 2, 641, 940] +[:mouse_move, 701, 318, 2, 642, 941] +[:mouse_move, 712, 319, 2, 643, 942] +[:mouse_move, 714, 320, 2, 644, 943] +[:mouse_move, 720, 321, 2, 645, 944] +[:mouse_move, 721, 321, 2, 646, 945] +[:mouse_move, 723, 321, 2, 647, 946] +[:key_down_raw, 100, 0, 2, 648, 953] +[:key_up_raw, 100, 0, 2, 649, 962] +[:mouse_move, 722, 321, 2, 650, 967] +[:mouse_move, 720, 320, 2, 651, 969] +[:mouse_move, 720, 319, 2, 652, 971] +[:mouse_move, 719, 319, 2, 653, 972] +[:mouse_move, 719, 318, 2, 654, 973] +[:mouse_move, 718, 318, 2, 655, 979] +[:key_down_raw, 100, 0, 2, 656, 992] +[:mouse_move, 716, 318, 2, 657, 1015] +[:mouse_move, 711, 317, 2, 658, 1016] +[:key_up_raw, 100, 0, 2, 659, 1016] +[:mouse_move, 692, 310, 2, 660, 1017] +[:mouse_move, 678, 304, 2, 661, 1018] +[:mouse_move, 639, 290, 2, 662, 1019] +[:mouse_move, 618, 283, 2, 663, 1020] +[:mouse_move, 587, 273, 2, 664, 1021] +[:mouse_move, 567, 267, 2, 665, 1022] +[:mouse_move, 541, 258, 2, 666, 1023] +[:mouse_move, 529, 254, 2, 667, 1024] +[:mouse_move, 517, 250, 2, 668, 1025] +[:mouse_move, 512, 248, 2, 669, 1026] +[:mouse_move, 505, 245, 2, 670, 1027] +[:mouse_move, 503, 244, 2, 671, 1028] +[:mouse_move, 501, 243, 2, 672, 1029] +[:mouse_move, 500, 243, 2, 673, 1030] +[:mouse_move, 500, 242, 2, 674, 1033] +[:mouse_move, 499, 242, 2, 675, 1034] +[:mouse_move, 498, 242, 2, 676, 1037] +[:mouse_move, 502, 241, 2, 677, 1042] +[:mouse_move, 505, 241, 2, 678, 1043] +[:mouse_move, 511, 241, 2, 679, 1044] +[:mouse_move, 514, 241, 2, 680, 1045] +[:mouse_move, 519, 242, 2, 681, 1046] +[:mouse_move, 520, 242, 2, 682, 1047] +[:mouse_move, 522, 242, 2, 683, 1048] +[:mouse_move, 523, 242, 2, 684, 1050] +[:mouse_move, 524, 241, 2, 685, 1061] +[:mouse_move, 526, 238, 2, 686, 1062] +[:mouse_move, 527, 237, 2, 687, 1063] +[:mouse_move, 529, 236, 2, 688, 1064] +[:mouse_move, 530, 236, 2, 689, 1065] +[:mouse_move, 531, 235, 2, 690, 1066] +[:mouse_move, 531, 236, 2, 691, 1070] +[:mouse_move, 531, 237, 2, 692, 1073] +[:mouse_move, 531, 238, 2, 693, 1081] +[:mouse_move, 531, 239, 2, 694, 1085] +[:mouse_button_pressed, 1, 0, 1, 695, 1104] +[:mouse_move, 534, 239, 2, 696, 1104] +[:mouse_move, 539, 239, 2, 697, 1105] +[:mouse_move, 548, 239, 2, 698, 1106] +[:mouse_move, 554, 239, 2, 699, 1107] +[:mouse_move, 566, 239, 2, 700, 1108] +[:mouse_move, 571, 239, 2, 701, 1109] +[:mouse_move, 584, 240, 2, 702, 1110] +[:mouse_move, 589, 240, 2, 703, 1111] +[:mouse_move, 600, 242, 2, 704, 1112] +[:mouse_move, 605, 242, 2, 705, 1113] +[:mouse_move, 614, 243, 2, 706, 1114] +[:mouse_move, 616, 243, 2, 707, 1115] +[:mouse_move, 626, 244, 2, 708, 1116] +[:mouse_move, 629, 244, 2, 709, 1117] +[:mouse_move, 637, 244, 2, 710, 1118] +[:mouse_move, 640, 244, 2, 711, 1119] +[:mouse_move, 647, 244, 2, 712, 1120] +[:mouse_move, 650, 245, 2, 713, 1121] +[:mouse_move, 654, 245, 2, 714, 1122] +[:mouse_move, 661, 245, 2, 715, 1123] +[:mouse_move, 665, 245, 2, 716, 1124] +[:mouse_move, 672, 245, 2, 717, 1125] +[:mouse_move, 676, 246, 2, 718, 1126] +[:mouse_move, 684, 246, 2, 719, 1127] +[:mouse_move, 688, 246, 2, 720, 1128] +[:mouse_move, 696, 246, 2, 721, 1129] +[:mouse_move, 700, 246, 2, 722, 1130] +[:mouse_move, 704, 247, 2, 723, 1131] +[:mouse_move, 711, 247, 2, 724, 1132] +[:mouse_move, 717, 247, 2, 725, 1133] +[:mouse_move, 718, 247, 2, 726, 1134] +[:mouse_move, 721, 247, 2, 727, 1135] +[:mouse_move, 722, 248, 2, 728, 1137] +[:mouse_move, 720, 252, 2, 729, 1141] +[:mouse_move, 719, 254, 2, 730, 1142] +[:mouse_move, 715, 264, 2, 731, 1143] +[:mouse_move, 712, 270, 2, 732, 1144] +[:mouse_move, 707, 282, 2, 733, 1145] +[:mouse_move, 705, 286, 2, 734, 1146] +[:mouse_move, 701, 294, 2, 735, 1147] +[:mouse_move, 700, 297, 2, 736, 1148] +[:mouse_move, 698, 305, 2, 737, 1149] +[:mouse_move, 698, 308, 2, 738, 1150] +[:mouse_move, 697, 312, 2, 739, 1151] +[:mouse_move, 696, 317, 2, 740, 1152] +[:mouse_move, 696, 320, 2, 741, 1153] +[:mouse_move, 695, 327, 2, 742, 1154] +[:mouse_move, 695, 331, 2, 743, 1155] +[:mouse_move, 695, 338, 2, 744, 1156] +[:mouse_move, 695, 342, 2, 745, 1157] +[:mouse_move, 695, 351, 2, 746, 1158] +[:mouse_move, 695, 356, 2, 747, 1159] +[:mouse_move, 696, 365, 2, 748, 1160] +[:mouse_move, 696, 368, 2, 749, 1161] +[:mouse_move, 696, 374, 2, 750, 1162] +[:mouse_move, 696, 377, 2, 751, 1163] +[:mouse_move, 697, 380, 2, 752, 1164] +[:mouse_move, 697, 383, 2, 753, 1165] +[:mouse_move, 697, 386, 2, 754, 1166] +[:mouse_move, 697, 388, 2, 755, 1167] +[:mouse_move, 697, 391, 2, 756, 1168] +[:mouse_move, 697, 393, 2, 757, 1169] +[:mouse_move, 697, 397, 2, 758, 1170] +[:mouse_move, 697, 399, 2, 759, 1171] +[:mouse_move, 697, 403, 2, 760, 1172] +[:mouse_move, 697, 406, 2, 761, 1173] +[:mouse_move, 697, 411, 2, 762, 1174] +[:mouse_move, 697, 413, 2, 763, 1175] +[:mouse_move, 697, 418, 2, 764, 1176] +[:mouse_move, 697, 420, 2, 765, 1177] +[:mouse_move, 697, 423, 2, 766, 1178] +[:mouse_move, 697, 426, 2, 767, 1179] +[:mouse_move, 697, 428, 2, 768, 1180] +[:mouse_move, 698, 434, 2, 769, 1181] +[:mouse_move, 698, 437, 2, 770, 1182] +[:mouse_move, 698, 442, 2, 771, 1183] +[:mouse_move, 698, 444, 2, 772, 1184] +[:mouse_move, 698, 448, 2, 773, 1185] +[:mouse_move, 698, 449, 2, 774, 1186] +[:mouse_move, 698, 452, 2, 775, 1187] +[:mouse_move, 698, 453, 2, 776, 1189] +[:mouse_move, 698, 454, 2, 777, 1190] +[:mouse_move, 698, 455, 2, 778, 1191] +[:mouse_move, 695, 456, 2, 779, 1193] +[:mouse_move, 692, 456, 2, 780, 1194] +[:mouse_move, 687, 457, 2, 781, 1195] +[:mouse_move, 685, 457, 2, 782, 1196] +[:mouse_move, 678, 458, 2, 783, 1197] +[:mouse_move, 674, 458, 2, 784, 1198] +[:mouse_move, 662, 459, 2, 785, 1199] +[:mouse_move, 653, 459, 2, 786, 1200] +[:mouse_move, 632, 459, 2, 787, 1201] +[:mouse_move, 626, 459, 2, 788, 1202] +[:mouse_move, 610, 460, 2, 789, 1203] +[:mouse_move, 601, 461, 2, 790, 1204] +[:mouse_move, 596, 461, 2, 791, 1205] +[:mouse_move, 585, 462, 2, 792, 1206] +[:mouse_move, 578, 463, 2, 793, 1207] +[:mouse_move, 568, 463, 2, 794, 1208] +[:mouse_move, 561, 464, 2, 795, 1209] +[:mouse_move, 542, 464, 2, 796, 1210] +[:mouse_move, 536, 464, 2, 797, 1211] +[:mouse_move, 524, 464, 2, 798, 1212] +[:mouse_move, 522, 464, 2, 799, 1213] +[:mouse_move, 513, 464, 2, 800, 1214] +[:mouse_move, 509, 464, 2, 801, 1215] +[:mouse_move, 502, 462, 2, 802, 1216] +[:mouse_move, 499, 461, 2, 803, 1217] +[:mouse_move, 492, 460, 2, 804, 1218] +[:mouse_move, 491, 460, 2, 805, 1219] +[:mouse_move, 487, 459, 2, 806, 1220] +[:mouse_move, 486, 459, 2, 807, 1221] +[:mouse_move, 484, 459, 2, 808, 1222] +[:mouse_move, 483, 459, 2, 809, 1223] +[:mouse_move, 482, 459, 2, 810, 1225] +[:mouse_button_up, 1, 0, 1, 811, 1245] +[:mouse_move, 488, 459, 2, 812, 1246] +[:mouse_move, 500, 457, 2, 813, 1247] +[:mouse_move, 505, 453, 2, 814, 1248] +[:mouse_move, 531, 432, 2, 815, 1249] +[:mouse_move, 544, 414, 2, 816, 1250] +[:mouse_move, 570, 363, 2, 817, 1251] +[:mouse_move, 584, 331, 2, 818, 1252] +[:mouse_move, 603, 287, 2, 819, 1253] +[:mouse_move, 615, 264, 2, 820, 1254] +[:mouse_move, 628, 239, 2, 821, 1255] +[:mouse_move, 634, 227, 2, 822, 1256] +[:mouse_move, 641, 217, 2, 823, 1257] +[:mouse_move, 644, 213, 2, 824, 1258] +[:mouse_move, 647, 208, 2, 825, 1259] +[:key_down_raw, 119, 0, 2, 826, 1259] +[:mouse_move, 648, 208, 2, 827, 1260] +[:mouse_move, 648, 207, 2, 828, 1261] +[:mouse_move, 649, 207, 2, 829, 1262] +[:key_down_raw, 119, 0, 2, 830, 1284] +[:key_down_raw, 119, 0, 2, 831, 1286] +[:key_down_raw, 119, 0, 2, 832, 1288] +[:key_down_raw, 119, 0, 2, 833, 1290] +[:mouse_move, 648, 208, 2, 834, 1292] +[:key_down_raw, 119, 0, 2, 835, 1292] +[:mouse_move, 647, 209, 2, 836, 1292] +[:mouse_move, 646, 212, 2, 837, 1293] +[:mouse_move, 642, 218, 2, 838, 1294] +[:key_down_raw, 119, 0, 2, 839, 1294] +[:mouse_move, 636, 223, 2, 840, 1294] +[:mouse_move, 626, 235, 2, 841, 1295] +[:mouse_move, 615, 246, 2, 842, 1296] +[:key_down_raw, 119, 0, 2, 843, 1296] +[:mouse_move, 600, 259, 2, 844, 1296] +[:mouse_move, 583, 273, 2, 845, 1297] +[:mouse_move, 561, 289, 2, 846, 1298] +[:key_down_raw, 119, 0, 2, 847, 1299] +[:mouse_move, 507, 322, 2, 848, 1299] +[:mouse_move, 452, 346, 2, 849, 1300] +[:key_down_raw, 119, 0, 2, 850, 1300] +[:mouse_move, 434, 351, 2, 851, 1300] +[:mouse_move, 399, 361, 2, 852, 1301] +[:mouse_move, 365, 369, 2, 853, 1302] +[:key_down_raw, 119, 0, 2, 854, 1303] +[:mouse_move, 325, 373, 2, 855, 1303] +[:mouse_move, 301, 374, 2, 856, 1304] +[:key_down_raw, 119, 0, 2, 857, 1304] +[:mouse_move, 263, 371, 2, 858, 1305] +[:key_up_raw, 119, 0, 2, 859, 1305] +[:mouse_move, 258, 369, 2, 860, 1306] +[:mouse_move, 242, 360, 2, 861, 1307] +[:mouse_move, 238, 356, 2, 862, 1308] +[:mouse_move, 233, 347, 2, 863, 1309] +[:mouse_move, 232, 343, 2, 864, 1310] +[:mouse_move, 231, 335, 2, 865, 1311] +[:mouse_move, 231, 331, 2, 866, 1312] +[:mouse_move, 231, 324, 2, 867, 1313] +[:mouse_move, 232, 320, 2, 868, 1314] +[:mouse_move, 234, 317, 2, 869, 1315] +[:mouse_move, 236, 309, 2, 870, 1316] +[:mouse_move, 237, 304, 2, 871, 1317] +[:mouse_move, 238, 299, 2, 872, 1318] +[:mouse_move, 239, 296, 2, 873, 1319] +[:mouse_move, 239, 288, 2, 874, 1320] +[:mouse_move, 239, 282, 2, 875, 1321] +[:mouse_move, 238, 281, 2, 876, 1322] +[:mouse_move, 236, 280, 2, 877, 1323] +[:mouse_move, 234, 275, 2, 878, 1324] +[:mouse_move, 231, 272, 2, 879, 1325] +[:mouse_move, 229, 270, 2, 880, 1326] +[:mouse_move, 228, 268, 2, 881, 1327] +[:mouse_move, 226, 265, 2, 882, 1328] +[:mouse_move, 225, 264, 2, 883, 1329] +[:mouse_move, 224, 262, 2, 884, 1330] +[:mouse_move, 224, 261, 2, 885, 1331] +[:mouse_move, 223, 260, 2, 886, 1332] +[:mouse_move, 223, 259, 2, 887, 1333] +[:mouse_button_pressed, 1, 0, 1, 888, 1357] +[:mouse_button_up, 1, 0, 1, 889, 1363] +[:mouse_move, 232, 267, 2, 890, 1374] +[:mouse_move, 245, 276, 2, 891, 1375] +[:mouse_move, 285, 302, 2, 892, 1376] +[:mouse_move, 311, 316, 2, 893, 1377] +[:mouse_move, 373, 343, 2, 894, 1378] +[:mouse_move, 406, 353, 2, 895, 1379] +[:mouse_move, 441, 362, 2, 896, 1380] +[:mouse_move, 461, 367, 2, 897, 1381] +[:mouse_move, 481, 373, 2, 898, 1382] +[:mouse_move, 490, 376, 2, 899, 1383] +[:mouse_move, 501, 383, 2, 900, 1384] +[:mouse_move, 504, 386, 2, 901, 1385] +[:mouse_move, 505, 389, 2, 902, 1386] +[:mouse_move, 505, 392, 2, 903, 1387] +[:mouse_move, 506, 395, 2, 904, 1388] +[:mouse_move, 506, 397, 2, 905, 1389] +[:mouse_move, 506, 399, 2, 906, 1390] +[:mouse_move, 506, 400, 2, 907, 1391] +[:mouse_move, 506, 401, 2, 908, 1392] +[:mouse_move, 503, 401, 2, 909, 1394] +[:mouse_move, 500, 401, 2, 910, 1395] +[:mouse_move, 499, 401, 2, 911, 1396] +[:mouse_move, 493, 400, 2, 912, 1397] +[:mouse_move, 490, 400, 2, 913, 1398] +[:mouse_move, 487, 400, 2, 914, 1399] +[:mouse_move, 486, 400, 2, 915, 1400] +[:mouse_move, 485, 400, 2, 916, 1401] +[:mouse_move, 485, 399, 2, 917, 1414] +[:mouse_move, 485, 398, 2, 918, 1415] +[:mouse_move, 484, 398, 2, 919, 1416] +[:mouse_move, 483, 396, 2, 920, 1417] +[:mouse_move, 481, 395, 2, 921, 1418] +[:mouse_move, 477, 392, 2, 922, 1419] +[:mouse_move, 476, 392, 2, 923, 1420] +[:mouse_move, 472, 391, 2, 924, 1421] +[:mouse_move, 471, 390, 2, 925, 1422] +[:mouse_move, 470, 390, 2, 926, 1423] +[:mouse_move, 468, 390, 2, 927, 1424] +[:mouse_move, 467, 390, 2, 928, 1427] +[:mouse_move, 466, 390, 2, 929, 1430] +[:mouse_move, 466, 391, 2, 930, 1432] +[:mouse_button_pressed, 1, 0, 1, 931, 1446] +[:mouse_move, 471, 391, 2, 932, 1447] +[:mouse_move, 488, 389, 2, 933, 1448] +[:mouse_move, 502, 387, 2, 934, 1449] +[:mouse_move, 527, 384, 2, 935, 1450] +[:mouse_move, 542, 383, 2, 936, 1451] +[:mouse_move, 554, 382, 2, 937, 1452] +[:mouse_move, 583, 381, 2, 938, 1453] +[:mouse_move, 594, 381, 2, 939, 1454] +[:mouse_move, 620, 381, 2, 940, 1455] +[:mouse_move, 631, 383, 2, 941, 1456] +[:mouse_move, 649, 385, 2, 942, 1457] +[:mouse_move, 659, 386, 2, 943, 1458] +[:mouse_move, 676, 388, 2, 944, 1459] +[:mouse_move, 684, 389, 2, 945, 1460] +[:mouse_move, 696, 391, 2, 946, 1461] +[:mouse_move, 701, 391, 2, 947, 1462] +[:mouse_move, 712, 392, 2, 948, 1463] +[:mouse_move, 715, 393, 2, 949, 1464] +[:mouse_move, 723, 393, 2, 950, 1465] +[:mouse_move, 726, 393, 2, 951, 1466] +[:mouse_move, 732, 393, 2, 952, 1467] +[:mouse_move, 745, 393, 2, 953, 1469] +[:mouse_move, 750, 392, 2, 954, 1470] +[:mouse_move, 761, 392, 2, 955, 1471] +[:mouse_move, 767, 392, 2, 956, 1472] +[:mouse_move, 780, 391, 2, 957, 1473] +[:mouse_move, 787, 391, 2, 958, 1474] +[:mouse_move, 799, 391, 2, 959, 1475] +[:mouse_move, 805, 391, 2, 960, 1476] +[:mouse_move, 809, 391, 2, 961, 1477] +[:mouse_move, 817, 391, 2, 962, 1478] +[:mouse_move, 820, 391, 2, 963, 1479] +[:mouse_move, 825, 392, 2, 964, 1480] +[:mouse_move, 827, 392, 2, 965, 1482] +[:mouse_button_up, 1, 0, 1, 966, 1532] +[:mouse_move, 827, 393, 2, 967, 1532] +[:mouse_move, 830, 397, 2, 968, 1533] +[:mouse_move, 833, 408, 2, 969, 1534] +[:mouse_move, 833, 415, 2, 970, 1535] +[:mouse_move, 833, 423, 2, 971, 1536] +[:mouse_move, 833, 428, 2, 972, 1537] +[:mouse_move, 831, 433, 2, 973, 1538] +[:mouse_move, 830, 435, 2, 974, 1539] +[:mouse_move, 828, 437, 2, 975, 1540] +[:mouse_move, 827, 437, 2, 976, 1541] +[:mouse_move, 826, 438, 2, 977, 1542] +[:mouse_move, 826, 439, 2, 978, 1544] +[:key_down_raw, 115, 0, 2, 979, 1550] +[:mouse_move, 826, 440, 2, 980, 1550] +[:key_down_raw, 115, 0, 2, 981, 1575] +[:key_down_raw, 115, 0, 2, 982, 1577] +[:key_down_raw, 115, 0, 2, 983, 1579] +[:key_down_raw, 115, 0, 2, 984, 1581] +[:key_down_raw, 115, 0, 2, 985, 1583] +[:key_down_raw, 115, 0, 2, 986, 1585] +[:key_down_raw, 115, 0, 2, 987, 1587] +[:key_down_raw, 115, 0, 2, 988, 1589] +[:key_down_raw, 115, 0, 2, 989, 1591] +[:key_down_raw, 115, 0, 2, 990, 1593] +[:key_down_raw, 115, 0, 2, 991, 1595] +[:key_up_raw, 115, 0, 2, 992, 1596] +[:mouse_move, 819, 447, 2, 993, 1683] +[:mouse_move, 810, 458, 2, 994, 1684] +[:mouse_move, 786, 484, 2, 995, 1685] +[:mouse_move, 773, 498, 2, 996, 1686] +[:mouse_move, 728, 534, 2, 997, 1687] +[:mouse_move, 699, 556, 2, 998, 1688] +[:mouse_move, 657, 586, 2, 999, 1689] +[:mouse_move, 634, 602, 2, 1000, 1690] +[:mouse_move, 608, 618, 2, 1001, 1691] +[:mouse_move, 595, 626, 2, 1002, 1692] +[:mouse_move, 575, 637, 2, 1003, 1693] +[:mouse_move, 569, 640, 2, 1004, 1694] +[:mouse_move, 563, 643, 2, 1005, 1695] +[:mouse_move, 554, 646, 2, 1006, 1696] +[:mouse_move, 552, 647, 2, 1007, 1697] +[:mouse_move, 546, 648, 2, 1008, 1698] +[:mouse_move, 544, 649, 2, 1009, 1699] +[:mouse_move, 541, 649, 2, 1010, 1700] +[:mouse_move, 540, 649, 2, 1011, 1701] +[:mouse_move, 538, 649, 2, 1012, 1702] +[:mouse_move, 537, 649, 2, 1013, 1703] +[:mouse_move, 535, 649, 2, 1014, 1704] +[:mouse_button_pressed, 1, 0, 1, 1015, 1709] +[:mouse_button_up, 1, 0, 1, 1016, 1716] +[:mouse_move, 536, 649, 2, 1017, 1723] +[:mouse_move, 540, 649, 2, 1018, 1724] +[:mouse_move, 550, 649, 2, 1019, 1725] +[:mouse_move, 567, 649, 2, 1020, 1726] +[:mouse_move, 629, 649, 2, 1021, 1727] +[:mouse_move, 671, 645, 2, 1022, 1728] +[:mouse_move, 800, 633, 2, 1023, 1729] +[:mouse_move, 870, 623, 2, 1024, 1730] +[:mouse_move, 1004, 590, 2, 1025, 1731] +[:mouse_move, 1026, 579, 2, 1026, 1732] +[:mouse_move, 1057, 565, 2, 1027, 1733] +[:mouse_move, 1084, 551, 2, 1028, 1734] +[:mouse_move, 1095, 546, 2, 1029, 1735] +[:key_down_raw, 1073742051, 1024, 2, 1030, 1805] +[:key_down_raw, 113, 1024, 2, 1031, 1810] diff --git a/samples/05_mouse_move_tile_editor/sprites/image1.png b/samples/05_mouse_move_tile_editor/sprites/image1.png Binary files differnew file mode 100644 index 0000000..887277c --- /dev/null +++ b/samples/05_mouse_move_tile_editor/sprites/image1.png diff --git a/samples/05_mouse_move_tile_editor/sprites/image2.png b/samples/05_mouse_move_tile_editor/sprites/image2.png Binary files differnew file mode 100644 index 0000000..71d6110 --- /dev/null +++ b/samples/05_mouse_move_tile_editor/sprites/image2.png diff --git a/samples/05_mouse_move_tile_editor/sprites/image3.png b/samples/05_mouse_move_tile_editor/sprites/image3.png Binary files differnew file mode 100644 index 0000000..841a104 --- /dev/null +++ b/samples/05_mouse_move_tile_editor/sprites/image3.png diff --git a/samples/05_mouse_move_tile_editor/sprites/image4.png b/samples/05_mouse_move_tile_editor/sprites/image4.png Binary files differnew file mode 100644 index 0000000..a2b0bd6 --- /dev/null +++ b/samples/05_mouse_move_tile_editor/sprites/image4.png diff --git a/samples/05_mouse_move_tile_editor/sprites/image5.png b/samples/05_mouse_move_tile_editor/sprites/image5.png Binary files differnew file mode 100644 index 0000000..6aed318 --- /dev/null +++ b/samples/05_mouse_move_tile_editor/sprites/image5.png diff --git a/samples/05_mouse_move_tile_editor/sprites/image6.png b/samples/05_mouse_move_tile_editor/sprites/image6.png Binary files differnew file mode 100644 index 0000000..c8045c8 --- /dev/null +++ b/samples/05_mouse_move_tile_editor/sprites/image6.png diff --git a/samples/06_coordinate_systems/app/main.rb b/samples/06_coordinate_systems/app/main.rb new file mode 100644 index 0000000..fcfa090 --- /dev/null +++ b/samples/06_coordinate_systems/app/main.rb @@ -0,0 +1,80 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - args.inputs.mouse.click.position: Coordinates of the mouse's position on the screen. + Unlike args.inputs.mouse.click.point, the mouse does not need to be pressed down for + position to know the mouse's coordinates. + For more information about the mouse, go to mygame/documentation/07-mouse.md. + + Reminders: + + - args.inputs.mouse.click: This property will be set if the mouse was clicked. + + - args.inputs.mouse.click.point.(x|y): The x and y location of the mouse. + + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + In this sample app, string interpolation is used to show the current position of the mouse + in a label. + + - args.outputs.labels: An array that generates a label. + The parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - args.outputs.solids: An array that generates a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.lines: An array that generates a line. + The parameters are [X, Y, X2, Y2, RED, GREEN, BLUE, ALPHA] + For more information about lines, go to mygame/documentation/04-lines.md. + +=end + +# This sample app shows a coordinate system or grid. The user can move their mouse around the screen and the +# coordinates of their position on the screen will be displayed. Users can choose to view one quadrant or +# four quadrants by pressing the button. + +def tick args + + # The addition and subtraction in the first two parameters of the label and solid + # ensure that the outputs don't overlap each other. Try removing them and see what happens. + pos = args.inputs.mouse.position # stores coordinates of mouse's position + args.outputs.labels << [pos.x + 10, pos.y + 10, "#{pos}"] # outputs label of coordinates + args.outputs.solids << [pos.x - 2, pos.y - 2, 5, 5] # outputs small blackk box placed where mouse is hovering + + button = [0, 0, 370, 50] # sets definition of toggle button + args.outputs.borders << button # outputs button as border (not filled in) + args.outputs.labels << [10, 35, "click here toggle coordinate system"] # label of button + args.outputs.lines << [ 0, -720, 0, 720] # vertical line dividing quadrants + args.outputs.lines << [-1280, 0, 1280, 0] # horizontal line dividing quadrants + + if args.inputs.mouse.click # if the user clicks the mouse + pos = args.inputs.mouse.click.point # pos's value is point where user clicked (coordinates) + if pos.inside_rect? button # if the click occurred inside the button + if args.grid.name == :bottom_left # if the grid shows bottom left as origin + args.grid.origin_center! # origin will be shown in center + else + args.grid.origin_bottom_left! # otherwise, the view will change to show bottom left as origin + end + end + end + + tick_instructions args, "Sample app shows the two supported coordinate systems in Game Toolkit." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/06_coordinate_systems/license-for-sample.txt b/samples/06_coordinate_systems/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/06_coordinate_systems/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/06_coordinate_systems/replay.txt b/samples/06_coordinate_systems/replay.txt new file mode 100644 index 0000000..d426464 --- /dev/null +++ b/samples/06_coordinate_systems/replay.txt @@ -0,0 +1,526 @@ +replay_version 2.0 +stopped_at 1360 +seed 100 +recorded_at Sun Sep 29 22:19:52 2019 +[:mouse_move, 1084, 546, 2, 1, 72] +[:mouse_move, 1074, 545, 2, 2, 73] +[:mouse_move, 1022, 539, 2, 3, 74] +[:mouse_move, 984, 535, 2, 4, 75] +[:mouse_move, 885, 523, 2, 5, 76] +[:mouse_move, 862, 521, 2, 6, 77] +[:mouse_move, 755, 515, 2, 7, 78] +[:mouse_move, 712, 515, 2, 8, 79] +[:mouse_move, 660, 515, 2, 9, 80] +[:mouse_move, 629, 516, 2, 10, 81] +[:mouse_move, 579, 524, 2, 11, 82] +[:mouse_move, 558, 530, 2, 12, 83] +[:mouse_move, 518, 543, 2, 13, 84] +[:mouse_move, 500, 550, 2, 14, 85] +[:mouse_move, 467, 562, 2, 15, 86] +[:mouse_move, 454, 567, 2, 16, 87] +[:mouse_move, 439, 573, 2, 17, 88] +[:mouse_move, 431, 577, 2, 18, 89] +[:mouse_move, 412, 586, 2, 19, 90] +[:mouse_move, 404, 589, 2, 20, 91] +[:mouse_move, 384, 597, 2, 21, 92] +[:mouse_move, 371, 601, 2, 22, 93] +[:mouse_move, 358, 605, 2, 23, 94] +[:mouse_move, 341, 611, 2, 24, 95] +[:mouse_move, 330, 615, 2, 25, 96] +[:mouse_move, 311, 622, 2, 26, 97] +[:mouse_move, 302, 625, 2, 27, 98] +[:mouse_move, 280, 635, 2, 28, 99] +[:mouse_move, 274, 637, 2, 29, 100] +[:mouse_move, 261, 642, 2, 30, 101] +[:mouse_move, 256, 642, 2, 31, 119] +[:mouse_move, 255, 641, 2, 32, 120] +[:mouse_move, 252, 641, 2, 33, 121] +[:mouse_move, 248, 640, 2, 34, 122] +[:mouse_move, 243, 639, 2, 35, 123] +[:mouse_move, 240, 637, 2, 36, 124] +[:mouse_move, 238, 636, 2, 37, 125] +[:mouse_move, 235, 634, 2, 38, 126] +[:mouse_move, 234, 633, 2, 39, 127] +[:mouse_move, 230, 631, 2, 40, 128] +[:mouse_move, 230, 630, 2, 41, 129] +[:mouse_move, 225, 628, 2, 42, 130] +[:mouse_move, 223, 628, 2, 43, 131] +[:mouse_move, 216, 626, 2, 44, 132] +[:mouse_move, 212, 626, 2, 45, 133] +[:mouse_move, 203, 626, 2, 46, 134] +[:mouse_move, 198, 626, 2, 47, 135] +[:mouse_move, 188, 626, 2, 48, 136] +[:mouse_move, 183, 626, 2, 49, 137] +[:mouse_move, 173, 626, 2, 50, 138] +[:mouse_move, 171, 626, 2, 51, 139] +[:mouse_move, 165, 625, 2, 52, 140] +[:mouse_move, 163, 625, 2, 53, 141] +[:mouse_move, 161, 624, 2, 54, 142] +[:mouse_move, 160, 624, 2, 55, 143] +[:mouse_move, 160, 623, 2, 56, 144] +[:mouse_move, 158, 622, 2, 57, 147] +[:mouse_move, 157, 621, 2, 58, 148] +[:mouse_move, 149, 618, 2, 59, 149] +[:mouse_move, 145, 616, 2, 60, 150] +[:mouse_move, 135, 613, 2, 61, 151] +[:mouse_move, 132, 612, 2, 62, 152] +[:mouse_move, 125, 610, 2, 63, 153] +[:mouse_move, 122, 609, 2, 64, 154] +[:mouse_move, 114, 608, 2, 65, 155] +[:mouse_move, 111, 608, 2, 66, 156] +[:mouse_move, 107, 608, 2, 67, 157] +[:mouse_move, 104, 608, 2, 68, 158] +[:mouse_move, 99, 608, 2, 69, 159] +[:mouse_move, 95, 608, 2, 70, 160] +[:mouse_move, 89, 607, 2, 71, 161] +[:mouse_move, 85, 607, 2, 72, 162] +[:mouse_move, 75, 605, 2, 73, 163] +[:mouse_move, 70, 604, 2, 74, 164] +[:mouse_move, 60, 602, 2, 75, 165] +[:mouse_move, 55, 601, 2, 76, 166] +[:mouse_move, 48, 599, 2, 77, 167] +[:mouse_move, 44, 598, 2, 78, 168] +[:mouse_move, 35, 595, 2, 79, 169] +[:mouse_move, 35, 598, 2, 80, 190] +[:mouse_move, 35, 601, 2, 81, 191] +[:mouse_move, 34, 608, 2, 82, 192] +[:mouse_move, 33, 613, 2, 83, 193] +[:mouse_move, 32, 625, 2, 84, 194] +[:mouse_move, 31, 630, 2, 85, 195] +[:mouse_move, 29, 636, 2, 86, 196] +[:mouse_move, 29, 640, 2, 87, 197] +[:mouse_move, 27, 645, 2, 88, 198] +[:mouse_move, 26, 647, 2, 89, 199] +[:mouse_move, 25, 650, 2, 90, 200] +[:mouse_move, 24, 657, 2, 91, 201] +[:mouse_move, 24, 661, 2, 92, 202] +[:mouse_move, 23, 672, 2, 93, 203] +[:mouse_move, 23, 678, 2, 94, 204] +[:mouse_move, 23, 684, 2, 95, 205] +[:mouse_move, 23, 689, 2, 96, 219] +[:mouse_move, 22, 692, 2, 97, 220] +[:mouse_move, 22, 697, 2, 98, 221] +[:mouse_move, 22, 699, 2, 99, 222] +[:mouse_move, 20, 705, 2, 100, 223] +[:mouse_move, 20, 707, 2, 101, 224] +[:mouse_move, 19, 709, 2, 102, 225] +[:mouse_move, 19, 710, 2, 103, 226] +[:mouse_move, 18, 711, 2, 104, 228] +[:mouse_move, 17, 712, 2, 105, 229] +[:mouse_move, 16, 712, 2, 106, 230] +[:mouse_move, 15, 712, 2, 107, 231] +[:mouse_move, 14, 713, 2, 108, 232] +[:mouse_move, 13, 714, 2, 109, 233] +[:mouse_move, 12, 714, 2, 110, 234] +[:mouse_move, 10, 715, 2, 111, 236] +[:mouse_move, 8, 715, 2, 112, 238] +[:mouse_move, 6, 715, 2, 113, 240] +[:mouse_move, 5, 715, 2, 114, 241] +[:mouse_move, 4, 714, 2, 115, 242] +[:mouse_move, 3, 713, 2, 116, 243] +[:mouse_move, 3, 712, 2, 117, 244] +[:mouse_move, 2, 712, 2, 118, 245] +[:mouse_move, 2, 711, 2, 119, 246] +[:mouse_move, 2, 710, 2, 120, 249] +[:mouse_move, 2, 709, 2, 121, 261] +[:mouse_move, 3, 709, 2, 122, 262] +[:mouse_move, 3, 710, 2, 123, 275] +[:mouse_move, 4, 710, 2, 124, 292] +[:mouse_move, 5, 710, 2, 125, 296] +[:mouse_move, 6, 710, 2, 126, 302] +[:mouse_move, 5, 710, 2, 127, 336] +[:mouse_move, 5, 711, 2, 128, 339] +[:mouse_move, 4, 711, 2, 129, 342] +[:mouse_move, 3, 711, 2, 130, 347] +[:mouse_move, 3, 712, 2, 131, 350] +[:mouse_move, 3, 713, 2, 132, 355] +[:mouse_move, 3, 714, 2, 133, 359] +[:mouse_move, 9, 713, 2, 134, 394] +[:mouse_move, 19, 712, 2, 135, 395] +[:mouse_move, 24, 711, 2, 136, 396] +[:mouse_move, 30, 711, 2, 137, 397] +[:mouse_move, 41, 710, 2, 138, 398] +[:mouse_move, 46, 710, 2, 139, 399] +[:mouse_move, 55, 710, 2, 140, 400] +[:mouse_move, 57, 710, 2, 141, 401] +[:mouse_move, 63, 709, 2, 142, 402] +[:mouse_move, 66, 709, 2, 143, 403] +[:mouse_move, 69, 709, 2, 144, 404] +[:mouse_move, 70, 708, 2, 145, 405] +[:mouse_move, 71, 708, 2, 146, 406] +[:mouse_move, 72, 708, 2, 147, 408] +[:mouse_move, 73, 707, 2, 148, 410] +[:mouse_move, 74, 707, 2, 149, 413] +[:mouse_move, 75, 707, 2, 150, 414] +[:mouse_move, 75, 706, 2, 151, 415] +[:mouse_move, 76, 706, 2, 152, 416] +[:mouse_move, 77, 706, 2, 153, 417] +[:mouse_move, 78, 705, 2, 154, 420] +[:mouse_button_pressed, 1, 0, 1, 155, 433] +[:mouse_button_up, 1, 0, 1, 156, 439] +[:mouse_move, 86, 704, 2, 157, 464] +[:mouse_move, 95, 702, 2, 158, 465] +[:mouse_move, 117, 697, 2, 159, 466] +[:mouse_move, 144, 690, 2, 160, 467] +[:mouse_move, 210, 668, 2, 161, 468] +[:mouse_move, 246, 654, 2, 162, 469] +[:mouse_move, 319, 621, 2, 163, 470] +[:mouse_move, 352, 605, 2, 164, 471] +[:mouse_move, 384, 590, 2, 165, 472] +[:mouse_move, 423, 571, 2, 166, 473] +[:mouse_move, 442, 562, 2, 167, 474] +[:mouse_move, 473, 544, 2, 168, 475] +[:mouse_move, 484, 535, 2, 169, 476] +[:mouse_move, 497, 523, 2, 170, 477] +[:mouse_move, 505, 516, 2, 171, 478] +[:mouse_move, 514, 505, 2, 172, 479] +[:mouse_move, 520, 500, 2, 173, 480] +[:mouse_move, 528, 490, 2, 174, 481] +[:mouse_move, 531, 486, 2, 175, 482] +[:mouse_move, 538, 479, 2, 176, 483] +[:mouse_move, 541, 475, 2, 177, 484] +[:mouse_move, 551, 461, 2, 178, 485] +[:mouse_move, 555, 453, 2, 179, 486] +[:mouse_move, 567, 432, 2, 180, 487] +[:mouse_move, 575, 421, 2, 181, 488] +[:mouse_move, 594, 392, 2, 182, 489] +[:mouse_move, 603, 380, 2, 183, 490] +[:mouse_move, 616, 363, 2, 184, 491] +[:mouse_move, 619, 360, 2, 185, 492] +[:mouse_move, 627, 351, 2, 186, 493] +[:mouse_move, 629, 349, 2, 187, 494] +[:mouse_move, 631, 349, 2, 188, 507] +[:mouse_move, 632, 350, 2, 189, 508] +[:mouse_move, 633, 350, 2, 190, 509] +[:mouse_move, 633, 351, 2, 191, 510] +[:mouse_move, 634, 351, 2, 192, 511] +[:mouse_move, 634, 352, 2, 193, 513] +[:mouse_move, 635, 353, 2, 194, 514] +[:mouse_move, 636, 354, 2, 195, 515] +[:mouse_move, 636, 356, 2, 196, 516] +[:mouse_move, 637, 356, 2, 197, 517] +[:mouse_move, 637, 357, 2, 198, 518] +[:mouse_move, 638, 357, 2, 199, 520] +[:mouse_move, 638, 358, 2, 200, 521] +[:mouse_move, 639, 358, 2, 201, 523] +[:mouse_move, 639, 359, 2, 202, 531] +[:mouse_move, 640, 359, 2, 203, 537] +[:mouse_move, 640, 360, 2, 204, 545] +[:mouse_move, 641, 360, 2, 205, 547] +[:mouse_move, 641, 361, 2, 206, 550] +[:mouse_move, 641, 360, 2, 207, 573] +[:mouse_move, 640, 360, 2, 208, 617] +[:mouse_move, 639, 360, 2, 209, 623] +[:mouse_move, 638, 360, 2, 210, 626] +[:mouse_move, 639, 360, 2, 211, 648] +[:mouse_move, 640, 360, 2, 212, 664] +[:mouse_move, 639, 360, 2, 213, 792] +[:mouse_move, 636, 361, 2, 214, 793] +[:mouse_move, 617, 369, 2, 215, 794] +[:mouse_move, 599, 375, 2, 216, 795] +[:mouse_move, 524, 405, 2, 217, 796] +[:mouse_move, 486, 421, 2, 218, 797] +[:mouse_move, 467, 431, 2, 219, 798] +[:mouse_move, 394, 468, 2, 220, 799] +[:mouse_move, 361, 484, 2, 221, 800] +[:mouse_move, 324, 502, 2, 222, 801] +[:mouse_move, 304, 512, 2, 223, 802] +[:mouse_move, 285, 522, 2, 224, 803] +[:mouse_move, 273, 528, 2, 225, 804] +[:mouse_move, 257, 536, 2, 226, 805] +[:mouse_move, 251, 538, 2, 227, 806] +[:mouse_move, 240, 543, 2, 228, 807] +[:mouse_move, 236, 545, 2, 229, 808] +[:mouse_move, 227, 549, 2, 230, 809] +[:mouse_move, 223, 551, 2, 231, 810] +[:mouse_move, 212, 557, 2, 232, 811] +[:mouse_move, 205, 560, 2, 233, 812] +[:mouse_move, 193, 565, 2, 234, 813] +[:mouse_move, 187, 568, 2, 235, 814] +[:mouse_move, 173, 574, 2, 236, 815] +[:mouse_move, 165, 577, 2, 237, 816] +[:mouse_move, 151, 583, 2, 238, 817] +[:mouse_move, 139, 590, 2, 239, 818] +[:mouse_move, 124, 600, 2, 240, 819] +[:mouse_move, 115, 606, 2, 241, 820] +[:mouse_move, 103, 617, 2, 242, 821] +[:mouse_move, 96, 623, 2, 243, 822] +[:mouse_move, 85, 636, 2, 244, 823] +[:mouse_move, 80, 641, 2, 245, 824] +[:mouse_move, 78, 644, 2, 246, 825] +[:mouse_move, 71, 653, 2, 247, 826] +[:mouse_move, 67, 659, 2, 248, 827] +[:mouse_move, 64, 665, 2, 249, 828] +[:mouse_move, 63, 668, 2, 250, 829] +[:mouse_move, 61, 672, 2, 251, 830] +[:mouse_move, 60, 675, 2, 252, 831] +[:mouse_move, 59, 678, 2, 253, 832] +[:mouse_move, 59, 680, 2, 254, 833] +[:mouse_move, 58, 682, 2, 255, 834] +[:mouse_move, 58, 683, 2, 256, 835] +[:mouse_move, 57, 684, 2, 257, 836] +[:mouse_move, 57, 685, 2, 258, 837] +[:mouse_move, 57, 686, 2, 259, 838] +[:mouse_move, 56, 686, 2, 260, 839] +[:mouse_move, 55, 687, 2, 261, 840] +[:mouse_move, 54, 688, 2, 262, 841] +[:mouse_move, 50, 689, 2, 263, 842] +[:mouse_move, 48, 689, 2, 264, 843] +[:mouse_move, 43, 690, 2, 265, 844] +[:mouse_move, 41, 691, 2, 266, 845] +[:mouse_move, 36, 692, 2, 267, 846] +[:mouse_move, 34, 692, 2, 268, 847] +[:mouse_move, 31, 693, 2, 269, 848] +[:mouse_move, 30, 693, 2, 270, 849] +[:mouse_move, 28, 694, 2, 271, 850] +[:mouse_move, 27, 694, 2, 272, 853] +[:mouse_move, 26, 695, 2, 273, 855] +[:mouse_move, 25, 696, 2, 274, 858] +[:mouse_move, 25, 697, 2, 275, 859] +[:mouse_move, 25, 698, 2, 276, 861] +[:mouse_move, 24, 699, 2, 277, 863] +[:mouse_move, 24, 700, 2, 278, 865] +[:mouse_move, 24, 701, 2, 279, 867] +[:mouse_move, 24, 702, 2, 280, 869] +[:mouse_move, 23, 703, 2, 281, 872] +[:mouse_move, 23, 704, 2, 282, 875] +[:mouse_move, 22, 704, 2, 283, 878] +[:mouse_move, 23, 704, 2, 284, 925] +[:mouse_move, 24, 703, 2, 285, 928] +[:mouse_move, 27, 702, 2, 286, 929] +[:mouse_move, 33, 699, 2, 287, 930] +[:mouse_move, 62, 686, 2, 288, 931] +[:mouse_move, 101, 668, 2, 289, 932] +[:mouse_move, 186, 626, 2, 290, 933] +[:mouse_move, 242, 597, 2, 291, 934] +[:mouse_move, 344, 544, 2, 292, 935] +[:mouse_move, 451, 486, 2, 293, 936] +[:mouse_move, 518, 450, 2, 294, 937] +[:mouse_move, 602, 404, 2, 295, 938] +[:mouse_move, 647, 378, 2, 296, 939] +[:mouse_move, 716, 337, 2, 297, 940] +[:mouse_move, 744, 321, 2, 298, 941] +[:mouse_move, 776, 300, 2, 299, 942] +[:mouse_move, 783, 295, 2, 300, 943] +[:mouse_move, 808, 276, 2, 301, 944] +[:mouse_move, 817, 268, 2, 302, 945] +[:mouse_move, 836, 248, 2, 303, 946] +[:mouse_move, 840, 244, 2, 304, 947] +[:mouse_move, 853, 229, 2, 305, 948] +[:mouse_move, 859, 223, 2, 306, 949] +[:mouse_move, 868, 214, 2, 307, 950] +[:mouse_move, 872, 211, 2, 308, 951] +[:mouse_move, 878, 206, 2, 309, 952] +[:mouse_move, 880, 205, 2, 310, 953] +[:mouse_move, 882, 204, 2, 311, 954] +[:mouse_move, 883, 204, 2, 312, 956] +[:mouse_move, 882, 208, 2, 313, 958] +[:mouse_move, 880, 211, 2, 314, 959] +[:mouse_move, 875, 219, 2, 315, 960] +[:mouse_move, 872, 223, 2, 316, 961] +[:mouse_move, 865, 231, 2, 317, 962] +[:mouse_move, 850, 243, 2, 318, 963] +[:mouse_move, 843, 249, 2, 319, 964] +[:mouse_move, 830, 260, 2, 320, 965] +[:mouse_move, 822, 265, 2, 321, 966] +[:mouse_move, 811, 276, 2, 322, 967] +[:mouse_move, 807, 281, 2, 323, 968] +[:mouse_move, 799, 290, 2, 324, 969] +[:mouse_move, 796, 295, 2, 325, 970] +[:mouse_move, 792, 303, 2, 326, 971] +[:mouse_move, 790, 307, 2, 327, 972] +[:mouse_move, 788, 313, 2, 328, 973] +[:mouse_move, 787, 316, 2, 329, 974] +[:mouse_move, 786, 318, 2, 330, 975] +[:mouse_move, 786, 319, 2, 331, 976] +[:mouse_move, 786, 320, 2, 332, 978] +[:mouse_move, 785, 320, 2, 333, 989] +[:mouse_move, 785, 321, 2, 334, 990] +[:mouse_move, 784, 322, 2, 335, 991] +[:mouse_move, 783, 324, 2, 336, 992] +[:mouse_move, 782, 325, 2, 337, 993] +[:mouse_move, 781, 326, 2, 338, 994] +[:mouse_move, 781, 327, 2, 339, 995] +[:mouse_button_pressed, 1, 0, 1, 340, 998] +[:mouse_button_up, 1, 0, 1, 341, 1006] +[:mouse_move, 771, 327, 2, 342, 1023] +[:mouse_move, 761, 330, 2, 343, 1024] +[:mouse_move, 704, 344, 2, 344, 1025] +[:mouse_move, 667, 355, 2, 345, 1026] +[:mouse_move, 578, 386, 2, 346, 1027] +[:mouse_move, 532, 407, 2, 347, 1028] +[:mouse_move, 468, 440, 2, 348, 1029] +[:mouse_move, 428, 462, 2, 349, 1030] +[:mouse_move, 360, 505, 2, 350, 1031] +[:mouse_move, 330, 523, 2, 351, 1032] +[:mouse_move, 296, 548, 2, 352, 1033] +[:mouse_move, 275, 564, 2, 353, 1034] +[:mouse_move, 239, 594, 2, 354, 1035] +[:mouse_move, 223, 609, 2, 355, 1036] +[:mouse_move, 194, 634, 2, 356, 1037] +[:mouse_move, 180, 647, 2, 357, 1038] +[:mouse_move, 155, 669, 2, 358, 1039] +[:mouse_move, 143, 680, 2, 359, 1040] +[:mouse_move, 135, 686, 2, 360, 1041] +[:mouse_move, 129, 690, 2, 361, 1042] +[:mouse_move, 119, 690, 2, 362, 1056] +[:mouse_move, 113, 690, 2, 363, 1057] +[:mouse_move, 94, 690, 2, 364, 1058] +[:mouse_move, 89, 690, 2, 365, 1059] +[:mouse_move, 72, 691, 2, 366, 1060] +[:mouse_move, 65, 691, 2, 367, 1061] +[:mouse_move, 57, 691, 2, 368, 1062] +[:mouse_move, 49, 691, 2, 369, 1063] +[:mouse_move, 41, 691, 2, 370, 1064] +[:mouse_move, 38, 691, 2, 371, 1065] +[:mouse_move, 33, 692, 2, 372, 1066] +[:mouse_move, 30, 693, 2, 373, 1067] +[:mouse_move, 22, 695, 2, 374, 1068] +[:mouse_move, 20, 697, 2, 375, 1069] +[:mouse_move, 17, 699, 2, 376, 1070] +[:mouse_move, 14, 702, 2, 377, 1071] +[:mouse_move, 12, 704, 2, 378, 1072] +[:mouse_move, 10, 706, 2, 379, 1073] +[:mouse_move, 9, 707, 2, 380, 1074] +[:mouse_move, 7, 710, 2, 381, 1075] +[:mouse_move, 6, 712, 2, 382, 1076] +[:mouse_move, 5, 714, 2, 383, 1077] +[:mouse_move, 5, 716, 2, 384, 1078] +[:mouse_move, 4, 718, 2, 385, 1079] +[:mouse_move, 4, 719, 2, 386, 1080] +[:mouse_move, 4, 719, 2, 387, 1081] +[:mouse_move, 5, 719, 2, 388, 1099] +[:mouse_move, 5, 718, 2, 389, 1099] +[:mouse_move, 6, 717, 2, 390, 1100] +[:mouse_move, 7, 715, 2, 391, 1101] +[:mouse_move, 7, 714, 2, 392, 1102] +[:mouse_move, 8, 713, 2, 393, 1103] +[:mouse_move, 9, 713, 2, 394, 1106] +[:mouse_move, 8, 713, 2, 395, 1118] +[:mouse_move, 20, 706, 2, 396, 1138] +[:mouse_move, 45, 692, 2, 397, 1139] +[:mouse_move, 77, 672, 2, 398, 1140] +[:mouse_move, 213, 586, 2, 399, 1141] +[:mouse_move, 285, 539, 2, 400, 1142] +[:mouse_move, 393, 465, 2, 401, 1143] +[:mouse_move, 460, 422, 2, 402, 1144] +[:mouse_move, 535, 375, 2, 403, 1145] +[:mouse_move, 577, 352, 2, 404, 1146] +[:mouse_move, 619, 330, 2, 405, 1147] +[:mouse_move, 642, 317, 2, 406, 1148] +[:mouse_move, 665, 304, 2, 407, 1149] +[:mouse_move, 678, 297, 2, 408, 1150] +[:mouse_move, 695, 287, 2, 409, 1151] +[:mouse_move, 702, 282, 2, 410, 1152] +[:mouse_move, 708, 280, 2, 411, 1153] +[:mouse_move, 713, 277, 2, 412, 1153] +[:mouse_move, 719, 275, 2, 413, 1154] +[:mouse_move, 724, 273, 2, 414, 1155] +[:mouse_move, 730, 272, 2, 415, 1155] +[:mouse_move, 735, 270, 2, 416, 1156] +[:mouse_move, 740, 269, 2, 417, 1157] +[:mouse_move, 746, 268, 2, 418, 1157] +[:mouse_move, 752, 266, 2, 419, 1158] +[:mouse_move, 763, 264, 2, 420, 1159] +[:mouse_move, 771, 261, 2, 421, 1159] +[:mouse_move, 779, 259, 2, 422, 1160] +[:mouse_move, 791, 255, 2, 423, 1161] +[:mouse_move, 812, 245, 2, 424, 1161] +[:mouse_move, 821, 241, 2, 425, 1162] +[:mouse_move, 837, 232, 2, 426, 1163] +[:mouse_move, 863, 214, 2, 427, 1163] +[:mouse_move, 872, 209, 2, 428, 1178] +[:mouse_move, 881, 203, 2, 429, 1179] +[:mouse_move, 890, 198, 2, 430, 1180] +[:mouse_move, 901, 192, 2, 431, 1180] +[:mouse_move, 913, 187, 2, 432, 1181] +[:mouse_move, 926, 181, 2, 433, 1182] +[:mouse_move, 950, 169, 2, 434, 1182] +[:mouse_move, 975, 157, 2, 435, 1183] +[:mouse_move, 986, 151, 2, 436, 1184] +[:mouse_move, 994, 147, 2, 437, 1184] +[:mouse_move, 1009, 138, 2, 438, 1185] +[:mouse_move, 1024, 129, 2, 439, 1186] +[:mouse_move, 1035, 122, 2, 440, 1186] +[:mouse_move, 1051, 110, 2, 441, 1187] +[:mouse_move, 1061, 104, 2, 442, 1188] +[:mouse_move, 1069, 98, 2, 443, 1188] +[:mouse_move, 1073, 95, 2, 444, 1189] +[:mouse_move, 1081, 90, 2, 445, 1190] +[:mouse_move, 1086, 86, 2, 446, 1190] +[:mouse_move, 1088, 84, 2, 447, 1191] +[:mouse_move, 1097, 79, 2, 448, 1192] +[:mouse_move, 1101, 76, 2, 449, 1192] +[:mouse_move, 1105, 74, 2, 450, 1193] +[:mouse_move, 1110, 73, 2, 451, 1194] +[:mouse_move, 1112, 72, 2, 452, 1194] +[:mouse_move, 1118, 70, 2, 453, 1195] +[:mouse_move, 1119, 70, 2, 454, 1196] +[:mouse_move, 1124, 68, 2, 455, 1197] +[:mouse_move, 1127, 67, 2, 456, 1198] +[:mouse_move, 1131, 66, 2, 457, 1199] +[:mouse_move, 1132, 65, 2, 458, 1200] +[:mouse_move, 1133, 64, 2, 459, 1201] +[:mouse_move, 1134, 64, 2, 460, 1201] +[:mouse_move, 1134, 63, 2, 461, 1203] +[:mouse_move, 1132, 62, 2, 462, 1204] +[:mouse_move, 1127, 62, 2, 463, 1205] +[:mouse_move, 1124, 62, 2, 464, 1206] +[:mouse_move, 1120, 62, 2, 465, 1207] +[:mouse_move, 1116, 62, 2, 466, 1207] +[:mouse_move, 1111, 62, 2, 467, 1208] +[:mouse_move, 1109, 62, 2, 468, 1209] +[:mouse_move, 1105, 62, 2, 469, 1209] +[:mouse_move, 1103, 63, 2, 470, 1210] +[:mouse_move, 1100, 63, 2, 471, 1211] +[:mouse_move, 1097, 64, 2, 472, 1211] +[:mouse_move, 1096, 64, 2, 473, 1212] +[:mouse_move, 1095, 65, 2, 474, 1213] +[:mouse_move, 1094, 65, 2, 475, 1213] +[:mouse_move, 1093, 65, 2, 476, 1214] +[:mouse_move, 1092, 65, 2, 477, 1216] +[:mouse_move, 1092, 64, 2, 478, 1217] +[:mouse_move, 1091, 63, 2, 479, 1218] +[:mouse_move, 1089, 61, 2, 480, 1219] +[:mouse_move, 1087, 60, 2, 481, 1219] +[:mouse_move, 1085, 59, 2, 482, 1220] +[:mouse_move, 1083, 58, 2, 483, 1221] +[:mouse_move, 1081, 57, 2, 484, 1221] +[:mouse_move, 1079, 56, 2, 485, 1222] +[:mouse_move, 1078, 55, 2, 486, 1223] +[:mouse_move, 1077, 54, 2, 487, 1223] +[:mouse_move, 1076, 54, 2, 488, 1224] +[:mouse_move, 1076, 53, 2, 489, 1225] +[:mouse_move, 1076, 52, 2, 490, 1226] +[:mouse_move, 1076, 51, 2, 491, 1227] +[:mouse_move, 1077, 51, 2, 492, 1228] +[:mouse_move, 1078, 50, 2, 493, 1229] +[:mouse_move, 1079, 50, 2, 494, 1230] +[:mouse_move, 1081, 49, 2, 495, 1231] +[:mouse_move, 1084, 48, 2, 496, 1232] +[:mouse_move, 1085, 48, 2, 497, 1233] +[:mouse_move, 1087, 47, 2, 498, 1234] +[:mouse_move, 1089, 46, 2, 499, 1234] +[:mouse_move, 1092, 45, 2, 500, 1235] +[:mouse_move, 1092, 44, 2, 501, 1236] +[:mouse_move, 1095, 44, 2, 502, 1236] +[:mouse_move, 1097, 43, 2, 503, 1237] +[:mouse_move, 1099, 42, 2, 504, 1238] +[:mouse_move, 1100, 42, 2, 505, 1238] +[:mouse_move, 1102, 41, 2, 506, 1239] +[:mouse_move, 1103, 41, 2, 507, 1240] +[:mouse_move, 1105, 41, 2, 508, 1240] +[:mouse_move, 1107, 40, 2, 509, 1241] +[:mouse_move, 1110, 40, 2, 510, 1242] +[:mouse_move, 1111, 40, 2, 511, 1242] +[:mouse_move, 1113, 40, 2, 512, 1243] +[:mouse_move, 1114, 40, 2, 513, 1244] +[:mouse_move, 1117, 40, 2, 514, 1244] +[:mouse_move, 1118, 40, 2, 515, 1245] +[:mouse_move, 1119, 40, 2, 516, 1246] +[:mouse_move, 1121, 40, 2, 517, 1246] +[:mouse_move, 1122, 40, 2, 518, 1248] +[:mouse_move, 1123, 40, 2, 519, 1249] +[:mouse_move, 1123, 41, 2, 520, 1250] +[:key_down_raw, 1073742051, 1024, 2, 521, 1356] +[:key_down_raw, 113, 1024, 2, 522, 1359] diff --git a/samples/07_render_targets/app/main.rb b/samples/07_render_targets/app/main.rb new file mode 100644 index 0000000..8670453 --- /dev/null +++ b/samples/07_render_targets/app/main.rb @@ -0,0 +1,52 @@ +def tick args + # args.outputs.render_targets are really really powerful. + # They essentially allow you to create a sprite programmatically and cache the result. + + # Create a render_target of a :block and a :gradient on tick zero. + if args.state.tick_count == 0 + args.render_target(:block).solids << [0, 0, 1280, 100] + + # The gradient is actually just a collection of black solids with increasing + # opacities. + args.render_target(:gradient).solids << 90.map_with_index do |x| + 50.map_with_index do |y| + [x * 15, y * 15, 15, 15, 0, 0, 0, (x * 3).fdiv(255) * 255] + end + end + end + + # Take the :block render_target and present it horizontally centered. + # Use a subsection of the render_targetd specified by source_x, + # source_y, source_w, source_h. + args.outputs.sprites << { x: 0, + y: 310, + w: 1280, + h: 100, + path: :block, + source_x: 0, + source_y: 0, + source_w: 1280, + source_h: 100 } + + # After rendering :block, render gradient on top of :block. + args.outputs.sprites << [0, 0, 1280, 720, :gradient] + + args.outputs.labels << [1270, 710, args.gtk.current_framerate, 0, 2, 255, 255, 255] + tick_instructions args, "Sample app shows how to use render_targets (programmatically create cached sprites)." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end + +$gtk.reset diff --git a/samples/07_render_targets_advanced/app/main.rb b/samples/07_render_targets_advanced/app/main.rb new file mode 100644 index 0000000..2caec43 --- /dev/null +++ b/samples/07_render_targets_advanced/app/main.rb @@ -0,0 +1,95 @@ +# This sample is meant to show you how to do that dripping transition thing +# at the start of the original Doom. Most of this file is here to animate +# a scene to wipe away; the actual wipe effect is in the last 20 lines or +# so. + +$gtk.reset # reset all game state if reloaded. + +def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance + numblocks = 10 + + for i in 1..numblocks do + angle = ((360 / numblocks) * i) + angleoffset + radians = angle * (Math::PI / 180) + x = (xoffset + (distance * Math.cos(radians))).round + y = (yoffset + (distance * Math.sin(radians))).round + pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ] + end +end + +def draw_scene args, pass + pass.solids << [0, 360, 1280, 360, 0, 0, 200] + pass.solids << [0, 0, 1280, 360, 0, 127, 0] + + blocksize = 100 + angleoffset = args.state.tick_count * 2.5 + centerx = (1280 - blocksize) / 2 + centery = (720 - blocksize) / 2 + + circle_of_blocks pass, centerx, centery, angleoffset, blocksize * 2, 500 + circle_of_blocks pass, centerx, centery, angleoffset, blocksize, 325 + circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 2, 200 + circle_of_blocks pass, centerx, centery, angleoffset, blocksize / 4, 100 +end + +def tick args + segments = 160 + + # On the first tick, initialize some stuff. + if !args.state.yoffsets + args.state.baseyoff = 0 + args.state.yoffsets = [] + for i in 0..segments do + args.state.yoffsets << rand * 100 + end + end + + # Just draw some random stuff for a few seconds. + args.state.static_debounce ||= 60 * 2.5 + if args.state.static_debounce > 0 + last_frame = args.state.static_debounce == 1 + target = last_frame ? args.render_target(:last_frame) : args.outputs + draw_scene args, target + args.state.static_debounce -= 1 + return unless last_frame + end + + # build up the wipe... + + # this is the thing we're wiping to. + args.outputs.sprites << [ 0, 0, 1280, 720, 'dragonruby.png' ] + + return if (args.state.baseyoff > (1280 + 100)) # stop when done sliding + + segmentw = 1280 / segments + + x = 0 + for i in 0..segments do + yoffset = 0 + if args.state.yoffsets[i] < args.state.baseyoff + yoffset = args.state.baseyoff - args.state.yoffsets[i] + end + + # (720 - yoffset) flips the coordinate system, (- 720) adjusts for the height of the segment. + args.outputs.sprites << [ x, (720 - yoffset) - 720, segmentw, 720, 'last_frame', 0, 255, 255, 255, 255, x, 0, segmentw, 720 ] + x += segmentw + end + + args.state.baseyoff += 4 + + tick_instructions args, "Sample app shows an advanced usage of render_target." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/07_render_targets_advanced/license-for-sample.txt b/samples/07_render_targets_advanced/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/07_render_targets_advanced/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/08_platformer_collisions/app/main.rb b/samples/08_platformer_collisions/app/main.rb new file mode 100644 index 0000000..af85fef --- /dev/null +++ b/samples/08_platformer_collisions/app/main.rb @@ -0,0 +1,337 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - first: Returns the first element of the array. + For example, if we have an array + numbers = [1, 2, 3, 4, 5] + and we call first by saying + numbers.first + the number 1 will be returned because it is the first element of the numbers array. + + - num1.idiv(num2): Divides two numbers and returns an integer. + For example, + 16.idiv(3) = 5, because 16 / 3 is 5.33333 returned as an integer. + 16.idiv(4) = 4, because 16 / 4 is 4 and already has no decimal. + + Reminders: + + - find_all: Finds all values that satisfy specific requirements. + + - ARRAY#intersect_rect?: An array with at least four values is + considered a rect. The intersect_rect? function returns true + or false depending on if the two rectangles intersect. + + - reject: Removes elements from a collection if they meet certain requirements. + +=end + +# This sample app allows users to create tiles and place them anywhere on the screen as obstacles. +# The player can then move and maneuver around them. + +class PoorManPlatformerPhysics + attr_accessor :grid, :inputs, :state, :outputs + + # Calls all methods necessary for the app to run successfully. + def tick + defaults + render + calc + process_inputs + end + + # Sets default values for variables. + # The ||= sign means that the variable will only be set to the value following the = sign if the value has + # not already been set before. Intialization happens only in the first frame. + def defaults + state.tile_size = 64 + state.gravity = -0.2 + state.previous_tile_size ||= state.tile_size + state.x ||= 0 + state.y ||= 800 + state.dy ||= 0 + state.dx ||= 0 + state.world ||= [] + state.world_lookup ||= {} + state.world_collision_rects ||= [] + end + + # Outputs solids and borders of different colors for the world and collision_rects collections. + def render + + # Sets a black background on the screen (Comment this line out and the background will become white.) + # Also note that black is the default color for when no color is assigned. + outputs.solids << grid.rect + + # The position, size, and color (white) are set for borders given to the world collection. + # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters. + outputs.borders << state.world.map do |x, y| + [x * state.tile_size, + y * state.tile_size, + state.tile_size, + state.tile_size, 255, 255, 255] + end + + # The top, bottom, and sides of the borders for collision_rects are different colors. + outputs.borders << state.world_collision_rects.map do |e| + [ + [e[:top], 0, 170, 0], # top is a shade of green + [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue + [e[:left_right], 170, 0, 0], # left and right are a shade of red + ] + end + + # Sets the position, size, and color (a shade of green) of the borders of only the player's + # box and outputs it. If you change the 180 to 0, the player's box will be black and you + # won't be able to see it (because it will match the black background). + outputs.borders << [state.x, + state.y, + state.tile_size, + state.tile_size, 0, 180, 0] + end + + # Calls methods needed to perform calculations. + def calc + calc_world_lookup + calc_player + end + + # Performs calculations on world_lookup and sets values. + def calc_world_lookup + + # If the tile size isn't equal to the previous tile size, + # the previous tile size is set to the tile size, + # and world_lookup hash is set to empty. + if state.tile_size != state.previous_tile_size + state.previous_tile_size = state.tile_size + state.world_lookup = {} # empty hash + end + + # return if the world_lookup hash has keys (or, in other words, is not empty) + # return unless the world collection has values inside of it (or is not empty) + return if state.world_lookup.keys.length > 0 + return unless state.world.length > 0 + + # Starts with an empty hash for world_lookup. + # Searches through the world and finds the coordinates that exist. + state.world_lookup = {} + state.world.each { |x, y| state.world_lookup[[x, y]] = true } + + # Assigns world_collision_rects for every sprite drawn. + state.world_collision_rects = + state.world_lookup + .keys + .map do |coord_x, coord_y| + s = state.tile_size + # multiply by tile size so the grid coordinates; sets pixel value + # don't forget that position is denoted by bottom left corner + # set x = coord_x or y = coord_y and see what happens! + x = s * coord_x + y = s * coord_y + { + # The values added to x, y, and s position the world_collision_rects so they all appear + # stacked (on top of world rects) but don't directly overlap. + # Remove these added values and mess around with the rect placement! + args: [coord_x, coord_y], + left_right: [x, y + 4, s, s - 6], # hash keys and values + top: [x + 4, y + 6, s - 8, s - 6], + bottom: [x + 1, y - 1, s - 2, s - 8], + } + end + end + + # Performs calculations to change the x and y values of the player's box. + def calc_player + + # Since acceleration is the change in velocity, the change in y (dy) increases every frame. + # What goes up must come down because of gravity. + state.dy += state.gravity + + # Calls the calc_box_collision and calc_edge_collision methods. + calc_box_collision + calc_edge_collision + + # Since velocity is the change in position, the change in y increases by dy. Same with x and dx. + state.y += state.dy + state.x += state.dx + + # Scales dx down. + state.dx *= 0.8 + end + + # Calls methods needed to determine collisions between player and world_collision rects. + def calc_box_collision + return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key + collision_floor! + collision_left! + collision_right! + collision_ceiling! + end + + # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. + def collision_floor! + return unless state.dy <= 0 # return unless player is going down or is as far down as possible + player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player + + # Goes through world_collision_rects to find all intersections between the bottom of player's rect and + # the top of a world_collision_rect (hence the "-0.1" above) + floor_collisions = state.world_collision_rects + .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) } + .first + + return unless floor_collisions # return unless collision occurred + state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect + state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked + end + + # Finds collisions between the player's left side and the right side of a world_collision_rect. + def collision_left! + return unless state.dx < 0 # return unless player is moving left + player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size] + + # Goes through world_collision_rects to find all intersections beween the player's left side and the + # right side of a world_collision_rect. + left_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } + .first + + return unless left_side_collisions # return unless collision occurred + + # player's x is set to the value of the x of the collided rect's right side + state.x = left_side_collisions[:left_right].right + state.dx = 0 # player isn't moving left because its path is blocked + end + + # Finds collisions between the right side of the player and the left side of a world_collision_rect. + def collision_right! + return unless state.dx > 0 # return unless player is moving right + player_rect = [state.x + 0.1, state.y, state.tile_size, state.tile_size] + + # Goes through world_collision_rects to find all intersections between the player's right side + # and the left side of a world_collision_rect (hence the "+0.1" above) + right_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) } + .first + + return unless right_side_collisions # return unless collision occurred + + # player's x is set to the value of the collided rect's left, minus the size of a rect + # tile size is subtracted because player's position is denoted by bottom left corner + state.x = right_side_collisions[:left_right].left - state.tile_size + state.dx = 0 # player isn't moving right because its path is blocked + end + + # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. + def collision_ceiling! + return unless state.dy > 0 # return unless player is moving up + player_rect = [state.x, state.y + 0.1, state.tile_size, state.tile_size] + + # Goes through world_collision_rects to find intersections between the bottom of a + # world_collision_rect and the top of the player's rect (hence the "+0.1" above) + ceil_collisions = state.world_collision_rects + .find_all { |r| r[:bottom].intersect_rect?(player_rect, collision_tollerance) } + .first + + return unless ceil_collisions # return unless collision occurred + + # player's y is set to the bottom y of the rect it collided with, minus the size of a rect + state.y = ceil_collisions[:bottom].y - state.tile_size + state.dy = 0 # if a collision occurred, the player isn't moving up because its path is blocked + end + + # Makes sure the player remains within the screen's dimensions. + def calc_edge_collision + + #Ensures that the player doesn't fall below the map. + if state.y < 0 + state.y = 0 + state.dy = 0 + + #Ensures that the player doesn't go too high. + # Position of player is denoted by bottom left hand corner, which is why we have to subtract the + # size of the player's box (so it remains visible on the screen) + elsif state.y > 720 - state.tile_size # if the player's y position exceeds the height of screen + state.y = 720 - state.tile_size # the player will remain as high as possible while staying on screen + state.dy = 0 + end + + # Ensures that the player remains in the horizontal range that it is supposed to. + if state.x >= 1280 - state.tile_size && state.dx > 0 # if player moves too far right + state.x = 1280 - state.tile_size # player will remain as right as possible while staying on screen + state.dx = 0 + elsif state.x <= 0 && state.dx < 0 # if player moves too far left + state.x = 0 # player will remain as left as possible while remaining on screen + state.dx = 0 + end + end + + # Processes input from the user on the keyboard. + def process_inputs + if inputs.mouse.down + state.world_lookup = {} + x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid + + if state.world.any? { |loc| loc == [x, y] } # checks if coordinates duplicate + state.world = state.world.reject { |loc| loc == [x, y] } # erases tile space + else + state.world << [x, y] # If no duplicates, adds to world collection + end + end + + # Sets dx to 0 if the player lets go of arrow keys. + if inputs.keyboard.key_up.right + state.dx = 0 + elsif inputs.keyboard.key_up.left + state.dx = 0 + end + + # Sets dx to 3 in whatever direction the player chooses. + if inputs.keyboard.key_held.right # if right key is pressed + state.dx = 3 + elsif inputs.keyboard.key_held.left # if left key is pressed + state.dx = -3 + end + + #Sets dy to 5 to make the player ~fly~ when they press the space bar + if inputs.keyboard.key_held.space + state.dy = 5 + end + end + + def to_coord point + + # Integer divides (idiv) point.x to turn into grid + # Then, you can just multiply each integer by state.tile_size later so the grid coordinates. + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] + end + + # Represents the tolerance for a collision between the player's rect and another rect. + def collision_tollerance + 0.0 + end +end + +$platformer_physics = PoorManPlatformerPhysics.new + +def tick args + $platformer_physics.grid = args.grid + $platformer_physics.inputs = args.inputs + $platformer_physics.state = args.state + $platformer_physics.outputs = args.outputs + $platformer_physics.tick + tick_instructions args, "Sample app shows platformer collisions. CLICK to place box. ARROW keys to move around. SPACE to jump." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/08_platformer_collisions/license-for-sample.txt b/samples/08_platformer_collisions/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/08_platformer_collisions/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/08_platformer_collisions/replay.txt b/samples/08_platformer_collisions/replay.txt new file mode 100644 index 0000000..c7ea2cb --- /dev/null +++ b/samples/08_platformer_collisions/replay.txt @@ -0,0 +1,218 @@ +replay_version 2.0 +stopped_at 982 +seed 100 +recorded_at Mon Sep 30 00:11:39 2019 +[:mouse_move, 524, 240, 2, 1, 116] +[:mouse_move, 524, 246, 2, 2, 117] +[:mouse_move, 522, 258, 2, 3, 118] +[:mouse_move, 521, 270, 2, 4, 119] +[:mouse_move, 518, 284, 2, 5, 120] +[:mouse_move, 516, 291, 2, 6, 121] +[:mouse_move, 507, 317, 2, 7, 122] +[:mouse_move, 500, 331, 2, 8, 123] +[:mouse_move, 488, 357, 2, 9, 124] +[:mouse_move, 465, 395, 2, 10, 125] +[:mouse_move, 452, 416, 2, 11, 126] +[:mouse_move, 429, 451, 2, 12, 127] +[:mouse_move, 400, 485, 2, 13, 128] +[:mouse_move, 375, 509, 2, 14, 129] +[:mouse_move, 356, 522, 2, 15, 130] +[:mouse_move, 324, 543, 2, 16, 131] +[:mouse_move, 318, 546, 2, 17, 132] +[:mouse_move, 283, 562, 2, 18, 133] +[:mouse_move, 273, 564, 2, 19, 134] +[:mouse_move, 259, 566, 2, 20, 135] +[:mouse_move, 256, 567, 2, 21, 136] +[:mouse_move, 252, 567, 2, 22, 137] +[:mouse_move, 246, 567, 2, 23, 138] +[:mouse_move, 244, 567, 2, 24, 139] +[:mouse_move, 240, 566, 2, 25, 140] +[:mouse_move, 238, 561, 2, 26, 141] +[:mouse_move, 234, 555, 2, 27, 142] +[:mouse_move, 230, 550, 2, 28, 143] +[:mouse_move, 228, 547, 2, 29, 144] +[:mouse_move, 223, 542, 2, 30, 145] +[:mouse_move, 220, 540, 2, 31, 146] +[:mouse_move, 215, 537, 2, 32, 147] +[:mouse_move, 212, 535, 2, 33, 148] +[:mouse_move, 210, 532, 2, 34, 149] +[:mouse_move, 207, 528, 2, 35, 150] +[:mouse_move, 206, 526, 2, 36, 151] +[:mouse_move, 204, 523, 2, 37, 152] +[:mouse_move, 204, 522, 2, 38, 153] +[:mouse_move, 204, 521, 2, 39, 154] +[:mouse_button_pressed, 1, 0, 1, 40, 166] +[:mouse_button_up, 1, 0, 1, 41, 173] +[:mouse_move, 209, 521, 2, 42, 179] +[:mouse_move, 215, 521, 2, 43, 180] +[:mouse_move, 244, 521, 2, 44, 181] +[:mouse_move, 261, 521, 2, 45, 182] +[:mouse_move, 305, 521, 2, 46, 183] +[:mouse_move, 330, 519, 2, 47, 184] +[:mouse_move, 375, 511, 2, 48, 185] +[:mouse_move, 398, 505, 2, 49, 186] +[:mouse_move, 431, 493, 2, 50, 187] +[:mouse_move, 447, 486, 2, 51, 188] +[:mouse_move, 465, 476, 2, 52, 189] +[:mouse_move, 475, 470, 2, 53, 190] +[:mouse_move, 489, 461, 2, 54, 191] +[:mouse_move, 490, 458, 2, 55, 192] +[:mouse_move, 494, 455, 2, 56, 193] +[:mouse_move, 498, 450, 2, 57, 194] +[:mouse_move, 499, 448, 2, 58, 195] +[:mouse_move, 501, 445, 2, 59, 196] +[:mouse_move, 502, 444, 2, 60, 198] +[:mouse_button_pressed, 1, 0, 1, 61, 200] +[:mouse_button_up, 1, 0, 1, 62, 208] +[:mouse_move, 503, 443, 2, 63, 212] +[:mouse_move, 507, 445, 2, 64, 213] +[:mouse_move, 516, 453, 2, 65, 214] +[:mouse_move, 523, 461, 2, 66, 215] +[:mouse_move, 546, 493, 2, 67, 216] +[:mouse_move, 556, 509, 2, 68, 217] +[:mouse_move, 578, 546, 2, 69, 218] +[:mouse_move, 582, 555, 2, 70, 219] +[:mouse_move, 593, 578, 2, 71, 220] +[:mouse_move, 595, 582, 2, 72, 221] +[:mouse_move, 598, 591, 2, 73, 222] +[:mouse_move, 606, 611, 2, 74, 223] +[:mouse_move, 607, 617, 2, 75, 224] +[:mouse_move, 607, 627, 2, 76, 225] +[:mouse_move, 607, 632, 2, 77, 226] +[:mouse_move, 607, 638, 2, 78, 227] +[:mouse_move, 607, 640, 2, 79, 228] +[:mouse_move, 606, 643, 2, 80, 229] +[:mouse_move, 606, 644, 2, 81, 230] +[:mouse_button_pressed, 1, 0, 1, 82, 231] +[:mouse_move, 606, 645, 2, 83, 231] +[:mouse_button_up, 1, 0, 1, 84, 239] +[:mouse_move, 606, 643, 2, 85, 240] +[:mouse_move, 600, 636, 2, 86, 241] +[:mouse_move, 594, 631, 2, 87, 242] +[:mouse_move, 566, 613, 2, 88, 243] +[:mouse_move, 548, 607, 2, 89, 244] +[:mouse_move, 526, 599, 2, 90, 245] +[:mouse_move, 465, 572, 2, 91, 246] +[:mouse_move, 399, 533, 2, 92, 247] +[:mouse_move, 370, 512, 2, 93, 248] +[:mouse_move, 345, 489, 2, 94, 249] +[:mouse_move, 320, 459, 2, 95, 250] +[:mouse_move, 306, 439, 2, 96, 251] +[:mouse_move, 290, 403, 2, 97, 252] +[:mouse_move, 282, 368, 2, 98, 253] +[:mouse_move, 279, 351, 2, 99, 254] +[:mouse_move, 279, 332, 2, 100, 255] +[:mouse_move, 279, 308, 2, 101, 256] +[:mouse_move, 279, 303, 2, 102, 257] +[:mouse_move, 280, 287, 2, 103, 258] +[:mouse_move, 280, 282, 2, 104, 259] +[:mouse_move, 280, 278, 2, 105, 260] +[:mouse_move, 280, 276, 2, 106, 261] +[:mouse_button_pressed, 1, 0, 1, 107, 262] +[:mouse_move, 280, 275, 2, 108, 262] +[:mouse_button_up, 1, 0, 1, 109, 269] +[:key_down_raw, 1073741903, 0, 2, 110, 324] +[:key_down_raw, 1073741903, 0, 2, 111, 349] +[:key_down_raw, 1073741903, 0, 2, 112, 351] +[:key_down_raw, 1073741903, 0, 2, 113, 353] +[:key_down_raw, 1073741903, 0, 2, 114, 355] +[:key_down_raw, 1073741903, 0, 2, 115, 357] +[:key_down_raw, 1073741903, 0, 2, 116, 359] +[:key_down_raw, 1073741903, 0, 2, 117, 361] +[:key_down_raw, 1073741903, 0, 2, 118, 363] +[:key_down_raw, 1073741903, 0, 2, 119, 365] +[:key_down_raw, 1073741903, 0, 2, 120, 367] +[:key_down_raw, 1073741903, 0, 2, 121, 369] +[:key_down_raw, 8, 0, 2, 122, 371] +[:key_up_raw, 1073741903, 0, 2, 123, 382] +[:key_down_raw, 8, 0, 2, 124, 396] +[:key_up_raw, 8, 0, 2, 125, 396] +[:key_down_raw, 1073741903, 0, 2, 126, 400] +[:key_down_raw, 32, 0, 2, 127, 413] +[:key_up_raw, 1073741903, 0, 2, 128, 419] +[:key_down_raw, 1073741904, 0, 2, 129, 421] +[:key_down_raw, 1073741903, 0, 2, 130, 443] +[:key_up_raw, 1073741904, 0, 2, 131, 443] +[:key_down_raw, 1073741903, 0, 2, 132, 468] +[:key_up_raw, 1073741903, 0, 2, 133, 468] +[:key_down_raw, 1073741904, 0, 2, 134, 468] +[:key_down_raw, 1073741904, 0, 2, 135, 494] +[:key_down_raw, 1073741904, 0, 2, 136, 495] +[:key_down_raw, 1073741904, 0, 2, 137, 498] +[:key_down_raw, 1073741904, 0, 2, 138, 499] +[:key_down_raw, 1073741904, 0, 2, 139, 502] +[:key_down_raw, 1073741904, 0, 2, 140, 504] +[:key_down_raw, 1073741904, 0, 2, 141, 506] +[:key_down_raw, 1073741904, 0, 2, 142, 508] +[:key_down_raw, 1073741904, 0, 2, 143, 509] +[:key_down_raw, 1073741904, 0, 2, 144, 512] +[:key_down_raw, 1073741903, 0, 2, 145, 512] +[:key_up_raw, 1073741904, 0, 2, 146, 528] +[:key_down_raw, 1073741903, 0, 2, 147, 537] +[:key_down_raw, 1073741903, 0, 2, 148, 539] +[:key_down_raw, 1073741903, 0, 2, 149, 541] +[:key_down_raw, 1073741903, 0, 2, 150, 543] +[:key_down_raw, 1073741903, 0, 2, 151, 545] +[:key_down_raw, 1073741903, 0, 2, 152, 547] +[:key_down_raw, 1073741903, 0, 2, 153, 549] +[:key_down_raw, 1073741903, 0, 2, 154, 551] +[:key_down_raw, 1073741903, 0, 2, 155, 553] +[:key_down_raw, 1073741903, 0, 2, 156, 555] +[:key_down_raw, 1073741903, 0, 2, 157, 557] +[:key_down_raw, 1073741903, 0, 2, 158, 559] +[:key_down_raw, 1073741903, 0, 2, 159, 561] +[:key_down_raw, 1073741903, 0, 2, 160, 563] +[:key_down_raw, 1073741903, 0, 2, 161, 565] +[:key_down_raw, 1073741903, 0, 2, 162, 567] +[:key_down_raw, 1073741903, 0, 2, 163, 569] +[:key_down_raw, 1073741903, 0, 2, 164, 572] +[:key_down_raw, 1073741903, 0, 2, 165, 573] +[:key_down_raw, 1073741903, 0, 2, 166, 576] +[:key_down_raw, 1073741903, 0, 2, 167, 577] +[:key_down_raw, 1073741903, 0, 2, 168, 579] +[:key_down_raw, 1073741903, 0, 2, 169, 581] +[:key_down_raw, 1073741903, 0, 2, 170, 583] +[:key_down_raw, 1073741903, 0, 2, 171, 586] +[:key_down_raw, 1073741903, 0, 2, 172, 588] +[:key_down_raw, 1073741903, 0, 2, 173, 590] +[:key_down_raw, 1073741903, 0, 2, 174, 592] +[:key_down_raw, 1073741903, 0, 2, 175, 594] +[:key_up_raw, 32, 0, 2, 176, 594] +[:key_down_raw, 1073741903, 0, 2, 177, 596] +[:key_up_raw, 1073741903, 0, 2, 178, 597] +[:key_down_raw, 1073741904, 0, 2, 179, 670] +[:key_down_raw, 1073741904, 0, 2, 180, 695] +[:key_down_raw, 1073741904, 0, 2, 181, 697] +[:key_down_raw, 1073741904, 0, 2, 182, 699] +[:key_down_raw, 1073741904, 0, 2, 183, 701] +[:key_down_raw, 1073741904, 0, 2, 184, 703] +[:key_down_raw, 1073741904, 0, 2, 185, 705] +[:key_down_raw, 1073741904, 0, 2, 186, 707] +[:key_up_raw, 1073741904, 0, 2, 187, 708] +[:key_down_raw, 1073741903, 0, 2, 188, 722] +[:key_up_raw, 1073741903, 0, 2, 189, 733] +[:key_down_raw, 1073741903, 0, 2, 190, 762] +[:key_down_raw, 32, 0, 2, 191, 786] +[:key_down_raw, 32, 0, 2, 192, 811] +[:key_down_raw, 32, 0, 2, 193, 813] +[:key_down_raw, 32, 0, 2, 194, 815] +[:key_down_raw, 32, 0, 2, 195, 817] +[:key_down_raw, 32, 0, 2, 196, 819] +[:key_down_raw, 32, 0, 2, 197, 821] +[:key_down_raw, 32, 0, 2, 198, 823] +[:key_down_raw, 32, 0, 2, 199, 825] +[:key_down_raw, 32, 0, 2, 200, 827] +[:key_down_raw, 32, 0, 2, 201, 829] +[:key_down_raw, 32, 0, 2, 202, 831] +[:key_down_raw, 32, 0, 2, 203, 833] +[:key_down_raw, 32, 0, 2, 204, 835] +[:key_down_raw, 32, 0, 2, 205, 837] +[:key_down_raw, 32, 0, 2, 206, 839] +[:key_down_raw, 32, 0, 2, 207, 841] +[:key_up_raw, 32, 0, 2, 208, 843] +[:key_up_raw, 1073741903, 0, 2, 209, 848] +[:key_down_raw, 1073741903, 0, 2, 210, 871] +[:key_up_raw, 1073741903, 0, 2, 211, 877] +[:key_down_raw, 1073742051, 1024, 2, 212, 981] +[:key_down_raw, 113, 1024, 2, 213, 981] +[:key_up_raw, 113, 1024, 2, 214, 981] diff --git a/samples/08_platformer_collisions_metroidvania/app/main.rb b/samples/08_platformer_collisions_metroidvania/app/main.rb new file mode 100644 index 0000000..126759a --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/app/main.rb @@ -0,0 +1,470 @@ +=begin + APIs listing that haven't been encountered in previous sample apps: + + - times: Performs an action a specific number of times. + For example, if we said + 5.times puts "Hello DragonRuby", + then we'd see the words "Hello DragonRuby" printed on the console 5 times. + + - split: Divides a string into substrings based on a delimiter. + For example, if we had a command + "DragonRuby is awesome".split(" ") + then the result would be + ["DragonRuby", "is", "awesome"] because the words are separated by a space delimiter. + + - join: Opposite of split; converts each element of array to a string separated by delimiter. + For example, if we had a command + ["DragonRuby","is","awesome"].join(" ") + then the result would be + "DragonRuby is awesome". + + Reminders: + + - to_s: Returns a string representation of an object. + For example, if we had + 500.to_s + the string "500" would be returned. + Similar to to_i, which returns an integer representation of an object. + + - elapsed_time: How many frames have passed since the click event. + + - args.outputs.labels: An array. Values in the array generate labels on the screen. + The parameters are: [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - inputs.mouse.down: Determines whether or not the mouse is being pressed down. + The position of the mouse when it is pressed down can be found using inputs.mouse.down.point.(x|y). + + - first: Returns the first element of the array. + + - num1.idiv(num2): Divides two numbers and returns an integer. + + - find_all: Finds all values that satisfy specific requirements. + + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. + + - reject: Removes elements from a collection if they meet certain requirements. + + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + +=end + +MAP_FILE_PATH = 'app/map.txt' # the map.txt file in the app folder contains exported map + +class MetroidvaniaStarter + attr_accessor :grid, :inputs, :state, :outputs, :gtk + + # Calls methods needed to run the game properly. + def tick + defaults + render + calc + process_inputs + end + + # Sets all the default variables. + # '||' states that initialization occurs only in the first frame. + def defaults + state.tile_size = 64 + state.gravity = -0.2 + state.player_width = 60 + state.player_height = 64 + state.collision_tolerance = 0.0 + state.previous_tile_size ||= state.tile_size + state.x ||= 0 + state.y ||= 800 + state.dy ||= 0 + state.dx ||= 0 + attempt_load_world_from_file + state.world_lookup ||= { } + state.world_collision_rects ||= [] + state.mode ||= :creating # alternates between :creating and :selecting for sprite selection + state.select_menu ||= [0, 720, 1280, 720] + #=======================================IMPORTANT=======================================# + # When adding sprites, please label them "image1.png", "image2.png", image3".png", etc. + # Once you have done that, adjust "state.sprite_quantity" to how many sprites you have. + #=======================================================================================# + state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES + state.sprite_coords ||= [] + state.banner_coords ||= [640, 680 + 720] + state.sprite_selected ||= 1 + state.map_saved_at ||= 0 + + # Sets all the cordinate values for the sprite selection screen into a grid + # Displayed when 's' is pressed by player to access sprites + if state.sprite_coords == [] # if sprite_coords is an empty array + count = 1 + temp_x = 165 # sets a starting x and y position for display + temp_y = 500 + 720 + state.sprite_quantity.times do # for the number of sprites you have + state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array + temp_x += 100 # increment temp_x + count += 1 # increment count + if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen + temp_x = 165 # a new row of sprites starts + temp_y -= 75 # new row of sprites starts 75 units lower than the previous row + end + end + end + end + + # Places sprites + def render + + # Sets the x, y, width, height, and image path for each sprite in the world collection. + outputs.sprites << state.world.map do |x, y, sprite| + [x * state.tile_size, # multiply by size so grid coordinates; pixel value of location + y * state.tile_size, + state.tile_size, + state.tile_size, + 'sprites/image' + sprite.to_s + '.png'] # uses concatenation to create unique image path + end + + # Outputs sprite for the player by setting x, y, width, height, and image path + outputs.sprites << [state.x, + state.y, + state.player_width, + state.player_height,'sprites/player.png'] + + # Outputs labels as primitives in top right of the screen + outputs.primitives << [920, 700, 'Press \'s\' to access sprites.', 1, 0].label + outputs.primitives << [920, 675, 'Click existing sprite to delete.', 1, 0].label + + outputs.primitives << [920, 640, '<- and -> to move.', 1, 0].label + outputs.primitives << [920, 615, 'Press and hold space to jump.', 1, 0].label + + outputs.primitives << [920, 580, 'Press \'e\' to export current map.', 1, 0].label + + # if the map is saved and less than 120 frames have passed, the label is displayed + if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 + outputs.primitives << [920, 555, 'Map has been exported!', 1, 0, 50, 100, 50].label + end + + # If player hits 's', following appears + if state.mode == :selecting + # White background for sprite selection + outputs.primitives << [state.select_menu, 255, 255, 255].solid + + # Select tile label at the top of the screen + outputs.primitives << [state.banner_coords.x, state.banner_coords.y, "Select Sprite (sprites located in \"sprites\" folder)", 10, 1, 0, 0, 0, 255].label + + # Places sprites in locations calculated in the defaults function + outputs.primitives << state.sprite_coords.map do |x, y, order| + [x, y, 50, 50, 'sprites/image' + order.to_s + ".png"].sprite + end + end + + # Creates sprite following mouse to help indicate which sprite you have selected + # 10 is subtracted from the mouse's x position so that the sprite is not covered by the mouse icon + outputs.primitives << [inputs.mouse.position.x - 10, inputs.mouse.position.y, + 10, 10, 'sprites/image' + state.sprite_selected.to_s + ".png"].sprite + end + + # Calls methods that perform calculations + def calc + calc_in_game + calc_sprite_selection + end + + # Calls methods that perform calculations (if in creating mode) + def calc_in_game + return unless state.mode == :creating + calc_world_lookup + calc_player + end + + def calc_world_lookup + # If the tile size isn't equal to the previous tile size, + # the previous tile size is set to the tile size, + # and world_lookup hash is set to empty. + if state.tile_size != state.previous_tile_size + state.previous_tile_size = state.tile_size + state.world_lookup = {} + end + + # return if world_lookup is not empty or if world is empty + return if state.world_lookup.keys.length > 0 + return unless state.world.length > 0 + + # Searches through the world and finds the coordinates that exist + state.world_lookup = {} + state.world.each { |x, y| state.world_lookup[[x, y]] = true } + + # Assigns collision rects for every sprite drawn + state.world_collision_rects = + state.world_lookup + .keys + .map do |coord_x, coord_y| + s = state.tile_size + # Multiplying by s (the size of a tile) ensures that the rect is + # placed exactly where you want it to be placed (causes grid to coordinate) + # How many pixels horizontally across and vertically up and down + x = s * coord_x + y = s * coord_y + { + args: [coord_x, coord_y], + left_right: [x, y + 4, s, s - 6], # hash keys and values + top: [x + 4, y + 6, s - 8, s - 6], + bottom: [x + 1, y - 1, s - 2, s - 8], + } + end + end + + # Calculates movement of player and calls methods that perform collision calculations + def calc_player + state.dy += state.gravity # what goes up must come down because of gravity + calc_box_collision + calc_edge_collision + state.y += state.dy # Since velocity is the change in position, the change in y increases by dy + state.x += state.dx # Ditto line above but dx and x + state.dx *= 0.8 # Scales dx down + end + + # Calls methods that determine whether the player collides with any world_collision_rects. + def calc_box_collision + return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key + collision_floor + collision_left + collision_right + collision_ceiling + end + + # Finds collisions between the bottom of the player's rect and the top of a world_collision_rect. + def collision_floor + return unless state.dy <= 0 # return unless player is going down or is as far down as possible + player_rect = [state.x, next_y, state.tile_size, state.tile_size] # definition of player + + # Runs through all the sprites on the field and finds all intersections between player's + # bottom and the top of a rect. + floor_collisions = state.world_collision_rects + .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless floor_collisions # performs following changes if a collision has occurred + state.y = floor_collisions[:top].top # y of player is set to the y of the colliding rect's top + state.dy = 0 # no change in y because the player's path is blocked + end + + # Finds collisions between the player's left side and the right side of a world_collision_rect. + def collision_left + return unless state.dx < 0 # return unless player is moving left + player_rect = [next_x, state.y, state.tile_size, state.tile_size] + + # Runs through all the sprites on the field and finds all intersections between the player's left side + # and the right side of a rect. + left_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless left_side_collisions # return unless collision occurred + state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side + state.dx = 0 # no change in x because the player's path is blocked + end + + # Finds collisions between the right side of the player and the left side of a world_collision_rect. + def collision_right + return unless state.dx > 0 # return unless player is moving right + player_rect = [next_x, state.y, state.tile_size, state.tile_size] + + # Runs through all the sprites on the field and finds all intersections between the player's + # right side and the left side of a rect. + right_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless right_side_collisions # return unless collision occurred + state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner) + state.dx = 0 # no change in x because the player's path is blocked + end + + # Finds collisions between the top of the player's rect and the bottom of a world_collision_rect. + def collision_ceiling + return unless state.dy > 0 # return unless player is moving up + player_rect = [state.x, next_y, state.player_width, state.player_height] + + # Runs through all the sprites on the field and finds all intersections between the player's top + # and the bottom of a rect. + ceil_collisions = state.world_collision_rects + .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless ceil_collisions # return unless collision occurred + state.y = ceil_collisions[:bottom].y - state.tile_size # player's y is set to the y of the colliding rect's bottom (minus tile size) + state.dy = 0 # no change in y because the player's path is blocked + end + + # Makes sure the player remains within the screen's dimensions. + def calc_edge_collision + # Ensures that player doesn't fall below the map + if next_y < 0 && state.dy < 0 # if player is moving down and is about to fall (next_y) below the map's scope + state.y = 0 # 0 is the lowest the player can be while staying on the screen + state.dy = 0 + # Ensures player doesn't go insanely high + elsif next_y > 720 - state.tile_size && state.dy > 0 # if player is moving up, about to exceed map's scope + state.y = 720 - state.tile_size # if we don't subtract tile_size, we won't be able to see the player on the screen + state.dy = 0 + end + + # Ensures that player remains in the horizontal range its supposed to + if state.x >= 1280 - state.tile_size && state.dx > 0 # if the player is moving too far right + state.x = 1280 - state.tile_size # farthest right the player can be while remaining in the screen's scope + state.dx = 0 + elsif state.x <= 0 && state.dx < 0 # if the player is moving too far left + state.x = 0 # farthest left the player can be while remaining in the screen's scope + state.dx = 0 + end + end + + def calc_sprite_selection + # Does the transition to bring down the select sprite screen + if state.mode == :selecting && state.select_menu.y != 0 + state.select_menu.y = 0 # sets y position of select menu (shown when 's' is pressed) + state.banner_coords.y = 680 # sets y position of Select Sprite banner + state.sprite_coords = state.sprite_coords.map do |x, y, w, h| + [x, y - 720, w, h] # sets definition of sprites (change '-' to '+' and the sprites can't be seen) + end + end + + # Does the transition to leave the select sprite screen + if state.mode == :creating && state.select_menu.y != 720 + state.select_menu.y = 720 # sets y position of select menu (menu is retreated back up) + state.banner_coords.y = 1000 # sets y position of Select Sprite banner + state.sprite_coords = state.sprite_coords.map do |x, y, w, h| + [x, y + 720, w, h] # sets definition of all elements in collection + end + end + end + + def process_inputs + # If the state.mode is back and if the menu has retreated back up + # call methods that process user inputs + if state.mode == :creating + process_inputs_player_movement + process_inputs_place_tile + end + + # For each sprite_coordinate added, check what sprite was selected + if state.mode == :selecting + state.sprite_coords.map do |x, y, order| # goes through all sprites in collection + # checks that a specific sprite was pressed based on x, y position + if inputs.mouse.down && # the && (and) sign means ALL statements must be true for the evaluation to be true + inputs.mouse.down.point.x >= x && # x is greater than or equal to sprite's x and + inputs.mouse.down.point.x <= x + 50 && # x is less than or equal to 50 pixels to the right + inputs.mouse.down.point.y >= y && # y is greater than or equal to sprite's y + inputs.mouse.down.point.y <= y + 50 # y is less than or equal to 50 pixels up + state.sprite_selected = order # sprite is chosen + end + end + end + + inputs_export_stage + process_inputs_show_available_sprites + end + + # Moves the player based on the keys they press on their keyboard + def process_inputs_player_movement + # Sets dx to 0 if the player lets go of arrow keys (player won't move left or right) + if inputs.keyboard.key_up.right + state.dx = 0 + elsif inputs.keyboard.key_up.left + state.dx = 0 + end + + # Sets dx to 3 in whatever direction the player chooses when they hold down (or press) the left or right keys + if inputs.keyboard.key_held.right + state.dx = 3 + elsif inputs.keyboard.key_held.left + state.dx = -3 + end + + # Sets dy to 5 to make the player ~fly~ when they press the space bar on their keyboard + if inputs.keyboard.key_held.space + state.dy = 5 + end + end + + # Adds tile in the place the user holds down the mouse + def process_inputs_place_tile + if inputs.mouse.down # if mouse is pressed + state.world_lookup = {} + x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid + + # Checks if any coordinates duplicate (already exist in world) + if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y } + #erases existing tile space by rejecting them from world + state.world = state.world.reject do |existing_x, existing_y, n| + existing_x == x && existing_y == y + end + else + state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite + end + end + end + + # Stores/exports world collection's info (coordinates, sprite number) into a file + def inputs_export_stage + if inputs.keyboard.key_down.e # if "e" is pressed + export_string = state.world.map do |x, y, sprite_number| # stores world info in a string + "#{x},#{y},#{sprite_number}" # using string interpolation + end + gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) # writes string into a file + state.map_saved_at = state.tick_count # frame number (passage of time) when the map was saved + end + end + + def process_inputs_show_available_sprites + # Based on keyboard input, the entity (:creating and :selecting) switch + if inputs.keyboard.key_held.s && state.mode == :creating # if "s" is pressed and currently creating + state.mode = :selecting # will change to selecting + inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off + elsif inputs.keyboard.key_held.s && state.mode == :selecting # if "s" is pressed and currently selecting + state.mode = :creating # will change to creating + inputs.keyboard.clear # VERY IMPORTANT! If not present, it'll flicker between on and off + end + end + + # Loads the world collection by reading from the map.txt file in the app folder + def attempt_load_world_from_file + return if state.world # return if the world collection is already populated + state.world ||= [] # initialized as an empty collection + exported_world = gtk.read_file(MAP_FILE_PATH) # reads the file using the path mentioned at top of code + return unless exported_world # return unless the file read was successful + state.world = exported_world.each_line.map do |l| # perform action on each line of exported_world + l.split(',').map(&:to_i) # calls split using ',' as a delimiter, and invokes .map on the collection, + # calling to_i (converts to integers) on each element + end + end + + # Adds the change in y to y to determine the next y position of the player. + def next_y + state.y + state.dy + end + + # Determines next x position of player + def next_x + if state.dx < 0 # if the player moves left + return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left) + else + return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right) + end + end + + def to_coord point + # Integer divides (idiv) point.x to turn into grid + # Then, you can just multiply each integer by state.tile_size + # later and huzzah. Grid coordinates + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] + end +end + +$metroidvania_starter = MetroidvaniaStarter.new + +def tick args + $metroidvania_starter.grid = args.grid + $metroidvania_starter.inputs = args.inputs + $metroidvania_starter.state = args.state + $metroidvania_starter.outputs = args.outputs + $metroidvania_starter.gtk = args.gtk + $metroidvania_starter.tick +end diff --git a/samples/08_platformer_collisions_metroidvania/app/map.txt b/samples/08_platformer_collisions_metroidvania/app/map.txt new file mode 100644 index 0000000..abbc046 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/app/map.txt @@ -0,0 +1,11 @@ +5,7,2 +11,7,2 +15,2,2 +6,5,2 +16,5,2 +13,4,2 +7,2,2 +8,5,2 +8,8,2 +4,6,2 +11,3,2
\ No newline at end of file diff --git a/samples/08_platformer_collisions_metroidvania/app/repl.rb b/samples/08_platformer_collisions_metroidvania/app/repl.rb new file mode 100644 index 0000000..9416675 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/app/repl.rb @@ -0,0 +1,2 @@ +# save this file and this code will be run once +puts 1 + 2 diff --git a/samples/08_platformer_collisions_metroidvania/app/tests.rb b/samples/08_platformer_collisions_metroidvania/app/tests.rb new file mode 100644 index 0000000..925f321 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/app/tests.rb @@ -0,0 +1,24 @@ +# For advanced users: +# You can put some quick verification tests here, any method +# that starts with the `test_` will be run when you save this file. + +# here is an example test and game + +class MySuperHappyFunGame + attr_gtk + + def tick + outputs.solids << [100, 100, 300, 300] + end +end + +def test_universe args, assert + game = MySuperHappyFunGame.new + game.args = args + game.tick + assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick" + assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending" + puts "test_universe completed successfully" +end + +$gtk.tests.start diff --git a/samples/08_platformer_collisions_metroidvania/license-for-sample.txt b/samples/08_platformer_collisions_metroidvania/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/08_platformer_collisions_metroidvania/replay.txt b/samples/08_platformer_collisions_metroidvania/replay.txt new file mode 100644 index 0000000..d53870b --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/replay.txt @@ -0,0 +1,819 @@ +replay_version 2.0 +stopped_at 1897 +seed 100 +recorded_at Sun Sep 29 22:22:11 2019 +[:mouse_move, 40, 523, 2, 1, 129] +[:mouse_move, 114, 503, 2, 2, 130] +[:mouse_move, 170, 488, 2, 3, 131] +[:mouse_move, 299, 454, 2, 4, 132] +[:mouse_move, 481, 406, 2, 5, 133] +[:mouse_move, 685, 346, 2, 6, 134] +[:mouse_move, 812, 302, 2, 7, 135] +[:mouse_move, 1026, 205, 2, 8, 136] +[:mouse_move, 1062, 184, 2, 9, 137] +[:mouse_move, 1112, 150, 2, 10, 138] +[:mouse_move, 1153, 121, 2, 11, 139] +[:mouse_move, 1169, 107, 2, 12, 140] +[:mouse_move, 1182, 95, 2, 13, 141] +[:mouse_move, 1197, 73, 2, 14, 142] +[:mouse_move, 1197, 70, 2, 15, 143] +[:mouse_move, 1192, 63, 2, 16, 144] +[:mouse_move, 1187, 60, 2, 17, 145] +[:mouse_move, 1170, 50, 2, 18, 146] +[:mouse_move, 1161, 45, 2, 19, 147] +[:mouse_move, 1147, 38, 2, 20, 148] +[:mouse_move, 1140, 34, 2, 21, 149] +[:mouse_move, 1126, 28, 2, 22, 150] +[:mouse_move, 1114, 25, 2, 23, 151] +[:mouse_move, 1098, 23, 2, 24, 152] +[:mouse_move, 1088, 23, 2, 25, 153] +[:mouse_move, 1072, 23, 2, 26, 154] +[:mouse_move, 1055, 24, 2, 27, 155] +[:mouse_move, 1044, 26, 2, 28, 156] +[:mouse_move, 1019, 29, 2, 29, 157] +[:mouse_move, 994, 31, 2, 30, 158] +[:mouse_move, 969, 32, 2, 31, 159] +[:mouse_move, 963, 32, 2, 32, 160] +[:mouse_move, 948, 32, 2, 33, 161] +[:mouse_move, 941, 31, 2, 34, 162] +[:mouse_move, 924, 29, 2, 35, 163] +[:mouse_move, 918, 27, 2, 36, 164] +[:mouse_move, 910, 25, 2, 37, 165] +[:mouse_move, 907, 24, 2, 38, 166] +[:mouse_move, 902, 23, 2, 39, 167] +[:mouse_move, 901, 22, 2, 40, 168] +[:mouse_move, 899, 22, 2, 41, 169] +[:mouse_move, 898, 22, 2, 42, 170] +[:mouse_move, 897, 22, 2, 43, 172] +[:mouse_move, 897, 23, 2, 44, 174] +[:mouse_move, 897, 30, 2, 45, 175] +[:mouse_move, 898, 34, 2, 46, 176] +[:mouse_move, 906, 46, 2, 47, 177] +[:mouse_move, 912, 52, 2, 48, 178] +[:mouse_move, 929, 64, 2, 49, 179] +[:mouse_move, 941, 69, 2, 50, 180] +[:mouse_move, 963, 74, 2, 51, 181] +[:mouse_move, 969, 75, 2, 52, 182] +[:mouse_move, 980, 76, 2, 53, 183] +[:mouse_move, 1001, 76, 2, 54, 184] +[:mouse_move, 1009, 76, 2, 55, 185] +[:mouse_move, 1025, 76, 2, 56, 186] +[:mouse_move, 1028, 76, 2, 57, 187] +[:mouse_move, 1041, 75, 2, 58, 188] +[:mouse_move, 1046, 73, 2, 59, 189] +[:mouse_move, 1055, 71, 2, 60, 190] +[:mouse_move, 1061, 69, 2, 61, 191] +[:mouse_move, 1078, 65, 2, 62, 192] +[:mouse_move, 1086, 64, 2, 63, 193] +[:mouse_move, 1104, 62, 2, 64, 194] +[:mouse_move, 1109, 62, 2, 65, 195] +[:mouse_move, 1126, 61, 2, 66, 196] +[:mouse_move, 1141, 61, 2, 67, 197] +[:mouse_move, 1155, 60, 2, 68, 198] +[:mouse_move, 1162, 60, 2, 69, 199] +[:mouse_move, 1170, 59, 2, 70, 200] +[:mouse_move, 1175, 59, 2, 71, 201] +[:mouse_move, 1181, 58, 2, 72, 202] +[:mouse_move, 1183, 57, 2, 73, 203] +[:mouse_move, 1186, 56, 2, 74, 204] +[:mouse_move, 1189, 55, 2, 75, 205] +[:mouse_move, 1191, 53, 2, 76, 206] +[:mouse_move, 1191, 52, 2, 77, 207] +[:mouse_move, 1193, 48, 2, 78, 208] +[:mouse_move, 1193, 45, 2, 79, 209] +[:mouse_move, 1192, 43, 2, 80, 210] +[:mouse_move, 1186, 38, 2, 81, 211] +[:mouse_move, 1181, 35, 2, 82, 212] +[:mouse_move, 1168, 30, 2, 83, 213] +[:mouse_move, 1161, 27, 2, 84, 214] +[:mouse_move, 1140, 23, 2, 85, 215] +[:mouse_move, 1130, 21, 2, 86, 216] +[:mouse_move, 1109, 19, 2, 87, 217] +[:mouse_move, 1104, 19, 2, 88, 218] +[:mouse_move, 1081, 19, 2, 89, 219] +[:mouse_move, 1064, 19, 2, 90, 220] +[:mouse_move, 1048, 19, 2, 91, 221] +[:mouse_move, 1037, 19, 2, 92, 222] +[:mouse_move, 1012, 20, 2, 93, 223] +[:mouse_move, 1007, 21, 2, 94, 224] +[:mouse_move, 986, 22, 2, 95, 225] +[:mouse_move, 978, 23, 2, 96, 226] +[:mouse_move, 957, 26, 2, 97, 227] +[:mouse_move, 949, 28, 2, 98, 228] +[:mouse_move, 935, 32, 2, 99, 229] +[:mouse_move, 930, 34, 2, 100, 230] +[:mouse_move, 926, 37, 2, 101, 231] +[:mouse_move, 921, 40, 2, 102, 232] +[:mouse_move, 918, 46, 2, 103, 233] +[:mouse_move, 918, 51, 2, 104, 234] +[:mouse_move, 919, 60, 2, 105, 235] +[:mouse_move, 923, 67, 2, 106, 236] +[:mouse_move, 929, 70, 2, 107, 237] +[:mouse_move, 941, 73, 2, 108, 238] +[:mouse_move, 948, 74, 2, 109, 239] +[:mouse_move, 958, 74, 2, 110, 240] +[:mouse_move, 962, 74, 2, 111, 241] +[:mouse_move, 968, 74, 2, 112, 242] +[:mouse_move, 969, 73, 2, 113, 243] +[:mouse_move, 970, 73, 2, 114, 244] +[:mouse_move, 968, 73, 2, 115, 256] +[:mouse_move, 963, 77, 2, 116, 257] +[:mouse_move, 949, 85, 2, 117, 258] +[:mouse_move, 944, 88, 2, 118, 259] +[:mouse_move, 935, 94, 2, 119, 260] +[:mouse_move, 932, 96, 2, 120, 261] +[:mouse_move, 925, 101, 2, 121, 262] +[:mouse_move, 921, 104, 2, 122, 263] +[:mouse_move, 917, 107, 2, 123, 264] +[:mouse_move, 915, 107, 2, 124, 265] +[:mouse_move, 914, 108, 2, 125, 266] +[:mouse_move, 912, 108, 2, 126, 267] +[:mouse_move, 912, 109, 2, 127, 268] +[:mouse_move, 911, 109, 2, 128, 269] +[:mouse_move, 913, 109, 2, 129, 275] +[:mouse_move, 915, 109, 2, 130, 276] +[:mouse_move, 922, 109, 2, 131, 277] +[:mouse_move, 926, 109, 2, 132, 278] +[:mouse_move, 937, 108, 2, 133, 279] +[:mouse_move, 943, 107, 2, 134, 280] +[:mouse_move, 955, 106, 2, 135, 281] +[:mouse_move, 961, 106, 2, 136, 282] +[:mouse_move, 971, 106, 2, 137, 283] +[:mouse_move, 977, 106, 2, 138, 284] +[:mouse_move, 987, 106, 2, 139, 285] +[:mouse_move, 994, 106, 2, 140, 286] +[:mouse_move, 1012, 108, 2, 141, 287] +[:mouse_move, 1016, 109, 2, 142, 288] +[:mouse_move, 1030, 110, 2, 143, 289] +[:mouse_move, 1036, 111, 2, 144, 290] +[:mouse_move, 1050, 111, 2, 145, 291] +[:mouse_move, 1056, 111, 2, 146, 292] +[:mouse_move, 1062, 111, 2, 147, 293] +[:mouse_move, 1074, 111, 2, 148, 294] +[:mouse_move, 1080, 111, 2, 149, 295] +[:mouse_move, 1086, 111, 2, 150, 296] +[:mouse_move, 1094, 111, 2, 151, 297] +[:mouse_move, 1099, 112, 2, 152, 298] +[:mouse_move, 1101, 112, 2, 153, 299] +[:mouse_move, 1106, 112, 2, 154, 300] +[:mouse_move, 1107, 112, 2, 155, 301] +[:mouse_move, 1109, 112, 2, 156, 302] +[:mouse_move, 1104, 112, 2, 157, 306] +[:mouse_move, 1097, 112, 2, 158, 307] +[:mouse_move, 1079, 112, 2, 159, 308] +[:mouse_move, 1067, 111, 2, 160, 309] +[:mouse_move, 1043, 111, 2, 161, 310] +[:mouse_move, 1038, 111, 2, 162, 311] +[:mouse_move, 1018, 111, 2, 163, 312] +[:mouse_move, 1009, 111, 2, 164, 313] +[:mouse_move, 986, 111, 2, 165, 314] +[:mouse_move, 978, 111, 2, 166, 315] +[:mouse_move, 963, 111, 2, 167, 316] +[:mouse_move, 954, 111, 2, 168, 317] +[:mouse_move, 940, 111, 2, 169, 318] +[:mouse_move, 934, 111, 2, 170, 319] +[:mouse_move, 929, 111, 2, 171, 320] +[:mouse_move, 920, 110, 2, 172, 321] +[:mouse_move, 916, 110, 2, 173, 322] +[:mouse_move, 911, 109, 2, 174, 323] +[:mouse_move, 909, 109, 2, 175, 324] +[:mouse_move, 906, 109, 2, 176, 325] +[:mouse_move, 905, 109, 2, 177, 327] +[:mouse_move, 904, 109, 2, 178, 328] +[:mouse_move, 904, 110, 2, 179, 334] +[:mouse_move, 907, 112, 2, 180, 335] +[:mouse_move, 910, 113, 2, 181, 336] +[:mouse_move, 917, 117, 2, 182, 337] +[:mouse_move, 921, 118, 2, 183, 338] +[:mouse_move, 931, 122, 2, 184, 339] +[:mouse_move, 935, 123, 2, 185, 340] +[:mouse_move, 943, 125, 2, 186, 341] +[:mouse_move, 945, 125, 2, 187, 342] +[:mouse_move, 954, 128, 2, 188, 343] +[:mouse_move, 957, 128, 2, 189, 344] +[:mouse_move, 963, 129, 2, 190, 345] +[:mouse_move, 966, 130, 2, 191, 346] +[:mouse_move, 968, 130, 2, 192, 347] +[:mouse_move, 976, 131, 2, 193, 348] +[:mouse_move, 980, 132, 2, 194, 349] +[:mouse_move, 986, 132, 2, 195, 350] +[:mouse_move, 991, 133, 2, 196, 351] +[:mouse_move, 998, 133, 2, 197, 352] +[:mouse_move, 1002, 133, 2, 198, 353] +[:mouse_move, 1010, 133, 2, 199, 354] +[:mouse_move, 1014, 133, 2, 200, 355] +[:mouse_move, 1024, 133, 2, 201, 356] +[:mouse_move, 1030, 133, 2, 202, 357] +[:mouse_move, 1041, 133, 2, 203, 358] +[:mouse_move, 1047, 134, 2, 204, 359] +[:mouse_move, 1062, 134, 2, 205, 360] +[:mouse_move, 1070, 134, 2, 206, 361] +[:mouse_move, 1083, 135, 2, 207, 362] +[:mouse_move, 1091, 135, 2, 208, 363] +[:mouse_move, 1103, 136, 2, 209, 364] +[:mouse_move, 1110, 136, 2, 210, 365] +[:mouse_move, 1123, 138, 2, 211, 366] +[:mouse_move, 1129, 140, 2, 212, 367] +[:mouse_move, 1140, 141, 2, 213, 368] +[:mouse_move, 1145, 142, 2, 214, 369] +[:mouse_move, 1156, 144, 2, 215, 370] +[:mouse_move, 1161, 144, 2, 216, 371] +[:mouse_move, 1171, 145, 2, 217, 372] +[:mouse_move, 1175, 145, 2, 218, 373] +[:mouse_move, 1180, 145, 2, 219, 374] +[:mouse_move, 1188, 145, 2, 220, 375] +[:mouse_move, 1189, 145, 2, 221, 376] +[:mouse_move, 1196, 146, 2, 222, 377] +[:mouse_move, 1199, 146, 2, 223, 378] +[:mouse_move, 1203, 147, 2, 224, 379] +[:mouse_move, 1205, 148, 2, 225, 380] +[:mouse_move, 1208, 150, 2, 226, 381] +[:mouse_move, 1210, 150, 2, 227, 382] +[:mouse_move, 1211, 151, 2, 228, 383] +[:mouse_move, 1212, 151, 2, 229, 384] +[:mouse_move, 1212, 152, 2, 230, 385] +[:mouse_move, 1213, 152, 2, 231, 386] +[:mouse_move, 1212, 152, 2, 232, 422] +[:mouse_move, 1211, 152, 2, 233, 427] +[:mouse_move, 1209, 152, 2, 234, 428] +[:mouse_move, 1194, 159, 2, 235, 429] +[:mouse_move, 1179, 166, 2, 236, 430] +[:mouse_move, 1135, 186, 2, 237, 431] +[:mouse_move, 1123, 191, 2, 238, 432] +[:mouse_move, 1080, 208, 2, 239, 433] +[:mouse_move, 1073, 211, 2, 240, 434] +[:mouse_move, 1045, 219, 2, 241, 435] +[:mouse_move, 1033, 220, 2, 242, 436] +[:mouse_move, 1021, 221, 2, 243, 437] +[:mouse_move, 1016, 221, 2, 244, 438] +[:mouse_move, 1009, 221, 2, 245, 439] +[:mouse_move, 1007, 220, 2, 246, 440] +[:mouse_move, 1002, 218, 2, 247, 441] +[:mouse_move, 999, 216, 2, 248, 442] +[:mouse_move, 987, 210, 2, 249, 443] +[:mouse_move, 979, 207, 2, 250, 444] +[:mouse_move, 958, 199, 2, 251, 445] +[:mouse_move, 947, 196, 2, 252, 446] +[:mouse_move, 929, 191, 2, 253, 447] +[:mouse_move, 920, 189, 2, 254, 448] +[:mouse_move, 910, 186, 2, 255, 449] +[:mouse_move, 906, 185, 2, 256, 450] +[:mouse_move, 901, 184, 2, 257, 451] +[:mouse_move, 900, 183, 2, 258, 452] +[:mouse_move, 899, 183, 2, 259, 453] +[:mouse_move, 898, 183, 2, 260, 457] +[:mouse_move, 892, 183, 2, 261, 458] +[:mouse_move, 885, 183, 2, 262, 459] +[:mouse_move, 864, 183, 2, 263, 460] +[:mouse_move, 841, 182, 2, 264, 461] +[:mouse_move, 811, 180, 2, 265, 462] +[:mouse_move, 775, 178, 2, 266, 463] +[:mouse_move, 754, 176, 2, 267, 464] +[:mouse_move, 748, 176, 2, 268, 465] +[:mouse_move, 728, 175, 2, 269, 466] +[:mouse_move, 723, 174, 2, 270, 467] +[:mouse_move, 717, 174, 2, 271, 468] +[:mouse_move, 716, 174, 2, 272, 469] +[:mouse_move, 719, 174, 2, 273, 472] +[:mouse_move, 724, 174, 2, 274, 473] +[:mouse_move, 734, 176, 2, 275, 474] +[:mouse_move, 741, 177, 2, 276, 475] +[:mouse_move, 758, 178, 2, 277, 476] +[:mouse_move, 772, 179, 2, 278, 477] +[:mouse_move, 792, 180, 2, 279, 478] +[:mouse_move, 796, 180, 2, 280, 479] +[:mouse_move, 813, 181, 2, 281, 480] +[:mouse_move, 822, 181, 2, 282, 481] +[:mouse_move, 830, 181, 2, 283, 482] +[:mouse_move, 854, 182, 2, 284, 483] +[:mouse_move, 866, 183, 2, 285, 484] +[:mouse_move, 891, 183, 2, 286, 485] +[:mouse_move, 905, 184, 2, 287, 486] +[:mouse_move, 938, 185, 2, 288, 487] +[:mouse_move, 970, 186, 2, 289, 488] +[:mouse_move, 1017, 188, 2, 290, 489] +[:mouse_move, 1042, 189, 2, 291, 490] +[:mouse_move, 1079, 190, 2, 292, 491] +[:mouse_move, 1102, 190, 2, 293, 492] +[:mouse_move, 1128, 190, 2, 294, 493] +[:mouse_move, 1142, 190, 2, 295, 494] +[:mouse_move, 1162, 190, 2, 296, 495] +[:mouse_move, 1165, 190, 2, 297, 496] +[:mouse_move, 1175, 190, 2, 298, 497] +[:mouse_move, 1178, 190, 2, 299, 498] +[:mouse_move, 1183, 189, 2, 300, 499] +[:mouse_move, 1185, 189, 2, 301, 500] +[:mouse_move, 1187, 189, 2, 302, 501] +[:mouse_move, 1188, 189, 2, 303, 502] +[:mouse_move, 1190, 189, 2, 304, 503] +[:mouse_move, 1190, 190, 2, 305, 504] +[:mouse_move, 1192, 190, 2, 306, 505] +[:mouse_move, 1193, 191, 2, 307, 506] +[:mouse_move, 1195, 192, 2, 308, 507] +[:mouse_move, 1197, 193, 2, 309, 509] +[:mouse_move, 1198, 194, 2, 310, 510] +[:mouse_move, 1199, 194, 2, 311, 511] +[:mouse_move, 1201, 195, 2, 312, 512] +[:mouse_move, 1202, 196, 2, 313, 513] +[:mouse_move, 1203, 196, 2, 314, 514] +[:mouse_move, 1203, 197, 2, 315, 515] +[:mouse_move, 1204, 197, 2, 316, 516] +[:mouse_move, 1204, 198, 2, 317, 520] +[:mouse_move, 1203, 198, 2, 318, 523] +[:mouse_move, 1202, 199, 2, 319, 524] +[:mouse_move, 1200, 199, 2, 320, 525] +[:mouse_move, 1192, 203, 2, 321, 526] +[:mouse_move, 1177, 209, 2, 322, 527] +[:mouse_move, 1115, 235, 2, 323, 528] +[:mouse_move, 1071, 251, 2, 324, 529] +[:mouse_move, 958, 294, 2, 325, 530] +[:mouse_move, 890, 320, 2, 326, 531] +[:mouse_move, 758, 368, 2, 327, 532] +[:mouse_move, 693, 388, 2, 328, 533] +[:mouse_move, 610, 409, 2, 329, 534] +[:mouse_move, 564, 421, 2, 330, 535] +[:mouse_move, 549, 423, 2, 331, 536] +[:mouse_move, 518, 429, 2, 332, 537] +[:mouse_move, 512, 429, 2, 333, 538] +[:mouse_move, 495, 432, 2, 334, 539] +[:mouse_move, 490, 432, 2, 335, 540] +[:mouse_move, 487, 433, 2, 336, 541] +[:mouse_move, 486, 433, 2, 337, 542] +[:mouse_move, 486, 432, 2, 338, 543] +[:mouse_move, 486, 430, 2, 339, 545] +[:mouse_move, 487, 430, 2, 340, 546] +[:mouse_move, 487, 426, 2, 341, 547] +[:mouse_move, 486, 424, 2, 342, 548] +[:mouse_move, 481, 416, 2, 343, 549] +[:mouse_move, 477, 409, 2, 344, 550] +[:mouse_move, 471, 401, 2, 345, 551] +[:mouse_move, 467, 397, 2, 346, 552] +[:mouse_move, 456, 391, 2, 347, 553] +[:mouse_move, 451, 391, 2, 348, 554] +[:mouse_move, 429, 397, 2, 349, 555] +[:mouse_move, 416, 406, 2, 350, 556] +[:mouse_move, 383, 429, 2, 351, 557] +[:mouse_move, 364, 444, 2, 352, 558] +[:mouse_move, 337, 471, 2, 353, 559] +[:mouse_move, 322, 487, 2, 354, 560] +[:mouse_move, 300, 507, 2, 355, 561] +[:mouse_move, 289, 515, 2, 356, 562] +[:mouse_move, 285, 518, 2, 357, 563] +[:mouse_move, 273, 525, 2, 358, 564] +[:mouse_move, 269, 527, 2, 359, 565] +[:mouse_move, 266, 528, 2, 360, 566] +[:mouse_move, 264, 528, 2, 361, 567] +[:mouse_move, 262, 528, 2, 362, 568] +[:mouse_move, 261, 528, 2, 363, 569] +[:mouse_move, 259, 527, 2, 364, 570] +[:mouse_move, 258, 526, 2, 365, 571] +[:mouse_move, 257, 526, 2, 366, 572] +[:key_down_raw, 115, 0, 2, 367, 589] +[:key_up_raw, 115, 0, 2, 368, 594] +[:mouse_move, 257, 524, 2, 369, 617] +[:mouse_move, 259, 521, 2, 370, 618] +[:mouse_move, 260, 516, 2, 371, 619] +[:mouse_move, 263, 497, 2, 372, 620] +[:mouse_move, 263, 484, 2, 373, 621] +[:mouse_move, 263, 446, 2, 374, 622] +[:mouse_move, 258, 426, 2, 375, 623] +[:mouse_move, 250, 389, 2, 376, 624] +[:mouse_move, 248, 382, 2, 377, 625] +[:mouse_move, 239, 351, 2, 378, 626] +[:mouse_move, 235, 339, 2, 379, 627] +[:mouse_move, 229, 322, 2, 380, 628] +[:mouse_move, 226, 314, 2, 381, 629] +[:mouse_move, 222, 305, 2, 382, 630] +[:mouse_move, 219, 300, 2, 383, 631] +[:mouse_move, 216, 296, 2, 384, 632] +[:mouse_move, 215, 293, 2, 385, 633] +[:mouse_move, 212, 289, 2, 386, 634] +[:mouse_move, 212, 286, 2, 387, 635] +[:mouse_move, 209, 280, 2, 388, 636] +[:mouse_move, 208, 278, 2, 389, 637] +[:mouse_move, 207, 271, 2, 390, 638] +[:mouse_move, 206, 269, 2, 391, 639] +[:mouse_move, 203, 261, 2, 392, 640] +[:mouse_move, 201, 258, 2, 393, 641] +[:mouse_move, 198, 252, 2, 394, 642] +[:mouse_move, 196, 248, 2, 395, 643] +[:mouse_move, 194, 245, 2, 396, 644] +[:mouse_move, 192, 242, 2, 397, 645] +[:mouse_move, 191, 240, 2, 398, 646] +[:mouse_move, 189, 238, 2, 399, 647] +[:mouse_move, 189, 237, 2, 400, 648] +[:mouse_move, 188, 237, 2, 401, 649] +[:mouse_move, 187, 237, 2, 402, 658] +[:mouse_move, 187, 236, 2, 403, 659] +[:mouse_move, 188, 235, 2, 404, 663] +[:mouse_move, 191, 234, 2, 405, 664] +[:mouse_move, 215, 232, 2, 406, 665] +[:mouse_move, 234, 231, 2, 407, 666] +[:mouse_move, 280, 226, 2, 408, 667] +[:mouse_move, 305, 224, 2, 409, 668] +[:mouse_move, 360, 220, 2, 410, 669] +[:mouse_move, 372, 220, 2, 411, 670] +[:mouse_move, 417, 219, 2, 412, 671] +[:mouse_move, 438, 219, 2, 413, 672] +[:mouse_move, 458, 219, 2, 414, 673] +[:mouse_move, 493, 220, 2, 415, 674] +[:mouse_move, 509, 220, 2, 416, 675] +[:mouse_move, 536, 221, 2, 417, 676] +[:mouse_move, 548, 222, 2, 418, 677] +[:mouse_move, 573, 223, 2, 419, 678] +[:mouse_move, 585, 225, 2, 420, 679] +[:mouse_move, 610, 226, 2, 421, 680] +[:mouse_move, 616, 227, 2, 422, 681] +[:mouse_move, 640, 228, 2, 423, 682] +[:mouse_move, 659, 228, 2, 424, 683] +[:mouse_move, 684, 228, 2, 425, 684] +[:mouse_move, 697, 228, 2, 426, 685] +[:mouse_move, 730, 228, 2, 427, 686] +[:mouse_move, 762, 228, 2, 428, 687] +[:mouse_move, 804, 226, 2, 429, 688] +[:mouse_move, 827, 224, 2, 430, 689] +[:mouse_move, 861, 221, 2, 431, 690] +[:mouse_move, 884, 218, 2, 432, 691] +[:mouse_move, 923, 213, 2, 433, 692] +[:mouse_move, 930, 212, 2, 434, 693] +[:mouse_move, 955, 208, 2, 435, 694] +[:mouse_move, 966, 206, 2, 436, 695] +[:mouse_move, 983, 202, 2, 437, 696] +[:mouse_move, 990, 200, 2, 438, 697] +[:mouse_move, 1004, 197, 2, 439, 698] +[:mouse_move, 1009, 197, 2, 440, 699] +[:mouse_move, 1012, 197, 2, 441, 700] +[:mouse_move, 1025, 197, 2, 442, 701] +[:mouse_move, 1028, 197, 2, 443, 702] +[:mouse_move, 1034, 201, 2, 444, 721] +[:mouse_move, 1036, 203, 2, 445, 722] +[:mouse_move, 1041, 208, 2, 446, 723] +[:mouse_move, 1044, 212, 2, 447, 724] +[:mouse_move, 1051, 222, 2, 448, 725] +[:mouse_move, 1054, 229, 2, 449, 726] +[:mouse_move, 1057, 236, 2, 450, 727] +[:mouse_move, 1061, 245, 2, 451, 728] +[:mouse_move, 1064, 254, 2, 452, 729] +[:mouse_move, 1067, 262, 2, 453, 730] +[:mouse_move, 1068, 264, 2, 454, 731] +[:mouse_move, 1070, 270, 2, 455, 732] +[:mouse_move, 1071, 272, 2, 456, 733] +[:mouse_move, 1072, 275, 2, 457, 734] +[:mouse_move, 1072, 277, 2, 458, 735] +[:mouse_move, 1073, 278, 2, 459, 736] +[:mouse_move, 1074, 279, 2, 460, 737] +[:mouse_move, 1075, 280, 2, 461, 738] +[:mouse_move, 1077, 281, 2, 462, 739] +[:mouse_move, 1078, 282, 2, 463, 740] +[:mouse_move, 1080, 282, 2, 464, 741] +[:mouse_move, 1082, 282, 2, 465, 742] +[:mouse_move, 1083, 282, 2, 466, 743] +[:mouse_move, 1084, 282, 2, 467, 744] +[:mouse_move, 1085, 281, 2, 468, 746] +[:mouse_move, 1085, 280, 2, 469, 747] +[:mouse_move, 1086, 280, 2, 470, 748] +[:mouse_move, 1086, 279, 2, 471, 749] +[:mouse_move, 1086, 278, 2, 472, 750] +[:mouse_move, 1087, 278, 2, 473, 751] +[:mouse_move, 1088, 278, 2, 474, 755] +[:mouse_move, 1086, 276, 2, 475, 759] +[:mouse_move, 1082, 273, 2, 476, 760] +[:mouse_move, 1058, 257, 2, 477, 761] +[:mouse_move, 1040, 246, 2, 478, 762] +[:mouse_move, 995, 214, 2, 479, 763] +[:mouse_move, 968, 195, 2, 480, 764] +[:mouse_move, 915, 163, 2, 481, 765] +[:mouse_move, 887, 148, 2, 482, 766] +[:mouse_move, 853, 131, 2, 483, 767] +[:mouse_move, 833, 122, 2, 484, 768] +[:mouse_move, 794, 105, 2, 485, 769] +[:mouse_move, 776, 99, 2, 486, 770] +[:mouse_move, 739, 87, 2, 487, 771] +[:mouse_move, 723, 83, 2, 488, 772] +[:mouse_move, 690, 76, 2, 489, 773] +[:mouse_move, 674, 73, 2, 490, 774] +[:mouse_move, 627, 69, 2, 491, 775] +[:mouse_move, 607, 69, 2, 492, 776] +[:mouse_move, 573, 69, 2, 493, 777] +[:mouse_move, 554, 69, 2, 494, 778] +[:mouse_move, 519, 69, 2, 495, 779] +[:mouse_move, 504, 69, 2, 496, 780] +[:mouse_move, 484, 68, 2, 497, 781] +[:mouse_move, 473, 67, 2, 498, 782] +[:mouse_move, 462, 67, 2, 499, 783] +[:mouse_move, 445, 66, 2, 500, 784] +[:mouse_move, 430, 66, 2, 501, 785] +[:mouse_move, 410, 66, 2, 502, 786] +[:mouse_move, 396, 66, 2, 503, 787] +[:mouse_move, 367, 68, 2, 504, 788] +[:mouse_move, 352, 69, 2, 505, 789] +[:mouse_move, 321, 73, 2, 506, 790] +[:mouse_move, 307, 75, 2, 507, 791] +[:mouse_move, 274, 79, 2, 508, 792] +[:mouse_move, 258, 81, 2, 509, 793] +[:mouse_move, 248, 82, 2, 510, 794] +[:mouse_move, 239, 83, 2, 511, 795] +[:mouse_move, 231, 84, 2, 512, 796] +[:mouse_move, 228, 84, 2, 513, 797] +[:mouse_move, 225, 84, 2, 514, 798] +[:mouse_move, 224, 84, 2, 515, 800] +[:mouse_move, 221, 85, 2, 516, 802] +[:mouse_move, 217, 85, 2, 517, 803] +[:mouse_move, 209, 86, 2, 518, 804] +[:mouse_move, 204, 86, 2, 519, 805] +[:mouse_move, 199, 87, 2, 520, 806] +[:mouse_move, 193, 88, 2, 521, 807] +[:mouse_move, 186, 88, 2, 522, 808] +[:mouse_move, 179, 89, 2, 523, 809] +[:mouse_move, 178, 89, 2, 524, 810] +[:mouse_move, 173, 89, 2, 525, 811] +[:mouse_move, 172, 89, 2, 526, 812] +[:mouse_move, 171, 89, 2, 527, 813] +[:mouse_move, 170, 89, 2, 528, 814] +[:mouse_move, 173, 89, 2, 529, 819] +[:mouse_move, 178, 89, 2, 530, 820] +[:mouse_move, 184, 89, 2, 531, 821] +[:mouse_move, 189, 88, 2, 532, 822] +[:mouse_move, 199, 88, 2, 533, 823] +[:mouse_move, 209, 88, 2, 534, 824] +[:mouse_move, 226, 86, 2, 535, 825] +[:mouse_move, 236, 85, 2, 536, 826] +[:mouse_move, 261, 84, 2, 537, 827] +[:mouse_move, 267, 83, 2, 538, 828] +[:mouse_move, 287, 83, 2, 539, 829] +[:mouse_move, 296, 83, 2, 540, 830] +[:mouse_move, 318, 83, 2, 541, 831] +[:mouse_move, 328, 84, 2, 542, 832] +[:mouse_move, 341, 85, 2, 543, 833] +[:mouse_move, 350, 86, 2, 544, 834] +[:mouse_move, 359, 86, 2, 545, 835] +[:mouse_move, 368, 87, 2, 546, 836] +[:mouse_move, 376, 88, 2, 547, 837] +[:mouse_move, 390, 88, 2, 548, 838] +[:mouse_move, 394, 88, 2, 549, 839] +[:mouse_move, 408, 88, 2, 550, 840] +[:mouse_move, 415, 88, 2, 551, 841] +[:mouse_move, 428, 87, 2, 552, 842] +[:mouse_move, 436, 87, 2, 553, 843] +[:mouse_move, 458, 86, 2, 554, 844] +[:mouse_move, 468, 85, 2, 555, 845] +[:mouse_move, 496, 82, 2, 556, 846] +[:mouse_move, 523, 79, 2, 557, 847] +[:mouse_move, 539, 77, 2, 558, 848] +[:mouse_move, 564, 74, 2, 559, 849] +[:mouse_move, 592, 71, 2, 560, 850] +[:mouse_move, 605, 70, 2, 561, 851] +[:mouse_move, 631, 69, 2, 562, 852] +[:mouse_move, 646, 69, 2, 563, 853] +[:mouse_move, 672, 69, 2, 564, 854] +[:mouse_move, 677, 69, 2, 565, 855] +[:mouse_move, 705, 69, 2, 566, 856] +[:mouse_move, 709, 69, 2, 567, 857] +[:mouse_move, 730, 69, 2, 568, 858] +[:mouse_move, 745, 70, 2, 569, 859] +[:mouse_move, 769, 71, 2, 570, 860] +[:mouse_move, 784, 72, 2, 571, 861] +[:mouse_move, 814, 73, 2, 572, 862] +[:mouse_move, 830, 73, 2, 573, 863] +[:mouse_move, 846, 73, 2, 574, 864] +[:mouse_move, 876, 74, 2, 575, 865] +[:mouse_move, 892, 74, 2, 576, 866] +[:mouse_move, 923, 76, 2, 577, 867] +[:mouse_move, 940, 78, 2, 578, 868] +[:mouse_move, 972, 81, 2, 579, 869] +[:mouse_move, 986, 82, 2, 580, 870] +[:mouse_move, 1014, 85, 2, 581, 871] +[:mouse_move, 1027, 88, 2, 582, 872] +[:mouse_move, 1043, 90, 2, 583, 873] +[:mouse_move, 1053, 92, 2, 584, 874] +[:mouse_move, 1069, 94, 2, 585, 875] +[:mouse_move, 1075, 95, 2, 586, 876] +[:mouse_move, 1083, 96, 2, 587, 877] +[:mouse_move, 1086, 97, 2, 588, 878] +[:mouse_move, 1091, 97, 2, 589, 879] +[:mouse_move, 1092, 97, 2, 590, 880] +[:mouse_move, 1093, 97, 2, 591, 881] +[:mouse_move, 1094, 97, 2, 592, 883] +[:mouse_move, 1094, 106, 2, 593, 898] +[:mouse_move, 1094, 112, 2, 594, 899] +[:mouse_move, 1094, 136, 2, 595, 900] +[:mouse_move, 1094, 142, 2, 596, 901] +[:mouse_move, 1094, 157, 2, 597, 902] +[:mouse_move, 1094, 165, 2, 598, 903] +[:mouse_move, 1094, 182, 2, 599, 904] +[:mouse_move, 1094, 186, 2, 600, 905] +[:mouse_move, 1094, 197, 2, 601, 906] +[:mouse_move, 1093, 200, 2, 602, 907] +[:mouse_move, 1092, 206, 2, 603, 908] +[:mouse_move, 1092, 208, 2, 604, 909] +[:mouse_move, 1092, 210, 2, 605, 910] +[:mouse_move, 1092, 211, 2, 606, 911] +[:mouse_move, 1092, 212, 2, 607, 912] +[:mouse_move, 1092, 213, 2, 608, 913] +[:mouse_move, 1092, 214, 2, 609, 914] +[:mouse_move, 1092, 215, 2, 610, 915] +[:mouse_move, 1092, 220, 2, 611, 916] +[:mouse_move, 1092, 222, 2, 612, 917] +[:mouse_move, 1092, 226, 2, 613, 918] +[:mouse_move, 1092, 236, 2, 614, 919] +[:mouse_move, 1092, 239, 2, 615, 920] +[:mouse_move, 1091, 245, 2, 616, 921] +[:mouse_move, 1091, 248, 2, 617, 922] +[:mouse_move, 1091, 252, 2, 618, 923] +[:mouse_move, 1091, 253, 2, 619, 924] +[:mouse_move, 1091, 255, 2, 620, 925] +[:mouse_move, 1091, 256, 2, 621, 926] +[:mouse_move, 1091, 257, 2, 622, 927] +[:mouse_move, 1091, 258, 2, 623, 928] +[:mouse_move, 1091, 259, 2, 624, 931] +[:mouse_move, 1091, 260, 2, 625, 941] +[:mouse_move, 1091, 261, 2, 626, 942] +[:mouse_move, 1091, 262, 2, 627, 943] +[:mouse_move, 1091, 263, 2, 628, 944] +[:mouse_move, 1091, 264, 2, 629, 945] +[:mouse_move, 1091, 265, 2, 630, 947] +[:mouse_move, 1091, 266, 2, 631, 948] +[:mouse_move, 1091, 267, 2, 632, 949] +[:mouse_move, 1091, 268, 2, 633, 951] +[:mouse_button_pressed, 1, 0, 1, 634, 952] +[:mouse_button_up, 1, 0, 1, 635, 960] +[:mouse_move, 1090, 268, 2, 636, 1062] +[:mouse_move, 1089, 269, 2, 637, 1063] +[:mouse_move, 1084, 271, 2, 638, 1064] +[:mouse_move, 1079, 272, 2, 639, 1065] +[:mouse_move, 1070, 277, 2, 640, 1066] +[:mouse_move, 1065, 279, 2, 641, 1067] +[:mouse_move, 1060, 282, 2, 642, 1068] +[:mouse_move, 1057, 283, 2, 643, 1069] +[:mouse_move, 1053, 286, 2, 644, 1070] +[:mouse_move, 1052, 286, 2, 645, 1071] +[:mouse_move, 1052, 287, 2, 646, 1072] +[:mouse_move, 1051, 287, 2, 647, 1073] +[:mouse_move, 1051, 288, 2, 648, 1074] +[:mouse_move, 1051, 289, 2, 649, 1078] +[:key_down_raw, 115, 0, 2, 650, 1083] +[:key_up_raw, 115, 0, 2, 651, 1088] +[:mouse_move, 1050, 289, 2, 652, 1096] +[:mouse_move, 1042, 294, 2, 653, 1097] +[:mouse_move, 1032, 300, 2, 654, 1098] +[:mouse_move, 979, 325, 2, 655, 1099] +[:mouse_move, 945, 339, 2, 656, 1100] +[:mouse_move, 803, 383, 2, 657, 1101] +[:mouse_move, 722, 403, 2, 658, 1102] +[:mouse_move, 535, 441, 2, 659, 1103] +[:mouse_move, 441, 454, 2, 660, 1104] +[:mouse_move, 311, 467, 2, 661, 1105] +[:mouse_move, 279, 469, 2, 662, 1106] +[:mouse_move, 214, 470, 2, 663, 1107] +[:mouse_move, 149, 469, 2, 664, 1108] +[:mouse_move, 115, 464, 2, 665, 1109] +[:mouse_move, 98, 459, 2, 666, 1110] +[:mouse_move, 84, 456, 2, 667, 1111] +[:mouse_move, 70, 451, 2, 668, 1112] +[:mouse_move, 67, 449, 2, 669, 1113] +[:mouse_move, 64, 447, 2, 670, 1114] +[:mouse_move, 64, 446, 2, 671, 1115] +[:mouse_move, 63, 446, 2, 672, 1116] +[:mouse_move, 63, 445, 2, 673, 1117] +[:mouse_move, 64, 445, 2, 674, 1121] +[:mouse_move, 71, 445, 2, 675, 1122] +[:mouse_move, 78, 445, 2, 676, 1123] +[:mouse_move, 96, 449, 2, 677, 1124] +[:mouse_move, 101, 451, 2, 678, 1125] +[:mouse_move, 113, 455, 2, 679, 1126] +[:mouse_move, 118, 457, 2, 680, 1127] +[:mouse_move, 124, 460, 2, 681, 1128] +[:mouse_move, 126, 460, 2, 682, 1129] +[:mouse_move, 127, 461, 2, 683, 1130] +[:mouse_move, 128, 461, 2, 684, 1131] +[:mouse_move, 128, 462, 2, 685, 1132] +[:mouse_button_pressed, 1, 0, 1, 686, 1137] +[:mouse_button_up, 1, 0, 1, 687, 1145] +[:mouse_move, 128, 457, 2, 688, 1155] +[:mouse_move, 128, 451, 2, 689, 1156] +[:mouse_move, 128, 420, 2, 690, 1157] +[:mouse_move, 128, 397, 2, 691, 1158] +[:mouse_move, 128, 334, 2, 692, 1159] +[:mouse_move, 128, 298, 2, 693, 1160] +[:mouse_move, 128, 282, 2, 694, 1161] +[:mouse_move, 128, 231, 2, 695, 1162] +[:mouse_move, 128, 222, 2, 696, 1163] +[:mouse_move, 128, 192, 2, 697, 1164] +[:mouse_move, 127, 178, 2, 698, 1165] +[:mouse_move, 126, 172, 2, 699, 1166] +[:mouse_move, 126, 168, 2, 700, 1167] +[:mouse_move, 125, 163, 2, 701, 1168] +[:mouse_move, 125, 162, 2, 702, 1169] +[:mouse_move, 124, 161, 2, 703, 1170] +[:mouse_move, 124, 160, 2, 704, 1171] +[:mouse_move, 123, 160, 2, 705, 1173] +[:mouse_button_pressed, 1, 0, 1, 706, 1177] +[:mouse_button_up, 1, 0, 1, 707, 1186] +[:mouse_move, 126, 160, 2, 708, 1190] +[:mouse_move, 149, 160, 2, 709, 1191] +[:mouse_move, 187, 160, 2, 710, 1192] +[:mouse_move, 240, 156, 2, 711, 1193] +[:mouse_move, 274, 150, 2, 712, 1194] +[:mouse_move, 294, 146, 2, 713, 1195] +[:mouse_move, 311, 141, 2, 714, 1196] +[:mouse_move, 324, 139, 2, 715, 1197] +[:mouse_move, 329, 137, 2, 716, 1198] +[:mouse_move, 335, 136, 2, 717, 1199] +[:mouse_button_pressed, 1, 0, 1, 718, 1208] +[:mouse_button_up, 1, 0, 1, 719, 1217] +[:mouse_move, 331, 149, 2, 720, 1220] +[:mouse_move, 325, 159, 2, 721, 1221] +[:mouse_move, 285, 225, 2, 722, 1222] +[:mouse_move, 238, 300, 2, 723, 1223] +[:mouse_move, 159, 435, 2, 724, 1224] +[:mouse_move, 137, 471, 2, 725, 1225] +[:mouse_move, 82, 563, 2, 726, 1226] +[:mouse_move, 51, 612, 2, 727, 1227] +[:mouse_move, 39, 634, 2, 728, 1228] +[:mouse_move, 28, 654, 2, 729, 1229] +[:key_down_raw, 1073741903, 0, 2, 730, 1293] +[:key_down_raw, 1073741903, 0, 2, 731, 1317] +[:key_down_raw, 1073741903, 0, 2, 732, 1319] +[:key_down_raw, 1073741903, 0, 2, 733, 1321] +[:key_down_raw, 1073741903, 0, 2, 734, 1323] +[:key_down_raw, 1073741903, 0, 2, 735, 1325] +[:key_down_raw, 1073741903, 0, 2, 736, 1327] +[:key_down_raw, 1073741903, 0, 2, 737, 1330] +[:key_down_raw, 1073741903, 0, 2, 738, 1332] +[:key_down_raw, 1073741903, 0, 2, 739, 1334] +[:key_down_raw, 1073741903, 0, 2, 740, 1336] +[:key_down_raw, 1073741903, 0, 2, 741, 1338] +[:key_down_raw, 1073741903, 0, 2, 742, 1340] +[:key_up_raw, 1073741903, 0, 2, 743, 1341] +[:key_down_raw, 1073741904, 0, 2, 744, 1341] +[:key_down_raw, 1073741903, 0, 2, 745, 1366] +[:key_up_raw, 1073741904, 0, 2, 746, 1369] +[:key_down_raw, 1073741903, 0, 2, 747, 1391] +[:key_down_raw, 1073741903, 0, 2, 748, 1393] +[:key_down_raw, 1073741903, 0, 2, 749, 1395] +[:key_down_raw, 1073741904, 0, 2, 750, 1397] +[:key_up_raw, 1073741903, 0, 2, 751, 1398] +[:key_down_raw, 32, 0, 2, 752, 1417] +[:key_down_raw, 1073741903, 0, 2, 753, 1420] +[:key_up_raw, 1073741904, 0, 2, 754, 1421] +[:key_down_raw, 1073741904, 0, 2, 755, 1437] +[:key_up_raw, 1073741903, 0, 2, 756, 1438] +[:key_down_raw, 1073741904, 0, 2, 757, 1462] +[:key_down_raw, 1073741904, 0, 2, 758, 1464] +[:key_down_raw, 1073741904, 0, 2, 759, 1466] +[:key_down_raw, 1073741904, 0, 2, 760, 1468] +[:key_down_raw, 1073741904, 0, 2, 761, 1470] +[:key_down_raw, 1073741904, 0, 2, 762, 1472] +[:key_down_raw, 1073741904, 0, 2, 763, 1474] +[:key_down_raw, 1073741903, 0, 2, 764, 1475] +[:key_up_raw, 1073741904, 0, 2, 765, 1490] +[:key_down_raw, 1073741903, 0, 2, 766, 1500] +[:key_down_raw, 1073741903, 0, 2, 767, 1502] +[:key_down_raw, 1073741903, 0, 2, 768, 1504] +[:key_down_raw, 1073741903, 0, 2, 769, 1506] +[:key_down_raw, 1073741903, 0, 2, 770, 1508] +[:key_down_raw, 1073741903, 0, 2, 771, 1510] +[:key_down_raw, 1073741903, 0, 2, 772, 1512] +[:key_up_raw, 32, 0, 2, 773, 1514] +[:key_down_raw, 1073741903, 0, 2, 774, 1514] +[:key_down_raw, 1073741903, 0, 2, 775, 1516] +[:key_up_raw, 1073741903, 0, 2, 776, 1516] +[:mouse_move, 30, 645, 2, 777, 1626] +[:mouse_move, 51, 614, 2, 778, 1627] +[:mouse_move, 61, 599, 2, 779, 1628] +[:mouse_move, 84, 572, 2, 780, 1629] +[:mouse_move, 95, 562, 2, 781, 1630] +[:mouse_move, 110, 552, 2, 782, 1631] +[:mouse_move, 122, 543, 2, 783, 1632] +[:mouse_move, 132, 538, 2, 784, 1633] +[:mouse_move, 137, 536, 2, 785, 1634] +[:mouse_move, 142, 534, 2, 786, 1635] +[:mouse_move, 143, 534, 2, 787, 1636] +[:mouse_move, 144, 534, 2, 788, 1637] +[:mouse_move, 144, 533, 2, 789, 1641] +[:mouse_move, 144, 532, 2, 790, 1642] +[:mouse_move, 145, 527, 2, 791, 1643] +[:mouse_move, 147, 522, 2, 792, 1644] +[:mouse_move, 157, 500, 2, 793, 1645] +[:mouse_move, 160, 493, 2, 794, 1646] +[:mouse_move, 168, 478, 2, 795, 1647] +[:mouse_move, 169, 474, 2, 796, 1648] +[:mouse_move, 175, 463, 2, 797, 1649] +[:mouse_move, 177, 460, 2, 798, 1650] +[:mouse_move, 179, 455, 2, 799, 1651] +[:mouse_move, 179, 453, 2, 800, 1652] +[:mouse_move, 179, 451, 2, 801, 1653] +[:mouse_move, 179, 448, 2, 802, 1654] +[:mouse_move, 179, 447, 2, 803, 1655] +[:mouse_move, 179, 445, 2, 804, 1656] +[:mouse_move, 178, 444, 2, 805, 1657] +[:mouse_move, 177, 443, 2, 806, 1658] +[:mouse_move, 175, 441, 2, 807, 1660] +[:mouse_move, 174, 440, 2, 808, 1661] +[:mouse_move, 173, 438, 2, 809, 1662] +[:mouse_move, 172, 437, 2, 810, 1664] +[:mouse_move, 171, 437, 2, 811, 1666] +[:mouse_button_pressed, 1, 0, 1, 812, 1674] +[:mouse_button_up, 1, 0, 1, 813, 1681] +[:key_down_raw, 1073742051, 1024, 2, 814, 1894] +[:key_down_raw, 113, 1024, 2, 815, 1896] diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image1.png b/samples/08_platformer_collisions_metroidvania/sprites/image1.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image1.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image10.png b/samples/08_platformer_collisions_metroidvania/sprites/image10.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image10.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image11.png b/samples/08_platformer_collisions_metroidvania/sprites/image11.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image11.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image12.png b/samples/08_platformer_collisions_metroidvania/sprites/image12.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image12.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image13.png b/samples/08_platformer_collisions_metroidvania/sprites/image13.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image13.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image14.png b/samples/08_platformer_collisions_metroidvania/sprites/image14.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image14.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image15.png b/samples/08_platformer_collisions_metroidvania/sprites/image15.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image15.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image16.png b/samples/08_platformer_collisions_metroidvania/sprites/image16.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image16.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image17.png b/samples/08_platformer_collisions_metroidvania/sprites/image17.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image17.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image18.png b/samples/08_platformer_collisions_metroidvania/sprites/image18.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image18.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image19.png b/samples/08_platformer_collisions_metroidvania/sprites/image19.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image19.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image2.png b/samples/08_platformer_collisions_metroidvania/sprites/image2.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image2.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image20.png b/samples/08_platformer_collisions_metroidvania/sprites/image20.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image20.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image3.png b/samples/08_platformer_collisions_metroidvania/sprites/image3.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image3.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image4.png b/samples/08_platformer_collisions_metroidvania/sprites/image4.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image4.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image5.png b/samples/08_platformer_collisions_metroidvania/sprites/image5.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image5.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image6.png b/samples/08_platformer_collisions_metroidvania/sprites/image6.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image6.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image7.png b/samples/08_platformer_collisions_metroidvania/sprites/image7.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image7.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image8.png b/samples/08_platformer_collisions_metroidvania/sprites/image8.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image8.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/image9.png b/samples/08_platformer_collisions_metroidvania/sprites/image9.png Binary files differnew file mode 100644 index 0000000..b0eb399 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/image9.png diff --git a/samples/08_platformer_collisions_metroidvania/sprites/player.png b/samples/08_platformer_collisions_metroidvania/sprites/player.png Binary files differnew file mode 100644 index 0000000..4c733a2 --- /dev/null +++ b/samples/08_platformer_collisions_metroidvania/sprites/player.png diff --git a/samples/08_platformer_jumping_inertia/app/main.rb b/samples/08_platformer_jumping_inertia/app/main.rb new file mode 100644 index 0000000..3fcb9e9 --- /dev/null +++ b/samples/08_platformer_jumping_inertia/app/main.rb @@ -0,0 +1,196 @@ +=begin + + Reminders: + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + For example, if we want to create a new button, we would declare it as a new entity and + then define its properties. (Remember, you can use state to define ANY property and it will + be retained across frames.) + + - args.outputs.solids: An array. The values generate a solid. + The parameters for a solid are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + + - num1.greater(num2): Returns the greater value. + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + - ARRAY#inside_rect?: Returns true or false depending on if the point is inside the rect. + +=end + +# This sample app is a game that requires the user to jump from one platform to the next. +# As the player successfully clears platforms, they become smaller and move faster. + +class VerticalPlatformer + attr_gtk + + # declares vertical platformer as new entity + def s + state.vertical_platformer ||= state.new_entity(:vertical_platformer) + state.vertical_platformer + end + + # creates a new platform using a hash + def new_platform hash + s.new_entity_strict(:platform, hash) # platform key + end + + # calls methods needed for game to run properly + def tick + defaults + render + calc + input + end + + # Sets default values + def defaults + s.platforms ||= [ # initializes platforms collection with two platforms using hashes + new_platform(x: 0, y: 0, w: 700, h: 32, dx: 1, speed: 0, rect: nil), + new_platform(x: 0, y: 300, w: 700, h: 32, dx: 1, speed: 0, rect: nil), # 300 pixels higher + ] + + s.tick_count = args.state.tick_count + s.gravity = -0.3 # what goes up must come down because of gravity + s.player.platforms_cleared ||= 0 # counts how many platforms the player has successfully cleared + s.player.x ||= 0 # sets player values + s.player.y ||= 100 + s.player.w ||= 64 + s.player.h ||= 64 + s.player.dy ||= 0 # change in position + s.player.dx ||= 0 + s.player_jump_power = 15 + s.player_jump_power_duration = 10 + s.player_max_run_speed = 5 + s.player_speed_slowdown_rate = 0.9 + s.player_acceleration = 1 + s.camera ||= { y: -100 } # shows view on screen (as the player moves upward, the camera does too) + end + + # Outputs objects onto the screen + def render + outputs.solids << s.platforms.map do |p| # outputs platforms onto screen + [p.x + 300, p.y - s.camera[:y], p.w, p.h] # add 300 to place platform in horizontal center + # don't forget, position of platform is denoted by bottom left hand corner + end + + # outputs player using hash + outputs.solids << { + x: s.player.x + 300, # player positioned on top of platform + y: s.player.y - s.camera[:y], + w: s.player.w, + h: s.player.h, + r: 100, # color saturation + g: 100, + b: 200 + } + end + + # Performs calculations + def calc + s.platforms.each do |p| # for each platform in the collection + p.rect = [p.x, p.y, p.w, p.h] # set the definition + end + + # sets player point by adding half the player's width to the player's x + s.player.point = [s.player.x + s.player.w.half, s.player.y] # change + to - and see what happens! + + # search the platforms collection to find if the player's point is inside the rect of a platform + collision = s.platforms.find { |p| s.player.point.inside_rect? p.rect } + + # if collision occurred and player is moving down (or not moving vertically at all) + if collision && s.player.dy <= 0 + s.player.y = collision.rect.y + collision.rect.h - 2 # player positioned on top of platform + s.player.dy = 0 if s.player.dy < 0 # player stops moving vertically + if !s.player.platform + s.player.dx = 0 # no horizontal movement + end + # changes horizontal position of player by multiplying collision change in x (dx) by speed and adding it to current x + s.player.x += collision.dx * collision.speed + s.player.platform = collision # player is on the platform that it collided with (or landed on) + if s.player.falling # if player is falling + s.player.dx = 0 # no horizontal movement + end + s.player.falling = false + s.player.jumped_at = nil + else + s.player.platform = nil # player is not on a platform + s.player.y += s.player.dy # velocity is the change in position + s.player.dy += s.gravity # acceleration is the change in velocity; what goes up must come down + end + + s.platforms.each do |p| # for each platform in the collection + p.x += p.dx * p.speed # x is incremented by product of dx and speed (causes platform to move horizontally) + # changes platform's x so it moves left and right across the screen (between -300 and 300 pixels) + if p.x < -300 # if platform goes too far left + p.dx *= -1 # dx is scaled down + p.x = -300 # as far left as possible within scope + elsif p.x > (1000 - p.w) # if platform's x is greater than 300 + p.dx *= -1 + p.x = (1000 - p.w) # set to 300 (as far right as possible within scope) + end + end + + delta = (s.player.y - s.camera[:y] - 100) # used to position camera view + + if delta > -200 + s.camera[:y] += delta * 0.01 # allows player to see view as they move upwards + s.player.x += s.player.dx # velocity is change in position; change in x increases by dx + + # searches platform collection to find platforms located more than 300 pixels above the player + has_platforms = s.platforms.find { |p| p.y > (s.player.y + 300) } + if !has_platforms # if there are no platforms 300 pixels above the player + width = 700 - (700 * (0.1 * s.player.platforms_cleared)) # the next platform is smaller than previous + s.player.platforms_cleared += 1 # player successfully cleared another platform + last_platform = s.platforms[-1] # platform just cleared becomes last platform + # another platform is created 300 pixels above the last platform, and this + # new platform has a smaller width and moves faster than all previous platforms + s.platforms << new_platform(x: (700 - width) * rand, # random x position + y: last_platform.y + 300, + w: width, + h: 32, + dx: 1.randomize(:sign), # random change in x + speed: 2 * s.player.platforms_cleared, + rect: nil) + end + else + s.as_hash.clear # otherwise clear the hash (no new platform is necessary) + end + end + + # Takes input from the user to move the player + def input + if inputs.keyboard.space # if the space bar is pressed + s.player.jumped_at ||= s.tick_count # set to current frame + + # if the time that has passed since the jump is less than the duration of a jump (10 frames) + # and the player is not falling + if s.player.jumped_at.elapsed_time < s.player_jump_power_duration && !s.player.falling + s.player.dy = s.player_jump_power # player jumps up + end + end + + if inputs.keyboard.key_up.space # if space bar is in "up" state + s.player.falling = true # player is falling + end + + if inputs.keyboard.left # if left key is pressed + s.player.dx -= s.player_acceleration # player's position changes, decremented by acceleration + s.player.dx = s.player.dx.greater(-s.player_max_run_speed) # dx is either current dx or -5, whichever is greater + elsif inputs.keyboard.right # if right key is pressed + s.player.dx += s.player_acceleration # player's position changes, incremented by acceleration + s.player.dx = s.player.dx.lesser(s.player_max_run_speed) # dx is either current dx or 5, whichever is lesser + else + s.player.dx *= s.player_speed_slowdown_rate # scales dx down + end + end +end + +$game = VerticalPlatformer.new + +def tick args + $game.args = args + $game.tick +end diff --git a/samples/08_platformer_jumping_inertia/replay.txt b/samples/08_platformer_jumping_inertia/replay.txt new file mode 100644 index 0000000..966dbcd --- /dev/null +++ b/samples/08_platformer_jumping_inertia/replay.txt @@ -0,0 +1,124 @@ +replay_version 2.0 +stopped_at 1260 +seed 100 +recorded_at Sun Sep 29 22:23:22 2019 +[:key_down_raw, 1073741903, 0, 2, 1, 45] +[:key_down_raw, 1073741903, 0, 2, 2, 70] +[:key_down_raw, 1073741903, 0, 2, 3, 72] +[:key_down_raw, 1073741903, 0, 2, 4, 74] +[:key_down_raw, 1073741903, 0, 2, 5, 76] +[:key_down_raw, 1073741903, 0, 2, 6, 78] +[:key_down_raw, 1073741903, 0, 2, 7, 80] +[:key_down_raw, 1073741903, 0, 2, 8, 82] +[:key_down_raw, 1073741903, 0, 2, 9, 84] +[:key_down_raw, 1073741903, 0, 2, 10, 86] +[:key_down_raw, 1073741903, 0, 2, 11, 88] +[:key_up_raw, 1073741903, 0, 2, 12, 89] +[:key_down_raw, 1073741904, 0, 2, 13, 92] +[:key_down_raw, 1073741903, 0, 2, 14, 112] +[:key_up_raw, 1073741904, 0, 2, 15, 115] +[:key_down_raw, 1073741903, 0, 2, 16, 137] +[:key_down_raw, 1073741903, 0, 2, 17, 139] +[:key_down_raw, 8, 0, 2, 18, 141] +[:key_up_raw, 1073741903, 0, 2, 19, 146] +[:key_down_raw, 1073741903, 0, 2, 20, 147] +[:key_up_raw, 1073741903, 0, 2, 21, 147] +[:key_down_raw, 1073741904, 0, 2, 22, 154] +[:key_up_raw, 8, 0, 2, 23, 172] +[:key_down_raw, 1073741903, 0, 2, 24, 175] +[:key_up_raw, 1073741904, 0, 2, 25, 175] +[:key_down_raw, 32, 0, 2, 26, 194] +[:key_down_raw, 1073741904, 0, 2, 27, 201] +[:key_up_raw, 1073741903, 0, 2, 28, 202] +[:key_down_raw, 1073741903, 0, 2, 29, 222] +[:key_up_raw, 1073741904, 0, 2, 30, 226] +[:key_up_raw, 32, 0, 2, 31, 233] +[:key_down_raw, 1073741903, 0, 2, 32, 247] +[:key_down_raw, 1073741903, 0, 2, 33, 249] +[:key_down_raw, 1073741903, 0, 2, 34, 251] +[:key_down_raw, 1073741903, 0, 2, 35, 253] +[:key_down_raw, 1073741903, 0, 2, 36, 255] +[:key_down_raw, 1073741903, 0, 2, 37, 257] +[:key_down_raw, 1073741903, 0, 2, 38, 259] +[:key_down_raw, 1073741903, 0, 2, 39, 261] +[:key_down_raw, 1073741903, 0, 2, 40, 263] +[:key_down_raw, 1073741903, 0, 2, 41, 265] +[:key_down_raw, 1073741903, 0, 2, 42, 267] +[:key_down_raw, 1073741903, 0, 2, 43, 269] +[:key_down_raw, 1073741903, 0, 2, 44, 271] +[:key_down_raw, 1073741903, 0, 2, 45, 273] +[:key_down_raw, 1073741903, 0, 2, 46, 275] +[:key_up_raw, 1073741903, 0, 2, 47, 276] +[:key_down_raw, 1073741904, 0, 2, 48, 280] +[:key_up_raw, 1073741904, 0, 2, 49, 297] +[:key_down_raw, 1073741903, 0, 2, 50, 300] +[:key_down_raw, 32, 0, 2, 51, 303] +[:key_up_raw, 32, 0, 2, 52, 308] +[:key_up_raw, 1073741903, 0, 2, 53, 334] +[:key_down_raw, 1073741904, 0, 2, 54, 336] +[:key_down_raw, 1073741903, 0, 2, 55, 355] +[:key_up_raw, 1073741904, 0, 2, 56, 355] +[:key_up_raw, 1073741903, 0, 2, 57, 373] +[:key_down_raw, 1073741904, 0, 2, 58, 380] +[:key_down_raw, 32, 0, 2, 59, 398] +[:key_up_raw, 32, 0, 2, 60, 404] +[:key_up_raw, 1073741904, 0, 2, 61, 490] +[:key_down_raw, 32, 0, 2, 62, 510] +[:key_up_raw, 32, 0, 2, 63, 516] +[:key_down_raw, 1073741903, 0, 2, 64, 517] +[:key_up_raw, 1073741903, 0, 2, 65, 537] +[:key_down_raw, 1073741904, 0, 2, 66, 538] +[:key_up_raw, 1073741904, 0, 2, 67, 553] +[:key_down_raw, 32, 0, 2, 68, 653] +[:key_up_raw, 32, 0, 2, 69, 659] +[:key_down_raw, 1073741903, 0, 2, 70, 661] +[:key_down_raw, 1073741903, 0, 2, 71, 686] +[:key_up_raw, 1073741903, 0, 2, 72, 687] +[:key_down_raw, 1073741904, 0, 2, 73, 690] +[:key_down_raw, 1073741904, 0, 2, 74, 715] +[:key_down_raw, 1073741904, 0, 2, 75, 717] +[:key_down_raw, 1073741904, 0, 2, 76, 719] +[:key_down_raw, 1073741904, 0, 2, 77, 721] +[:key_down_raw, 1073741904, 0, 2, 78, 723] +[:key_down_raw, 1073741904, 0, 2, 79, 725] +[:key_down_raw, 1073741904, 0, 2, 80, 727] +[:key_down_raw, 1073741904, 0, 2, 81, 729] +[:key_up_raw, 1073741904, 0, 2, 82, 731] +[:key_down_raw, 1073741903, 0, 2, 83, 740] +[:key_down_raw, 32, 0, 2, 84, 749] +[:key_up_raw, 32, 0, 2, 85, 756] +[:key_up_raw, 1073741903, 0, 2, 86, 789] +[:key_down_raw, 1073741904, 0, 2, 87, 792] +[:key_down_raw, 1073741904, 0, 2, 88, 817] +[:key_up_raw, 1073741904, 0, 2, 89, 817] +[:key_down_raw, 32, 0, 2, 90, 844] +[:key_down_raw, 1073741903, 0, 2, 91, 846] +[:key_up_raw, 32, 0, 2, 92, 852] +[:key_down_raw, 1073741903, 0, 2, 93, 871] +[:key_down_raw, 1073741903, 0, 2, 94, 873] +[:key_down_raw, 1073741903, 0, 2, 95, 875] +[:key_down_raw, 1073741903, 0, 2, 96, 877] +[:key_down_raw, 1073741903, 0, 2, 97, 879] +[:key_down_raw, 1073741903, 0, 2, 98, 881] +[:key_down_raw, 1073741903, 0, 2, 99, 883] +[:key_down_raw, 1073741903, 0, 2, 100, 885] +[:key_down_raw, 1073741903, 0, 2, 101, 887] +[:key_up_raw, 1073741903, 0, 2, 102, 887] +[:key_down_raw, 1073741904, 0, 2, 103, 897] +[:key_up_raw, 1073741904, 0, 2, 104, 901] +[:key_down_raw, 32, 0, 2, 105, 948] +[:key_up_raw, 32, 0, 2, 106, 953] +[:key_down_raw, 1073741904, 0, 2, 107, 977] +[:key_up_raw, 1073741904, 0, 2, 108, 991] +[:key_down_raw, 32, 0, 2, 109, 1056] +[:key_up_raw, 32, 0, 2, 110, 1060] +[:key_down_raw, 1073741904, 0, 2, 111, 1065] +[:key_down_raw, 1073741904, 0, 2, 112, 1090] +[:key_down_raw, 1073741904, 0, 2, 113, 1092] +[:key_down_raw, 1073741904, 0, 2, 114, 1094] +[:key_down_raw, 1073741904, 0, 2, 115, 1096] +[:key_up_raw, 1073741904, 0, 2, 116, 1098] +[:key_down_raw, 1073741903, 0, 2, 117, 1108] +[:key_up_raw, 1073741903, 0, 2, 118, 1127] +[:key_down_raw, 1073742051, 1024, 2, 119, 1258] +[:key_down_raw, 113, 1024, 2, 120, 1259] diff --git a/samples/09_controller_analog_usage_advanced_sprites/app/main.rb b/samples/09_controller_analog_usage_advanced_sprites/app/main.rb new file mode 100644 index 0000000..c3f2d8f --- /dev/null +++ b/samples/09_controller_analog_usage_advanced_sprites/app/main.rb @@ -0,0 +1,226 @@ +=begin + APIs listing that haven't been encountered in previous sample apps: + + - merge: Returns a hash containing the contents of two original hashes. + Merge does not allow duplicate keys, so the value of a repeated key + will be overwritten. + + For example, if we had two hashes + h1 = { "a" => 1, "b" => 2} + h2 = { "b" => 3, "c" => 3} + and we called the command + h1.merge(h2) + the result would the following hash + { "a" => 1, "b" => 3, "c" => 3}. + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + In this sample app, we're using a hash to create a sprite. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + Before continuing with this sample app, it is HIGHLY recommended that you look + at mygame/documentation/05-sprites.md. + + - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + + - args.inputs.controller_one: Takes input from the controller based on what key is pressed. + For more information about the controller, go to mygame/documentation/08-controllers.md. + + - num1.lesser(num2): Finds the lower value of the given options. + +=end + +# This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen, +# and also can be moved in different directions through keyboard input from the user. + +# Calls the methods necessary for the game to run successfully. +def tick args + default args + render args.grid, args.outputs, args.state + calc args.state + process_inputs args +end + +# Sets default values for the car sprite +# Initialization ||= only happens in the first frame +def default args + args.state.sprite.width = 19 + args.state.sprite.height = 10 + args.state.sprite.scale = 4 + args.state.max_speed = 5 + args.state.x ||= 100 + args.state.y ||= 100 + args.state.speed ||= 1 + args.state.angle ||= 0 +end + +# Outputs sprite onto screen +def render grid, outputs, state + outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background + outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite + 'sprites/86.png', # image path of car + state.angle, + opacity, # transparency + saturation, + source_rect(state), # sprite sub division/tile (tile x, y, w, h) + false, false, # don't flip sprites + rotation_anchor] + + # also look at the create_sprite helper method + # + # For example: + # + # dest = destination_rect(state) + # source = source_rect(state), + # outputs.sprites << create_sprite( + # 'sprites/86.png', + # x: dest.x, + # y: dest.y, + # w: dest.w, + # h: dest.h, + # angle: state.angle, + # source_x: source.x, + # source_y: source.y, + # source_w: source.w, + # source_h: source.h, + # flip_h: false, + # flip_v: false, + # rotation_anchor_x: 0.7, + # rotation_anchor_y: 0.5 + # ) +end + +# Creates sprite by setting values inside of a hash +def create_sprite path, options = {} + options = { + + # dest x, y, w, h + x: 0, + y: 0, + w: 100, + h: 100, + + # angle, rotation + angle: 0, + rotation_anchor_x: 0.5, + rotation_anchor_y: 0.5, + + # color saturation (red, green, blue), transparency + r: 255, + g: 255, + b: 255, + a: 255, + + # source x, y, width, height + source_x: 0, + source_y: 0, + source_w: -1, + source_h: -1, + + # flip horiztonally, flip vertically + flip_h: false, + flip_v: false, + + }.merge options + + [ + options[:x], options[:y], options[:w], options[:h], # dest rect keys + path, + options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha + options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys + options[:flip_h], options[:flip_v], # flip + options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor + ] # hash keys contain corresponding values +end + +# Calls the calc_pos and calc_wrap methods. +def calc state + calc_pos state + calc_wrap state +end + +# Changes sprite's position on screen +# Vectors have magnitude and direction, so the incremented x and y values give the car direction +def calc_pos state + state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed + state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed + state.speed *= 1.1 # scales speed up + state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed) +end + +# The screen's dimensions are 1280x720. If the car goes out of scope, +# it loops back around on the screen. +def calc_wrap state + + # car returns to left side of screen if it disappears on right side of screen + # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger + state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280 + + # car wraps around to right side of screen if it disappears on the left side + state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0 + + # car wraps around to bottom of screen if it disappears at the top of the screen + # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!) + state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope + + # car wraps around to top of screen if it disappears at the bottom of the screen + state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0 +end + +# Changes angle of sprite based on user input from keyboard or controller +def process_inputs args + + # NOTE: increasing the angle doesn't mean that the car will continue to go + # in a specific direction. The angle is increasing, which means that if the + # left key was kept in the "down" state, the change in the angle would cause + # the car to go in a counter-clockwise direction and form a circle (360 degrees) + if args.inputs.keyboard.key_held.left # if left key is pressed + args.state.angle += 2 # car's angle is incremented by 2 + + # The same applies to decreasing the angle. If the right key was kept in the + # "down" state, the decreasing angle would cause the car to go in a clockwise + # direction and form a circle (360 degrees) + elsif args.inputs.keyboard.key_held.right # if right key is pressed + args.state.angle -= 2 # car's angle is decremented by 2 + + # Input from a controller can also change the angle of the car + elsif args.inputs.controller_one.left_analog_x_perc != 0 + args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1 + end +end + +# A sprite's center of rotation can be altered +# Increasing either of these numbers would dramatically increase the +# car's drift when it turns! +def rotation_anchor + [0.7, 0.5] +end + +# Sets opacity value of sprite to 255 so that it is not transparent at all +# Change it to 0 and you won't be able to see the car sprite on the screen +def opacity + 255 +end + +# Sets the color of the sprite to white. +def saturation + [255, 255, 255] +end + +# Sets definition of destination_rect (used to define the car sprite) +def destination_rect state + [state.x, state.y, + state.sprite.width * state.sprite.scale, # multiplies by 4 to set size + state.sprite.height * state.sprite.scale] +end + +# Portion of a sprite (a tile) +# Sub division of sprite is denoted as a rectangle directly related to original size of .png +# Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height) +def source_rect state + [0, 0, state.sprite.width, state.sprite.height] +end diff --git a/samples/09_controller_analog_usage_advanced_sprites/license-for-sample.txt b/samples/09_controller_analog_usage_advanced_sprites/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/09_controller_analog_usage_advanced_sprites/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/09_controller_analog_usage_advanced_sprites/replay.txt b/samples/09_controller_analog_usage_advanced_sprites/replay.txt new file mode 100644 index 0000000..a88fc4e --- /dev/null +++ b/samples/09_controller_analog_usage_advanced_sprites/replay.txt @@ -0,0 +1,891 @@ +replay_version 2.0 +stopped_at 1251 +seed 100 +recorded_at Sun Sep 29 22:24:17 2019 +[:left_analog_x_player_1, -3000, 0, 1, 1, 104] +[:left_analog_x_player_1, -6000, 0, 1, 2, 105] +[:left_analog_x_player_1, -7000, 0, 1, 3, 106] +[:left_analog_x_player_1, -8000, 0, 1, 4, 107] +[:left_analog_x_player_1, -10000, 0, 1, 5, 108] +[:left_analog_y_player_1, 1000, 0, 1, 6, 108] +[:left_analog_x_player_1, -12000, 0, 1, 7, 109] +[:left_analog_y_player_1, 2000, 0, 1, 8, 109] +[:left_analog_x_player_1, -13000, 0, 1, 9, 110] +[:left_analog_x_player_1, -14000, 0, 1, 10, 111] +[:left_analog_y_player_1, 3000, 0, 1, 11, 113] +[:left_analog_x_player_1, -15000, 0, 1, 12, 114] +[:left_analog_x_player_1, -16000, 0, 1, 13, 121] +[:left_analog_x_player_1, -17000, 0, 1, 14, 123] +[:left_analog_x_player_1, -18000, 0, 1, 15, 124] +[:left_analog_x_player_1, -19000, 0, 1, 16, 125] +[:left_analog_x_player_1, -20000, 0, 1, 17, 127] +[:key_down_player_one, 3, 0, 1, 18, 128] +[:key_held_player_one, 3, 0, 1, 19, 129] +[:key_held_player_one, 3, 0, 1, 20, 130] +[:key_held_player_one, 3, 0, 1, 21, 131] +[:key_held_player_one, 3, 0, 1, 22, 132] +[:key_held_player_one, 3, 0, 1, 23, 133] +[:key_held_player_one, 3, 0, 1, 24, 134] +[:key_held_player_one, 3, 0, 1, 25, 135] +[:key_held_player_one, 3, 0, 1, 26, 136] +[:key_held_player_one, 3, 0, 1, 27, 137] +[:key_held_player_one, 3, 0, 1, 28, 138] +[:key_held_player_one, 3, 0, 1, 29, 139] +[:key_held_player_one, 3, 0, 1, 30, 140] +[:key_held_player_one, 3, 0, 1, 31, 141] +[:key_held_player_one, 3, 0, 1, 32, 142] +[:left_analog_x_player_1, -21000, 0, 1, 33, 142] +[:key_held_player_one, 3, 0, 1, 34, 143] +[:key_held_player_one, 3, 0, 1, 35, 144] +[:left_analog_x_player_1, -22000, 0, 1, 36, 144] +[:key_held_player_one, 3, 0, 1, 37, 145] +[:key_held_player_one, 3, 0, 1, 38, 146] +[:key_held_player_one, 3, 0, 1, 39, 147] +[:left_analog_x_player_1, -23000, 0, 1, 40, 147] +[:key_held_player_one, 3, 0, 1, 41, 148] +[:left_analog_x_player_1, -24000, 0, 1, 42, 148] +[:key_held_player_one, 3, 0, 1, 43, 149] +[:left_analog_x_player_1, -26000, 0, 1, 44, 149] +[:key_held_player_one, 3, 0, 1, 45, 150] +[:left_analog_x_player_1, -27000, 0, 1, 46, 150] +[:key_held_player_one, 3, 0, 1, 47, 151] +[:left_analog_x_player_1, -30000, 0, 1, 48, 151] +[:key_held_player_one, 3, 0, 1, 49, 152] +[:left_analog_x_player_1, -31000, 0, 1, 50, 152] +[:key_held_player_one, 3, 0, 1, 51, 153] +[:left_analog_x_player_1, -32000, 0, 1, 52, 153] +[:key_held_player_one, 3, 0, 1, 53, 154] +[:key_held_player_one, 3, 0, 1, 54, 155] +[:key_held_player_one, 3, 0, 1, 55, 156] +[:key_held_player_one, 3, 0, 1, 56, 157] +[:key_held_player_one, 3, 0, 1, 57, 158] +[:key_held_player_one, 3, 0, 1, 58, 159] +[:key_held_player_one, 3, 0, 1, 59, 160] +[:key_held_player_one, 3, 0, 1, 60, 161] +[:key_held_player_one, 3, 0, 1, 61, 162] +[:left_analog_y_player_1, 2000, 0, 1, 62, 162] +[:key_held_player_one, 3, 0, 1, 63, 163] +[:key_held_player_one, 3, 0, 1, 64, 164] +[:key_held_player_one, 3, 0, 1, 65, 165] +[:key_held_player_one, 3, 0, 1, 66, 166] +[:key_held_player_one, 3, 0, 1, 67, 167] +[:key_held_player_one, 3, 0, 1, 68, 168] +[:key_held_player_one, 3, 0, 1, 69, 169] +[:key_held_player_one, 3, 0, 1, 70, 170] +[:key_held_player_one, 3, 0, 1, 71, 171] +[:key_held_player_one, 3, 0, 1, 72, 172] +[:key_held_player_one, 3, 0, 1, 73, 173] +[:key_held_player_one, 3, 0, 1, 74, 174] +[:key_held_player_one, 3, 0, 1, 75, 175] +[:key_held_player_one, 3, 0, 1, 76, 176] +[:key_held_player_one, 3, 0, 1, 77, 177] +[:key_held_player_one, 3, 0, 1, 78, 178] +[:key_held_player_one, 3, 0, 1, 79, 179] +[:key_held_player_one, 3, 0, 1, 80, 180] +[:key_held_player_one, 3, 0, 1, 81, 181] +[:key_held_player_one, 3, 0, 1, 82, 182] +[:key_held_player_one, 3, 0, 1, 83, 183] +[:key_held_player_one, 3, 0, 1, 84, 184] +[:key_held_player_one, 3, 0, 1, 85, 185] +[:key_held_player_one, 3, 0, 1, 86, 186] +[:key_held_player_one, 3, 0, 1, 87, 187] +[:key_held_player_one, 3, 0, 1, 88, 188] +[:key_held_player_one, 3, 0, 1, 89, 189] +[:key_held_player_one, 3, 0, 1, 90, 190] +[:key_held_player_one, 3, 0, 1, 91, 191] +[:key_held_player_one, 3, 0, 1, 92, 192] +[:key_held_player_one, 3, 0, 1, 93, 193] +[:key_held_player_one, 3, 0, 1, 94, 194] +[:key_held_player_one, 3, 0, 1, 95, 195] +[:key_held_player_one, 3, 0, 1, 96, 196] +[:key_held_player_one, 3, 0, 1, 97, 197] +[:key_held_player_one, 3, 0, 1, 98, 198] +[:key_held_player_one, 3, 0, 1, 99, 199] +[:key_held_player_one, 3, 0, 1, 100, 200] +[:key_held_player_one, 3, 0, 1, 101, 201] +[:key_held_player_one, 3, 0, 1, 102, 202] +[:key_held_player_one, 3, 0, 1, 103, 203] +[:key_held_player_one, 3, 0, 1, 104, 204] +[:key_held_player_one, 3, 0, 1, 105, 205] +[:key_held_player_one, 3, 0, 1, 106, 206] +[:key_held_player_one, 3, 0, 1, 107, 207] +[:key_held_player_one, 3, 0, 1, 108, 208] +[:key_held_player_one, 3, 0, 1, 109, 209] +[:key_held_player_one, 3, 0, 1, 110, 210] +[:key_held_player_one, 3, 0, 1, 111, 211] +[:key_held_player_one, 3, 0, 1, 112, 212] +[:key_held_player_one, 3, 0, 1, 113, 213] +[:key_held_player_one, 3, 0, 1, 114, 214] +[:key_held_player_one, 3, 0, 1, 115, 215] +[:key_held_player_one, 3, 0, 1, 116, 216] +[:key_held_player_one, 3, 0, 1, 117, 217] +[:key_held_player_one, 3, 0, 1, 118, 218] +[:key_held_player_one, 3, 0, 1, 119, 219] +[:key_held_player_one, 3, 0, 1, 120, 220] +[:key_held_player_one, 3, 0, 1, 121, 221] +[:key_held_player_one, 3, 0, 1, 122, 222] +[:key_held_player_one, 3, 0, 1, 123, 223] +[:key_held_player_one, 3, 0, 1, 124, 224] +[:key_held_player_one, 3, 0, 1, 125, 225] +[:key_held_player_one, 3, 0, 1, 126, 226] +[:key_held_player_one, 3, 0, 1, 127, 227] +[:key_held_player_one, 3, 0, 1, 128, 228] +[:key_held_player_one, 3, 0, 1, 129, 229] +[:key_held_player_one, 3, 0, 1, 130, 230] +[:left_analog_y_player_1, 3000, 0, 1, 131, 230] +[:key_held_player_one, 3, 0, 1, 132, 231] +[:key_held_player_one, 3, 0, 1, 133, 232] +[:key_held_player_one, 3, 0, 1, 134, 233] +[:key_held_player_one, 3, 0, 1, 135, 234] +[:key_held_player_one, 3, 0, 1, 136, 235] +[:key_held_player_one, 3, 0, 1, 137, 236] +[:key_held_player_one, 3, 0, 1, 138, 237] +[:key_held_player_one, 3, 0, 1, 139, 238] +[:key_held_player_one, 3, 0, 1, 140, 239] +[:key_held_player_one, 3, 0, 1, 141, 240] +[:key_held_player_one, 3, 0, 1, 142, 241] +[:key_held_player_one, 3, 0, 1, 143, 242] +[:key_held_player_one, 3, 0, 1, 144, 243] +[:key_held_player_one, 3, 0, 1, 145, 244] +[:key_held_player_one, 3, 0, 1, 146, 245] +[:key_held_player_one, 3, 0, 1, 147, 246] +[:key_held_player_one, 3, 0, 1, 148, 247] +[:key_held_player_one, 3, 0, 1, 149, 248] +[:key_held_player_one, 3, 0, 1, 150, 249] +[:key_held_player_one, 3, 0, 1, 151, 250] +[:key_held_player_one, 3, 0, 1, 152, 251] +[:key_held_player_one, 3, 0, 1, 153, 252] +[:key_held_player_one, 3, 0, 1, 154, 253] +[:key_held_player_one, 3, 0, 1, 155, 254] +[:key_held_player_one, 3, 0, 1, 156, 255] +[:key_held_player_one, 3, 0, 1, 157, 256] +[:key_held_player_one, 3, 0, 1, 158, 257] +[:key_held_player_one, 3, 0, 1, 159, 258] +[:key_held_player_one, 3, 0, 1, 160, 259] +[:key_held_player_one, 3, 0, 1, 161, 260] +[:key_held_player_one, 3, 0, 1, 162, 261] +[:key_held_player_one, 3, 0, 1, 163, 262] +[:key_held_player_one, 3, 0, 1, 164, 263] +[:key_held_player_one, 3, 0, 1, 165, 264] +[:key_held_player_one, 3, 0, 1, 166, 265] +[:key_held_player_one, 3, 0, 1, 167, 266] +[:key_held_player_one, 3, 0, 1, 168, 267] +[:key_held_player_one, 3, 0, 1, 169, 268] +[:key_held_player_one, 3, 0, 1, 170, 269] +[:key_held_player_one, 3, 0, 1, 171, 270] +[:key_held_player_one, 3, 0, 1, 172, 271] +[:key_held_player_one, 3, 0, 1, 173, 272] +[:key_held_player_one, 3, 0, 1, 174, 273] +[:key_held_player_one, 3, 0, 1, 175, 274] +[:key_held_player_one, 3, 0, 1, 176, 275] +[:key_held_player_one, 3, 0, 1, 177, 276] +[:key_held_player_one, 3, 0, 1, 178, 277] +[:key_held_player_one, 3, 0, 1, 179, 278] +[:key_held_player_one, 3, 0, 1, 180, 279] +[:key_held_player_one, 3, 0, 1, 181, 280] +[:key_held_player_one, 3, 0, 1, 182, 281] +[:key_held_player_one, 3, 0, 1, 183, 282] +[:key_held_player_one, 3, 0, 1, 184, 283] +[:key_held_player_one, 3, 0, 1, 185, 284] +[:key_held_player_one, 3, 0, 1, 186, 285] +[:key_held_player_one, 3, 0, 1, 187, 286] +[:key_held_player_one, 3, 0, 1, 188, 287] +[:key_held_player_one, 3, 0, 1, 189, 288] +[:key_held_player_one, 3, 0, 1, 190, 289] +[:key_held_player_one, 3, 0, 1, 191, 290] +[:key_held_player_one, 3, 0, 1, 192, 291] +[:key_held_player_one, 3, 0, 1, 193, 292] +[:key_held_player_one, 3, 0, 1, 194, 293] +[:key_held_player_one, 3, 0, 1, 195, 294] +[:key_held_player_one, 3, 0, 1, 196, 295] +[:key_held_player_one, 3, 0, 1, 197, 296] +[:key_held_player_one, 3, 0, 1, 198, 297] +[:key_held_player_one, 3, 0, 1, 199, 298] +[:key_held_player_one, 3, 0, 1, 200, 299] +[:key_held_player_one, 3, 0, 1, 201, 300] +[:key_held_player_one, 3, 0, 1, 202, 301] +[:key_held_player_one, 3, 0, 1, 203, 302] +[:key_held_player_one, 3, 0, 1, 204, 303] +[:key_held_player_one, 3, 0, 1, 205, 304] +[:key_held_player_one, 3, 0, 1, 206, 305] +[:key_held_player_one, 3, 0, 1, 207, 306] +[:key_held_player_one, 3, 0, 1, 208, 307] +[:key_held_player_one, 3, 0, 1, 209, 308] +[:key_held_player_one, 3, 0, 1, 210, 309] +[:key_held_player_one, 3, 0, 1, 211, 310] +[:key_held_player_one, 3, 0, 1, 212, 311] +[:key_held_player_one, 3, 0, 1, 213, 312] +[:key_held_player_one, 3, 0, 1, 214, 313] +[:key_held_player_one, 3, 0, 1, 215, 314] +[:key_held_player_one, 3, 0, 1, 216, 315] +[:key_held_player_one, 3, 0, 1, 217, 316] +[:key_held_player_one, 3, 0, 1, 218, 317] +[:key_held_player_one, 3, 0, 1, 219, 318] +[:key_held_player_one, 3, 0, 1, 220, 319] +[:key_held_player_one, 3, 0, 1, 221, 320] +[:key_held_player_one, 3, 0, 1, 222, 321] +[:key_held_player_one, 3, 0, 1, 223, 322] +[:key_held_player_one, 3, 0, 1, 224, 323] +[:key_held_player_one, 3, 0, 1, 225, 324] +[:key_held_player_one, 3, 0, 1, 226, 325] +[:key_held_player_one, 3, 0, 1, 227, 326] +[:key_held_player_one, 3, 0, 1, 228, 327] +[:key_held_player_one, 3, 0, 1, 229, 328] +[:key_held_player_one, 3, 0, 1, 230, 329] +[:key_held_player_one, 3, 0, 1, 231, 330] +[:key_held_player_one, 3, 0, 1, 232, 331] +[:key_held_player_one, 3, 0, 1, 233, 332] +[:key_held_player_one, 3, 0, 1, 234, 333] +[:key_held_player_one, 3, 0, 1, 235, 334] +[:key_held_player_one, 3, 0, 1, 236, 335] +[:key_held_player_one, 3, 0, 1, 237, 336] +[:key_held_player_one, 3, 0, 1, 238, 337] +[:key_held_player_one, 3, 0, 1, 239, 338] +[:key_held_player_one, 3, 0, 1, 240, 339] +[:key_held_player_one, 3, 0, 1, 241, 340] +[:key_held_player_one, 3, 0, 1, 242, 341] +[:key_held_player_one, 3, 0, 1, 243, 342] +[:key_held_player_one, 3, 0, 1, 244, 343] +[:key_held_player_one, 3, 0, 1, 245, 344] +[:key_held_player_one, 3, 0, 1, 246, 345] +[:key_held_player_one, 3, 0, 1, 247, 346] +[:key_held_player_one, 3, 0, 1, 248, 347] +[:key_held_player_one, 3, 0, 1, 249, 348] +[:key_held_player_one, 3, 0, 1, 250, 349] +[:key_held_player_one, 3, 0, 1, 251, 350] +[:key_held_player_one, 3, 0, 1, 252, 351] +[:key_held_player_one, 3, 0, 1, 253, 352] +[:key_held_player_one, 3, 0, 1, 254, 353] +[:key_held_player_one, 3, 0, 1, 255, 354] +[:key_held_player_one, 3, 0, 1, 256, 355] +[:key_held_player_one, 3, 0, 1, 257, 356] +[:key_held_player_one, 3, 0, 1, 258, 357] +[:key_held_player_one, 3, 0, 1, 259, 358] +[:key_held_player_one, 3, 0, 1, 260, 359] +[:key_held_player_one, 3, 0, 1, 261, 360] +[:key_held_player_one, 3, 0, 1, 262, 361] +[:key_held_player_one, 3, 0, 1, 263, 362] +[:key_held_player_one, 3, 0, 1, 264, 363] +[:key_held_player_one, 3, 0, 1, 265, 364] +[:key_held_player_one, 3, 0, 1, 266, 365] +[:key_held_player_one, 3, 0, 1, 267, 366] +[:key_held_player_one, 3, 0, 1, 268, 367] +[:key_held_player_one, 3, 0, 1, 269, 368] +[:key_held_player_one, 3, 0, 1, 270, 369] +[:key_held_player_one, 3, 0, 1, 271, 370] +[:key_held_player_one, 3, 0, 1, 272, 371] +[:key_held_player_one, 3, 0, 1, 273, 372] +[:key_held_player_one, 3, 0, 1, 274, 373] +[:key_held_player_one, 3, 0, 1, 275, 374] +[:key_held_player_one, 3, 0, 1, 276, 375] +[:key_held_player_one, 3, 0, 1, 277, 376] +[:key_held_player_one, 3, 0, 1, 278, 377] +[:key_held_player_one, 3, 0, 1, 279, 378] +[:key_held_player_one, 3, 0, 1, 280, 379] +[:left_analog_y_player_1, 2000, 0, 1, 281, 379] +[:key_held_player_one, 3, 0, 1, 282, 380] +[:left_analog_y_player_1, 0, 0, 1, 283, 380] +[:key_held_player_one, 3, 0, 1, 284, 381] +[:left_analog_x_player_1, -28000, 0, 1, 285, 381] +[:key_held_player_one, 3, 0, 1, 286, 382] +[:left_analog_x_player_1, -20000, 0, 1, 287, 382] +[:key_held_player_one, 3, 0, 1, 288, 383] +[:left_analog_x_player_1, 0, 0, 1, 289, 383] +[:key_up_player_one, 3, 0, 1, 290, 384] +[:right_analog_x_player_1, 2000, 0, 1, 291, 391] +[:right_analog_x_player_1, 6000, 0, 1, 292, 392] +[:right_analog_x_player_1, 8000, 0, 1, 293, 393] +[:right_analog_x_player_1, 11000, 0, 1, 294, 394] +[:right_analog_x_player_1, 13000, 0, 1, 295, 395] +[:right_analog_x_player_1, 15000, 0, 1, 296, 396] +[:right_analog_x_player_1, 18000, 0, 1, 297, 397] +[:right_analog_x_player_1, 19000, 0, 1, 298, 398] +[:right_analog_x_player_1, 20000, 0, 1, 299, 400] +[:key_down_player_one, 4, 0, 1, 300, 401] +[:key_held_player_one, 4, 0, 1, 301, 402] +[:key_held_player_one, 4, 0, 1, 302, 403] +[:key_held_player_one, 4, 0, 1, 303, 404] +[:key_held_player_one, 4, 0, 1, 304, 405] +[:key_held_player_one, 4, 0, 1, 305, 406] +[:key_held_player_one, 4, 0, 1, 306, 407] +[:key_held_player_one, 4, 0, 1, 307, 408] +[:key_held_player_one, 4, 0, 1, 308, 409] +[:key_held_player_one, 4, 0, 1, 309, 410] +[:key_held_player_one, 4, 0, 1, 310, 411] +[:key_held_player_one, 4, 0, 1, 311, 412] +[:key_held_player_one, 4, 0, 1, 312, 413] +[:key_held_player_one, 4, 0, 1, 313, 414] +[:key_held_player_one, 4, 0, 1, 314, 415] +[:right_analog_x_player_1, 21000, 0, 1, 315, 415] +[:key_held_player_one, 4, 0, 1, 316, 416] +[:key_held_player_one, 4, 0, 1, 317, 417] +[:key_held_player_one, 4, 0, 1, 318, 418] +[:right_analog_x_player_1, 22000, 0, 1, 319, 418] +[:key_held_player_one, 4, 0, 1, 320, 419] +[:key_held_player_one, 4, 0, 1, 321, 420] +[:key_held_player_one, 4, 0, 1, 322, 421] +[:right_analog_x_player_1, 24000, 0, 1, 323, 421] +[:key_held_player_one, 4, 0, 1, 324, 422] +[:right_analog_x_player_1, 25000, 0, 1, 325, 422] +[:key_held_player_one, 4, 0, 1, 326, 423] +[:right_analog_x_player_1, 26000, 0, 1, 327, 423] +[:key_held_player_one, 4, 0, 1, 328, 424] +[:key_held_player_one, 4, 0, 1, 329, 425] +[:right_analog_x_player_1, 27000, 0, 1, 330, 425] +[:key_held_player_one, 4, 0, 1, 331, 426] +[:right_analog_x_player_1, 29000, 0, 1, 332, 426] +[:key_held_player_one, 4, 0, 1, 333, 427] +[:right_analog_x_player_1, 31000, 0, 1, 334, 427] +[:key_held_player_one, 4, 0, 1, 335, 428] +[:right_analog_x_player_1, 32000, 0, 1, 336, 428] +[:key_held_player_one, 4, 0, 1, 337, 429] +[:key_held_player_one, 4, 0, 1, 338, 430] +[:key_held_player_one, 4, 0, 1, 339, 431] +[:key_held_player_one, 4, 0, 1, 340, 432] +[:key_held_player_one, 4, 0, 1, 341, 433] +[:key_held_player_one, 4, 0, 1, 342, 434] +[:key_held_player_one, 4, 0, 1, 343, 435] +[:key_held_player_one, 4, 0, 1, 344, 436] +[:key_held_player_one, 4, 0, 1, 345, 437] +[:key_held_player_one, 4, 0, 1, 346, 438] +[:key_held_player_one, 4, 0, 1, 347, 439] +[:key_held_player_one, 4, 0, 1, 348, 440] +[:key_held_player_one, 4, 0, 1, 349, 441] +[:key_held_player_one, 4, 0, 1, 350, 442] +[:key_held_player_one, 4, 0, 1, 351, 443] +[:key_held_player_one, 4, 0, 1, 352, 444] +[:key_held_player_one, 4, 0, 1, 353, 445] +[:key_held_player_one, 4, 0, 1, 354, 446] +[:key_held_player_one, 4, 0, 1, 355, 447] +[:key_held_player_one, 4, 0, 1, 356, 448] +[:key_held_player_one, 4, 0, 1, 357, 449] +[:key_held_player_one, 4, 0, 1, 358, 450] +[:key_held_player_one, 4, 0, 1, 359, 451] +[:key_held_player_one, 4, 0, 1, 360, 452] +[:key_held_player_one, 4, 0, 1, 361, 453] +[:key_held_player_one, 4, 0, 1, 362, 454] +[:key_held_player_one, 4, 0, 1, 363, 455] +[:key_held_player_one, 4, 0, 1, 364, 456] +[:key_held_player_one, 4, 0, 1, 365, 457] +[:right_analog_x_player_1, 31000, 0, 1, 366, 457] +[:key_held_player_one, 4, 0, 1, 367, 458] +[:right_analog_x_player_1, 22000, 0, 1, 368, 458] +[:key_held_player_one, 4, 0, 1, 369, 459] +[:right_analog_x_player_1, 3000, 0, 1, 370, 459] +[:key_up_player_one, 4, 0, 1, 371, 460] +[:right_analog_x_player_1, 0, 0, 1, 372, 460] +[:right_analog_x_player_1, -1000, 0, 1, 373, 494] +[:right_analog_x_player_1, -2000, 0, 1, 374, 496] +[:right_analog_x_player_1, -4000, 0, 1, 375, 497] +[:right_analog_x_player_1, -8000, 0, 1, 376, 498] +[:right_analog_x_player_1, -13000, 0, 1, 377, 499] +[:right_analog_x_player_1, -18000, 0, 1, 378, 500] +[:right_analog_y_player_1, -1000, 0, 1, 379, 500] +[:right_analog_x_player_1, -23000, 0, 1, 380, 501] +[:right_analog_y_player_1, -2000, 0, 1, 381, 501] +[:key_down_player_one, 3, 0, 1, 382, 502] +[:right_analog_x_player_1, -27000, 0, 1, 383, 502] +[:right_analog_y_player_1, -3000, 0, 1, 384, 502] +[:key_held_player_one, 3, 0, 1, 385, 503] +[:right_analog_x_player_1, -32000, 0, 1, 386, 503] +[:right_analog_y_player_1, -4000, 0, 1, 387, 503] +[:key_held_player_one, 3, 0, 1, 388, 504] +[:key_held_player_one, 3, 0, 1, 389, 505] +[:key_held_player_one, 3, 0, 1, 390, 506] +[:key_held_player_one, 3, 0, 1, 391, 507] +[:key_held_player_one, 3, 0, 1, 392, 508] +[:key_held_player_one, 3, 0, 1, 393, 509] +[:key_held_player_one, 3, 0, 1, 394, 510] +[:key_held_player_one, 3, 0, 1, 395, 511] +[:key_held_player_one, 3, 0, 1, 396, 512] +[:key_held_player_one, 3, 0, 1, 397, 513] +[:key_held_player_one, 3, 0, 1, 398, 514] +[:key_held_player_one, 3, 0, 1, 399, 515] +[:key_held_player_one, 3, 0, 1, 400, 516] +[:right_analog_x_player_1, -31000, 0, 1, 401, 516] +[:right_analog_y_player_1, -7000, 0, 1, 402, 516] +[:key_held_player_one, 3, 0, 1, 403, 517] +[:right_analog_x_player_1, -21000, 0, 1, 404, 517] +[:right_analog_y_player_1, -8000, 0, 1, 405, 517] +[:key_held_player_one, 3, 0, 1, 406, 518] +[:right_analog_x_player_1, -9000, 0, 1, 407, 518] +[:key_up_player_one, 3, 0, 1, 408, 519] +[:right_analog_x_player_1, -2000, 0, 1, 409, 519] +[:right_analog_y_player_1, -2000, 0, 1, 410, 519] +[:right_analog_x_player_1, 0, 0, 1, 411, 520] +[:right_analog_y_player_1, 0, 0, 1, 412, 520] +[:left_analog_x_player_1, 1000, 0, 1, 413, 523] +[:left_analog_x_player_1, 3000, 0, 1, 414, 524] +[:left_analog_x_player_1, 5000, 0, 1, 415, 525] +[:left_analog_x_player_1, 8000, 0, 1, 416, 526] +[:left_analog_x_player_1, 12000, 0, 1, 417, 527] +[:left_analog_x_player_1, 15000, 0, 1, 418, 528] +[:left_analog_x_player_1, 18000, 0, 1, 419, 529] +[:left_analog_x_player_1, 19000, 0, 1, 420, 530] +[:left_analog_x_player_1, 20000, 0, 1, 421, 531] +[:key_down_player_one, 4, 0, 1, 422, 532] +[:left_analog_x_player_1, 21000, 0, 1, 423, 532] +[:key_held_player_one, 4, 0, 1, 424, 533] +[:key_held_player_one, 4, 0, 1, 425, 534] +[:key_held_player_one, 4, 0, 1, 426, 535] +[:key_held_player_one, 4, 0, 1, 427, 536] +[:key_held_player_one, 4, 0, 1, 428, 537] +[:key_held_player_one, 4, 0, 1, 429, 538] +[:key_held_player_one, 4, 0, 1, 430, 539] +[:left_analog_x_player_1, 22000, 0, 1, 431, 539] +[:key_held_player_one, 4, 0, 1, 432, 540] +[:left_analog_x_player_1, 23000, 0, 1, 433, 540] +[:left_analog_y_player_1, 2000, 0, 1, 434, 540] +[:key_held_player_one, 4, 0, 1, 435, 541] +[:key_held_player_one, 4, 0, 1, 436, 542] +[:left_analog_x_player_1, 24000, 0, 1, 437, 542] +[:left_analog_y_player_1, 3000, 0, 1, 438, 542] +[:key_held_player_one, 4, 0, 1, 439, 543] +[:left_analog_x_player_1, 26000, 0, 1, 440, 543] +[:key_held_player_one, 4, 0, 1, 441, 544] +[:left_analog_x_player_1, 27000, 0, 1, 442, 544] +[:key_held_player_one, 4, 0, 1, 443, 545] +[:key_held_player_one, 4, 0, 1, 444, 546] +[:key_held_player_one, 4, 0, 1, 445, 547] +[:key_held_player_one, 4, 0, 1, 446, 548] +[:key_held_player_one, 4, 0, 1, 447, 549] +[:key_held_player_one, 4, 0, 1, 448, 550] +[:key_held_player_one, 4, 0, 1, 449, 551] +[:key_held_player_one, 4, 0, 1, 450, 552] +[:key_held_player_one, 4, 0, 1, 451, 553] +[:key_held_player_one, 4, 0, 1, 452, 554] +[:key_held_player_one, 4, 0, 1, 453, 555] +[:key_held_player_one, 4, 0, 1, 454, 556] +[:key_held_player_one, 4, 0, 1, 455, 557] +[:key_held_player_one, 4, 0, 1, 456, 558] +[:key_held_player_one, 4, 0, 1, 457, 559] +[:key_held_player_one, 4, 0, 1, 458, 560] +[:key_held_player_one, 4, 0, 1, 459, 561] +[:key_held_player_one, 4, 0, 1, 460, 562] +[:key_held_player_one, 4, 0, 1, 461, 563] +[:key_held_player_one, 4, 0, 1, 462, 564] +[:key_held_player_one, 4, 0, 1, 463, 565] +[:key_held_player_one, 4, 0, 1, 464, 566] +[:key_held_player_one, 4, 0, 1, 465, 567] +[:key_held_player_one, 4, 0, 1, 466, 568] +[:key_held_player_one, 4, 0, 1, 467, 569] +[:key_held_player_one, 4, 0, 1, 468, 570] +[:key_held_player_one, 4, 0, 1, 469, 571] +[:key_held_player_one, 4, 0, 1, 470, 572] +[:key_held_player_one, 4, 0, 1, 471, 573] +[:key_held_player_one, 4, 0, 1, 472, 574] +[:key_held_player_one, 4, 0, 1, 473, 575] +[:key_held_player_one, 4, 0, 1, 474, 576] +[:key_held_player_one, 4, 0, 1, 475, 577] +[:key_held_player_one, 4, 0, 1, 476, 578] +[:key_held_player_one, 4, 0, 1, 477, 579] +[:key_held_player_one, 4, 0, 1, 478, 580] +[:key_held_player_one, 4, 0, 1, 479, 581] +[:left_analog_x_player_1, 28000, 0, 1, 480, 581] +[:left_analog_y_player_1, 4000, 0, 1, 481, 581] +[:key_held_player_one, 4, 0, 1, 482, 582] +[:left_analog_x_player_1, 30000, 0, 1, 483, 582] +[:left_analog_y_player_1, 5000, 0, 1, 484, 582] +[:key_held_player_one, 4, 0, 1, 485, 583] +[:left_analog_x_player_1, 32000, 0, 1, 486, 583] +[:left_analog_y_player_1, 7000, 0, 1, 487, 583] +[:key_held_player_one, 4, 0, 1, 488, 584] +[:key_held_player_one, 4, 0, 1, 489, 585] +[:key_held_player_one, 4, 0, 1, 490, 586] +[:key_held_player_one, 4, 0, 1, 491, 587] +[:key_held_player_one, 4, 0, 1, 492, 588] +[:key_held_player_one, 4, 0, 1, 493, 589] +[:key_held_player_one, 4, 0, 1, 494, 590] +[:key_held_player_one, 4, 0, 1, 495, 591] +[:key_held_player_one, 4, 0, 1, 496, 592] +[:key_held_player_one, 4, 0, 1, 497, 593] +[:key_held_player_one, 4, 0, 1, 498, 594] +[:key_held_player_one, 4, 0, 1, 499, 595] +[:key_held_player_one, 4, 0, 1, 500, 596] +[:key_held_player_one, 4, 0, 1, 501, 597] +[:key_held_player_one, 4, 0, 1, 502, 598] +[:key_held_player_one, 4, 0, 1, 503, 599] +[:key_held_player_one, 4, 0, 1, 504, 600] +[:key_held_player_one, 4, 0, 1, 505, 601] +[:key_held_player_one, 4, 0, 1, 506, 602] +[:key_held_player_one, 4, 0, 1, 507, 603] +[:key_held_player_one, 4, 0, 1, 508, 604] +[:key_held_player_one, 4, 0, 1, 509, 605] +[:key_held_player_one, 4, 0, 1, 510, 606] +[:key_held_player_one, 4, 0, 1, 511, 607] +[:key_held_player_one, 4, 0, 1, 512, 608] +[:key_held_player_one, 4, 0, 1, 513, 609] +[:key_held_player_one, 4, 0, 1, 514, 610] +[:key_held_player_one, 4, 0, 1, 515, 611] +[:key_held_player_one, 4, 0, 1, 516, 612] +[:key_held_player_one, 4, 0, 1, 517, 613] +[:key_held_player_one, 4, 0, 1, 518, 614] +[:key_held_player_one, 4, 0, 1, 519, 615] +[:key_held_player_one, 4, 0, 1, 520, 616] +[:key_held_player_one, 4, 0, 1, 521, 617] +[:key_held_player_one, 4, 0, 1, 522, 618] +[:key_held_player_one, 4, 0, 1, 523, 619] +[:key_held_player_one, 4, 0, 1, 524, 620] +[:key_held_player_one, 4, 0, 1, 525, 621] +[:key_held_player_one, 4, 0, 1, 526, 622] +[:key_held_player_one, 4, 0, 1, 527, 623] +[:key_held_player_one, 4, 0, 1, 528, 624] +[:key_held_player_one, 4, 0, 1, 529, 625] +[:key_held_player_one, 4, 0, 1, 530, 626] +[:key_held_player_one, 4, 0, 1, 531, 627] +[:key_held_player_one, 4, 0, 1, 532, 628] +[:key_held_player_one, 4, 0, 1, 533, 629] +[:key_held_player_one, 4, 0, 1, 534, 630] +[:key_held_player_one, 4, 0, 1, 535, 631] +[:left_analog_y_player_1, 8000, 0, 1, 536, 631] +[:key_held_player_one, 4, 0, 1, 537, 632] +[:key_held_player_one, 4, 0, 1, 538, 633] +[:key_held_player_one, 4, 0, 1, 539, 634] +[:key_held_player_one, 4, 0, 1, 540, 635] +[:key_held_player_one, 4, 0, 1, 541, 636] +[:key_held_player_one, 4, 0, 1, 542, 637] +[:key_held_player_one, 4, 0, 1, 543, 638] +[:key_held_player_one, 4, 0, 1, 544, 639] +[:key_held_player_one, 4, 0, 1, 545, 640] +[:key_held_player_one, 4, 0, 1, 546, 641] +[:key_held_player_one, 4, 0, 1, 547, 642] +[:key_held_player_one, 4, 0, 1, 548, 643] +[:key_held_player_one, 4, 0, 1, 549, 644] +[:left_analog_y_player_1, 9000, 0, 1, 550, 644] +[:key_held_player_one, 4, 0, 1, 551, 645] +[:left_analog_y_player_1, 8000, 0, 1, 552, 645] +[:key_held_player_one, 4, 0, 1, 553, 646] +[:left_analog_x_player_1, 29000, 0, 1, 554, 646] +[:left_analog_y_player_1, 6000, 0, 1, 555, 646] +[:key_held_player_one, 4, 0, 1, 556, 647] +[:left_analog_x_player_1, 25000, 0, 1, 557, 647] +[:left_analog_y_player_1, 4000, 0, 1, 558, 647] +[:key_held_player_one, 4, 0, 1, 559, 648] +[:left_analog_x_player_1, 17000, 0, 1, 560, 648] +[:left_analog_y_player_1, 2000, 0, 1, 561, 648] +[:key_up_player_one, 4, 0, 1, 562, 649] +[:left_analog_x_player_1, 11000, 0, 1, 563, 649] +[:left_analog_y_player_1, 0, 0, 1, 564, 649] +[:left_analog_x_player_1, 0, 0, 1, 565, 650] +[:left_analog_x_player_1, -2000, 0, 1, 566, 684] +[:left_analog_x_player_1, -5000, 0, 1, 567, 685] +[:left_analog_x_player_1, -8000, 0, 1, 568, 686] +[:left_analog_x_player_1, -12000, 0, 1, 569, 687] +[:left_analog_x_player_1, -15000, 0, 1, 570, 688] +[:left_analog_x_player_1, -18000, 0, 1, 571, 689] +[:left_analog_x_player_1, -21000, 0, 1, 572, 690] +[:key_down_player_one, 3, 0, 1, 573, 691] +[:left_analog_x_player_1, -22000, 0, 1, 574, 691] +[:key_held_player_one, 3, 0, 1, 575, 692] +[:left_analog_x_player_1, -23000, 0, 1, 576, 692] +[:key_held_player_one, 3, 0, 1, 577, 693] +[:key_held_player_one, 3, 0, 1, 578, 694] +[:key_held_player_one, 3, 0, 1, 579, 695] +[:left_analog_x_player_1, -22000, 0, 1, 580, 695] +[:key_held_player_one, 3, 0, 1, 581, 696] +[:key_held_player_one, 3, 0, 1, 582, 697] +[:left_analog_y_player_1, 1000, 0, 1, 583, 697] +[:key_held_player_one, 3, 0, 1, 584, 698] +[:key_held_player_one, 3, 0, 1, 585, 699] +[:key_held_player_one, 3, 0, 1, 586, 700] +[:key_held_player_one, 3, 0, 1, 587, 701] +[:key_held_player_one, 3, 0, 1, 588, 702] +[:left_analog_x_player_1, -23000, 0, 1, 589, 702] +[:key_held_player_one, 3, 0, 1, 590, 703] +[:left_analog_x_player_1, -24000, 0, 1, 591, 703] +[:key_held_player_one, 3, 0, 1, 592, 704] +[:key_held_player_one, 3, 0, 1, 593, 705] +[:key_held_player_one, 3, 0, 1, 594, 706] +[:key_held_player_one, 3, 0, 1, 595, 707] +[:key_held_player_one, 3, 0, 1, 596, 708] +[:key_held_player_one, 3, 0, 1, 597, 709] +[:left_analog_x_player_1, -25000, 0, 1, 598, 709] +[:key_held_player_one, 3, 0, 1, 599, 710] +[:left_analog_y_player_1, 2000, 0, 1, 600, 710] +[:key_held_player_one, 3, 0, 1, 601, 711] +[:key_held_player_one, 3, 0, 1, 602, 712] +[:key_held_player_one, 3, 0, 1, 603, 713] +[:key_held_player_one, 3, 0, 1, 604, 714] +[:key_held_player_one, 3, 0, 1, 605, 715] +[:key_held_player_one, 3, 0, 1, 606, 716] +[:key_held_player_one, 3, 0, 1, 607, 717] +[:left_analog_y_player_1, 1000, 0, 1, 608, 717] +[:key_held_player_one, 3, 0, 1, 609, 718] +[:left_analog_y_player_1, 2000, 0, 1, 610, 718] +[:key_held_player_one, 3, 0, 1, 611, 719] +[:key_held_player_one, 3, 0, 1, 612, 720] +[:left_analog_x_player_1, -26000, 0, 1, 613, 720] +[:key_held_player_one, 3, 0, 1, 614, 721] +[:key_held_player_one, 3, 0, 1, 615, 722] +[:key_held_player_one, 3, 0, 1, 616, 723] +[:key_held_player_one, 3, 0, 1, 617, 724] +[:left_analog_x_player_1, -27000, 0, 1, 618, 724] +[:key_held_player_one, 3, 0, 1, 619, 725] +[:key_held_player_one, 3, 0, 1, 620, 726] +[:key_held_player_one, 3, 0, 1, 621, 727] +[:key_held_player_one, 3, 0, 1, 622, 728] +[:key_held_player_one, 3, 0, 1, 623, 729] +[:key_held_player_one, 3, 0, 1, 624, 730] +[:key_held_player_one, 3, 0, 1, 625, 731] +[:key_held_player_one, 3, 0, 1, 626, 732] +[:key_held_player_one, 3, 0, 1, 627, 733] +[:key_held_player_one, 3, 0, 1, 628, 734] +[:key_held_player_one, 3, 0, 1, 629, 735] +[:key_held_player_one, 3, 0, 1, 630, 736] +[:key_held_player_one, 3, 0, 1, 631, 737] +[:key_held_player_one, 3, 0, 1, 632, 738] +[:key_held_player_one, 3, 0, 1, 633, 739] +[:key_held_player_one, 3, 0, 1, 634, 740] +[:key_held_player_one, 3, 0, 1, 635, 741] +[:key_held_player_one, 3, 0, 1, 636, 742] +[:key_held_player_one, 3, 0, 1, 637, 743] +[:key_held_player_one, 3, 0, 1, 638, 744] +[:key_held_player_one, 3, 0, 1, 639, 745] +[:key_held_player_one, 3, 0, 1, 640, 746] +[:key_held_player_one, 3, 0, 1, 641, 747] +[:key_held_player_one, 3, 0, 1, 642, 748] +[:key_held_player_one, 3, 0, 1, 643, 749] +[:key_held_player_one, 3, 0, 1, 644, 750] +[:key_held_player_one, 3, 0, 1, 645, 751] +[:key_held_player_one, 3, 0, 1, 646, 752] +[:key_held_player_one, 3, 0, 1, 647, 753] +[:key_held_player_one, 3, 0, 1, 648, 754] +[:key_held_player_one, 3, 0, 1, 649, 755] +[:key_held_player_one, 3, 0, 1, 650, 756] +[:key_held_player_one, 3, 0, 1, 651, 757] +[:key_held_player_one, 3, 0, 1, 652, 758] +[:key_held_player_one, 3, 0, 1, 653, 759] +[:key_held_player_one, 3, 0, 1, 654, 760] +[:key_held_player_one, 3, 0, 1, 655, 761] +[:key_held_player_one, 3, 0, 1, 656, 762] +[:key_held_player_one, 3, 0, 1, 657, 763] +[:key_held_player_one, 3, 0, 1, 658, 764] +[:key_held_player_one, 3, 0, 1, 659, 765] +[:key_held_player_one, 3, 0, 1, 660, 766] +[:key_held_player_one, 3, 0, 1, 661, 767] +[:key_held_player_one, 3, 0, 1, 662, 768] +[:key_held_player_one, 3, 0, 1, 663, 769] +[:key_held_player_one, 3, 0, 1, 664, 770] +[:key_held_player_one, 3, 0, 1, 665, 771] +[:key_held_player_one, 3, 0, 1, 666, 772] +[:key_held_player_one, 3, 0, 1, 667, 773] +[:key_held_player_one, 3, 0, 1, 668, 774] +[:key_held_player_one, 3, 0, 1, 669, 775] +[:key_held_player_one, 3, 0, 1, 670, 776] +[:left_analog_x_player_1, -26000, 0, 1, 671, 776] +[:key_held_player_one, 3, 0, 1, 672, 777] +[:key_held_player_one, 3, 0, 1, 673, 778] +[:key_held_player_one, 3, 0, 1, 674, 779] +[:key_held_player_one, 3, 0, 1, 675, 780] +[:left_analog_x_player_1, -25000, 0, 1, 676, 780] +[:key_held_player_one, 3, 0, 1, 677, 781] +[:left_analog_x_player_1, -24000, 0, 1, 678, 781] +[:key_held_player_one, 3, 0, 1, 679, 782] +[:key_held_player_one, 3, 0, 1, 680, 783] +[:left_analog_x_player_1, -23000, 0, 1, 681, 783] +[:key_held_player_one, 3, 0, 1, 682, 784] +[:key_held_player_one, 3, 0, 1, 683, 785] +[:left_analog_x_player_1, -22000, 0, 1, 684, 785] +[:left_analog_y_player_1, 3000, 0, 1, 685, 785] +[:key_held_player_one, 3, 0, 1, 686, 786] +[:left_analog_x_player_1, -21000, 0, 1, 687, 786] +[:key_held_player_one, 3, 0, 1, 688, 787] +[:left_analog_x_player_1, -20000, 0, 1, 689, 787] +[:key_held_player_one, 3, 0, 1, 690, 788] +[:key_held_player_one, 3, 0, 1, 691, 789] +[:key_held_player_one, 3, 0, 1, 692, 790] +[:key_held_player_one, 3, 0, 1, 693, 791] +[:left_analog_x_player_1, -19000, 0, 1, 694, 791] +[:key_up_player_one, 3, 0, 1, 695, 792] +[:left_analog_x_player_1, -18000, 0, 1, 696, 792] +[:left_analog_x_player_1, -15000, 0, 1, 697, 793] +[:left_analog_x_player_1, -13000, 0, 1, 698, 794] +[:left_analog_x_player_1, -10000, 0, 1, 699, 795] +[:left_analog_x_player_1, -8000, 0, 1, 700, 796] +[:left_analog_x_player_1, -6000, 0, 1, 701, 797] +[:left_analog_x_player_1, -4000, 0, 1, 702, 798] +[:left_analog_y_player_1, 2000, 0, 1, 703, 798] +[:left_analog_x_player_1, -2000, 0, 1, 704, 799] +[:left_analog_y_player_1, 1000, 0, 1, 705, 799] +[:left_analog_y_player_1, 0, 0, 1, 706, 800] +[:left_analog_x_player_1, -1000, 0, 1, 707, 814] +[:left_analog_x_player_1, 0, 0, 1, 708, 815] +[:left_analog_x_player_1, -1000, 0, 1, 709, 821] +[:left_analog_x_player_1, -2000, 0, 1, 710, 823] +[:left_analog_x_player_1, -4000, 0, 1, 711, 824] +[:left_analog_x_player_1, -6000, 0, 1, 712, 825] +[:left_analog_x_player_1, -8000, 0, 1, 713, 826] +[:left_analog_x_player_1, -9000, 0, 1, 714, 827] +[:left_analog_x_player_1, -10000, 0, 1, 715, 828] +[:left_analog_x_player_1, -11000, 0, 1, 716, 829] +[:left_analog_x_player_1, -10000, 0, 1, 717, 832] +[:left_analog_y_player_1, 2000, 0, 1, 718, 832] +[:left_analog_x_player_1, -8000, 0, 1, 719, 833] +[:left_analog_x_player_1, -3000, 0, 1, 720, 834] +[:left_analog_x_player_1, -1000, 0, 1, 721, 835] +[:left_analog_x_player_1, 0, 0, 1, 722, 836] +[:left_analog_y_player_1, 1000, 0, 1, 723, 836] +[:left_analog_x_player_1, 1000, 0, 1, 724, 841] +[:left_analog_x_player_1, 3000, 0, 1, 725, 842] +[:left_analog_x_player_1, 4000, 0, 1, 726, 843] +[:left_analog_y_player_1, 2000, 0, 1, 727, 843] +[:left_analog_x_player_1, 5000, 0, 1, 728, 844] +[:left_analog_x_player_1, 7000, 0, 1, 729, 845] +[:left_analog_x_player_1, 8000, 0, 1, 730, 847] +[:left_analog_x_player_1, 9000, 0, 1, 731, 848] +[:left_analog_x_player_1, 10000, 0, 1, 732, 853] +[:left_analog_y_player_1, 3000, 0, 1, 733, 857] +[:left_analog_x_player_1, 11000, 0, 1, 734, 859] +[:left_analog_x_player_1, 12000, 0, 1, 735, 862] +[:left_analog_x_player_1, 13000, 0, 1, 736, 863] +[:left_analog_x_player_1, 14000, 0, 1, 737, 864] +[:left_analog_x_player_1, 15000, 0, 1, 738, 868] +[:left_analog_x_player_1, 14000, 0, 1, 739, 894] +[:left_analog_x_player_1, 13000, 0, 1, 740, 906] +[:left_analog_x_player_1, 12000, 0, 1, 741, 914] +[:left_analog_x_player_1, 11000, 0, 1, 742, 918] +[:left_analog_x_player_1, 10000, 0, 1, 743, 979] +[:left_analog_y_player_1, 2000, 0, 1, 744, 1036] +[:left_analog_y_player_1, 3000, 0, 1, 745, 1040] +[:left_analog_y_player_1, 2000, 0, 1, 746, 1041] +[:left_analog_y_player_1, 3000, 0, 1, 747, 1044] +[:left_analog_y_player_1, 2000, 0, 1, 748, 1045] +[:left_analog_y_player_1, 3000, 0, 1, 749, 1046] +[:left_analog_y_player_1, 2000, 0, 1, 750, 1047] +[:left_analog_y_player_1, 3000, 0, 1, 751, 1050] +[:left_analog_y_player_1, 2000, 0, 1, 752, 1052] +[:left_analog_y_player_1, 3000, 0, 1, 753, 1053] +[:left_analog_y_player_1, 2000, 0, 1, 754, 1054] +[:left_analog_x_player_1, 11000, 0, 1, 755, 1082] +[:left_analog_x_player_1, 14000, 0, 1, 756, 1083] +[:left_analog_x_player_1, 17000, 0, 1, 757, 1084] +[:left_analog_y_player_1, 3000, 0, 1, 758, 1084] +[:left_analog_x_player_1, 22000, 0, 1, 759, 1085] +[:left_analog_y_player_1, 4000, 0, 1, 760, 1085] +[:key_down_player_one, 4, 0, 1, 761, 1086] +[:left_analog_x_player_1, 26000, 0, 1, 762, 1086] +[:key_held_player_one, 4, 0, 1, 763, 1087] +[:left_analog_x_player_1, 29000, 0, 1, 764, 1087] +[:left_analog_y_player_1, 3000, 0, 1, 765, 1087] +[:key_held_player_one, 4, 0, 1, 766, 1088] +[:left_analog_x_player_1, 31000, 0, 1, 767, 1088] +[:right_analog_x_player_1, 1000, 0, 1, 768, 1088] +[:key_held_player_one, 4, 0, 1, 769, 1089] +[:left_analog_x_player_1, 32000, 0, 1, 770, 1089] +[:right_analog_x_player_1, 3000, 0, 1, 771, 1089] +[:key_held_player_one, 4, 0, 1, 772, 1090] +[:right_analog_x_player_1, 4000, 0, 1, 773, 1090] +[:key_held_player_one, 4, 0, 1, 774, 1091] +[:right_analog_x_player_1, 5000, 0, 1, 775, 1091] +[:key_held_player_one, 4, 0, 1, 776, 1092] +[:key_held_player_one, 4, 0, 1, 777, 1093] +[:right_analog_x_player_1, 6000, 0, 1, 778, 1093] +[:key_held_player_one, 4, 0, 1, 779, 1094] +[:key_held_player_one, 4, 0, 1, 780, 1095] +[:left_analog_y_player_1, 2000, 0, 1, 781, 1095] +[:right_analog_x_player_1, 4000, 0, 1, 782, 1095] +[:key_held_player_one, 4, 0, 1, 783, 1096] +[:left_analog_y_player_1, 3000, 0, 1, 784, 1096] +[:right_analog_x_player_1, 0, 0, 1, 785, 1096] +[:key_held_player_one, 4, 0, 1, 786, 1097] +[:key_held_player_one, 4, 0, 1, 787, 1098] +[:left_analog_y_player_1, 4000, 0, 1, 788, 1098] +[:key_held_player_one, 4, 0, 1, 789, 1099] +[:key_held_player_one, 4, 0, 1, 790, 1100] +[:key_held_player_one, 4, 0, 1, 791, 1101] +[:key_held_player_one, 4, 0, 1, 792, 1102] +[:key_held_player_one, 4, 0, 1, 793, 1103] +[:key_held_player_one, 4, 0, 1, 794, 1104] +[:key_held_player_one, 4, 0, 1, 795, 1105] +[:key_held_player_one, 4, 0, 1, 796, 1106] +[:key_held_player_one, 4, 0, 1, 797, 1107] +[:key_held_player_one, 4, 0, 1, 798, 1108] +[:key_held_player_one, 4, 0, 1, 799, 1109] +[:key_held_player_one, 4, 0, 1, 800, 1110] +[:key_held_player_one, 4, 0, 1, 801, 1111] +[:key_held_player_one, 4, 0, 1, 802, 1112] +[:key_held_player_one, 4, 0, 1, 803, 1113] +[:key_held_player_one, 4, 0, 1, 804, 1114] +[:key_held_player_one, 4, 0, 1, 805, 1115] +[:key_held_player_one, 4, 0, 1, 806, 1116] +[:key_held_player_one, 4, 0, 1, 807, 1117] +[:key_held_player_one, 4, 0, 1, 808, 1118] +[:key_held_player_one, 4, 0, 1, 809, 1119] +[:key_held_player_one, 4, 0, 1, 810, 1120] +[:key_held_player_one, 4, 0, 1, 811, 1121] +[:key_held_player_one, 4, 0, 1, 812, 1122] +[:key_held_player_one, 4, 0, 1, 813, 1123] +[:key_held_player_one, 4, 0, 1, 814, 1124] +[:key_held_player_one, 4, 0, 1, 815, 1125] +[:key_held_player_one, 4, 0, 1, 816, 1126] +[:key_held_player_one, 4, 0, 1, 817, 1127] +[:key_held_player_one, 4, 0, 1, 818, 1128] +[:key_held_player_one, 4, 0, 1, 819, 1129] +[:key_held_player_one, 4, 0, 1, 820, 1130] +[:key_held_player_one, 4, 0, 1, 821, 1131] +[:key_held_player_one, 4, 0, 1, 822, 1132] +[:key_held_player_one, 4, 0, 1, 823, 1133] +[:left_analog_y_player_1, 3000, 0, 1, 824, 1133] +[:key_held_player_one, 4, 0, 1, 825, 1134] +[:key_held_player_one, 4, 0, 1, 826, 1135] +[:key_held_player_one, 4, 0, 1, 827, 1136] +[:key_held_player_one, 4, 0, 1, 828, 1137] +[:key_held_player_one, 4, 0, 1, 829, 1138] +[:key_held_player_one, 4, 0, 1, 830, 1139] +[:key_held_player_one, 4, 0, 1, 831, 1140] +[:key_held_player_one, 4, 0, 1, 832, 1141] +[:key_held_player_one, 4, 0, 1, 833, 1142] +[:key_held_player_one, 4, 0, 1, 834, 1143] +[:key_held_player_one, 4, 0, 1, 835, 1144] +[:key_held_player_one, 4, 0, 1, 836, 1145] +[:key_held_player_one, 4, 0, 1, 837, 1146] +[:left_analog_y_player_1, 2000, 0, 1, 838, 1146] +[:key_held_player_one, 4, 0, 1, 839, 1147] +[:key_held_player_one, 4, 0, 1, 840, 1148] +[:key_held_player_one, 4, 0, 1, 841, 1149] +[:key_held_player_one, 4, 0, 1, 842, 1150] +[:key_held_player_one, 4, 0, 1, 843, 1151] +[:key_held_player_one, 4, 0, 1, 844, 1152] +[:key_held_player_one, 4, 0, 1, 845, 1153] +[:key_held_player_one, 4, 0, 1, 846, 1154] +[:key_held_player_one, 4, 0, 1, 847, 1155] +[:key_held_player_one, 4, 0, 1, 848, 1156] +[:key_held_player_one, 4, 0, 1, 849, 1157] +[:key_held_player_one, 4, 0, 1, 850, 1158] +[:key_held_player_one, 4, 0, 1, 851, 1159] +[:key_held_player_one, 4, 0, 1, 852, 1160] +[:key_held_player_one, 4, 0, 1, 853, 1161] +[:key_held_player_one, 4, 0, 1, 854, 1162] +[:key_held_player_one, 4, 0, 1, 855, 1163] +[:key_held_player_one, 4, 0, 1, 856, 1164] +[:key_held_player_one, 4, 0, 1, 857, 1165] +[:key_held_player_one, 4, 0, 1, 858, 1166] +[:key_held_player_one, 4, 0, 1, 859, 1167] +[:key_held_player_one, 4, 0, 1, 860, 1168] +[:key_held_player_one, 4, 0, 1, 861, 1169] +[:left_analog_y_player_1, 1000, 0, 1, 862, 1169] +[:key_held_player_one, 4, 0, 1, 863, 1170] +[:left_analog_y_player_1, 0, 0, 1, 864, 1170] +[:key_held_player_one, 4, 0, 1, 865, 1171] +[:key_held_player_one, 4, 0, 1, 866, 1172] +[:key_held_player_one, 4, 0, 1, 867, 1173] +[:key_held_player_one, 4, 0, 1, 868, 1174] +[:key_held_player_one, 4, 0, 1, 869, 1175] +[:key_held_player_one, 4, 0, 1, 870, 1176] +[:key_held_player_one, 4, 0, 1, 871, 1177] +[:left_analog_x_player_1, 28000, 0, 1, 872, 1177] +[:left_analog_y_player_1, 1000, 0, 1, 873, 1177] +[:key_held_player_one, 4, 0, 1, 874, 1178] +[:left_analog_x_player_1, 24000, 0, 1, 875, 1178] +[:left_analog_y_player_1, 2000, 0, 1, 876, 1178] +[:key_held_player_one, 4, 0, 1, 877, 1179] +[:left_analog_x_player_1, 17000, 0, 1, 878, 1179] +[:key_up_player_one, 4, 0, 1, 879, 1180] +[:left_analog_x_player_1, 5000, 0, 1, 880, 1180] +[:left_analog_y_player_1, 1000, 0, 1, 881, 1180] +[:left_analog_x_player_1, 0, 0, 1, 882, 1181] +[:left_analog_y_player_1, 0, 0, 1, 883, 1181] +[:key_down_raw, 1073742051, 1024, 2, 884, 1250] +[:key_down_raw, 113, 1024, 2, 885, 1250] +[:key_up_raw, 113, 1024, 2, 886, 1250] +[:key_up_raw, 1073742051, 0, 2, 887, 1250] diff --git a/samples/09_controller_analog_usage_advanced_sprites/sprites/86.png b/samples/09_controller_analog_usage_advanced_sprites/sprites/86.png Binary files differnew file mode 100644 index 0000000..dad681e --- /dev/null +++ b/samples/09_controller_analog_usage_advanced_sprites/sprites/86.png diff --git a/samples/09_sprite_animation_using_tile_sheet/app/main.rb b/samples/09_sprite_animation_using_tile_sheet/app/main.rb new file mode 100644 index 0000000..17bfd49 --- /dev/null +++ b/samples/09_sprite_animation_using_tile_sheet/app/main.rb @@ -0,0 +1,98 @@ +def tick args + args.state.player.x ||= 100 + args.state.player.y ||= 100 + args.state.player.w ||= 64 + args.state.player.h ||= 64 + args.state.player.direction ||= 1 + + args.state.player.is_moving = false + + # get the keyboard input and set player properties + if args.inputs.keyboard.right + args.state.player.x += 3 + args.state.player.direction = 1 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.inputs.keyboard.left + args.state.player.x -= 3 + args.state.player.direction = -1 + args.state.player.started_running_at ||= args.state.tick_count + end + + if args.inputs.keyboard.up + args.state.player.y += 1 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.inputs.keyboard.down + args.state.player.y -= 1 + args.state.player.started_running_at ||= args.state.tick_count + end + + # if no arrow keys are being pressed, set the player as not moving + if !args.inputs.keyboard.directional_vector + args.state.player.started_running_at = nil + end + + # wrap player around the stage + if args.state.player.x > 1280 + args.state.player.x = -64 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.state.player.x < -64 + args.state.player.x = 1280 + args.state.player.started_running_at ||= args.state.tick_count + end + + if args.state.player.y > 720 + args.state.player.y = -64 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.state.player.y < -64 + args.state.player.y = 720 + args.state.player.started_running_at ||= args.state.tick_count + end + + # render player as standing or running + if args.state.player.started_running_at + args.outputs.sprites << running_sprite(args) + else + args.outputs.sprites << standing_sprite(args) + end + args.outputs.labels << [30, 700, "Use arrow keys to move around."] +end + +def standing_sprite args + { + x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: "sprites/horizontal-stand.png", + flip_horizontally: args.state.player.direction > 0 + } +end + +def running_sprite args + if !args.state.player.started_running_at + tile_index = 0 + else + how_many_frames_in_sprite_sheet = 6 + how_many_ticks_to_hold_each_frame = 3 + should_the_index_repeat = true + tile_index = args.state + .player + .started_running_at + .frame_index(how_many_frames_in_sprite_sheet, + how_many_ticks_to_hold_each_frame, + should_the_index_repeat) + end + + { + x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: 'sprites/horizontal-run.png', + tile_x: 0 + (tile_index * args.state.player.w), + tile_y: 0, + tile_w: args.state.player.w, + tile_h: args.state.player.h, + flip_horizontally: args.state.player.direction > 0, + } +end diff --git a/samples/09_sprite_animation_using_tile_sheet/license-for-sample.txt b/samples/09_sprite_animation_using_tile_sheet/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/09_sprite_animation_using_tile_sheet/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/09_sprite_animation_using_tile_sheet/sprites/horizontal-run.png b/samples/09_sprite_animation_using_tile_sheet/sprites/horizontal-run.png Binary files differnew file mode 100644 index 0000000..1e98253 --- /dev/null +++ b/samples/09_sprite_animation_using_tile_sheet/sprites/horizontal-run.png diff --git a/samples/09_sprite_animation_using_tile_sheet/sprites/horizontal-stand.png b/samples/09_sprite_animation_using_tile_sheet/sprites/horizontal-stand.png Binary files differnew file mode 100644 index 0000000..9d320e7 --- /dev/null +++ b/samples/09_sprite_animation_using_tile_sheet/sprites/horizontal-stand.png diff --git a/samples/10_save_load_game/app/main.rb b/samples/10_save_load_game/app/main.rb new file mode 100644 index 0000000..251848a --- /dev/null +++ b/samples/10_save_load_game/app/main.rb @@ -0,0 +1,389 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful + because with a given symbol name, you can refer to the same object throughout + a Ruby program. + + In this sample app, we're using symbols for our buttons. We have buttons that + light fires, save, load, etc. Each of these buttons has a distinct symbol like + :light_fire, :save_game, :load_game, etc. + + - to_sym: Returns the symbol corresponding to the given string; creates the symbol + if it does not already exist. + For example, + 'car'.to_sym + would return the symbol :car. + + - last: Returns the last element of an array. + + Reminders: + + - num1.lesser(num2): finds the lower value of the given options. + For example, in the statement + a = 4.lesser(3) + 3 has a lower value than 4, which means that the value of a would be set to 3, + but if the statement had been + a = 4.lesser(5) + 4 has a lower value than 5, which means that the value of a would be set to 4. + + - num1.fdiv(num2): returns the float division (will have a decimal) of the two given numbers. + For example, 5.fdiv(2) = 2.5 and 5.fdiv(5) = 1.0 + + - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + - args.outputs.labels: An array. Values generate a label. + Parameters are [X, Y, TEXT, SIZE, ALIGN, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information, go to mygame/documentation/02-labels.md. + + - ARRAY#inside_rect?: An array with at least two values is considered a point. An array + with at least four values is considered a rect. The inside_rect? function returns true + or false depending on if the point is inside the rect. + +=end + +# This code allows users to perform different tasks, such as saving and loading the game. +# Users also have options to reset the game and light a fire. + +class TextedBasedGame + + # Contains methods needed for game to run properly. + # Increments tick count by 1 each time it runs (60 times in a single second) + def tick + default + show_intro + state.engine_tick_count += 1 + tick_fire + end + + # Sets default values. + # The ||= ensures that a variable's value is only set to the value following the = sign + # if the value has not already been set before. Intialization happens only in the first frame. + def default + state.engine_tick_count ||= 0 + state.active_module ||= :room + state.fire_progress ||= 0 + state.fire_ready_in ||= 10 + state.previous_fire ||= :dead + state.fire ||= :dead + end + + def show_intro + return unless state.engine_tick_count == 0 # return unless the game just started + set_story_line "awake." # calls set_story_line method, sets to "awake" + end + + # Sets story line. + def set_story_line story_line + state.story_line = story_line # story line set to value of parameter + state.active_module = :alert # active module set to alert + end + + # Clears story line. + def clear_storyline + state.active_module = :none # active module set to none + state.story_line = nil # story line is cleared, set to nil (or empty) + end + + # Determines fire progress (how close the fire is to being ready to light). + def tick_fire + return if state.active_module == :alert # return if active module is alert + state.fire_progress += 1 # increment fire progress + # fire_ready_in is 10. The fire_progress is either the current value or 10, whichever has a lower value. + state.fire_progress = state.fire_progress.lesser(state.fire_ready_in) + end + + # Sets the value of fire (whether it is dead or roaring), and the story line + def light_fire + return unless fire_ready? # returns unless the fire is ready to be lit + state.fire = :roaring # fire is lit, set to roaring + state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit + if state.fire != state.previous_fire + set_story_line "the fire is #{state.fire}." # the story line is set using string interpolation + state.previous_fire = state.fire + end + end + + # Checks if the fire is ready to be lit. Returns a boolean value. + def fire_ready? + # If fire_progress (value between 0 and 10) is equal to fire_ready_in (value of 10), + # the fire is ready to be lit. + state.fire_progress == state.fire_ready_in + end + + # Divides the value of the fire_progress variable by 10 to determine how close the user is to + # being able to light a fire. + def light_fire_progress + state.fire_progress.fdiv(10) # float division + end + + # Defines fire as the state.fire variable. + def fire + state.fire + end + + # Sets the title of the room. + def room_title + return "a room that is dark" if state.fire == :dead # room is dark if the fire is dead + return "a room that is lit" # room is lit if the fire is not dead + end + + # Sets the active_module to room. + def go_to_room + state.active_module = :room + end + + # Defines active_module as the state.active_module variable. + def active_module + state.active_module + end + + # Defines story_line as the state.story_line variable. + def story_line + state.story_line + end + + # Update every 60 frames (or every second) + def should_tick? + state.tick_count.mod_zero?(60) + end + + # Sets the value of the game state provider. + def initialize game_state_provider + @game_state_provider = game_state_provider + end + + # Defines the game state. + # Any variable prefixed with an @ symbol is an instance variable. + def state + @game_state_provider.state + end + + # Saves the state of the game in a text file called game_state.txt. + def save + $gtk.serialize_state('game_state.txt', state) + end + + # Loads the game state from the game_state.txt text file. + # If the load is unsuccessful, the user is informed since the story line indicates the failure. + def load + parsed_state = $gtk.deserialize_state('game_state.txt') + if !parsed_state + set_story_line "no game to load. press save first." + else + $gtk.args.state = parsed_state + end + end + + # Resets the game. + def reset + $gtk.reset + end +end + +class TextedBasedGamePresenter + attr_accessor :state, :outputs, :inputs + + # Creates empty collection called highlights. + # Calls methods necessary to run the game. + def tick + state.layout.highlights ||= [] + game.tick if game.should_tick? + render + process_input + end + + # Outputs a label of the tick count (passage of time) and calls all render methods. + def render + outputs.labels << [10, 30, state.tick_count] + render_alert + render_room + render_highlights + end + + # Outputs a label onto the screen that shows the story line, and also outputs a "close" button. + def render_alert + return unless game.active_module == :alert + + outputs.labels << [640, 480, game.story_line, 5, 1] # outputs story line label + outputs.primitives << button(:alert_dismiss, 490, 380, "close") # positions "close" button under story line + end + + def render_room + return unless game.active_module == :room + outputs.labels << [640, 700, game.room_title, 4, 1] # outputs room title label at top of screen + + # The parameters for these outputs are (symbol, x, y, text, value/percentage) and each has a y value + # that positions it 60 pixels lower than the previous output. + + # outputs the light_fire_progress bar, uses light_fire_progress for its percentage (which changes bar's appearance) + outputs.primitives << progress_bar(:light_fire, 490, 600, "light fire", game.light_fire_progress) + outputs.primitives << button( :save_game, 490, 540, "save") # outputs save button + outputs.primitives << button( :load_game, 490, 480, "load") # outputs load button + outputs.primitives << button( :reset_game, 490, 420, "reset") # outputs reset button + outputs.labels << [640, 30, "the fire is #{game.fire}", 0, 1] # outputs fire label at bottom of screen + end + + # Outputs a collection of highlights using an array to set their values, and also rejects certain values from the collection. + def render_highlights + state.layout.highlights.each do |h| # for each highlight in the collection + h.lifetime -= 1 # decrease the value of its lifetime + end + + outputs.solids << state.layout.highlights.map do |h| # outputs highlights collection + [h.x, h.y, h.w, h.h, h.color, 255 * h.lifetime / h.max_lifetime] # sets definition for each highlight + # transparency changes; divide lifetime by max_lifetime, multiply result by 255 + end + + # reject highlights from collection that have no remaining lifetime + state.layout.highlights = state.layout.highlights.reject { |h| h.lifetime <= 0 } + end + + # Checks whether or not a button was clicked. + # Returns a boolean value. + def process_input + button = button_clicked? # calls button_clicked? method + end + + # Returns a boolean value. + # Finds the button that was clicked from the button list and determines what method to call. + # Adds a highlight to the highlights collection. + def button_clicked? + return nil unless click_pos # return nil unless click_pos holds coordinates of mouse click + button = @button_list.find do |k, v| # goes through button_list to find button clicked + click_pos.inside_rect? v[:primitives].last.rect # was the mouse clicked inside the rect of button? + end + return unless button # return unless a button was clicked + method_to_call = "#{button[0]}_clicked".to_sym # sets method_to_call to symbol (like :save_game or :load_game) + if self.respond_to? method_to_call # returns true if self responds to the given method (method actually exists) + border = button[1][:primitives].last # sets border definition using value of last key in button list hash + + # declares each highlight as a new entity, sets properties + state.layout.highlights << state.new_entity(:highlight) do |h| + h.x = border.x + h.y = border.y + h.w = border.w + h.h = border.h + h.max_lifetime = 10 + h.lifetime = h.max_lifetime + h.color = [120, 120, 180] # sets color to shade of purple + end + + self.send method_to_call # invoke method identified by symbol + else # otherwise, if self doesn't respond to given method + border = button[1][:primitives].last # sets border definition using value of last key in hash + + # declares each highlight as a new entity, sets properties + state.layout.highlights << state.new_entity(:highlight) do |h| + h.x = border.x + h.y = border.y + h.w = border.w + h.h = border.h + h.max_lifetime = 4 # different max_lifetime than the one set if respond_to? had been true + h.lifetime = h.max_lifetime + h.color = [120, 80, 80] # sets color to dark color + end + + # instructions for users on how to add the missing method_to_call to the code + puts "It looks like #{method_to_call} doesn't exists on TextedBasedGamePresenter. Please add this method:" + puts "Just copy the code below and put it in the #{TextedBasedGamePresenter} class definition." + puts "" + puts "```" + puts "class TextedBasedGamePresenter <--- find this class and put the method below in it" + puts "" + puts " def #{method_to_call}" + puts " puts 'Yay that worked!'" + puts " end" + puts "" + puts "end <-- make sure to put the #{method_to_call} method in between the `class` word and the final `end` statement." + puts "```" + puts "" + end + end + + # Returns the position of the mouse when it is clicked. + def click_pos + return nil unless inputs.mouse.click # returns nil unless the mouse was clicked + return inputs.mouse.click.point # returns location of mouse click (coordinates) + end + + # Creates buttons for the button_list and sets their values using a hash (uses symbols as keys) + def button id, x, y, text + @button_list[id] ||= { # assigns values to hash keys + id: id, + text: text, + primitives: [ + [x + 10, y + 30, text, 2, 0].label, # positions label inside border + [x, y, 300, 50].border, # sets definition of border + ] + } + + @button_list[id][:primitives] # returns label and border for buttons + end + + # Creates a progress bar (used for lighting the fire) and sets its values. + def progress_bar id, x, y, text, percentage + @button_list[id] = { # assigns values to hash keys + id: id, + text: text, + primitives: [ + [x, y, 300, 50, 100, 100, 100].solid, # sets definition for solid (which fills the bar with gray) + [x + 10, y + 30, text, 2, 0].label, # sets definition for label, positions inside border + [x, y, 300, 50].border, # sets definition of border + ] + } + + # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by + # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in. + @button_list[id][:primitives][0][2] = 300 * percentage + @button_list[id][:primitives] + end + + # Defines the game. + def game + @game + end + + # Initalizes the game and creates an empty list of buttons. + def initialize + @game = TextedBasedGame.new self + @button_list ||= {} + end + + # Clears the storyline and takes the user to the room. + def alert_dismiss_clicked + game.clear_storyline + game.go_to_room + end + + # Lights the fire when the user clicks the "light fire" option. + def light_fire_clicked + game.light_fire + end + + # Saves the game when the user clicks the "save" option. + def save_game_clicked + game.save + end + + # Resets the game when the user clicks the "reset" option. + def reset_game_clicked + game.reset + end + + # Loads the game when the user clicks the "load" option. + def load_game_clicked + game.load + end +end + +$text_based_rpg = TextedBasedGamePresenter.new + +def tick args + $text_based_rpg.state = args.state + $text_based_rpg.outputs = args.outputs + $text_based_rpg.inputs = args.inputs + $text_based_rpg.tick +end diff --git a/samples/10_save_load_game/license-for-sample.txt b/samples/10_save_load_game/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/10_save_load_game/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/10_save_load_game/replay.txt b/samples/10_save_load_game/replay.txt new file mode 100644 index 0000000..c243f28 --- /dev/null +++ b/samples/10_save_load_game/replay.txt @@ -0,0 +1,1450 @@ +replay_version 2.0 +stopped_at 2867 +seed 100 +recorded_at Sun Sep 29 22:25:40 2019 +[:mouse_move, 175, 437, 2, 1, 96] +[:mouse_move, 181, 437, 2, 2, 97] +[:mouse_move, 198, 437, 2, 3, 98] +[:mouse_move, 210, 438, 2, 4, 99] +[:mouse_move, 255, 440, 2, 5, 100] +[:mouse_move, 266, 441, 2, 6, 101] +[:mouse_move, 303, 442, 2, 7, 102] +[:mouse_move, 310, 443, 2, 8, 103] +[:mouse_move, 326, 444, 2, 9, 104] +[:mouse_move, 332, 445, 2, 10, 105] +[:mouse_move, 342, 445, 2, 11, 106] +[:mouse_move, 345, 445, 2, 12, 107] +[:mouse_move, 350, 445, 2, 13, 108] +[:mouse_move, 354, 445, 2, 14, 109] +[:mouse_move, 359, 445, 2, 15, 110] +[:mouse_move, 363, 443, 2, 16, 111] +[:mouse_move, 371, 439, 2, 17, 112] +[:mouse_move, 386, 431, 2, 18, 113] +[:mouse_move, 394, 425, 2, 19, 114] +[:mouse_move, 406, 417, 2, 20, 115] +[:mouse_move, 413, 411, 2, 21, 116] +[:mouse_move, 426, 398, 2, 22, 117] +[:mouse_move, 431, 391, 2, 23, 118] +[:mouse_move, 436, 378, 2, 24, 119] +[:mouse_move, 436, 369, 2, 25, 120] +[:mouse_move, 436, 368, 2, 26, 153] +[:mouse_move, 435, 368, 2, 27, 155] +[:mouse_move, 436, 368, 2, 28, 172] +[:mouse_move, 437, 368, 2, 29, 177] +[:mouse_move, 438, 367, 2, 30, 179] +[:mouse_move, 440, 366, 2, 31, 180] +[:mouse_move, 449, 362, 2, 32, 181] +[:mouse_move, 457, 359, 2, 33, 182] +[:mouse_move, 495, 348, 2, 34, 183] +[:mouse_move, 537, 341, 2, 35, 184] +[:mouse_move, 587, 334, 2, 36, 185] +[:mouse_move, 602, 333, 2, 37, 186] +[:mouse_move, 638, 329, 2, 38, 187] +[:mouse_move, 644, 328, 2, 39, 188] +[:mouse_move, 665, 326, 2, 40, 189] +[:mouse_move, 671, 326, 2, 41, 190] +[:mouse_move, 676, 325, 2, 42, 191] +[:mouse_move, 677, 325, 2, 43, 192] +[:mouse_move, 678, 325, 2, 44, 193] +[:mouse_move, 677, 324, 2, 45, 196] +[:mouse_move, 675, 323, 2, 46, 197] +[:mouse_move, 671, 321, 2, 47, 198] +[:mouse_move, 667, 320, 2, 48, 199] +[:mouse_move, 664, 320, 2, 49, 200] +[:mouse_move, 661, 320, 2, 50, 201] +[:mouse_move, 656, 319, 2, 51, 202] +[:mouse_move, 654, 319, 2, 52, 203] +[:mouse_move, 652, 319, 2, 53, 204] +[:mouse_move, 651, 319, 2, 54, 206] +[:mouse_button_pressed, 1, 0, 1, 55, 220] +[:mouse_button_up, 1, 0, 1, 56, 227] +[:mouse_move, 651, 320, 2, 57, 259] +[:mouse_move, 648, 321, 2, 58, 331] +[:mouse_move, 643, 323, 2, 59, 332] +[:mouse_move, 597, 339, 2, 60, 333] +[:mouse_move, 526, 366, 2, 61, 334] +[:mouse_move, 380, 433, 2, 62, 335] +[:mouse_move, 272, 486, 2, 63, 336] +[:mouse_move, 242, 499, 2, 64, 337] +[:mouse_move, 188, 520, 2, 65, 338] +[:mouse_move, 177, 527, 2, 66, 351] +[:mouse_move, 162, 537, 2, 67, 352] +[:mouse_move, 96, 582, 2, 68, 353] +[:mouse_move, 78, 594, 2, 69, 354] +[:mouse_move, 32, 630, 2, 70, 355] +[:mouse_move, 24, 637, 2, 71, 356] +[:mouse_move, 7, 652, 2, 72, 357] +[:mouse_move, 0, 664, 2, 73, 358] +[:mouse_move, 0, 702, 2, 74, 374] +[:mouse_move, 1, 702, 2, 75, 375] +[:mouse_move, 3, 703, 2, 76, 375] +[:mouse_move, 5, 704, 2, 77, 376] +[:mouse_move, 8, 705, 2, 78, 377] +[:mouse_move, 11, 705, 2, 79, 378] +[:mouse_move, 13, 706, 2, 80, 379] +[:mouse_move, 16, 707, 2, 81, 380] +[:mouse_move, 18, 707, 2, 82, 381] +[:mouse_move, 22, 708, 2, 83, 382] +[:mouse_move, 24, 708, 2, 84, 383] +[:mouse_move, 26, 708, 2, 85, 384] +[:mouse_move, 28, 708, 2, 86, 384] +[:mouse_move, 30, 708, 2, 87, 385] +[:mouse_move, 31, 708, 2, 88, 386] +[:mouse_move, 34, 708, 2, 89, 386] +[:mouse_move, 35, 707, 2, 90, 387] +[:mouse_move, 37, 706, 2, 91, 388] +[:mouse_move, 39, 705, 2, 92, 388] +[:mouse_move, 40, 705, 2, 93, 389] +[:mouse_move, 42, 704, 2, 94, 390] +[:mouse_move, 43, 703, 2, 95, 390] +[:mouse_move, 45, 701, 2, 96, 391] +[:mouse_move, 45, 700, 2, 97, 392] +[:mouse_move, 47, 698, 2, 98, 392] +[:mouse_move, 47, 696, 2, 99, 393] +[:mouse_move, 48, 694, 2, 100, 394] +[:mouse_move, 48, 691, 2, 101, 394] +[:mouse_move, 48, 689, 2, 102, 395] +[:mouse_move, 47, 688, 2, 103, 396] +[:mouse_move, 46, 686, 2, 104, 396] +[:mouse_move, 45, 684, 2, 105, 397] +[:mouse_move, 44, 683, 2, 106, 398] +[:mouse_move, 42, 682, 2, 107, 398] +[:mouse_move, 41, 681, 2, 108, 399] +[:mouse_move, 39, 681, 2, 109, 400] +[:mouse_move, 35, 681, 2, 110, 401] +[:mouse_move, 34, 681, 2, 111, 402] +[:mouse_move, 32, 681, 2, 112, 402] +[:mouse_move, 30, 681, 2, 113, 403] +[:mouse_move, 28, 681, 2, 114, 404] +[:mouse_move, 26, 681, 2, 115, 404] +[:mouse_move, 24, 681, 2, 116, 405] +[:mouse_move, 20, 682, 2, 117, 406] +[:mouse_move, 17, 683, 2, 118, 407] +[:mouse_move, 16, 684, 2, 119, 408] +[:mouse_move, 14, 685, 2, 120, 409] +[:mouse_move, 13, 685, 2, 121, 410] +[:mouse_move, 13, 686, 2, 122, 411] +[:mouse_move, 12, 686, 2, 123, 411] +[:mouse_move, 12, 687, 2, 124, 412] +[:mouse_move, 12, 688, 2, 125, 413] +[:mouse_move, 12, 691, 2, 126, 415] +[:mouse_move, 12, 694, 2, 127, 416] +[:mouse_move, 12, 697, 2, 128, 417] +[:mouse_move, 15, 700, 2, 129, 417] +[:mouse_move, 16, 702, 2, 130, 418] +[:mouse_move, 18, 704, 2, 131, 419] +[:mouse_move, 20, 707, 2, 132, 419] +[:mouse_move, 22, 708, 2, 133, 420] +[:mouse_move, 24, 709, 2, 134, 421] +[:mouse_move, 26, 710, 2, 135, 421] +[:mouse_move, 28, 710, 2, 136, 422] +[:mouse_move, 29, 710, 2, 137, 423] +[:mouse_move, 31, 710, 2, 138, 423] +[:mouse_move, 32, 710, 2, 139, 424] +[:mouse_move, 33, 710, 2, 140, 425] +[:mouse_move, 34, 709, 2, 141, 425] +[:mouse_move, 35, 708, 2, 142, 426] +[:mouse_move, 36, 707, 2, 143, 427] +[:mouse_move, 38, 706, 2, 144, 427] +[:mouse_move, 39, 705, 2, 145, 428] +[:mouse_move, 40, 704, 2, 146, 429] +[:mouse_move, 41, 703, 2, 147, 429] +[:mouse_move, 41, 701, 2, 148, 430] +[:mouse_move, 42, 700, 2, 149, 431] +[:mouse_move, 42, 696, 2, 150, 432] +[:mouse_move, 42, 693, 2, 151, 433] +[:mouse_move, 39, 689, 2, 152, 434] +[:mouse_move, 38, 688, 2, 153, 435] +[:mouse_move, 34, 685, 2, 154, 436] +[:mouse_move, 31, 683, 2, 155, 437] +[:mouse_move, 26, 683, 2, 156, 438] +[:mouse_move, 23, 682, 2, 157, 439] +[:mouse_move, 21, 682, 2, 158, 440] +[:mouse_move, 19, 682, 2, 159, 440] +[:mouse_move, 16, 682, 2, 160, 441] +[:mouse_move, 14, 682, 2, 161, 442] +[:mouse_move, 12, 682, 2, 162, 442] +[:mouse_move, 10, 682, 2, 163, 443] +[:mouse_move, 9, 682, 2, 164, 444] +[:mouse_move, 8, 682, 2, 165, 444] +[:mouse_move, 7, 682, 2, 166, 445] +[:mouse_move, 6, 683, 2, 167, 446] +[:mouse_move, 5, 683, 2, 168, 446] +[:mouse_move, 4, 684, 2, 169, 447] +[:mouse_move, 4, 685, 2, 170, 448] +[:mouse_move, 4, 686, 2, 171, 449] +[:mouse_move, 4, 688, 2, 172, 450] +[:mouse_move, 4, 689, 2, 173, 450] +[:mouse_move, 4, 690, 2, 174, 451] +[:mouse_move, 4, 692, 2, 175, 452] +[:mouse_move, 4, 695, 2, 176, 453] +[:mouse_move, 4, 696, 2, 177, 454] +[:mouse_move, 4, 697, 2, 178, 454] +[:mouse_move, 4, 698, 2, 179, 456] +[:mouse_move, 5, 699, 2, 180, 457] +[:mouse_move, 7, 700, 2, 181, 458] +[:mouse_move, 8, 700, 2, 182, 458] +[:mouse_move, 11, 701, 2, 183, 459] +[:mouse_move, 13, 701, 2, 184, 460] +[:mouse_move, 19, 702, 2, 185, 461] +[:mouse_move, 22, 702, 2, 186, 462] +[:mouse_move, 28, 702, 2, 187, 463] +[:mouse_move, 30, 702, 2, 188, 464] +[:mouse_move, 34, 702, 2, 189, 465] +[:mouse_move, 36, 701, 2, 190, 466] +[:mouse_move, 38, 700, 2, 191, 467] +[:mouse_move, 39, 699, 2, 192, 468] +[:mouse_move, 40, 699, 2, 193, 469] +[:mouse_move, 40, 698, 2, 194, 469] +[:mouse_move, 41, 696, 2, 195, 470] +[:mouse_move, 41, 692, 2, 196, 471] +[:mouse_move, 41, 690, 2, 197, 472] +[:mouse_move, 41, 688, 2, 198, 473] +[:mouse_move, 41, 686, 2, 199, 473] +[:mouse_move, 40, 684, 2, 200, 474] +[:mouse_move, 39, 682, 2, 201, 475] +[:mouse_move, 38, 681, 2, 202, 475] +[:mouse_move, 36, 680, 2, 203, 476] +[:mouse_move, 34, 679, 2, 204, 477] +[:mouse_move, 32, 679, 2, 205, 477] +[:mouse_move, 30, 679, 2, 206, 478] +[:mouse_move, 28, 679, 2, 207, 479] +[:mouse_move, 26, 679, 2, 208, 479] +[:mouse_move, 24, 679, 2, 209, 480] +[:mouse_move, 23, 679, 2, 210, 481] +[:mouse_move, 21, 679, 2, 211, 481] +[:mouse_move, 19, 679, 2, 212, 482] +[:mouse_move, 18, 679, 2, 213, 483] +[:mouse_move, 17, 680, 2, 214, 483] +[:mouse_move, 16, 681, 2, 215, 484] +[:mouse_move, 15, 682, 2, 216, 485] +[:mouse_move, 13, 684, 2, 217, 486] +[:mouse_move, 12, 686, 2, 218, 487] +[:mouse_move, 11, 688, 2, 219, 488] +[:mouse_move, 11, 689, 2, 220, 489] +[:mouse_move, 11, 690, 2, 221, 490] +[:mouse_move, 11, 693, 2, 222, 491] +[:mouse_move, 11, 696, 2, 223, 492] +[:mouse_move, 11, 699, 2, 224, 493] +[:mouse_move, 13, 702, 2, 225, 494] +[:mouse_move, 13, 704, 2, 226, 495] +[:mouse_move, 17, 707, 2, 227, 496] +[:mouse_move, 20, 708, 2, 228, 497] +[:mouse_move, 25, 709, 2, 229, 498] +[:mouse_move, 29, 709, 2, 230, 499] +[:mouse_move, 32, 709, 2, 231, 500] +[:mouse_move, 35, 708, 2, 232, 500] +[:mouse_move, 36, 708, 2, 233, 501] +[:mouse_move, 38, 706, 2, 234, 502] +[:mouse_move, 41, 706, 2, 235, 502] +[:mouse_move, 42, 704, 2, 236, 503] +[:mouse_move, 43, 703, 2, 237, 504] +[:mouse_move, 44, 702, 2, 238, 504] +[:mouse_move, 45, 701, 2, 239, 505] +[:mouse_move, 45, 699, 2, 240, 506] +[:mouse_move, 45, 697, 2, 241, 506] +[:mouse_move, 45, 695, 2, 242, 507] +[:mouse_move, 45, 693, 2, 243, 508] +[:mouse_move, 45, 691, 2, 244, 508] +[:mouse_move, 43, 689, 2, 245, 509] +[:mouse_move, 42, 687, 2, 246, 510] +[:mouse_move, 41, 685, 2, 247, 510] +[:mouse_move, 38, 682, 2, 248, 511] +[:mouse_move, 36, 681, 2, 249, 512] +[:mouse_move, 31, 679, 2, 250, 513] +[:mouse_move, 28, 679, 2, 251, 514] +[:mouse_move, 23, 679, 2, 252, 515] +[:mouse_move, 21, 679, 2, 253, 516] +[:mouse_move, 17, 681, 2, 254, 517] +[:mouse_move, 16, 681, 2, 255, 518] +[:mouse_move, 14, 683, 2, 256, 519] +[:mouse_move, 13, 683, 2, 257, 520] +[:mouse_move, 13, 684, 2, 258, 521] +[:mouse_move, 13, 685, 2, 259, 521] +[:mouse_move, 12, 685, 2, 260, 522] +[:mouse_move, 12, 689, 2, 261, 523] +[:mouse_move, 12, 691, 2, 262, 524] +[:mouse_move, 12, 692, 2, 263, 525] +[:mouse_move, 12, 694, 2, 264, 525] +[:mouse_move, 12, 696, 2, 265, 526] +[:mouse_move, 12, 699, 2, 266, 527] +[:mouse_move, 12, 700, 2, 267, 529] +[:mouse_move, 12, 701, 2, 268, 529] +[:mouse_move, 12, 702, 2, 269, 530] +[:mouse_move, 13, 702, 2, 270, 531] +[:mouse_move, 14, 703, 2, 271, 531] +[:mouse_move, 17, 703, 2, 272, 532] +[:mouse_move, 19, 704, 2, 273, 533] +[:mouse_move, 22, 704, 2, 274, 534] +[:mouse_move, 27, 705, 2, 275, 535] +[:mouse_move, 32, 705, 2, 276, 536] +[:mouse_move, 35, 705, 2, 277, 537] +[:mouse_move, 36, 705, 2, 278, 537] +[:mouse_move, 39, 705, 2, 279, 538] +[:mouse_move, 41, 704, 2, 280, 539] +[:mouse_move, 42, 703, 2, 281, 539] +[:mouse_move, 44, 703, 2, 282, 540] +[:mouse_move, 45, 702, 2, 283, 541] +[:mouse_move, 46, 702, 2, 284, 542] +[:mouse_move, 47, 702, 2, 285, 543] +[:mouse_move, 47, 701, 2, 286, 544] +[:mouse_move, 48, 701, 2, 287, 547] +[:mouse_move, 54, 698, 2, 288, 570] +[:mouse_move, 75, 683, 2, 289, 571] +[:mouse_move, 107, 657, 2, 290, 572] +[:mouse_move, 171, 589, 2, 291, 573] +[:mouse_move, 212, 537, 2, 292, 574] +[:mouse_move, 299, 409, 2, 293, 575] +[:mouse_move, 341, 340, 2, 294, 576] +[:mouse_move, 364, 296, 2, 295, 577] +[:mouse_move, 371, 283, 2, 296, 578] +[:mouse_move, 375, 275, 2, 297, 579] +[:mouse_move, 384, 258, 2, 298, 579] +[:mouse_move, 390, 247, 2, 299, 580] +[:mouse_move, 395, 236, 2, 300, 581] +[:mouse_move, 395, 234, 2, 301, 582] +[:mouse_move, 396, 234, 2, 302, 583] +[:mouse_move, 396, 233, 2, 303, 583] +[:mouse_move, 395, 232, 2, 304, 584] +[:mouse_move, 395, 229, 2, 305, 604] +[:mouse_move, 395, 227, 2, 306, 604] +[:mouse_move, 395, 221, 2, 307, 606] +[:mouse_move, 395, 217, 2, 308, 607] +[:mouse_move, 395, 212, 2, 309, 608] +[:mouse_move, 395, 202, 2, 310, 608] +[:mouse_move, 395, 195, 2, 311, 609] +[:mouse_move, 395, 185, 2, 312, 610] +[:mouse_move, 395, 173, 2, 313, 610] +[:mouse_move, 396, 160, 2, 314, 611] +[:mouse_move, 396, 155, 2, 315, 612] +[:mouse_move, 397, 150, 2, 316, 612] +[:mouse_move, 398, 144, 2, 317, 613] +[:mouse_move, 399, 138, 2, 318, 614] +[:mouse_move, 401, 130, 2, 319, 615] +[:mouse_move, 401, 127, 2, 320, 616] +[:mouse_move, 401, 126, 2, 321, 616] +[:mouse_move, 402, 125, 2, 322, 617] +[:mouse_move, 402, 123, 2, 323, 618] +[:mouse_move, 402, 122, 2, 324, 618] +[:mouse_move, 402, 119, 2, 325, 619] +[:mouse_move, 403, 118, 2, 326, 620] +[:mouse_move, 403, 116, 2, 327, 620] +[:mouse_move, 404, 114, 2, 328, 621] +[:mouse_move, 405, 113, 2, 329, 622] +[:mouse_move, 405, 112, 2, 330, 622] +[:mouse_move, 406, 111, 2, 331, 623] +[:mouse_move, 406, 110, 2, 332, 624] +[:mouse_move, 407, 109, 2, 333, 625] +[:mouse_move, 407, 108, 2, 334, 626] +[:mouse_move, 408, 108, 2, 335, 627] +[:mouse_move, 408, 107, 2, 336, 638] +[:mouse_move, 407, 106, 2, 337, 639] +[:mouse_move, 407, 105, 2, 338, 639] +[:mouse_move, 407, 103, 2, 339, 640] +[:mouse_move, 407, 100, 2, 340, 641] +[:mouse_move, 408, 96, 2, 341, 641] +[:mouse_move, 412, 89, 2, 342, 642] +[:mouse_move, 415, 82, 2, 343, 643] +[:mouse_move, 418, 78, 2, 344, 643] +[:mouse_move, 422, 72, 2, 345, 644] +[:mouse_move, 426, 65, 2, 346, 645] +[:mouse_move, 431, 59, 2, 347, 645] +[:mouse_move, 437, 55, 2, 348, 646] +[:mouse_move, 441, 51, 2, 349, 647] +[:mouse_move, 447, 49, 2, 350, 648] +[:mouse_move, 450, 47, 2, 351, 649] +[:mouse_move, 454, 46, 2, 352, 650] +[:mouse_move, 455, 46, 2, 353, 651] +[:mouse_move, 456, 46, 2, 354, 652] +[:mouse_move, 457, 46, 2, 355, 653] +[:mouse_move, 458, 46, 2, 356, 655] +[:mouse_move, 460, 47, 2, 357, 656] +[:mouse_move, 462, 47, 2, 358, 657] +[:mouse_move, 463, 47, 2, 359, 658] +[:mouse_move, 466, 47, 2, 360, 694] +[:mouse_move, 468, 47, 2, 361, 695] +[:mouse_move, 471, 47, 2, 362, 695] +[:mouse_move, 478, 47, 2, 363, 696] +[:mouse_move, 485, 47, 2, 364, 697] +[:mouse_move, 505, 47, 2, 365, 698] +[:mouse_move, 527, 47, 2, 366, 699] +[:mouse_move, 537, 47, 2, 367, 699] +[:mouse_move, 554, 47, 2, 368, 700] +[:mouse_move, 572, 47, 2, 369, 701] +[:mouse_move, 608, 48, 2, 370, 702] +[:mouse_move, 625, 49, 2, 371, 703] +[:mouse_move, 657, 50, 2, 372, 704] +[:mouse_move, 673, 51, 2, 373, 705] +[:mouse_move, 700, 53, 2, 374, 706] +[:mouse_move, 713, 53, 2, 375, 707] +[:mouse_move, 739, 55, 2, 376, 708] +[:mouse_move, 744, 55, 2, 377, 709] +[:mouse_move, 762, 57, 2, 378, 710] +[:mouse_move, 770, 59, 2, 379, 711] +[:mouse_move, 782, 61, 2, 380, 712] +[:mouse_move, 788, 63, 2, 381, 713] +[:mouse_move, 798, 66, 2, 382, 714] +[:mouse_move, 800, 67, 2, 383, 715] +[:mouse_move, 805, 69, 2, 384, 716] +[:mouse_move, 807, 71, 2, 385, 717] +[:mouse_move, 809, 72, 2, 386, 718] +[:mouse_move, 810, 72, 2, 387, 718] +[:mouse_move, 812, 75, 2, 388, 719] +[:mouse_move, 813, 76, 2, 389, 720] +[:mouse_move, 815, 79, 2, 390, 720] +[:mouse_move, 816, 83, 2, 391, 721] +[:mouse_move, 818, 86, 2, 392, 722] +[:mouse_move, 819, 89, 2, 393, 722] +[:mouse_move, 821, 91, 2, 394, 723] +[:mouse_move, 822, 93, 2, 395, 724] +[:mouse_move, 823, 95, 2, 396, 724] +[:mouse_move, 824, 96, 2, 397, 725] +[:mouse_move, 825, 97, 2, 398, 726] +[:mouse_move, 826, 98, 2, 399, 726] +[:mouse_move, 827, 98, 2, 400, 727] +[:mouse_move, 828, 98, 2, 401, 728] +[:mouse_move, 829, 98, 2, 402, 729] +[:mouse_move, 830, 98, 2, 403, 731] +[:mouse_move, 831, 98, 2, 404, 733] +[:mouse_move, 832, 98, 2, 405, 758] +[:mouse_move, 833, 98, 2, 406, 788] +[:mouse_move, 836, 98, 2, 407, 789] +[:mouse_move, 838, 99, 2, 408, 790] +[:mouse_move, 841, 99, 2, 409, 791] +[:mouse_move, 843, 99, 2, 410, 792] +[:mouse_move, 845, 99, 2, 411, 793] +[:mouse_move, 845, 100, 2, 412, 794] +[:mouse_move, 846, 100, 2, 413, 795] +[:mouse_move, 844, 100, 2, 414, 808] +[:mouse_move, 841, 99, 2, 415, 809] +[:mouse_move, 828, 96, 2, 416, 810] +[:mouse_move, 818, 94, 2, 417, 811] +[:mouse_move, 807, 92, 2, 418, 811] +[:mouse_move, 794, 91, 2, 419, 812] +[:mouse_move, 778, 90, 2, 420, 813] +[:mouse_move, 745, 88, 2, 421, 814] +[:mouse_move, 728, 88, 2, 422, 815] +[:mouse_move, 704, 88, 2, 423, 816] +[:mouse_move, 691, 88, 2, 424, 817] +[:mouse_move, 673, 88, 2, 425, 818] +[:mouse_move, 666, 89, 2, 426, 819] +[:mouse_move, 656, 90, 2, 427, 820] +[:mouse_move, 651, 90, 2, 428, 821] +[:mouse_move, 647, 90, 2, 429, 822] +[:mouse_move, 645, 90, 2, 430, 823] +[:mouse_move, 643, 90, 2, 431, 824] +[:mouse_move, 642, 90, 2, 432, 825] +[:mouse_move, 642, 89, 2, 433, 826] +[:mouse_move, 641, 89, 2, 434, 828] +[:mouse_button_pressed, 1, 0, 1, 435, 841] +[:mouse_button_up, 1, 0, 1, 436, 848] +[:mouse_move, 639, 91, 2, 437, 893] +[:mouse_move, 635, 93, 2, 438, 894] +[:mouse_move, 615, 106, 2, 439, 895] +[:mouse_move, 598, 117, 2, 440, 896] +[:mouse_move, 554, 145, 2, 441, 897] +[:mouse_move, 529, 160, 2, 442, 898] +[:mouse_move, 498, 181, 2, 443, 899] +[:mouse_move, 482, 195, 2, 444, 900] +[:mouse_move, 467, 209, 2, 445, 901] +[:mouse_move, 460, 217, 2, 446, 902] +[:mouse_move, 458, 221, 2, 447, 916] +[:mouse_move, 457, 223, 2, 448, 917] +[:mouse_move, 455, 226, 2, 449, 918] +[:mouse_move, 454, 228, 2, 450, 919] +[:mouse_move, 453, 232, 2, 451, 920] +[:mouse_move, 453, 233, 2, 452, 921] +[:mouse_move, 452, 235, 2, 453, 922] +[:mouse_move, 452, 236, 2, 454, 924] +[:mouse_move, 452, 237, 2, 455, 926] +[:mouse_move, 452, 238, 2, 456, 932] +[:mouse_move, 452, 239, 2, 457, 935] +[:mouse_move, 453, 239, 2, 458, 936] +[:mouse_move, 453, 240, 2, 459, 937] +[:mouse_move, 453, 241, 2, 460, 938] +[:mouse_move, 454, 243, 2, 461, 939] +[:mouse_move, 455, 244, 2, 462, 940] +[:mouse_move, 455, 247, 2, 463, 941] +[:mouse_move, 456, 248, 2, 464, 942] +[:mouse_move, 456, 250, 2, 465, 943] +[:mouse_move, 457, 251, 2, 466, 944] +[:mouse_move, 460, 253, 2, 467, 945] +[:mouse_move, 463, 255, 2, 468, 946] +[:mouse_move, 472, 259, 2, 469, 947] +[:mouse_move, 483, 262, 2, 470, 948] +[:mouse_move, 501, 265, 2, 471, 949] +[:mouse_move, 506, 266, 2, 472, 950] +[:mouse_move, 526, 268, 2, 473, 951] +[:mouse_move, 536, 268, 2, 474, 952] +[:mouse_move, 555, 269, 2, 475, 953] +[:mouse_move, 563, 269, 2, 476, 954] +[:mouse_move, 571, 270, 2, 477, 955] +[:mouse_move, 595, 271, 2, 478, 956] +[:mouse_move, 603, 272, 2, 479, 957] +[:mouse_move, 617, 273, 2, 480, 958] +[:mouse_move, 627, 273, 2, 481, 959] +[:mouse_move, 652, 275, 2, 482, 960] +[:mouse_move, 657, 275, 2, 483, 961] +[:mouse_move, 674, 276, 2, 484, 962] +[:mouse_move, 683, 276, 2, 485, 963] +[:mouse_move, 696, 276, 2, 486, 964] +[:mouse_move, 702, 276, 2, 487, 965] +[:mouse_move, 712, 276, 2, 488, 966] +[:mouse_move, 715, 276, 2, 489, 967] +[:mouse_move, 721, 276, 2, 490, 968] +[:mouse_move, 724, 276, 2, 491, 969] +[:mouse_move, 728, 276, 2, 492, 970] +[:mouse_move, 731, 276, 2, 493, 971] +[:mouse_move, 734, 277, 2, 494, 972] +[:mouse_move, 736, 277, 2, 495, 974] +[:mouse_move, 737, 277, 2, 496, 977] +[:mouse_move, 735, 277, 2, 497, 984] +[:mouse_move, 731, 278, 2, 498, 985] +[:mouse_move, 726, 279, 2, 499, 986] +[:mouse_move, 713, 283, 2, 500, 987] +[:mouse_move, 704, 286, 2, 501, 988] +[:mouse_move, 681, 293, 2, 502, 989] +[:mouse_move, 657, 300, 2, 503, 990] +[:mouse_move, 619, 313, 2, 504, 991] +[:mouse_move, 593, 321, 2, 505, 992] +[:mouse_move, 538, 340, 2, 506, 993] +[:mouse_move, 526, 344, 2, 507, 994] +[:mouse_move, 478, 360, 2, 508, 995] +[:mouse_move, 458, 367, 2, 509, 996] +[:mouse_move, 426, 379, 2, 510, 997] +[:mouse_move, 420, 381, 2, 511, 998] +[:mouse_move, 407, 385, 2, 512, 999] +[:mouse_move, 400, 388, 2, 513, 1000] +[:mouse_move, 392, 391, 2, 514, 1001] +[:mouse_move, 388, 391, 2, 515, 1002] +[:mouse_move, 385, 393, 2, 516, 1003] +[:mouse_move, 384, 393, 2, 517, 1004] +[:mouse_move, 383, 394, 2, 518, 1005] +[:mouse_move, 384, 394, 2, 519, 1007] +[:mouse_move, 387, 394, 2, 520, 1008] +[:mouse_move, 399, 392, 2, 521, 1009] +[:mouse_move, 408, 391, 2, 522, 1010] +[:mouse_move, 418, 389, 2, 523, 1011] +[:mouse_move, 441, 384, 2, 524, 1012] +[:mouse_move, 451, 382, 2, 525, 1013] +[:mouse_move, 475, 378, 2, 526, 1014] +[:mouse_move, 486, 376, 2, 527, 1015] +[:mouse_move, 507, 374, 2, 528, 1016] +[:mouse_move, 519, 373, 2, 529, 1017] +[:mouse_move, 539, 371, 2, 530, 1018] +[:mouse_move, 544, 371, 2, 531, 1019] +[:mouse_move, 567, 369, 2, 532, 1020] +[:mouse_move, 584, 369, 2, 533, 1021] +[:mouse_move, 598, 369, 2, 534, 1022] +[:mouse_move, 607, 368, 2, 535, 1023] +[:mouse_move, 625, 368, 2, 536, 1024] +[:mouse_move, 632, 368, 2, 537, 1025] +[:mouse_move, 645, 368, 2, 538, 1026] +[:mouse_move, 650, 368, 2, 539, 1027] +[:mouse_move, 657, 368, 2, 540, 1028] +[:mouse_move, 661, 368, 2, 541, 1029] +[:mouse_move, 667, 368, 2, 542, 1030] +[:mouse_move, 670, 368, 2, 543, 1031] +[:mouse_move, 674, 368, 2, 544, 1032] +[:mouse_move, 676, 368, 2, 545, 1033] +[:mouse_move, 679, 367, 2, 546, 1034] +[:mouse_move, 680, 367, 2, 547, 1036] +[:mouse_move, 681, 367, 2, 548, 1037] +[:mouse_move, 681, 366, 2, 549, 1040] +[:mouse_move, 675, 360, 2, 550, 1055] +[:mouse_move, 671, 356, 2, 551, 1056] +[:mouse_move, 664, 348, 2, 552, 1057] +[:mouse_move, 659, 344, 2, 553, 1058] +[:mouse_move, 654, 338, 2, 554, 1059] +[:mouse_move, 650, 332, 2, 555, 1060] +[:mouse_move, 644, 327, 2, 556, 1061] +[:mouse_move, 643, 326, 2, 557, 1062] +[:mouse_move, 641, 324, 2, 558, 1063] +[:mouse_move, 638, 321, 2, 559, 1064] +[:mouse_move, 636, 319, 2, 560, 1065] +[:mouse_move, 635, 319, 2, 561, 1066] +[:mouse_move, 635, 318, 2, 562, 1067] +[:mouse_move, 634, 318, 2, 563, 1068] +[:mouse_move, 634, 317, 2, 564, 1069] +[:mouse_button_pressed, 1, 0, 1, 565, 1071] +[:mouse_button_up, 1, 0, 1, 566, 1079] +[:mouse_move, 633, 317, 2, 567, 1099] +[:mouse_move, 633, 318, 2, 568, 1100] +[:mouse_move, 624, 324, 2, 569, 1101] +[:mouse_move, 613, 331, 2, 570, 1102] +[:mouse_move, 579, 351, 2, 571, 1103] +[:mouse_move, 554, 365, 2, 572, 1104] +[:mouse_move, 497, 393, 2, 573, 1105] +[:mouse_move, 469, 404, 2, 574, 1106] +[:mouse_move, 449, 411, 2, 575, 1107] +[:mouse_move, 432, 417, 2, 576, 1108] +[:mouse_move, 419, 421, 2, 577, 1109] +[:mouse_move, 412, 423, 2, 578, 1110] +[:mouse_move, 406, 425, 2, 579, 1111] +[:mouse_move, 405, 425, 2, 580, 1112] +[:mouse_move, 404, 425, 2, 581, 1113] +[:mouse_move, 397, 425, 2, 582, 1203] +[:mouse_move, 388, 428, 2, 583, 1204] +[:mouse_move, 363, 440, 2, 584, 1205] +[:mouse_move, 348, 447, 2, 585, 1206] +[:mouse_move, 289, 487, 2, 586, 1207] +[:mouse_move, 260, 509, 2, 587, 1208] +[:mouse_move, 223, 542, 2, 588, 1209] +[:mouse_move, 203, 561, 2, 589, 1210] +[:mouse_move, 181, 584, 2, 590, 1211] +[:mouse_move, 170, 595, 2, 591, 1212] +[:mouse_move, 155, 613, 2, 592, 1213] +[:mouse_move, 150, 619, 2, 593, 1214] +[:mouse_move, 143, 629, 2, 594, 1215] +[:mouse_move, 139, 633, 2, 595, 1216] +[:mouse_move, 135, 638, 2, 596, 1217] +[:mouse_move, 133, 641, 2, 597, 1218] +[:mouse_move, 126, 646, 2, 598, 1219] +[:mouse_move, 123, 648, 2, 599, 1220] +[:mouse_move, 116, 653, 2, 600, 1221] +[:mouse_move, 112, 656, 2, 601, 1222] +[:mouse_move, 103, 660, 2, 602, 1223] +[:mouse_move, 99, 662, 2, 603, 1224] +[:mouse_move, 88, 665, 2, 604, 1225] +[:mouse_move, 84, 667, 2, 605, 1226] +[:mouse_move, 76, 671, 2, 606, 1227] +[:mouse_move, 72, 673, 2, 607, 1228] +[:mouse_move, 69, 675, 2, 608, 1229] +[:mouse_move, 63, 679, 2, 609, 1230] +[:mouse_move, 60, 682, 2, 610, 1231] +[:mouse_move, 53, 688, 2, 611, 1232] +[:mouse_move, 50, 690, 2, 612, 1233] +[:mouse_move, 46, 693, 2, 613, 1234] +[:mouse_move, 44, 695, 2, 614, 1235] +[:mouse_move, 39, 697, 2, 615, 1236] +[:mouse_move, 37, 699, 2, 616, 1237] +[:mouse_move, 33, 700, 2, 617, 1238] +[:mouse_move, 32, 700, 2, 618, 1239] +[:mouse_move, 28, 701, 2, 619, 1240] +[:mouse_move, 27, 701, 2, 620, 1241] +[:mouse_move, 25, 702, 2, 621, 1242] +[:mouse_move, 24, 702, 2, 622, 1243] +[:mouse_move, 22, 703, 2, 623, 1244] +[:mouse_move, 20, 703, 2, 624, 1245] +[:mouse_move, 18, 704, 2, 625, 1246] +[:mouse_move, 16, 704, 2, 626, 1247] +[:mouse_move, 14, 704, 2, 627, 1248] +[:mouse_move, 13, 704, 2, 628, 1249] +[:mouse_move, 12, 704, 2, 629, 1250] +[:mouse_move, 11, 704, 2, 630, 1251] +[:mouse_move, 10, 704, 2, 631, 1252] +[:mouse_move, 10, 705, 2, 632, 1253] +[:mouse_move, 11, 705, 2, 633, 1261] +[:mouse_move, 12, 705, 2, 634, 1262] +[:mouse_move, 15, 706, 2, 635, 1263] +[:mouse_move, 17, 706, 2, 636, 1264] +[:mouse_move, 20, 707, 2, 637, 1265] +[:mouse_move, 22, 707, 2, 638, 1266] +[:mouse_move, 26, 708, 2, 639, 1267] +[:mouse_move, 27, 708, 2, 640, 1268] +[:mouse_move, 30, 708, 2, 641, 1269] +[:mouse_move, 31, 708, 2, 642, 1270] +[:mouse_move, 33, 708, 2, 643, 1271] +[:mouse_move, 34, 708, 2, 644, 1272] +[:mouse_move, 37, 708, 2, 645, 1273] +[:mouse_move, 38, 708, 2, 646, 1274] +[:mouse_move, 41, 708, 2, 647, 1275] +[:mouse_move, 42, 708, 2, 648, 1276] +[:mouse_move, 44, 708, 2, 649, 1277] +[:mouse_move, 45, 708, 2, 650, 1279] +[:mouse_move, 46, 708, 2, 651, 1280] +[:mouse_move, 53, 702, 2, 652, 1304] +[:mouse_move, 60, 696, 2, 653, 1305] +[:mouse_move, 81, 674, 2, 654, 1306] +[:mouse_move, 107, 646, 2, 655, 1307] +[:mouse_move, 141, 609, 2, 656, 1308] +[:mouse_move, 234, 517, 2, 657, 1309] +[:mouse_move, 288, 465, 2, 658, 1310] +[:mouse_move, 366, 397, 2, 659, 1311] +[:mouse_move, 412, 362, 2, 660, 1312] +[:mouse_move, 464, 328, 2, 661, 1313] +[:mouse_move, 474, 322, 2, 662, 1314] +[:mouse_move, 495, 310, 2, 663, 1315] +[:mouse_move, 504, 304, 2, 664, 1316] +[:mouse_move, 513, 299, 2, 665, 1317] +[:mouse_move, 514, 298, 2, 666, 1318] +[:mouse_move, 515, 297, 2, 667, 1319] +[:mouse_move, 517, 292, 2, 668, 1333] +[:mouse_move, 519, 288, 2, 669, 1334] +[:mouse_move, 524, 275, 2, 670, 1335] +[:mouse_move, 531, 254, 2, 671, 1336] +[:mouse_move, 536, 238, 2, 672, 1337] +[:mouse_move, 546, 209, 2, 673, 1338] +[:mouse_move, 548, 203, 2, 674, 1339] +[:mouse_move, 555, 188, 2, 675, 1340] +[:mouse_move, 557, 181, 2, 676, 1341] +[:mouse_move, 560, 173, 2, 677, 1342] +[:mouse_move, 561, 171, 2, 678, 1343] +[:mouse_move, 562, 169, 2, 679, 1344] +[:mouse_move, 562, 168, 2, 680, 1345] +[:mouse_move, 562, 167, 2, 681, 1346] +[:mouse_move, 562, 166, 2, 682, 1347] +[:mouse_move, 562, 165, 2, 683, 1348] +[:mouse_move, 562, 164, 2, 684, 1350] +[:mouse_move, 562, 163, 2, 685, 1351] +[:mouse_move, 562, 162, 2, 686, 1354] +[:mouse_button_pressed, 1, 0, 1, 687, 1359] +[:mouse_button_up, 1, 0, 1, 688, 1365] +[:mouse_move, 563, 163, 2, 689, 1401] +[:mouse_move, 563, 164, 2, 690, 1402] +[:mouse_move, 564, 165, 2, 691, 1403] +[:mouse_move, 565, 169, 2, 692, 1404] +[:mouse_move, 566, 173, 2, 693, 1405] +[:mouse_move, 566, 179, 2, 694, 1406] +[:mouse_move, 566, 180, 2, 695, 1407] +[:mouse_move, 566, 186, 2, 696, 1408] +[:mouse_move, 565, 188, 2, 697, 1409] +[:mouse_move, 563, 192, 2, 698, 1410] +[:mouse_move, 562, 195, 2, 699, 1411] +[:mouse_move, 561, 198, 2, 700, 1412] +[:mouse_move, 561, 199, 2, 701, 1413] +[:mouse_move, 560, 202, 2, 702, 1414] +[:mouse_move, 560, 205, 2, 703, 1415] +[:mouse_move, 559, 210, 2, 704, 1416] +[:mouse_move, 558, 213, 2, 705, 1417] +[:mouse_move, 558, 215, 2, 706, 1418] +[:mouse_move, 558, 220, 2, 707, 1419] +[:mouse_move, 558, 222, 2, 708, 1420] +[:mouse_move, 558, 224, 2, 709, 1421] +[:mouse_move, 558, 225, 2, 710, 1422] +[:mouse_move, 558, 226, 2, 711, 1423] +[:mouse_move, 558, 225, 2, 712, 1443] +[:mouse_move, 558, 224, 2, 713, 1444] +[:mouse_move, 558, 225, 2, 714, 1451] +[:mouse_move, 558, 229, 2, 715, 1452] +[:mouse_move, 558, 231, 2, 716, 1453] +[:mouse_move, 556, 236, 2, 717, 1454] +[:mouse_move, 556, 238, 2, 718, 1455] +[:mouse_move, 555, 247, 2, 719, 1456] +[:mouse_move, 555, 252, 2, 720, 1457] +[:mouse_move, 555, 261, 2, 721, 1458] +[:mouse_move, 555, 263, 2, 722, 1459] +[:mouse_move, 555, 269, 2, 723, 1460] +[:mouse_move, 556, 272, 2, 724, 1461] +[:mouse_move, 556, 275, 2, 725, 1462] +[:mouse_move, 556, 276, 2, 726, 1464] +[:mouse_move, 556, 277, 2, 727, 1465] +[:mouse_move, 556, 278, 2, 728, 1467] +[:mouse_move, 556, 279, 2, 729, 1471] +[:mouse_move, 556, 281, 2, 730, 1475] +[:mouse_move, 556, 282, 2, 731, 1476] +[:mouse_move, 556, 283, 2, 732, 1477] +[:mouse_move, 556, 285, 2, 733, 1478] +[:mouse_move, 556, 286, 2, 734, 1479] +[:mouse_move, 556, 287, 2, 735, 1482] +[:mouse_move, 556, 286, 2, 736, 1485] +[:mouse_move, 555, 286, 2, 737, 1487] +[:mouse_move, 555, 285, 2, 738, 1488] +[:mouse_move, 556, 282, 2, 739, 1549] +[:mouse_move, 556, 280, 2, 740, 1550] +[:mouse_move, 557, 271, 2, 741, 1551] +[:mouse_move, 557, 268, 2, 742, 1552] +[:mouse_move, 558, 264, 2, 743, 1553] +[:mouse_move, 559, 258, 2, 744, 1554] +[:mouse_move, 559, 256, 2, 745, 1555] +[:mouse_move, 559, 254, 2, 746, 1556] +[:mouse_move, 559, 256, 2, 747, 1559] +[:mouse_move, 560, 261, 2, 748, 1560] +[:mouse_move, 560, 265, 2, 749, 1561] +[:mouse_move, 561, 270, 2, 750, 1562] +[:mouse_move, 562, 273, 2, 751, 1563] +[:mouse_move, 562, 276, 2, 752, 1564] +[:mouse_move, 562, 277, 2, 753, 1565] +[:mouse_move, 562, 278, 2, 754, 1566] +[:mouse_move, 562, 279, 2, 755, 1567] +[:mouse_button_pressed, 1, 0, 1, 756, 1569] +[:mouse_button_up, 1, 0, 1, 757, 1578] +[:mouse_move, 557, 280, 2, 758, 1609] +[:mouse_move, 543, 284, 2, 759, 1610] +[:mouse_move, 532, 285, 2, 760, 1611] +[:mouse_move, 498, 292, 2, 761, 1612] +[:mouse_move, 475, 296, 2, 762, 1613] +[:mouse_move, 425, 304, 2, 763, 1614] +[:mouse_move, 400, 308, 2, 764, 1615] +[:mouse_move, 348, 314, 2, 765, 1616] +[:mouse_move, 337, 316, 2, 766, 1617] +[:mouse_move, 278, 328, 2, 767, 1618] +[:mouse_move, 267, 333, 2, 768, 1619] +[:mouse_move, 228, 348, 2, 769, 1620] +[:mouse_move, 213, 357, 2, 770, 1621] +[:mouse_move, 195, 366, 2, 771, 1622] +[:mouse_move, 192, 368, 2, 772, 1623] +[:mouse_move, 184, 375, 2, 773, 1624] +[:mouse_move, 182, 376, 2, 774, 1625] +[:mouse_move, 181, 379, 2, 775, 1626] +[:mouse_move, 181, 380, 2, 776, 1627] +[:mouse_move, 185, 385, 2, 777, 1628] +[:mouse_move, 187, 386, 2, 778, 1629] +[:mouse_move, 195, 392, 2, 779, 1630] +[:mouse_move, 198, 394, 2, 780, 1631] +[:mouse_move, 210, 396, 2, 781, 1632] +[:mouse_move, 213, 396, 2, 782, 1633] +[:mouse_move, 219, 396, 2, 783, 1634] +[:mouse_move, 231, 395, 2, 784, 1635] +[:mouse_move, 237, 393, 2, 785, 1636] +[:mouse_move, 247, 392, 2, 786, 1637] +[:mouse_move, 252, 392, 2, 787, 1638] +[:mouse_move, 258, 394, 2, 788, 1639] +[:mouse_move, 261, 397, 2, 789, 1640] +[:mouse_move, 263, 428, 2, 790, 1641] +[:mouse_move, 253, 453, 2, 791, 1642] +[:mouse_move, 210, 531, 2, 792, 1643] +[:mouse_move, 196, 553, 2, 793, 1644] +[:mouse_move, 194, 554, 2, 794, 1656] +[:mouse_move, 174, 575, 2, 795, 1657] +[:mouse_move, 162, 587, 2, 796, 1658] +[:mouse_move, 137, 612, 2, 797, 1659] +[:mouse_move, 114, 635, 2, 798, 1660] +[:mouse_move, 86, 665, 2, 799, 1661] +[:mouse_move, 79, 671, 2, 800, 1662] +[:mouse_move, 69, 681, 2, 801, 1663] +[:mouse_move, 52, 698, 2, 802, 1664] +[:mouse_move, 48, 703, 2, 803, 1665] +[:mouse_move, 41, 711, 2, 804, 1666] +[:mouse_move, 39, 715, 2, 805, 1667] +[:mouse_move, 36, 719, 2, 806, 1668] +[:mouse_move, 35, 719, 2, 807, 1669] +[:mouse_move, 20, 719, 2, 808, 1685] +[:mouse_move, 18, 717, 2, 809, 1686] +[:mouse_move, 18, 716, 2, 810, 1687] +[:mouse_move, 16, 715, 2, 811, 1688] +[:mouse_move, 16, 714, 2, 812, 1688] +[:mouse_move, 15, 714, 2, 813, 1689] +[:mouse_move, 15, 713, 2, 814, 1690] +[:mouse_move, 14, 712, 2, 815, 1691] +[:mouse_move, 15, 712, 2, 816, 1697] +[:mouse_move, 17, 712, 2, 817, 1698] +[:mouse_move, 20, 713, 2, 818, 1698] +[:mouse_move, 22, 713, 2, 819, 1699] +[:mouse_move, 25, 713, 2, 820, 1700] +[:mouse_move, 27, 713, 2, 821, 1700] +[:mouse_move, 30, 713, 2, 822, 1701] +[:mouse_move, 32, 713, 2, 823, 1702] +[:mouse_move, 36, 711, 2, 824, 1702] +[:mouse_move, 38, 710, 2, 825, 1703] +[:mouse_move, 41, 708, 2, 826, 1704] +[:mouse_move, 46, 700, 2, 827, 1705] +[:mouse_move, 47, 698, 2, 828, 1706] +[:mouse_move, 50, 691, 2, 829, 1707] +[:mouse_move, 51, 689, 2, 830, 1708] +[:mouse_move, 52, 685, 2, 831, 1709] +[:mouse_move, 52, 683, 2, 832, 1710] +[:mouse_move, 50, 680, 2, 833, 1711] +[:mouse_move, 47, 679, 2, 834, 1712] +[:mouse_move, 39, 675, 2, 835, 1713] +[:mouse_move, 35, 675, 2, 836, 1714] +[:mouse_move, 26, 672, 2, 837, 1715] +[:mouse_move, 23, 671, 2, 838, 1716] +[:mouse_move, 21, 671, 2, 839, 1717] +[:mouse_move, 18, 671, 2, 840, 1717] +[:mouse_move, 15, 671, 2, 841, 1718] +[:mouse_move, 13, 671, 2, 842, 1719] +[:mouse_move, 12, 671, 2, 843, 1719] +[:mouse_move, 10, 671, 2, 844, 1720] +[:mouse_move, 9, 672, 2, 845, 1721] +[:mouse_move, 8, 673, 2, 846, 1721] +[:mouse_move, 7, 676, 2, 847, 1722] +[:mouse_move, 6, 679, 2, 848, 1723] +[:mouse_move, 6, 680, 2, 849, 1723] +[:mouse_move, 6, 683, 2, 850, 1724] +[:mouse_move, 6, 686, 2, 851, 1725] +[:mouse_move, 5, 688, 2, 852, 1725] +[:mouse_move, 5, 690, 2, 853, 1726] +[:mouse_move, 5, 692, 2, 854, 1727] +[:mouse_move, 5, 693, 2, 855, 1727] +[:mouse_move, 6, 696, 2, 856, 1728] +[:mouse_move, 7, 698, 2, 857, 1729] +[:mouse_move, 11, 701, 2, 858, 1730] +[:mouse_move, 13, 702, 2, 859, 1731] +[:mouse_move, 15, 704, 2, 860, 1731] +[:mouse_move, 17, 705, 2, 861, 1732] +[:mouse_move, 21, 707, 2, 862, 1733] +[:mouse_move, 22, 707, 2, 863, 1733] +[:mouse_move, 26, 707, 2, 864, 1734] +[:mouse_move, 28, 707, 2, 865, 1735] +[:mouse_move, 35, 707, 2, 866, 1736] +[:mouse_move, 37, 705, 2, 867, 1737] +[:mouse_move, 41, 702, 2, 868, 1738] +[:mouse_move, 45, 699, 2, 869, 1739] +[:mouse_move, 48, 696, 2, 870, 1740] +[:mouse_move, 49, 695, 2, 871, 1741] +[:mouse_move, 50, 690, 2, 872, 1742] +[:mouse_move, 50, 687, 2, 873, 1743] +[:mouse_move, 50, 684, 2, 874, 1744] +[:mouse_move, 49, 680, 2, 875, 1744] +[:mouse_move, 46, 677, 2, 876, 1745] +[:mouse_move, 42, 674, 2, 877, 1746] +[:mouse_move, 41, 673, 2, 878, 1746] +[:mouse_move, 37, 671, 2, 879, 1747] +[:mouse_move, 34, 669, 2, 880, 1748] +[:mouse_move, 32, 668, 2, 881, 1748] +[:mouse_move, 30, 667, 2, 882, 1749] +[:mouse_move, 28, 666, 2, 883, 1750] +[:mouse_move, 26, 666, 2, 884, 1750] +[:mouse_move, 24, 666, 2, 885, 1751] +[:mouse_move, 20, 666, 2, 886, 1752] +[:mouse_move, 18, 666, 2, 887, 1752] +[:mouse_move, 16, 668, 2, 888, 1753] +[:mouse_move, 14, 668, 2, 889, 1754] +[:mouse_move, 12, 669, 2, 890, 1754] +[:mouse_move, 10, 671, 2, 891, 1755] +[:mouse_move, 9, 672, 2, 892, 1756] +[:mouse_move, 8, 674, 2, 893, 1756] +[:mouse_move, 7, 675, 2, 894, 1757] +[:mouse_move, 6, 675, 2, 895, 1758] +[:mouse_move, 6, 678, 2, 896, 1758] +[:mouse_move, 6, 680, 2, 897, 1759] +[:mouse_move, 6, 683, 2, 898, 1760] +[:mouse_move, 9, 690, 2, 899, 1761] +[:mouse_move, 12, 693, 2, 900, 1762] +[:mouse_move, 19, 699, 2, 901, 1763] +[:mouse_move, 24, 702, 2, 902, 1764] +[:mouse_move, 37, 705, 2, 903, 1765] +[:mouse_move, 45, 705, 2, 904, 1766] +[:mouse_move, 72, 692, 2, 905, 1767] +[:mouse_move, 88, 682, 2, 906, 1768] +[:mouse_move, 129, 649, 2, 907, 1769] +[:mouse_move, 172, 610, 2, 908, 1770] +[:mouse_move, 234, 545, 2, 909, 1771] +[:mouse_move, 267, 507, 2, 910, 1772] +[:mouse_move, 300, 469, 2, 911, 1773] +[:mouse_move, 318, 451, 2, 912, 1773] +[:mouse_move, 349, 415, 2, 913, 1774] +[:mouse_move, 381, 383, 2, 914, 1775] +[:mouse_move, 393, 370, 2, 915, 1775] +[:mouse_move, 414, 345, 2, 916, 1776] +[:mouse_move, 432, 325, 2, 917, 1777] +[:mouse_move, 437, 318, 2, 918, 1777] +[:mouse_move, 447, 305, 2, 919, 1778] +[:mouse_move, 450, 302, 2, 920, 1779] +[:mouse_move, 455, 295, 2, 921, 1779] +[:mouse_move, 459, 290, 2, 922, 1780] +[:mouse_move, 461, 288, 2, 923, 1781] +[:mouse_move, 463, 285, 2, 924, 1781] +[:mouse_move, 465, 284, 2, 925, 1782] +[:mouse_move, 467, 283, 2, 926, 1783] +[:mouse_move, 470, 283, 2, 927, 1783] +[:mouse_move, 472, 283, 2, 928, 1784] +[:mouse_move, 476, 283, 2, 929, 1785] +[:mouse_move, 483, 284, 2, 930, 1786] +[:mouse_move, 485, 286, 2, 931, 1787] +[:mouse_move, 493, 291, 2, 932, 1788] +[:mouse_move, 495, 294, 2, 933, 1789] +[:mouse_move, 500, 300, 2, 934, 1790] +[:mouse_move, 503, 303, 2, 935, 1791] +[:mouse_move, 507, 309, 2, 936, 1792] +[:mouse_move, 509, 311, 2, 937, 1793] +[:mouse_move, 513, 314, 2, 938, 1794] +[:mouse_move, 514, 314, 2, 939, 1795] +[:mouse_move, 516, 314, 2, 940, 1796] +[:mouse_move, 517, 314, 2, 941, 1797] +[:mouse_move, 518, 314, 2, 942, 1798] +[:mouse_move, 519, 314, 2, 943, 1800] +[:mouse_button_pressed, 1, 0, 1, 944, 1801] +[:mouse_button_up, 1, 0, 1, 945, 1808] +[:mouse_move, 519, 312, 2, 946, 1826] +[:mouse_move, 519, 310, 2, 947, 1827] +[:mouse_move, 522, 303, 2, 948, 1828] +[:mouse_move, 523, 298, 2, 949, 1829] +[:mouse_move, 529, 282, 2, 950, 1830] +[:mouse_move, 532, 273, 2, 951, 1831] +[:mouse_move, 541, 252, 2, 952, 1832] +[:mouse_move, 544, 246, 2, 953, 1833] +[:mouse_move, 549, 233, 2, 954, 1834] +[:mouse_move, 552, 225, 2, 955, 1835] +[:mouse_move, 555, 217, 2, 956, 1836] +[:mouse_move, 556, 214, 2, 957, 1837] +[:mouse_move, 557, 211, 2, 958, 1838] +[:mouse_move, 557, 210, 2, 959, 1839] +[:mouse_move, 558, 210, 2, 960, 1841] +[:mouse_move, 558, 211, 2, 961, 1848] +[:mouse_move, 558, 212, 2, 962, 1849] +[:mouse_move, 558, 213, 2, 963, 1850] +[:mouse_move, 558, 214, 2, 964, 1851] +[:mouse_move, 558, 215, 2, 965, 1853] +[:mouse_button_pressed, 1, 0, 1, 966, 1863] +[:mouse_button_up, 1, 0, 1, 967, 1870] +[:mouse_move, 551, 215, 2, 968, 1907] +[:mouse_move, 544, 216, 2, 969, 1908] +[:mouse_move, 512, 220, 2, 970, 1909] +[:mouse_move, 493, 224, 2, 971, 1910] +[:mouse_move, 447, 239, 2, 972, 1911] +[:mouse_move, 422, 250, 2, 973, 1912] +[:mouse_move, 341, 296, 2, 974, 1913] +[:mouse_move, 325, 309, 2, 975, 1914] +[:mouse_move, 233, 390, 2, 976, 1915] +[:mouse_move, 199, 428, 2, 977, 1916] +[:mouse_move, 138, 510, 2, 978, 1917] +[:mouse_move, 126, 530, 2, 979, 1918] +[:mouse_move, 100, 577, 2, 980, 1919] +[:mouse_move, 95, 586, 2, 981, 1920] +[:mouse_move, 86, 604, 2, 982, 1921] +[:mouse_move, 83, 611, 2, 983, 1922] +[:mouse_move, 79, 618, 2, 984, 1923] +[:mouse_move, 78, 620, 2, 985, 1935] +[:mouse_move, 74, 626, 2, 986, 1936] +[:mouse_move, 68, 633, 2, 987, 1937] +[:mouse_move, 55, 651, 2, 988, 1938] +[:mouse_move, 47, 662, 2, 989, 1939] +[:mouse_move, 34, 679, 2, 990, 1940] +[:mouse_move, 27, 688, 2, 991, 1941] +[:mouse_move, 20, 697, 2, 992, 1942] +[:mouse_move, 16, 701, 2, 993, 1943] +[:mouse_move, 12, 705, 2, 994, 1944] +[:mouse_move, 11, 706, 2, 995, 1945] +[:mouse_move, 9, 707, 2, 996, 1946] +[:mouse_move, 8, 707, 2, 997, 1947] +[:mouse_move, 7, 707, 2, 998, 1948] +[:mouse_move, 7, 706, 2, 999, 1949] +[:mouse_move, 6, 706, 2, 1000, 1953] +[:mouse_move, 7, 706, 2, 1001, 1968] +[:mouse_move, 10, 706, 2, 1002, 1969] +[:mouse_move, 11, 706, 2, 1003, 1970] +[:mouse_move, 14, 706, 2, 1004, 1971] +[:mouse_move, 15, 706, 2, 1005, 1972] +[:mouse_move, 18, 705, 2, 1006, 1973] +[:mouse_move, 20, 705, 2, 1007, 1974] +[:mouse_move, 22, 705, 2, 1008, 1975] +[:mouse_move, 23, 705, 2, 1009, 1976] +[:mouse_move, 25, 705, 2, 1010, 1977] +[:mouse_move, 26, 705, 2, 1011, 1979] +[:mouse_move, 27, 705, 2, 1012, 1980] +[:mouse_move, 29, 705, 2, 1013, 1981] +[:mouse_move, 31, 705, 2, 1014, 1983] +[:mouse_move, 32, 705, 2, 1015, 1984] +[:mouse_move, 33, 705, 2, 1016, 1985] +[:mouse_move, 35, 704, 2, 1017, 1987] +[:mouse_move, 36, 704, 2, 1018, 1989] +[:mouse_move, 37, 704, 2, 1019, 1990] +[:mouse_move, 38, 704, 2, 1020, 1991] +[:mouse_move, 39, 704, 2, 1021, 1992] +[:mouse_move, 40, 704, 2, 1022, 1993] +[:mouse_move, 41, 704, 2, 1023, 1994] +[:mouse_move, 42, 704, 2, 1024, 1995] +[:mouse_move, 43, 704, 2, 1025, 1996] +[:mouse_move, 44, 704, 2, 1026, 1997] +[:mouse_move, 45, 704, 2, 1027, 1999] +[:mouse_move, 46, 704, 2, 1028, 2000] +[:mouse_move, 47, 704, 2, 1029, 2002] +[:mouse_move, 48, 704, 2, 1030, 2003] +[:mouse_move, 49, 704, 2, 1031, 2004] +[:mouse_move, 50, 703, 2, 1032, 2006] +[:mouse_move, 51, 703, 2, 1033, 2009] +[:mouse_move, 52, 703, 2, 1034, 2012] +[:mouse_move, 54, 700, 2, 1035, 2041] +[:mouse_move, 62, 691, 2, 1036, 2042] +[:mouse_move, 72, 678, 2, 1037, 2043] +[:mouse_move, 101, 641, 2, 1038, 2044] +[:mouse_move, 136, 589, 2, 1039, 2045] +[:mouse_move, 224, 445, 2, 1040, 2046] +[:mouse_move, 275, 356, 2, 1041, 2047] +[:mouse_move, 351, 237, 2, 1042, 2048] +[:mouse_move, 372, 211, 2, 1043, 2049] +[:mouse_move, 418, 157, 2, 1044, 2050] +[:mouse_move, 426, 150, 2, 1045, 2051] +[:mouse_move, 444, 133, 2, 1046, 2052] +[:mouse_move, 452, 126, 2, 1047, 2053] +[:mouse_move, 459, 120, 2, 1048, 2054] +[:mouse_move, 461, 119, 2, 1049, 2055] +[:mouse_move, 464, 118, 2, 1050, 2056] +[:mouse_move, 465, 118, 2, 1051, 2057] +[:mouse_move, 468, 117, 2, 1052, 2058] +[:mouse_move, 470, 116, 2, 1053, 2059] +[:mouse_move, 472, 115, 2, 1054, 2060] +[:mouse_move, 473, 115, 2, 1055, 2061] +[:mouse_move, 475, 114, 2, 1056, 2062] +[:mouse_move, 476, 114, 2, 1057, 2063] +[:mouse_move, 479, 111, 2, 1058, 2064] +[:mouse_move, 481, 110, 2, 1059, 2065] +[:mouse_move, 487, 101, 2, 1060, 2066] +[:mouse_move, 488, 97, 2, 1061, 2067] +[:mouse_move, 495, 87, 2, 1062, 2068] +[:mouse_move, 496, 85, 2, 1063, 2069] +[:mouse_move, 497, 80, 2, 1064, 2070] +[:mouse_move, 501, 70, 2, 1065, 2071] +[:mouse_move, 501, 68, 2, 1066, 2072] +[:mouse_move, 502, 63, 2, 1067, 2073] +[:mouse_move, 502, 61, 2, 1068, 2074] +[:mouse_move, 502, 58, 2, 1069, 2075] +[:mouse_move, 502, 57, 2, 1070, 2076] +[:mouse_move, 502, 55, 2, 1071, 2077] +[:mouse_move, 501, 55, 2, 1072, 2078] +[:mouse_move, 501, 53, 2, 1073, 2079] +[:mouse_move, 501, 52, 2, 1074, 2081] +[:mouse_move, 501, 51, 2, 1075, 2082] +[:mouse_move, 501, 50, 2, 1076, 2083] +[:mouse_move, 502, 49, 2, 1077, 2084] +[:mouse_move, 503, 47, 2, 1078, 2085] +[:mouse_move, 505, 46, 2, 1079, 2086] +[:mouse_move, 509, 43, 2, 1080, 2087] +[:mouse_move, 512, 42, 2, 1081, 2088] +[:mouse_move, 519, 40, 2, 1082, 2089] +[:mouse_move, 528, 39, 2, 1083, 2090] +[:mouse_move, 545, 38, 2, 1084, 2091] +[:mouse_move, 555, 38, 2, 1085, 2092] +[:mouse_move, 571, 37, 2, 1086, 2093] +[:mouse_move, 582, 37, 2, 1087, 2094] +[:mouse_move, 603, 35, 2, 1088, 2095] +[:mouse_move, 612, 34, 2, 1089, 2096] +[:mouse_move, 621, 33, 2, 1090, 2097] +[:mouse_move, 636, 33, 2, 1091, 2098] +[:mouse_move, 644, 32, 2, 1092, 2099] +[:mouse_move, 659, 32, 2, 1093, 2100] +[:mouse_move, 665, 32, 2, 1094, 2101] +[:mouse_move, 679, 32, 2, 1095, 2102] +[:mouse_move, 686, 33, 2, 1096, 2103] +[:mouse_move, 696, 34, 2, 1097, 2104] +[:mouse_move, 701, 34, 2, 1098, 2105] +[:mouse_move, 710, 34, 2, 1099, 2106] +[:mouse_move, 714, 34, 2, 1100, 2107] +[:mouse_move, 722, 35, 2, 1101, 2108] +[:mouse_move, 726, 35, 2, 1102, 2109] +[:mouse_move, 735, 36, 2, 1103, 2110] +[:mouse_move, 740, 36, 2, 1104, 2111] +[:mouse_move, 749, 36, 2, 1105, 2112] +[:mouse_move, 753, 36, 2, 1106, 2113] +[:mouse_move, 762, 36, 2, 1107, 2114] +[:mouse_move, 767, 36, 2, 1108, 2115] +[:mouse_move, 775, 36, 2, 1109, 2116] +[:mouse_move, 777, 36, 2, 1110, 2117] +[:mouse_move, 784, 36, 2, 1111, 2118] +[:mouse_move, 787, 36, 2, 1112, 2119] +[:mouse_move, 789, 35, 2, 1113, 2120] +[:mouse_move, 790, 35, 2, 1114, 2121] +[:mouse_move, 791, 35, 2, 1115, 2122] +[:mouse_move, 787, 36, 2, 1116, 2165] +[:mouse_move, 776, 43, 2, 1117, 2166] +[:mouse_move, 771, 47, 2, 1118, 2167] +[:mouse_move, 759, 55, 2, 1119, 2168] +[:mouse_move, 746, 63, 2, 1120, 2169] +[:mouse_move, 719, 79, 2, 1121, 2170] +[:mouse_move, 706, 85, 2, 1122, 2171] +[:mouse_move, 675, 98, 2, 1123, 2172] +[:mouse_move, 669, 100, 2, 1124, 2173] +[:mouse_move, 650, 105, 2, 1125, 2174] +[:mouse_move, 647, 105, 2, 1126, 2175] +[:mouse_move, 637, 107, 2, 1127, 2176] +[:mouse_move, 633, 108, 2, 1128, 2177] +[:mouse_move, 630, 108, 2, 1129, 2178] +[:mouse_move, 626, 108, 2, 1130, 2179] +[:mouse_move, 625, 108, 2, 1131, 2180] +[:mouse_move, 624, 108, 2, 1132, 2181] +[:mouse_move, 623, 108, 2, 1133, 2183] +[:mouse_button_pressed, 1, 0, 1, 1134, 2222] +[:mouse_button_up, 1, 0, 1, 1135, 2228] +[:mouse_move, 614, 115, 2, 1136, 2245] +[:mouse_move, 608, 120, 2, 1137, 2246] +[:mouse_move, 588, 140, 2, 1138, 2247] +[:mouse_move, 571, 158, 2, 1139, 2248] +[:mouse_move, 514, 226, 2, 1140, 2249] +[:mouse_move, 487, 263, 2, 1141, 2250] +[:mouse_move, 427, 346, 2, 1142, 2251] +[:mouse_move, 393, 389, 2, 1143, 2252] +[:mouse_move, 349, 437, 2, 1144, 2253] +[:mouse_move, 337, 448, 2, 1145, 2254] +[:mouse_move, 309, 472, 2, 1146, 2255] +[:mouse_move, 305, 475, 2, 1147, 2256] +[:mouse_move, 302, 476, 2, 1148, 2267] +[:mouse_move, 289, 483, 2, 1149, 2268] +[:mouse_move, 280, 489, 2, 1150, 2269] +[:mouse_move, 247, 512, 2, 1151, 2270] +[:mouse_move, 223, 529, 2, 1152, 2271] +[:mouse_move, 171, 573, 2, 1153, 2272] +[:mouse_move, 160, 583, 2, 1154, 2273] +[:mouse_move, 116, 616, 2, 1155, 2274] +[:mouse_move, 109, 621, 2, 1156, 2275] +[:mouse_move, 85, 637, 2, 1157, 2276] +[:mouse_move, 75, 643, 2, 1158, 2277] +[:mouse_move, 62, 651, 2, 1159, 2278] +[:mouse_move, 58, 654, 2, 1160, 2279] +[:mouse_move, 50, 659, 2, 1161, 2280] +[:mouse_move, 46, 662, 2, 1162, 2281] +[:mouse_move, 37, 667, 2, 1163, 2282] +[:mouse_move, 36, 668, 2, 1164, 2283] +[:mouse_move, 26, 673, 2, 1165, 2284] +[:mouse_move, 23, 675, 2, 1166, 2285] +[:mouse_move, 16, 678, 2, 1167, 2286] +[:mouse_move, 13, 681, 2, 1168, 2287] +[:mouse_move, 7, 686, 2, 1169, 2288] +[:mouse_move, 7, 687, 2, 1170, 2289] +[:mouse_move, 5, 689, 2, 1171, 2290] +[:mouse_move, 3, 694, 2, 1172, 2291] +[:mouse_move, 2, 696, 2, 1173, 2292] +[:mouse_move, 2, 698, 2, 1174, 2293] +[:mouse_move, 1, 699, 2, 1175, 2294] +[:mouse_move, 1, 701, 2, 1176, 2295] +[:mouse_move, 1, 702, 2, 1177, 2297] +[:mouse_move, 2, 703, 2, 1178, 2301] +[:mouse_move, 3, 703, 2, 1179, 2304] +[:mouse_move, 4, 702, 2, 1180, 2305] +[:mouse_move, 6, 700, 2, 1181, 2306] +[:mouse_move, 13, 694, 2, 1182, 2307] +[:mouse_move, 18, 691, 2, 1183, 2308] +[:mouse_move, 30, 682, 2, 1184, 2309] +[:mouse_move, 63, 661, 2, 1185, 2310] +[:mouse_move, 133, 611, 2, 1186, 2311] +[:mouse_move, 171, 579, 2, 1187, 2312] +[:mouse_move, 261, 490, 2, 1188, 2313] +[:mouse_move, 311, 440, 2, 1189, 2314] +[:mouse_move, 364, 387, 2, 1190, 2315] +[:mouse_move, 467, 291, 2, 1191, 2316] +[:mouse_move, 486, 276, 2, 1192, 2317] +[:mouse_move, 513, 255, 2, 1193, 2318] +[:mouse_move, 537, 236, 2, 1194, 2319] +[:mouse_move, 558, 218, 2, 1195, 2320] +[:mouse_move, 566, 212, 2, 1196, 2321] +[:mouse_move, 573, 205, 2, 1197, 2322] +[:mouse_move, 575, 204, 2, 1198, 2323] +[:mouse_move, 576, 203, 2, 1199, 2324] +[:mouse_move, 576, 202, 2, 1200, 2328] +[:mouse_move, 576, 201, 2, 1201, 2329] +[:mouse_move, 577, 198, 2, 1202, 2330] +[:mouse_move, 578, 194, 2, 1203, 2331] +[:mouse_move, 580, 185, 2, 1204, 2332] +[:mouse_move, 581, 181, 2, 1205, 2333] +[:mouse_move, 583, 174, 2, 1206, 2334] +[:mouse_move, 584, 171, 2, 1207, 2335] +[:mouse_move, 585, 166, 2, 1208, 2336] +[:mouse_move, 585, 164, 2, 1209, 2337] +[:mouse_move, 586, 162, 2, 1210, 2338] +[:mouse_move, 586, 161, 2, 1211, 2339] +[:mouse_move, 586, 160, 2, 1212, 2341] +[:mouse_button_pressed, 1, 0, 1, 1213, 2346] +[:mouse_button_up, 1, 0, 1, 1214, 2352] +[:mouse_move, 584, 162, 2, 1215, 2371] +[:mouse_move, 578, 171, 2, 1216, 2372] +[:mouse_move, 569, 185, 2, 1217, 2373] +[:mouse_move, 533, 235, 2, 1218, 2374] +[:mouse_move, 510, 265, 2, 1219, 2375] +[:mouse_move, 441, 337, 2, 1220, 2376] +[:mouse_move, 397, 381, 2, 1221, 2377] +[:mouse_move, 299, 465, 2, 1222, 2378] +[:mouse_move, 254, 505, 2, 1223, 2379] +[:mouse_move, 195, 555, 2, 1224, 2380] +[:mouse_move, 183, 564, 2, 1225, 2381] +[:mouse_move, 155, 587, 2, 1226, 2382] +[:mouse_move, 140, 598, 2, 1227, 2383] +[:mouse_move, 121, 610, 2, 1228, 2384] +[:mouse_move, 120, 611, 2, 1229, 2385] +[:mouse_move, 113, 615, 2, 1230, 2386] +[:mouse_move, 104, 624, 2, 1231, 2399] +[:mouse_move, 97, 630, 2, 1232, 2400] +[:mouse_move, 81, 643, 2, 1233, 2401] +[:mouse_move, 73, 649, 2, 1234, 2402] +[:mouse_move, 59, 662, 2, 1235, 2403] +[:mouse_move, 49, 669, 2, 1236, 2404] +[:mouse_move, 40, 677, 2, 1237, 2405] +[:mouse_move, 34, 681, 2, 1238, 2406] +[:mouse_move, 28, 686, 2, 1239, 2407] +[:mouse_move, 26, 687, 2, 1240, 2408] +[:mouse_move, 24, 689, 2, 1241, 2409] +[:mouse_move, 23, 689, 2, 1242, 2410] +[:mouse_move, 22, 689, 2, 1243, 2411] +[:mouse_move, 22, 690, 2, 1244, 2415] +[:mouse_move, 21, 690, 2, 1245, 2418] +[:mouse_move, 19, 693, 2, 1246, 2419] +[:mouse_move, 18, 694, 2, 1247, 2420] +[:mouse_move, 15, 697, 2, 1248, 2421] +[:mouse_move, 13, 699, 2, 1249, 2422] +[:mouse_move, 10, 701, 2, 1250, 2423] +[:mouse_move, 9, 702, 2, 1251, 2424] +[:mouse_move, 8, 703, 2, 1252, 2425] +[:mouse_move, 7, 704, 2, 1253, 2426] +[:mouse_move, 6, 704, 2, 1254, 2428] +[:mouse_move, 7, 705, 2, 1255, 2432] +[:mouse_move, 8, 705, 2, 1256, 2435] +[:mouse_move, 12, 705, 2, 1257, 2436] +[:mouse_move, 14, 705, 2, 1258, 2437] +[:mouse_move, 21, 705, 2, 1259, 2438] +[:mouse_move, 26, 705, 2, 1260, 2439] +[:mouse_move, 31, 704, 2, 1261, 2440] +[:mouse_move, 35, 703, 2, 1262, 2441] +[:mouse_move, 43, 702, 2, 1263, 2442] +[:mouse_move, 45, 702, 2, 1264, 2443] +[:mouse_move, 50, 701, 2, 1265, 2444] +[:mouse_move, 51, 700, 2, 1266, 2445] +[:mouse_move, 54, 700, 2, 1267, 2446] +[:mouse_move, 55, 700, 2, 1268, 2448] +[:mouse_move, 56, 700, 2, 1269, 2453] +[:mouse_move, 63, 698, 2, 1270, 2461] +[:mouse_move, 75, 693, 2, 1271, 2462] +[:mouse_move, 124, 667, 2, 1272, 2463] +[:mouse_move, 159, 645, 2, 1273, 2464] +[:mouse_move, 308, 537, 2, 1274, 2465] +[:mouse_move, 379, 478, 2, 1275, 2466] +[:mouse_move, 482, 386, 2, 1276, 2467] +[:mouse_move, 507, 363, 2, 1277, 2468] +[:mouse_move, 571, 310, 2, 1278, 2469] +[:mouse_move, 582, 302, 2, 1279, 2470] +[:mouse_move, 604, 284, 2, 1280, 2471] +[:mouse_move, 614, 276, 2, 1281, 2472] +[:mouse_move, 621, 269, 2, 1282, 2473] +[:mouse_move, 623, 267, 2, 1283, 2474] +[:mouse_move, 624, 266, 2, 1284, 2475] +[:mouse_move, 624, 265, 2, 1285, 2476] +[:mouse_move, 624, 264, 2, 1286, 2477] +[:mouse_move, 624, 263, 2, 1287, 2479] +[:mouse_move, 624, 262, 2, 1288, 2481] +[:mouse_move, 624, 261, 2, 1289, 2482] +[:mouse_move, 624, 260, 2, 1290, 2483] +[:mouse_move, 624, 256, 2, 1291, 2484] +[:mouse_move, 624, 253, 2, 1292, 2485] +[:mouse_move, 624, 246, 2, 1293, 2486] +[:mouse_move, 625, 244, 2, 1294, 2487] +[:mouse_move, 625, 239, 2, 1295, 2488] +[:mouse_move, 626, 236, 2, 1296, 2489] +[:mouse_move, 626, 232, 2, 1297, 2490] +[:mouse_move, 626, 231, 2, 1298, 2491] +[:mouse_move, 626, 228, 2, 1299, 2492] +[:mouse_move, 626, 227, 2, 1300, 2493] +[:mouse_move, 626, 226, 2, 1301, 2495] +[:mouse_move, 626, 225, 2, 1302, 2496] +[:mouse_move, 626, 224, 2, 1303, 2505] +[:mouse_button_pressed, 1, 0, 1, 1304, 2509] +[:mouse_button_up, 1, 0, 1, 1305, 2515] +[:mouse_move, 624, 224, 2, 1306, 2521] +[:mouse_move, 621, 227, 2, 1307, 2522] +[:mouse_move, 602, 243, 2, 1308, 2523] +[:mouse_move, 575, 266, 2, 1309, 2524] +[:mouse_move, 519, 327, 2, 1310, 2525] +[:mouse_move, 484, 365, 2, 1311, 2526] +[:mouse_move, 434, 415, 2, 1312, 2527] +[:mouse_move, 402, 444, 2, 1313, 2528] +[:mouse_move, 348, 490, 2, 1314, 2529] +[:mouse_move, 323, 511, 2, 1315, 2530] +[:mouse_move, 296, 535, 2, 1316, 2531] +[:mouse_move, 280, 552, 2, 1317, 2532] +[:mouse_move, 266, 566, 2, 1318, 2533] +[:mouse_move, 242, 590, 2, 1319, 2534] +[:mouse_move, 237, 594, 2, 1320, 2535] +[:mouse_move, 219, 610, 2, 1321, 2536] +[:mouse_move, 210, 616, 2, 1322, 2537] +[:mouse_move, 196, 627, 2, 1323, 2538] +[:mouse_move, 183, 634, 2, 1324, 2539] +[:mouse_move, 166, 639, 2, 1325, 2540] +[:mouse_move, 162, 640, 2, 1326, 2541] +[:mouse_move, 142, 646, 2, 1327, 2542] +[:mouse_move, 134, 649, 2, 1328, 2543] +[:mouse_move, 124, 653, 2, 1329, 2544] +[:mouse_move, 120, 654, 2, 1330, 2545] +[:mouse_move, 115, 656, 2, 1331, 2546] +[:mouse_move, 114, 656, 2, 1332, 2547] +[:mouse_move, 118, 655, 2, 1333, 2548] +[:mouse_move, 123, 652, 2, 1334, 2549] +[:mouse_move, 132, 648, 2, 1335, 2550] +[:mouse_move, 134, 646, 2, 1336, 2551] +[:mouse_move, 141, 644, 2, 1337, 2552] +[:mouse_move, 143, 643, 2, 1338, 2553] +[:mouse_move, 145, 642, 2, 1339, 2554] +[:mouse_move, 146, 641, 2, 1340, 2555] +[:mouse_move, 149, 639, 2, 1341, 2556] +[:mouse_move, 152, 635, 2, 1342, 2557] +[:mouse_move, 169, 614, 2, 1343, 2558] +[:mouse_move, 194, 585, 2, 1344, 2559] +[:mouse_move, 220, 559, 2, 1345, 2560] +[:mouse_move, 298, 486, 2, 1346, 2561] +[:mouse_move, 349, 442, 2, 1347, 2562] +[:mouse_move, 458, 347, 2, 1348, 2563] +[:mouse_move, 480, 326, 2, 1349, 2564] +[:mouse_move, 533, 277, 2, 1350, 2565] +[:mouse_move, 558, 253, 2, 1351, 2566] +[:mouse_move, 579, 232, 2, 1352, 2567] +[:mouse_move, 582, 229, 2, 1353, 2568] +[:mouse_move, 595, 215, 2, 1354, 2569] +[:mouse_move, 598, 211, 2, 1355, 2570] +[:mouse_move, 602, 206, 2, 1356, 2571] +[:mouse_move, 603, 204, 2, 1357, 2572] +[:mouse_move, 606, 199, 2, 1358, 2573] +[:mouse_move, 607, 196, 2, 1359, 2574] +[:mouse_move, 611, 191, 2, 1360, 2575] +[:mouse_move, 612, 190, 2, 1361, 2576] +[:mouse_move, 615, 185, 2, 1362, 2577] +[:mouse_move, 616, 184, 2, 1363, 2578] +[:mouse_move, 618, 182, 2, 1364, 2579] +[:mouse_move, 618, 181, 2, 1365, 2580] +[:mouse_move, 619, 180, 2, 1366, 2581] +[:mouse_move, 619, 183, 2, 1367, 2592] +[:mouse_move, 620, 184, 2, 1368, 2593] +[:mouse_move, 620, 187, 2, 1369, 2594] +[:mouse_move, 621, 189, 2, 1370, 2596] +[:mouse_move, 621, 190, 2, 1371, 2597] +[:mouse_move, 621, 191, 2, 1372, 2598] +[:mouse_move, 621, 192, 2, 1373, 2600] +[:mouse_move, 622, 192, 2, 1374, 2601] +[:mouse_move, 622, 193, 2, 1375, 2602] +[:mouse_move, 622, 194, 2, 1376, 2604] +[:mouse_move, 622, 195, 2, 1377, 2611] +[:mouse_move, 614, 203, 2, 1378, 2613] +[:mouse_move, 603, 212, 2, 1379, 2614] +[:mouse_move, 571, 240, 2, 1380, 2615] +[:mouse_move, 548, 261, 2, 1381, 2616] +[:mouse_move, 464, 335, 2, 1382, 2617] +[:mouse_move, 422, 371, 2, 1383, 2618] +[:mouse_move, 320, 457, 2, 1384, 2619] +[:mouse_move, 269, 501, 2, 1385, 2620] +[:mouse_move, 175, 591, 2, 1386, 2621] +[:mouse_move, 158, 608, 2, 1387, 2622] +[:mouse_move, 121, 644, 2, 1388, 2623] +[:mouse_move, 113, 651, 2, 1389, 2624] +[:mouse_move, 95, 669, 2, 1390, 2625] +[:mouse_move, 87, 677, 2, 1391, 2626] +[:mouse_move, 79, 685, 2, 1392, 2627] +[:mouse_move, 76, 687, 2, 1393, 2628] +[:mouse_move, 74, 689, 2, 1394, 2629] +[:mouse_move, 73, 690, 2, 1395, 2630] +[:mouse_move, 71, 691, 2, 1396, 2631] +[:mouse_move, 70, 692, 2, 1397, 2632] +[:mouse_move, 66, 695, 2, 1398, 2633] +[:mouse_move, 64, 696, 2, 1399, 2634] +[:mouse_move, 60, 699, 2, 1400, 2635] +[:mouse_move, 56, 702, 2, 1401, 2636] +[:mouse_move, 51, 706, 2, 1402, 2637] +[:mouse_move, 48, 709, 2, 1403, 2638] +[:mouse_move, 45, 712, 2, 1404, 2639] +[:mouse_move, 43, 713, 2, 1405, 2640] +[:mouse_move, 41, 715, 2, 1406, 2641] +[:mouse_move, 37, 716, 2, 1407, 2642] +[:mouse_move, 35, 717, 2, 1408, 2643] +[:mouse_move, 31, 717, 2, 1409, 2644] +[:mouse_move, 30, 717, 2, 1410, 2645] +[:mouse_move, 25, 716, 2, 1411, 2646] +[:mouse_move, 24, 716, 2, 1412, 2647] +[:mouse_move, 21, 715, 2, 1413, 2648] +[:mouse_move, 20, 715, 2, 1414, 2649] +[:mouse_move, 19, 715, 2, 1415, 2650] +[:mouse_move, 18, 715, 2, 1416, 2651] +[:mouse_move, 18, 714, 2, 1417, 2652] +[:mouse_move, 20, 713, 2, 1418, 2664] +[:mouse_move, 23, 712, 2, 1419, 2665] +[:mouse_move, 35, 710, 2, 1420, 2666] +[:mouse_move, 39, 709, 2, 1421, 2667] +[:mouse_move, 45, 708, 2, 1422, 2668] +[:mouse_move, 58, 704, 2, 1423, 2669] +[:mouse_move, 63, 703, 2, 1424, 2670] +[:mouse_move, 72, 702, 2, 1425, 2671] +[:mouse_move, 76, 701, 2, 1426, 2672] +[:mouse_move, 82, 701, 2, 1427, 2673] +[:mouse_move, 85, 701, 2, 1428, 2674] +[:mouse_move, 89, 701, 2, 1429, 2675] +[:mouse_move, 91, 701, 2, 1430, 2676] +[:mouse_move, 93, 701, 2, 1431, 2677] +[:mouse_move, 94, 701, 2, 1432, 2678] +[:mouse_move, 95, 701, 2, 1433, 2679] +[:mouse_move, 95, 700, 2, 1434, 2725] +[:mouse_move, 95, 699, 2, 1435, 2726] +[:mouse_move, 98, 694, 2, 1436, 2727] +[:mouse_move, 99, 691, 2, 1437, 2728] +[:mouse_move, 105, 675, 2, 1438, 2729] +[:mouse_move, 108, 666, 2, 1439, 2730] +[:mouse_move, 113, 650, 2, 1440, 2731] +[:mouse_move, 116, 642, 2, 1441, 2732] +[:mouse_move, 118, 633, 2, 1442, 2733] +[:mouse_move, 120, 628, 2, 1443, 2734] +[:mouse_move, 121, 625, 2, 1444, 2735] +[:key_down_raw, 1073742051, 1024, 2, 1445, 2866] +[:key_down_raw, 113, 1024, 2, 1446, 2866] diff --git a/samples/11_coersion_of_primitives/app/main.rb b/samples/11_coersion_of_primitives/app/main.rb new file mode 100644 index 0000000..aedd830 --- /dev/null +++ b/samples/11_coersion_of_primitives/app/main.rb @@ -0,0 +1,172 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - Nested array: An array whose individual elements are also arrays; useful for + storing groups of similar data. Also called multidimensional arrays. + + In this sample app, we see nested arrays being used in object definitions. + Notice the parameters for solids, listed below. Parameters 1-3 set the + definition for the rect, and parameter 4 sets the definition of the color. + + Instead of having a solid definition that looks like this, + [X, Y, W, H, R, G, B] + we can separate it into two separate array definitions in one, like this + [[X, Y, W, H], [R, G, B]] + and both options work fine in defining our solid (or any object). + + - Collections: Lists of data; useful for organizing large amounts of data. + One element of a collection could be an array (which itself contains many elements). + For example, a collection that stores two solid objects would look like this: + [ + [100, 100, 50, 50, 0, 0, 0], + [100, 150, 50, 50, 255, 255, 255] + ] + If this collection was added to args.outputs.solids, two solids would be output + next to each other, one black and one white. + Nested arrays can be used in collections, as you will see in this sample app. + + Reminders: + + - args.outputs.solids: An array. The values generate a solid. + The parameters for a solid are + 1. The position on the screen (x, y) + 2. The width (w) + 3. The height (h) + 4. The color (r, g, b) (if a color is not assigned, the object's default color will be black) + NOTE: THE PARAMETERS ARE THE SAME FOR BORDERS! + + Here is an example of a (red) border or solid definition: + [100, 100, 400, 500, 255, 0, 0] + It will be a solid or border depending on if it is added to args.outputs.solids or args.outputs.borders. + For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters for sprites are + 1. The position on the screen (x, y) + 2. The width (w) + 3. The height (h) + 4. The image path (p) + + Here is an example of a sprite definition: + [100, 100, 400, 500, 'sprites/dragonruby.png'] + For more information about sprites, go to mygame/documentation/05-sprites.md. + +=end + +# This code demonstrates the creation and output of objects like sprites, borders, and solids +# If filled in, they are solids +# If hollow, they are borders +# If images, they are sprites + +# Solids are added to args.outputs.solids +# Borders are added to args.outputs.borders +# Sprites are added to args.outputs.sprites + +# The tick method runs 60 frames every second. +# Your game is going to happen under this one function. +def tick args + border_as_solid_and_solid_as_border args + sprite_as_border_or_solids args + collection_of_borders_and_solids args + collection_of_sprites args +end + +# Shows a border being output onto the screen as a border and a solid +# Also shows how colors can be set +def border_as_solid_and_solid_as_border args + border = [0, 0, 50, 50] + args.outputs.borders << border + args.outputs.solids << border + + # Red, green, blue saturations (last three parameters) can be any number between 0 and 255 + border_with_color = [0, 100, 50, 50, 255, 0, 0] + args.outputs.borders << border_with_color + args.outputs.solids << border_with_color + + border_with_nested_color = [0, 200, 50, 50, [0, 255, 0]] # nested color + args.outputs.borders << border_with_nested_color + args.outputs.solids << border_with_nested_color + + border_with_nested_rect = [[0, 300, 50, 50], 0, 0, 255] # nested rect + args.outputs.borders << border_with_nested_rect + args.outputs.solids << border_with_nested_rect + + border_with_nested_color_and_rect = [[0, 400, 50, 50], [255, 0, 255]] # nested rect and color + args.outputs.borders << border_with_nested_color_and_rect + args.outputs.solids << border_with_nested_color_and_rect +end + +# Shows a sprite output onto the screen as a sprite, border, and solid +# Demonstrates that all three outputs appear differently on screen +def sprite_as_border_or_solids args + sprite = [100, 0, 50, 50, 'sprites/ship.png'] + args.outputs.sprites << sprite + + # Sprite_as_border variable has same parameters (excluding position) as above object, + # but will appear differently on screen because it is added to args.outputs.borders + sprite_as_border = [100, 100, 50, 50, 'sprites/ship.png'] + args.outputs.borders << sprite_as_border + + # Sprite_as_solid variable has same parameters (excluding position) as above object, + # but will appear differently on screen because it is added to args.outputs.solids + sprite_as_solid = [100, 200, 50, 50, 'sprites/ship.png'] + args.outputs.solids << sprite_as_solid +end + +# Holds and outputs a collection of borders and a collection of solids +# Collections are created by using arrays to hold parameters of each individual object +def collection_of_borders_and_solids args + collection_borders = [ + [ + [200, 0, 50, 50], # black border + [200, 100, 50, 50, 255, 0, 0], # red border + [200, 200, 50, 50, [0, 255, 0]], # nested color + ], + [[200, 300, 50, 50], 0, 0, 255], # nested rect + [[200, 400, 50, 50], [255, 0, 255]] # nested rect and nested color + ] + + args.outputs.borders << collection_borders + + collection_solids = [ + [ + [[300, 300, 50, 50], 0, 0, 255], # nested rect + [[300, 400, 50, 50], [255, 0, 255]] # nested rect and nested color + ], + [300, 0, 50, 50], + [300, 100, 50, 50, 255, 0, 0], + [300, 200, 50, 50, [0, 255, 0]], # nested color + ] + + args.outputs.solids << collection_solids +end + +# Holds and outputs a collection of sprites by adding it to args.outputs.sprites +# Also outputs a collection with same parameters (excluding position) by adding +# it to args.outputs.solids and another to args.outputs.borders +def collection_of_sprites args + sprites_collection = [ + [ + [400, 0, 50, 50, 'sprites/ship.png'], + [400, 100, 50, 50, 'sprites/ship.png'], + ], + [400, 200, 50, 50, 'sprites/ship.png'] + ] + + args.outputs.sprites << sprites_collection + + args.outputs.solids << [ + [500, 0, 50, 50, 'sprites/ship.png'], + [500, 100, 50, 50, 'sprites/ship.png'], + [[[500, 200, 50, 50, 'sprites/ship.png']]] + ] + + args.outputs.borders << [ + [ + [600, 0, 50, 50, 'sprites/ship.png'], + [600, 100, 50, 50, 'sprites/ship.png'], + ], + [600, 200, 50, 50, 'sprites/ship.png'] + ] +end diff --git a/samples/11_coersion_of_primitives/license-for-sample.txt b/samples/11_coersion_of_primitives/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/11_coersion_of_primitives/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/11_coersion_of_primitives/sprites/ship.png b/samples/11_coersion_of_primitives/sprites/ship.png Binary files differnew file mode 100644 index 0000000..3ef5f0b --- /dev/null +++ b/samples/11_coersion_of_primitives/sprites/ship.png diff --git a/samples/11_hash_primitives/app/main.rb b/samples/11_hash_primitives/app/main.rb new file mode 100644 index 0000000..f7e5bac --- /dev/null +++ b/samples/11_hash_primitives/app/main.rb @@ -0,0 +1,191 @@ +=begin + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + + For example, if we have a "numbers" hash that stores numbers in English as the + key and numbers in Spanish as the value, we'd have a hash that looks like this... + numbers = { "one" => "uno", "two" => "dos", "three" => "tres" } + and on it goes. + + Now if we wanted to find the corresponding value of the "one" key, we could say + puts numbers["one"] + which would print "uno" to the console. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - args.outputs.solids: An array. The values generate a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.borders: An array. The values generate a border. + The parameters are the same as a solid. + For more information about borders, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.lines: An array. The values generate a line. + The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE] + For more information about labels, go to mygame/documentation/02-labels.md. + +=end + +# This sample app demonstrates how hashes can be used to output different kinds of objects. + +def tick args + args.state.angle ||= 0 # initializes angle to 0 + args.state.angle += 1 # increments angle by 1 every frame (60 times a second) + + # Outputs sprite using a hash + args.outputs.sprites << { + x: 30, # sprite position + y: 550, + w: 128, # sprite size + h: 101, + path: "dragonruby.png", # image path + angle: args.state.angle, # angle + a: 255, # alpha (transparency) + r: 255, # color saturation + g: 255, + b: 255, + tile_x: 0, # sprite sub division/tile + tile_y: 0, + tile_w: -1, + tile_h: -1, + flip_vertically: false, # don't flip sprite + flip_horizontally: false, + angle_anchor_x: 0.5, # rotation center set to middle + angle_anchor_y: 0.5 + } + + # Outputs label using a hash + args.outputs.labels << { + x: 200, # label position + y: 550, + text: "dragonruby", # label text + size_enum: 2, + alignment_enum: 1, + r: 155, # color saturation + g: 50, + b: 50, + a: 255, # transparency + font: "fonts/manaspc.ttf" # font style; without mentioned file, label won't output correctly + } + + # Outputs solid using a hash + # [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE, ALPHA] + args.outputs.solids << { + x: 400, # position + y: 550, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + } + + # Outputs border using a hash + # Same parameters as a solid + args.outputs.borders << { + x: 600, + y: 550, + w: 160, + h: 90, + r: 120, + g: 50, + b: 50, + a: 255 + } + + # Outputs line using a hash + args.outputs.lines << { + x: 900, # starting position + y: 550, + x2: 1200, # ending position + y2: 550, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + } + + # Outputs sprite as a primitive using a hash + args.outputs.primitives << { + x: 30, # position + y: 200, + w: 128, # size + h: 101, + path: "dragonruby.png", # image path + angle: args.state.angle, # angle + a: 255, # transparency + r: 255, # color saturation + g: 255, + b: 255, + tile_x: 0, # sprite sub division/tile + tile_y: 0, + tile_w: -1, + tile_h: -1, + flip_vertically: false, # don't flip + flip_horizontally: false, + angle_anchor_x: 0.5, # rotation center set to middle + angle_anchor_y: 0.5 + }.sprite + + # Outputs label as primitive using a hash + args.outputs.primitives << { + x: 200, # position + y: 200, + text: "dragonruby", # text + size: 2, + alignment: 1, + r: 155, # color saturation + g: 50, + b: 50, + a: 255, # transparency + font: "fonts/manaspc.ttf" # font style + }.label + + # Outputs solid as primitive using a hash + args.outputs.primitives << { + x: 400, # position + y: 200, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.solid + + # Outputs border as primitive using a hash + # Same parameters as solid + args.outputs.primitives << { + x: 600, # position + y: 200, + w: 160, # size + h: 90, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.border + + # Outputs line as primitive using a hash + args.outputs.primitives << { + x: 900, # starting position + y: 200, + x2: 1200, # ending position + y2: 200, + r: 120, # color saturation + g: 50, + b: 50, + a: 255 # transparency + }.line +end diff --git a/samples/11_hash_primitives/fonts/manaspc.ttf b/samples/11_hash_primitives/fonts/manaspc.ttf Binary files differnew file mode 100644 index 0000000..0c56733 --- /dev/null +++ b/samples/11_hash_primitives/fonts/manaspc.ttf diff --git a/samples/11_hash_primitives/license-for-sample.txt b/samples/11_hash_primitives/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/11_hash_primitives/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/12_controller_input_sprite_sheet_animations/app/main.rb b/samples/12_controller_input_sprite_sheet_animations/app/main.rb new file mode 100644 index 0000000..63608a4 --- /dev/null +++ b/samples/12_controller_input_sprite_sheet_animations/app/main.rb @@ -0,0 +1,183 @@ +class Game + attr_gtk + + def defaults + state.show_debug_layer = true if state.tick_count == 0 + player.tile_size = 64 + player.speed = 3 + player.slash_frames = 15 + player.x ||= 50 + player.y ||= 400 + player.dir_x ||= 1 + player.dir_y ||= -1 + player.is_moving ||= false + state.watch_list ||= {} + state.enemies ||= [] + end + + def add_enemy + state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 } + end + + def sprite_horizontal_run + tile_index = 0.frame_index(6, 3, true) + tile_index = 0 if !player.is_moving + + { + x: player.x, + y: player.y, + w: player.tile_size, + h: player.tile_size, + path: 'sprites/horizontal-run.png', + tile_x: 0 + (tile_index * player.tile_size), + tile_y: 0, + tile_w: player.tile_size, + tile_h: player.tile_size, + flip_horizontally: player.dir_x > 0, + # a: 40 + } + end + + def sprite_horizontal_stand + { + x: player.x, + y: player.y, + w: player.tile_size, + h: player.tile_size, + path: 'sprites/horizontal-stand.png', + flip_horizontally: player.dir_x > 0, + # a: 40 + } + end + + def sprite_horizontal_slash + tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0 + + { + x: player.x - 41.25, + y: player.y - 41.25, + w: 165, + h: 165, + path: 'sprites/horizontal-slash.png', + tile_x: 0 + (tile_index * 128), + tile_y: 0, + tile_w: 128, + tile_h: 128, + flip_horizontally: player.dir_x > 0 + } + end + + def render_player + if player.slash_at + outputs.sprites << sprite_horizontal_slash + elsif player.is_moving + outputs.sprites << sprite_horizontal_run + else + outputs.sprites << sprite_horizontal_stand + end + end + + def render_enemies + outputs.borders << state.enemies + end + + def render_debug_layer + return if !state.show_debug_layer + outputs.labels << state.watch_list.map.with_index do |(k, v), i| + [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"] + end + + outputs.borders << player.slash_collision_rect + end + + def slash_initiate? + # buffalo usb controller has a button and b button swapped lol + inputs.controller_one.key_down.a || inputs.keyboard.key_down.j + end + + def input + # player movement + if slash_complete? && (vector = inputs.directional_vector) + player.x += vector.x * player.speed + player.y += vector.y * player.speed + end + player.slash_at = slash_initiate? if slash_initiate? + end + + def calc_movement + # movement + if vector = inputs.directional_vector + state.debug_label = vector + player.dir_x = vector.x + player.dir_y = vector.y + player.is_moving = true + else + state.debug_label = vector + player.is_moving = false + end + end + + def calc_slash + # re-calc the location of the swords collision box + if player.dir_x.positive? + player.slash_collision_rect = [player.x + player.tile_size, + player.y + player.tile_size.half - 10, + 40, 20] + else + player.slash_collision_rect = [player.x - 32 - 8, + player.y + player.tile_size.half - 10, + 40, 20] + end + + # recalc sword's slash state + player.slash_at = nil if slash_complete? + + # determine collision if the sword is at it's point of damaging + return unless slash_can_damage? + + state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect } + end + + def slash_complete? + !player.slash_at || player.slash_at.elapsed?(player.slash_frames) + end + + def slash_can_damage? + # damage occurs half way into the slash animation + return false if slash_complete? + return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count + return true + end + + def calc + # generate an enemy if there aren't any on the screen + add_enemy if state.enemies.length == 0 + calc_movement + calc_slash + end + + # source is at http://github.com/amirrajan/dragonruby-link-to-the-past + def tick + defaults + render_enemies + render_player + outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."] + outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."] + render_debug_layer + input + calc + end + + def player + state.player + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.tick +end + +$gtk.reset diff --git a/samples/12_controller_input_sprite_sheet_animations/license-for-sample.txt b/samples/12_controller_input_sprite_sheet_animations/license-for-sample.txt new file mode 100644 index 0000000..48fe983 --- /dev/null +++ b/samples/12_controller_input_sprite_sheet_animations/license-for-sample.txt @@ -0,0 +1,86 @@ +====================================== +====== LICENSE FOR CODE ============== +====================================== + +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +========================================= +====== LICENSE FOR SPRITES ============== +========================================= + +Creative Commons + +Attribution-NonCommercial 3.0 Unported + +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. +License +THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. + +BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. + +1. Definitions + +"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. +"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License. +"Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership. +"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. +"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. +"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. +"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. +"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. +"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. +2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. + +3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: + +to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; +to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified."; +to Distribute and Publicly Perform the Work including as incorporated in Collections; and, +to Distribute and Publicly Perform Adaptations. +The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d). + +4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: + +You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(c), as requested. +You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works. +If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and, (iv) consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. +For the avoidance of doubt: + +Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; +Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and, +Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(c). +Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise. +5. Representations, Warranties and Disclaimer + +UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. + +6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. Termination + +This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. +Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. +8. Miscellaneous + +Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. +Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License. +If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. +No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. +This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. +The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. +Creative Commons Notice +Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor. + +Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of the License. + +Creative Commons may be contacted at https://creativecommons.org/. + +« Back to Commons Deed diff --git a/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-run.png b/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-run.png Binary files differnew file mode 100644 index 0000000..aabb47a --- /dev/null +++ b/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-run.png diff --git a/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-slash.png b/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-slash.png Binary files differnew file mode 100644 index 0000000..3b0dc87 --- /dev/null +++ b/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-slash.png diff --git a/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-stand.png b/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-stand.png Binary files differnew file mode 100644 index 0000000..77eb7ec --- /dev/null +++ b/samples/12_controller_input_sprite_sheet_animations/sprites/horizontal-stand.png diff --git a/samples/12_top_down_area/app/main.rb b/samples/12_top_down_area/app/main.rb new file mode 100644 index 0000000..c447940 --- /dev/null +++ b/samples/12_top_down_area/app/main.rb @@ -0,0 +1,108 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - reverse: Returns a new string with the characters from original string in reverse order. + For example, the command + "dragonruby".reverse + would return the string + "yburnogard". + Reverse is not only limited to strings, but can be applied to arrays and other collections. + + Reminders: + + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + +=end + +# This code shows a maze and uses input from the keyboard to move the user around the screen. +# The objective is to reach the goal. + +# Sets values of tile size and player's movement speed +# Also creates tile or box for player and generates map +def tick args + args.state.tile_size = 80 + args.state.player_speed = 4 + args.state.player ||= tile(args, 7, 3, 0, 128, 180) + generate_map args + + # Adds walls, goal, and player to args.outputs.solids so they appear on screen + args.outputs.solids << args.state.walls + args.outputs.solids << args.state.goal + args.outputs.solids << args.state.player + + # If player's box intersects with goal, a label is output onto the screen + if args.state.player.intersect_rect? args.state.goal + args.outputs.labels << [30, 720 - 30, "You're a wizard Harry!!"] # 30 pixels lower than top of screen + end + + move_player args, -1, 0 if args.inputs.keyboard.left # x position decreases by 1 if left key is pressed + move_player args, 1, 0 if args.inputs.keyboard.right # x position increases by 1 if right key is pressed + move_player args, 0, 1 if args.inputs.keyboard.up # y position increases by 1 if up is pressed + move_player args, 0, -1 if args.inputs.keyboard.down # y position decreases by 1 if down is pressed +end + +# Sets position, size, and color of the tile +def tile args, x, y, *color + [x * args.state.tile_size, # sets definition for array using method parameters + y * args.state.tile_size, # multiplying by tile_size sets x and y to correct position using pixel values + args.state.tile_size, + args.state.tile_size, + *color] +end + +# Creates map by adding tiles to the wall, as well as a goal (that the player needs to reach) +def generate_map args + return if args.state.area + + # Creates the area of the map. There are 9 rows running horizontally across the screen + # and 16 columns running vertically on the screen. Any spot with a "1" is not + # open for the player to move into (and is green), and any spot with a "0" is available + # for the player to move in. + args.state.area = [ + [1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,], # the "2" represents the goal + [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], + [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], + ].reverse # reverses the order of the area collection + + # By reversing the order, the way that the area appears above is how it appears + # on the screen in the game. If we did not reverse, the map would appear inverted. + + #The wall starts off with no tiles. + args.state.walls = [] + + # If v is 1, a green tile is added to args.state.walls. + # If v is 2, a black tile is created as the goal. + args.state.area.map_2d do |y, x, v| + if v == 1 + args.state.walls << tile(args, x, y, 0, 255, 0) # green tile + elsif v == 2 # notice there is only one "2" above because there is only one single goal + args.state.goal = tile(args, x, y, 0, 0, 0) # black tile + end + end +end + +# Allows the player to move their box around the screen +def move_player args, *vector + box = args.state.player.shift_rect(vector) # box is able to move at an angle + + # If the player's box hits a wall, it is not able to move further in that direction + return if args.state.walls + .any_intersect_rect?(box) + + # Player's box is able to move at angles (not just the four general directions) fast + args.state.player = + args.state.player + .shift_rect(vector.x * args.state.player_speed, # if we don't multiply by speed, then + vector.y * args.state.player_speed) # the box will move extremely slow +end diff --git a/samples/12_top_down_area/license-for-sample.txt b/samples/12_top_down_area/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/12_top_down_area/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/12_top_down_area/replay.txt b/samples/12_top_down_area/replay.txt new file mode 100644 index 0000000..f121bc6 --- /dev/null +++ b/samples/12_top_down_area/replay.txt @@ -0,0 +1,187 @@ +replay_version 2.0 +stopped_at 880 +seed 100 +recorded_at Sun Sep 29 22:31:22 2019 +[:key_down_raw, 1073741904, 0, 2, 1, 92] +[:key_down_raw, 1073741904, 0, 2, 2, 117] +[:key_down_raw, 1073741903, 0, 2, 3, 119] +[:key_up_raw, 1073741904, 0, 2, 4, 119] +[:key_down_raw, 1073741903, 0, 2, 5, 144] +[:key_down_raw, 1073741903, 0, 2, 6, 146] +[:key_down_raw, 1073741903, 0, 2, 7, 148] +[:key_down_raw, 1073741903, 0, 2, 8, 150] +[:key_down_raw, 1073741903, 0, 2, 9, 152] +[:key_down_raw, 1073741906, 0, 2, 10, 152] +[:key_down_raw, 1073741906, 0, 2, 11, 177] +[:key_down_raw, 1073741906, 0, 2, 12, 179] +[:key_down_raw, 1073741906, 0, 2, 13, 181] +[:key_down_raw, 1073741906, 0, 2, 14, 183] +[:key_down_raw, 1073741906, 0, 2, 15, 185] +[:key_down_raw, 1073741906, 0, 2, 16, 187] +[:key_down_raw, 1073741906, 0, 2, 17, 189] +[:key_down_raw, 1073741906, 0, 2, 18, 191] +[:key_down_raw, 1073741906, 0, 2, 19, 193] +[:key_down_raw, 1073741906, 0, 2, 20, 195] +[:key_down_raw, 1073741906, 0, 2, 21, 197] +[:key_down_raw, 1073741906, 0, 2, 22, 199] +[:key_down_raw, 1073741906, 0, 2, 23, 201] +[:key_down_raw, 1073741906, 0, 2, 24, 203] +[:key_down_raw, 1073741906, 0, 2, 25, 205] +[:key_down_raw, 1073741906, 0, 2, 26, 207] +[:key_down_raw, 1073741906, 0, 2, 27, 209] +[:key_down_raw, 1073741906, 0, 2, 28, 211] +[:key_down_raw, 1073741906, 0, 2, 29, 213] +[:key_down_raw, 1073741906, 0, 2, 30, 215] +[:key_down_raw, 1073741906, 0, 2, 31, 217] +[:key_down_raw, 1073741906, 0, 2, 32, 219] +[:key_down_raw, 1073741906, 0, 2, 33, 221] +[:key_down_raw, 1073741906, 0, 2, 34, 223] +[:key_down_raw, 1073741906, 0, 2, 35, 225] +[:key_down_raw, 1073741906, 0, 2, 36, 227] +[:key_down_raw, 1073741906, 0, 2, 37, 229] +[:key_down_raw, 1073741906, 0, 2, 38, 231] +[:key_down_raw, 1073741906, 0, 2, 39, 233] +[:key_down_raw, 1073741906, 0, 2, 40, 235] +[:key_down_raw, 1073741906, 0, 2, 41, 237] +[:key_down_raw, 1073741906, 0, 2, 42, 239] +[:key_down_raw, 1073741906, 0, 2, 43, 241] +[:key_down_raw, 1073741906, 0, 2, 44, 243] +[:key_down_raw, 1073741906, 0, 2, 45, 245] +[:key_down_raw, 1073741906, 0, 2, 46, 248] +[:key_down_raw, 1073741906, 0, 2, 47, 250] +[:key_down_raw, 1073741906, 0, 2, 48, 252] +[:key_down_raw, 1073741906, 0, 2, 49, 254] +[:key_down_raw, 1073741906, 0, 2, 50, 256] +[:key_down_raw, 1073741906, 0, 2, 51, 258] +[:key_down_raw, 1073741906, 0, 2, 52, 260] +[:key_down_raw, 1073741906, 0, 2, 53, 262] +[:key_down_raw, 1073741906, 0, 2, 54, 264] +[:key_down_raw, 1073741905, 0, 2, 55, 265] +[:key_up_raw, 1073741906, 0, 2, 56, 266] +[:key_up_raw, 1073741903, 0, 2, 57, 267] +[:key_down_raw, 1073741904, 0, 2, 58, 287] +[:key_up_raw, 1073741905, 0, 2, 59, 289] +[:key_down_raw, 1073741904, 0, 2, 60, 312] +[:key_down_raw, 1073741904, 0, 2, 61, 314] +[:key_down_raw, 1073741904, 0, 2, 62, 316] +[:key_down_raw, 1073741904, 0, 2, 63, 318] +[:key_down_raw, 1073741904, 0, 2, 64, 320] +[:key_down_raw, 1073741904, 0, 2, 65, 322] +[:key_down_raw, 1073741904, 0, 2, 66, 324] +[:key_down_raw, 1073741904, 0, 2, 67, 326] +[:key_down_raw, 1073741905, 0, 2, 68, 328] +[:key_up_raw, 1073741905, 0, 2, 69, 348] +[:key_down_raw, 1073741905, 0, 2, 70, 385] +[:key_down_raw, 1073741906, 0, 2, 71, 395] +[:key_up_raw, 1073741904, 0, 2, 72, 408] +[:key_up_raw, 1073741905, 0, 2, 73, 409] +[:key_down_raw, 1073741906, 0, 2, 74, 420] +[:key_down_raw, 1073741906, 0, 2, 75, 422] +[:key_down_raw, 1073741906, 0, 2, 76, 424] +[:key_down_raw, 1073741906, 0, 2, 77, 426] +[:key_down_raw, 1073741906, 0, 2, 78, 428] +[:key_down_raw, 1073741906, 0, 2, 79, 430] +[:key_down_raw, 1073741906, 0, 2, 80, 432] +[:key_down_raw, 1073741906, 0, 2, 81, 434] +[:key_down_raw, 1073741906, 0, 2, 82, 436] +[:key_down_raw, 1073741906, 0, 2, 83, 438] +[:key_down_raw, 1073741904, 0, 2, 84, 440] +[:key_down_raw, 1073741904, 0, 2, 85, 465] +[:key_down_raw, 1073741904, 0, 2, 86, 467] +[:key_down_raw, 1073741904, 0, 2, 87, 469] +[:key_down_raw, 1073741904, 0, 2, 88, 471] +[:key_down_raw, 1073741904, 0, 2, 89, 473] +[:key_down_raw, 1073741904, 0, 2, 90, 475] +[:key_down_raw, 1073741904, 0, 2, 91, 477] +[:key_down_raw, 1073741904, 0, 2, 92, 479] +[:key_down_raw, 1073741904, 0, 2, 93, 481] +[:key_down_raw, 1073741904, 0, 2, 94, 483] +[:key_down_raw, 1073741904, 0, 2, 95, 485] +[:key_down_raw, 1073741904, 0, 2, 96, 487] +[:key_down_raw, 1073741904, 0, 2, 97, 489] +[:key_down_raw, 1073741904, 0, 2, 98, 491] +[:key_up_raw, 1073741906, 0, 2, 99, 493] +[:key_down_raw, 1073741904, 0, 2, 100, 493] +[:key_down_raw, 1073741904, 0, 2, 101, 495] +[:key_down_raw, 1073741904, 0, 2, 102, 497] +[:key_down_raw, 1073741904, 0, 2, 103, 499] +[:key_down_raw, 1073741904, 0, 2, 104, 501] +[:key_down_raw, 1073741904, 0, 2, 105, 503] +[:key_down_raw, 1073741904, 0, 2, 106, 505] +[:key_down_raw, 1073741904, 0, 2, 107, 507] +[:key_down_raw, 1073741904, 0, 2, 108, 509] +[:key_down_raw, 1073741904, 0, 2, 109, 511] +[:key_down_raw, 1073741904, 0, 2, 110, 513] +[:key_down_raw, 1073741904, 0, 2, 111, 515] +[:key_down_raw, 1073741904, 0, 2, 112, 517] +[:key_down_raw, 1073741904, 0, 2, 113, 519] +[:key_down_raw, 1073741904, 0, 2, 114, 521] +[:key_down_raw, 1073741904, 0, 2, 115, 523] +[:key_down_raw, 1073741904, 0, 2, 116, 526] +[:key_down_raw, 1073741904, 0, 2, 117, 527] +[:key_down_raw, 1073741904, 0, 2, 118, 530] +[:key_down_raw, 1073741904, 0, 2, 119, 532] +[:key_down_raw, 1073741904, 0, 2, 120, 533] +[:key_down_raw, 1073741904, 0, 2, 121, 536] +[:key_up_raw, 1073741904, 0, 2, 122, 537] +[:key_down_raw, 1073741906, 0, 2, 123, 556] +[:key_down_raw, 1073741906, 0, 2, 124, 580] +[:key_down_raw, 1073741906, 0, 2, 125, 583] +[:key_down_raw, 1073741906, 0, 2, 126, 585] +[:key_down_raw, 1073741906, 0, 2, 127, 587] +[:key_down_raw, 1073741906, 0, 2, 128, 589] +[:key_up_raw, 1073741906, 0, 2, 129, 589] +[:key_down_raw, 1073741905, 0, 2, 130, 617] +[:key_down_raw, 1073741905, 0, 2, 131, 642] +[:key_down_raw, 1073741905, 0, 2, 132, 644] +[:key_down_raw, 1073741905, 0, 2, 133, 646] +[:key_down_raw, 1073741905, 0, 2, 134, 648] +[:key_down_raw, 1073741905, 0, 2, 135, 650] +[:key_down_raw, 1073741905, 0, 2, 136, 652] +[:key_down_raw, 1073741905, 0, 2, 137, 654] +[:key_up_raw, 1073741905, 0, 2, 138, 654] +[:key_down_raw, 1073741906, 0, 2, 139, 663] +[:key_down_raw, 1073741906, 0, 2, 140, 688] +[:key_down_raw, 1073741906, 0, 2, 141, 690] +[:key_down_raw, 1073741906, 0, 2, 142, 692] +[:key_down_raw, 1073741906, 0, 2, 143, 695] +[:key_down_raw, 1073741906, 0, 2, 144, 697] +[:key_down_raw, 1073741906, 0, 2, 145, 699] +[:key_down_raw, 1073741906, 0, 2, 146, 701] +[:key_down_raw, 1073741906, 0, 2, 147, 703] +[:key_down_raw, 1073741906, 0, 2, 148, 705] +[:key_down_raw, 1073741906, 0, 2, 149, 707] +[:key_up_raw, 1073741906, 0, 2, 150, 707] +[:key_down_raw, 1073741905, 0, 2, 151, 713] +[:key_down_raw, 1073741905, 0, 2, 152, 738] +[:key_down_raw, 1073741905, 0, 2, 153, 740] +[:key_down_raw, 1073741903, 0, 2, 154, 741] +[:key_down_raw, 1073741903, 0, 2, 155, 766] +[:key_down_raw, 1073741903, 0, 2, 156, 768] +[:key_down_raw, 1073741903, 0, 2, 157, 770] +[:key_down_raw, 1073741903, 0, 2, 158, 772] +[:key_up_raw, 1073741905, 0, 2, 159, 772] +[:key_down_raw, 1073741903, 0, 2, 160, 774] +[:key_down_raw, 1073741903, 0, 2, 161, 776] +[:key_down_raw, 1073741903, 0, 2, 162, 778] +[:key_down_raw, 1073741903, 0, 2, 163, 780] +[:key_down_raw, 1073741903, 0, 2, 164, 782] +[:key_down_raw, 1073741903, 0, 2, 165, 784] +[:key_down_raw, 1073741903, 0, 2, 166, 786] +[:key_down_raw, 1073741903, 0, 2, 167, 788] +[:key_down_raw, 1073741903, 0, 2, 168, 790] +[:key_down_raw, 1073741903, 0, 2, 169, 792] +[:key_down_raw, 1073741903, 0, 2, 170, 794] +[:key_down_raw, 1073741903, 0, 2, 171, 796] +[:key_down_raw, 1073741903, 0, 2, 172, 798] +[:key_down_raw, 1073741903, 0, 2, 173, 800] +[:key_down_raw, 1073741903, 0, 2, 174, 802] +[:key_down_raw, 1073741903, 0, 2, 175, 804] +[:key_down_raw, 1073741903, 0, 2, 176, 806] +[:key_down_raw, 1073741903, 0, 2, 177, 808] +[:key_down_raw, 1073741903, 0, 2, 178, 810] +[:key_down_raw, 1073741903, 0, 2, 179, 812] +[:key_down_raw, 1073741903, 0, 2, 180, 814] +[:key_up_raw, 1073741903, 0, 2, 181, 814] +[:key_down_raw, 1073742051, 1024, 2, 182, 879] +[:key_down_raw, 113, 1024, 2, 183, 879] diff --git a/samples/13_01_easing_functions/app/main.rb b/samples/13_01_easing_functions/app/main.rb new file mode 100644 index 0000000..5bb26f9 --- /dev/null +++ b/samples/13_01_easing_functions/app/main.rb @@ -0,0 +1,132 @@ +def tick args + # STOP! Watch the following presentation first!!!! + # Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations + # https://www.youtube.com/watch?v=mr5xkf6zSzk + + # You've watched the talk, yes? YES??? + + # define starting and ending points of properties to animate + args.state.target_x = 1180 + args.state.target_y = 620 + args.state.target_w = 100 + args.state.target_h = 100 + args.state.starting_x = 0 + args.state.starting_y = 0 + args.state.starting_w = 300 + args.state.starting_h = 300 + + # define start time and duration of animation + args.state.start_animate_at = 3.seconds # this is the same as writing 60 * 5 (or 300) + args.state.duration = 2.seconds # this is the same as writing 60 * 2 (or 120) + + # define type of animations + # Here are all the options you have for values you can put in the array: + # :identity, :quad, :cube, :quart, :quint, :flip + + # Linear is defined as: + # [:identity] + # + # Smooth start variations are: + # [:quad] + # [:cube] + # [:quart] + # [:quint] + + # Linear reversed, and smooth stop are the same as the animations defined above, but reversed: + # [:flip, :identity] + # [:flip, :quad, :flip] + # [:flip, :cube, :flip] + # [:flip, :quart, :flip] + # [:flip, :quint, :flip] + + # You can also do custom definitions. See the bottom of the file details + # on how to do that. I've defined a couple for you: + # [:smoothest_start] + # [:smoothest_stop] + + # CHANGE THIS LINE TO ONE OF THE LINES ABOVE TO SEE VARIATIONS + args.state.animation_type = [:identity] + # args.state.animation_type = [:quad] + # args.state.animation_type = [:cube] + # args.state.animation_type = [:quart] + # args.state.animation_type = [:quint] + # args.state.animation_type = [:flip, :identity] + # args.state.animation_type = [:flip, :quad, :flip] + # args.state.animation_type = [:flip, :cube, :flip] + # args.state.animation_type = [:flip, :quart, :flip] + # args.state.animation_type = [:flip, :quint, :flip] + # args.state.animation_type = [:smoothest_start] + # args.state.animation_type = [:smoothest_stop] + + # THIS IS WHERE THE MAGIC HAPPENS! + # Numeric#ease + progress = args.state.start_animate_at.ease(args.state.duration, args.state.animation_type) + + # Numeric#ease needs to called: + # 1. On the number that represents the point in time you want to start, and takes two parameters: + # a. The first parameter is how long the animation should take. + # b. The second parameter represents the functions that need to be called. + # + # For example, if I wanted an animate to start 3 seconds in, and last for 10 seconds, + # and I want to animation to start fast and end slow, I would do: + # (60 * 3).ease(60 * 10, :flip, :quint, :flip) + + # initial value delta to the final value + calc_x = args.state.starting_x + (args.state.target_x - args.state.starting_x) * progress + calc_y = args.state.starting_y + (args.state.target_y - args.state.starting_y) * progress + calc_w = args.state.starting_w + (args.state.target_w - args.state.starting_w) * progress + calc_h = args.state.starting_h + (args.state.target_h - args.state.starting_h) * progress + + args.outputs.solids << [calc_x, calc_y, calc_w, calc_h, 0, 0, 0] + + # count down + count_down = args.state.start_animate_at - args.state.tick_count + if count_down > 0 + args.outputs.labels << [640, 375, "Running: #{args.state.animation_type} in...", 3, 1] + args.outputs.labels << [640, 345, "%.2f" % count_down.fdiv(60), 3, 1] + elsif progress >= 1 + args.outputs.labels << [640, 360, "Click screen to reset.", 3, 1] + if args.inputs.click + $gtk.reset + end + end +end + +# $gtk.reset + +# you can make own variations of animations using this +module Easing + # you have access to all the built in functions: identity, flip, quad, cube, quart, quint + def self.smoothest_start x + quad(quint(x)) + end + + def self.smoothest_stop x + flip(quad(quint(flip(x)))) + end + + # this is the source for the existing easing functions + def self.identity x + x + end + + def self.flip x + 1 - x + end + + def self.quad x + x * x + end + + def self.cube x + x * x * x + end + + def self.quart x + x * x * x * x * x + end + + def self.quint x + x * x * x * x * x * x + end +end diff --git a/samples/13_01_easing_functions/license-for-sample.txt b/samples/13_01_easing_functions/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/13_01_easing_functions/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/13_02_cubic_bezier/app/main.rb b/samples/13_02_cubic_bezier/app/main.rb new file mode 100644 index 0000000..93dba31 --- /dev/null +++ b/samples/13_02_cubic_bezier/app/main.rb @@ -0,0 +1,61 @@ +def tick args + args.outputs.background_color = [33, 33, 33] + args.outputs.lines << bezier(100, 100, + 100, 620, + 1180, 620, + 1180, 100, + 0) + + args.outputs.lines << bezier(100, 100, + 100, 620, + 1180, 620, + 1180, 100, + 20) +end + + +def bezier x1, y1, x2, y2, x3, y3, x4, y4, step + step ||= 0 + color = [200, 200, 200] + points = points_for_bezier [x1, y1], [x2, y2], [x3, y3], [x4, y4], step + + points.each_cons(2).map do |p1, p2| + [p1, p2, color] + end +end + +def points_for_bezier p1, p2, p3, p4, step + points = [] + if step == 0 + [p1, p2, p3, p4] + else + t_step = 1.fdiv(step + 1) + t = 0 + t += t_step + points = [] + while t < 1 + points << [ + b_for_t(p1.x, p2.x, p3.x, p4.x, t), + b_for_t(p1.y, p2.y, p3.y, p4.y, t), + ] + t += t_step + end + + [ + p1, + *points, + p4 + ] + end +end + +def b_for_t v0, v1, v2, v3, t + pow(1 - t, 3) * v0 + + 3 * pow(1 - t, 2) * t * v1 + + 3 * (1 - t) * pow(t, 2) * v2 + + pow(t, 3) * v3 +end + +def pow n, to + n ** to +end diff --git a/samples/13_03_easing_using_spline/app/main.rb b/samples/13_03_easing_using_spline/app/main.rb new file mode 100644 index 0000000..c30c0e6 --- /dev/null +++ b/samples/13_03_easing_using_spline/app/main.rb @@ -0,0 +1,18 @@ +def tick args + args.state.duration = 10.seconds + args.state.spline = [ + [0.0, 0.33, 0.66, 1.0], + [1.0, 1.0, 1.0, 1.0], + [1.0, 0.66, 0.33, 0.0], + ] + + args.state.simulation_tick = args.state.tick_count % args.state.duration + progress = 0.ease_spline_extended args.state.simulation_tick, args.state.duration, args.state.spline + args.outputs.borders << args.grid.rect + args.outputs.solids << [20 + 1240 * progress, + 20 + 680 * progress, + 20, 20].anchor_rect(0.5, 0.5) + args.outputs.labels << [10, + 710, + "perc: #{"%.2f" % (args.state.simulation_tick / args.state.duration)} t: #{args.state.simulation_tick}"] +end diff --git a/samples/13_04_parametric_enemy_movement/app/main.rb b/samples/13_04_parametric_enemy_movement/app/main.rb new file mode 100644 index 0000000..8e73fb0 --- /dev/null +++ b/samples/13_04_parametric_enemy_movement/app/main.rb @@ -0,0 +1,213 @@ +def new_star args + { x: 1280.randomize(:ratio), + starting_y: 800, + distance_to_travel: 900 + 100.randomize(:ratio), + duration: 100.randomize(:ratio) + 60, + created_at: args.state.tick_count, + max_alpha: 128.randomize(:ratio) + 128, + b: 255.randomize(:ratio), + g: 200.randomize(:ratio), + w: 1.randomize(:ratio) + 1, + h: 1.randomize(:ratio) + 1 } +end + +def new_enemy args + { x: 1280.randomize(:ratio), + starting_y: 800, + distance_to_travel: -900, + duration: 60.randomize(:ratio) + 180, + created_at: args.state.tick_count, + w: 32, + h: 32, + fire_rate: (30.randomize(:ratio) + (60 - args.state.score)).to_i } +end + +def new_bullet args, starting_x, starting_y, enemy_speed + { x: starting_x, + starting_y: starting_y, + distance_to_travel: -900, + created_at: args.state.tick_count, + duration: 900 / (enemy_speed.abs + 2.0 + (5.0 * args.state.score.fdiv(100))).abs, + w: 5, + h: 5 } +end + +def new_player_bullet args, starting_x, starting_y, player_speed + { x: starting_x, + starting_y: starting_y, + distance_to_travel: 900, + created_at: args.state.tick_count, + duration: 900 / (player_speed + 2.0), + w: 5, + h: 5 } +end + +def defaults args + args.outputs.background_color = [0, 0, 0] + args.state.score ||= 0 + args.state.stars ||= [] + args.state.enemies ||= [] + args.state.bullets ||= [] + args.state.player_bullets ||= [] + args.state.max_stars = 50 + args.state.max_enemies = 10 + args.state.player.x ||= 640 + args.state.player.y ||= 100 + args.state.player.w ||= 32 + args.state.player.h ||= 32 + + if args.state.tick_count == 0 + args.state.stars.clear + args.state.max_stars.times do + s = new_star args + s[:created_at] += s[:duration].randomize(:ratio) + args.state.stars << s + end + end + + if args.state.tick_count == 0 + args.state.enemies.clear + args.state.max_enemies.times do + s = new_enemy args + s[:created_at] += s[:duration].randomize(:ratio) + args.state.enemies << s + end + end +end + +def input args + if args.inputs.keyboard.left + args.state.player.x -= 5 + elsif args.inputs.keyboard.right + args.state.player.x += 5 + end + + if args.inputs.keyboard.up + args.state.player.y += 5 + elsif args.inputs.keyboard.down + args.state.player.y -= 5 + end + + if args.inputs.keyboard.key_down.space + args.state.player_bullets << new_player_bullet(args, + args.state.player.x + args.state.player.w.half, + args.state.player.y + args.state.player.h, 5) + end + + args.state.player.y = args.state.player.y.greater(0).lesser(720 - args.state.player.w) + args.state.player.x = args.state.player.x.greater(0).lesser(1280 - args.state.player.h) +end + +def completed? entity + (entity[:created_at] + entity[:duration]).elapsed_time > 0 +end + +def calc_stars args + if (stars_to_add = args.state.max_stars - args.state.stars.length) > 0 + stars_to_add.times { args.state.stars << new_star(args) } + end + args.state.stars = args.state.stars.reject { |s| completed? s } +end + +def move_enemies args + if (enemies_to_add = args.state.max_enemies - args.state.enemies.length) > 0 + enemies_to_add.times { args.state.enemies << new_enemy(args) } + end + + args.state.enemies = args.state.enemies.reject { |s| completed? s } +end + +def move_bullets args + args.state.enemies.each do |e| + if args.state.tick_count.mod_zero?(e[:fire_rate]) + args.state.bullets << new_bullet(args, e[:x] + e[:w].half, current_y(e), e[:distance_to_travel] / e[:duration]) + end + end + + args.state.bullets = args.state.bullets.reject { |s| completed? s } + args.state.player_bullets = args.state.player_bullets.reject { |s| completed? s } +end + +def intersect? entity_one, entity_two + entity_one.merge(y: current_y(entity_one)) + .intersect_rect? entity_two.merge(y: current_y(entity_two)) +end + +def kill args + bullets_hitting_enemies = [] + dead_bullets = [] + dead_enemies = [] + + args.state.player_bullets.each do |b| + args.state.enemies.each do |e| + if intersect? b, e + dead_bullets << b + dead_enemies << e + end + end + end + + args.state.score += dead_enemies.length + + args.state.player_bullets.reject! { |b| dead_bullets.include? b } + args.state.enemies.reject! { |e| dead_enemies.include? e } + + dead = args.state.bullets.any? do |b| + [args.state.player.x, + args.state.player.y, + args.state.player.w, + args.state.player.h].intersect_rect? b.merge(y: current_y(b)) + end + return unless dead + args.gtk.reset + defaults args +end + +def calc args + calc_stars args + move_enemies args + move_bullets args + kill args +end + +def current_y entity + entity[:starting_y] + (entity[:distance_to_travel] * entity[:created_at].ease(entity[:duration], :identity)) +end + +def render args + args.outputs.solids << args.state.stars.map do |s| + [s[:x], + current_y(s), + s[:w], s[:h], 0, s[:g], s[:b], s[:max_alpha] * s[:created_at].ease(20, :identity)] + end + + args.outputs.borders << args.state.enemies.map do |s| + [s[:x], + current_y(s), + s[:w], s[:h], 255, 0, 0] + end + + args.outputs.borders << args.state.bullets.map do |b| + [b[:x], + current_y(b), + b[:w], b[:h], 255, 0, 0] + end + + args.outputs.borders << args.state.player_bullets.map do |b| + [b[:x], + current_y(b), + b[:w], b[:h], 255, 255, 255] + end + + args.borders << [args.state.player.x, + args.state.player.y, + args.state.player.w, + args.state.player.h, 255, 255, 255] +end + +def tick args + defaults args + input args + calc args + render args +end diff --git a/samples/13_04_parametric_enemy_movement/license-for-sample.txt b/samples/13_04_parametric_enemy_movement/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/13_04_parametric_enemy_movement/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/13_04_parametric_enemy_movement/replay.txt b/samples/13_04_parametric_enemy_movement/replay.txt new file mode 100644 index 0000000..6580c5b --- /dev/null +++ b/samples/13_04_parametric_enemy_movement/replay.txt @@ -0,0 +1,94 @@ +replay_version 2.0 +stopped_at 673 +seed 100 +recorded_at Sun Sep 29 22:32:05 2019 +[:key_down_raw, 1073741904, 0, 2, 1, 63] +[:key_up_raw, 1073741904, 0, 2, 2, 85] +[:key_down_raw, 1073741903, 0, 2, 3, 93] +[:key_up_raw, 1073741903, 0, 2, 4, 111] +[:key_down_raw, 1073741904, 0, 2, 5, 114] +[:key_up_raw, 1073741904, 0, 2, 6, 136] +[:key_down_raw, 1073741903, 0, 2, 7, 162] +[:key_up_raw, 1073741903, 0, 2, 8, 183] +[:key_down_raw, 32, 0, 2, 9, 184] +[:key_up_raw, 32, 0, 2, 10, 189] +[:key_down_raw, 32, 0, 2, 11, 194] +[:key_up_raw, 32, 0, 2, 12, 198] +[:key_down_raw, 32, 0, 2, 13, 202] +[:key_down_raw, 1073741904, 0, 2, 14, 205] +[:key_up_raw, 32, 0, 2, 15, 207] +[:key_down_raw, 1073741904, 0, 2, 16, 229] +[:key_down_raw, 1073741904, 0, 2, 17, 231] +[:key_down_raw, 32, 0, 2, 18, 232] +[:key_up_raw, 1073741904, 0, 2, 19, 235] +[:key_up_raw, 32, 0, 2, 20, 237] +[:key_down_raw, 1073741903, 0, 2, 21, 238] +[:key_down_raw, 32, 0, 2, 22, 241] +[:key_up_raw, 32, 0, 2, 23, 245] +[:key_down_raw, 32, 0, 2, 24, 249] +[:key_up_raw, 32, 0, 2, 25, 253] +[:key_down_raw, 32, 0, 2, 26, 258] +[:key_up_raw, 32, 0, 2, 27, 262] +[:key_down_raw, 32, 0, 2, 28, 266] +[:key_up_raw, 1073741903, 0, 2, 29, 267] +[:key_down_raw, 1073741904, 0, 2, 30, 269] +[:key_up_raw, 32, 0, 2, 31, 271] +[:key_up_raw, 1073741904, 0, 2, 32, 291] +[:key_down_raw, 1073741903, 0, 2, 33, 293] +[:key_down_raw, 32, 0, 2, 34, 301] +[:key_up_raw, 32, 0, 2, 35, 307] +[:key_down_raw, 32, 0, 2, 36, 346] +[:key_up_raw, 1073741903, 0, 2, 37, 347] +[:key_down_raw, 1073741904, 0, 2, 38, 350] +[:key_up_raw, 32, 0, 2, 39, 351] +[:key_down_raw, 1073741904, 0, 2, 40, 373] +[:key_down_raw, 1073741904, 0, 2, 41, 375] +[:key_down_raw, 1073741904, 0, 2, 42, 377] +[:key_down_raw, 1073741904, 0, 2, 43, 378] +[:key_down_raw, 1073741904, 0, 2, 44, 380] +[:key_down_raw, 1073741904, 0, 2, 45, 382] +[:key_down_raw, 1073741904, 0, 2, 46, 384] +[:key_down_raw, 1073741904, 0, 2, 47, 386] +[:key_up_raw, 1073741904, 0, 2, 48, 386] +[:key_down_raw, 32, 0, 2, 49, 387] +[:key_up_raw, 32, 0, 2, 50, 394] +[:key_down_raw, 1073741903, 0, 2, 51, 398] +[:key_down_raw, 32, 0, 2, 52, 399] +[:key_up_raw, 32, 0, 2, 53, 403] +[:key_down_raw, 32, 0, 2, 54, 408] +[:key_up_raw, 32, 0, 2, 55, 413] +[:key_down_raw, 32, 0, 2, 56, 418] +[:key_up_raw, 32, 0, 2, 57, 422] +[:key_down_raw, 32, 0, 2, 58, 427] +[:key_up_raw, 32, 0, 2, 59, 431] +[:key_down_raw, 32, 0, 2, 60, 435] +[:key_up_raw, 32, 0, 2, 61, 439] +[:key_up_raw, 1073741903, 0, 2, 62, 440] +[:key_down_raw, 1073741904, 0, 2, 63, 441] +[:key_down_raw, 1073741904, 0, 2, 64, 461] +[:key_down_raw, 1073741904, 0, 2, 65, 463] +[:key_down_raw, 1073741904, 0, 2, 66, 465] +[:key_down_raw, 1073741904, 0, 2, 67, 466] +[:key_down_raw, 1073741904, 0, 2, 68, 468] +[:key_up_raw, 1073741904, 0, 2, 69, 468] +[:key_down_raw, 1073741904, 0, 2, 70, 483] +[:key_down_raw, 1073741904, 0, 2, 71, 503] +[:key_down_raw, 1073741904, 0, 2, 72, 505] +[:key_down_raw, 1073741904, 0, 2, 73, 507] +[:key_down_raw, 32, 0, 2, 74, 508] +[:key_up_raw, 1073741904, 0, 2, 75, 509] +[:key_up_raw, 32, 0, 2, 76, 512] +[:key_down_raw, 1073741903, 0, 2, 77, 515] +[:key_down_raw, 32, 0, 2, 78, 516] +[:key_up_raw, 32, 0, 2, 79, 520] +[:key_up_raw, 1073741903, 0, 2, 80, 521] +[:key_down_raw, 32, 0, 2, 81, 524] +[:key_up_raw, 32, 0, 2, 82, 528] +[:key_down_raw, 32, 0, 2, 83, 532] +[:key_up_raw, 32, 0, 2, 84, 535] +[:key_down_raw, 32, 0, 2, 85, 539] +[:key_up_raw, 32, 0, 2, 86, 543] +[:key_down_raw, 32, 0, 2, 87, 551] +[:key_up_raw, 32, 0, 2, 88, 555] +[:key_down_raw, 1073742051, 1024, 2, 89, 656] +[:key_down_raw, 113, 1024, 2, 90, 672] diff --git a/samples/14_sprite_limits/app/main.rb b/samples/14_sprite_limits/app/main.rb new file mode 100644 index 0000000..9972cff --- /dev/null +++ b/samples/14_sprite_limits/app/main.rb @@ -0,0 +1,192 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - Instance variable (@): Used to give objects their own space to store data. + Used in this sample app when the class data structure is chosen to assign + star values, like the position, speed, size, color, etc. Check the + initialize method inside of the StarClass class to see @ used. + + Reminders: + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mymgame/documentation/02-labels.md. + + - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful + because with a given symbol name, you can refer to the same object throughout + a Ruby program. + + - args.state.new_entity: Used when we want to create a new object, like a sprite or button. + For example, if we want to create a new button, we would declare it as a new entity and + then define its properties. (Remember, you can use state to define ANY property and it will + be retained across frames.) + + - to_s: Returns a string representation of an object. + + - to_i: Returns an integer representation of an object. + + - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + - args.inputs.mouse.(x|y): The x and y location of the mouse. + For more information about the mouse, go to mygame/documentation/07-mouse.md. + +=end + +# This sample app serves to show performance differences between using: +# a very flexible data structure (:entity), +# a less flexible but faster data structure (:strict), +# and the least flexible but fastest data structure (:class). + +# If the user chooses the "class" data structure type, the StarClass will be used to assign star values +class StarClass + attr_sprite + attr_accessor :speed_x, :speed_y + + def initialize + @x = -1280 * rand # random position on screen + @y = -720 * rand + @w = 15 + @h = 15 + @speed_x = 2 * rand + 1 # random speed + @speed_y = 2 * rand + 1 + @r = 255 + @g = 255 * rand # random color + @b = 255 * rand + @a = 128 + @path = 'sprites/star.png' + end +end + +# Outputs sample app instructions onto console +# Provides acceptable command if user does not wish to enter their own input +# Calls methods needed to create and show stars +def tick args + if Kernel.global_tick_count == 0 + args.gtk.console.show # shows console when the sample app initially opens + puts " +================================================ + HELLO!!!! +================================================ + +This sample app shows the performance differences between using +a very flexible data structure (:entity), +a less flexible but faster data structure (:strict), +and the least flexible but fastest data structure (:class). + +To see the differences use the `reset_with SPRITE_COUNT, CATEGORY` method. + +For example, the following invocations generate 100 sprites of each data structure type: + + reset_with 100, :entity + reset_with 100, :strict + reset_with 100, :class + +and these commands generate 1k sprites of each data structure type: + + reset_with 1000, :entity + reset_with 1000, :strict + reset_with 1000, :class + +================================================ +" + args.gtk.console.current_input_str = 'reset_with 1000, :entity' # default input for user + end + + defaults args + render_stars args + move_stars args + process_inputs args +end + +# Sets default values, creates empty collection of stars +# Creates stars depending on whether user chooses the "entity", "strict", or "class" option +# by using an if/elsif statement +# Initialization happens only in first frame +def defaults args + args.outputs.background_color = [0, 0, 0] # black background + args.state.star_count ||= 10 + args.state.option ||= :class + args.state.stars ||= args.state.star_count.map do # do the following to 10 stars + r = nil # r starts off empty (given value later based on which data structure is chosen) + if args.state.option == :entity # if the entity data structure is chosen + r = args.state.new_entity(:star) do |star| # declares each star as new entity, sets properties + star.x = -1280 * rand # random position + star.y = -720 * rand + star.speed_x = 2 * rand + 1 # random speed + star.speed_y = 2 * rand + 1 + star.r = 255 # white color + star.g = 255 + star.b = 255 + star.alpha = 128 # slightly transparent + star.sprite = [star.x, star.y, 15, 15, 'sprites/star.png', 0, star.alpha, 255, 255 * rand, 255 * rand] # sets definition for star sprite (color is randomized) + end + elsif args.state.option == :strict # otherwise, if the strict data structure is chosen + r = args.state.new_entity_strict(:star) do |star| # declares each star as new entity, sets properties + star.x = -1280 * rand # random position + star.y = -720 * rand + star.speed_x = 2 * rand + 1 # random speed + star.speed_y = 2 * rand + 1 + star.r = 255 # white + star.g = 255 + star.b = 255 + star.alpha = 128 # slightly transparent + star.sprite = [star.x, star.y, 15, 15, 'sprites/star.png', 0, star.alpha, 255, 255 * rand, 255 * rand] # sets definition for star sprite (color is randomized) + end + elsif args.state.option == :class # if the class data structure is chosen + r = StarClass.new # uses StarClass to assign star values + end + r # returns r; value based on which part of the if statement above ran + end + args.state.stars ||= [] # initialized to empty array (if value of stars has not already been set) +end + +# Used to output solids, sprites (specifically the stars), and labels on the screen +def render_stars args + args.outputs.solids << [0, 0, 1280, 720] # sets black background + + # Outputs stars + args.outputs.sprites << args.state.stars.map do |star| # outputs every star in the collection + star.sprite + end + + # Outputs (white) label with number of stars, type of data structure chosen, + # and frames per second + args.outputs.labels << [10, 30, "Count: #{args.state.star_count}, Type: #{args.state.option}, FPS: #{args.gtk.current_framerate.to_s.to_i}", 255, 255, 255, 80] # string interpolation + # converts current framerate to a string, and then converts that result to an integer value +end + +# Allows the stars to move across the screen +# Stars loop back around if they exceed the scope of the screen +def move_stars args + args.state.stars.map! do |star| # for each star in the collection + star.x = -200 * rand if star.x > 1500 # random x position if exceeds x value of 1500 (goes too far right) + star.y = -200 * rand if star.y > 800 # random y position if exceeds y value fo 800 (goes too far up) + star.x += star.speed_x # increments position by star's speed + star.y += star.speed_y + star.sprite.x = star.x # the sprite's position is the star's position + star.sprite.y = star.y + star + end +end + +# Creates and outputs a red border to surround the mouse +# Resets game if "r" key on keyboard is pressed +def process_inputs args + # 50 is subtracted from x and y so the mouse can be in the center of red box + mouse_border = [args.inputs.mouse.x - 50, args.inputs.mouse.y - 50, 100, 100, 255, 0, 0] + args.outputs.borders << mouse_border + $gtk.reset if args.inputs.keyboard.key_down.r +end + +# Resets the game, and assigns the star_count and option values given by the user +def reset_with count, option + $gtk.reset + $gtk.args.state.option = option + $gtk.args.state.star_count = count +end diff --git a/samples/14_sprite_limits/license-for-sample.txt b/samples/14_sprite_limits/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/14_sprite_limits/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/14_sprite_limits/sprites/star.png b/samples/14_sprite_limits/sprites/star.png Binary files differnew file mode 100644 index 0000000..e0ee0f9 --- /dev/null +++ b/samples/14_sprite_limits/sprites/star.png diff --git a/samples/14_sprite_limits_static_references/app/main.rb b/samples/14_sprite_limits_static_references/app/main.rb new file mode 100644 index 0000000..5761345 --- /dev/null +++ b/samples/14_sprite_limits_static_references/app/main.rb @@ -0,0 +1,99 @@ +=begin + + Reminders: + + - Instance variable (@): Used to give objects their own space to store data. + In this sample app, check the initialize method inside of the StarClass class + to see @ used. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mymgame/documentation/02-labels.md. + + - to_s: Returns a string representation of an object. + + - to_i: Returns an integer representation of an object. + + - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + - args.inputs.mouse.(x|y): The x and y location of the mouse. + For more information about the mouse, go to mygame/documentation/07-mouse.md. +=end + +class StarClass + attr_sprite + attr_accessor :speed_x, :speed_y + + def initialize outputs + @x = -1280 * rand # random position on screen + @y = -720 * rand + @w = 15 # size + @h = 15 + @speed_x = 2 * rand + 1 # random speed + @speed_y = 2 * rand + 1 + @r = 255 + @g = 255 * rand # random color + @b = 255 * rand + @a = 128 # transparency + @path = 'sprites/star.png' # image path + outputs.static_sprites << self # adds self to collection + end +end + +# calls methods needed for game to run properly +def tick args + # sets console command when sample app initially opens + if Kernel.global_tick_count == 0 + args.gtk.console.set_command "reset_with count: 100" + end + + defaults args + render_stars args + move_stars args + process_inputs args +end + +# sets default values +def defaults args + args.outputs.background_color = [0, 0, 0] # black background + args.state.star_count ||= 10 + # sets stars collection by performing action on each star (initially 10 stars based on star_count) + args.state.stars ||= args.state.star_count.map { StarClass.new args.outputs } +end + +def render_stars args + # outputs white label with number of stars and frames per second onto the screen + args.outputs.labels << [10, 30, "Count: #{args.state.star_count}, FPS: #{args.gtk.current_framerate.to_s.to_i}", 255, 255, 255, 80] # string interpolation +end + +# allows stars to move on screen +# stars loop back around if they exceed scope of screen +def move_stars args + args.state.stars.each do |star| # perform action on each star in collection + star.x = -200 * rand if star.x > 1500 # random x position if exceeds value of 1500 (goes too far right) + star.y = -200 * rand if star.y > 800 # random y position if exceeds value of 800 (goes too far up) + star.x += star.speed_x # increments position by speed of star + star.y += star.speed_y + star + end +end + +# creates and outputs a red border to surround the mouse +# resets game if "r" key on keyboard is pressed +def process_inputs args + # 50 is subtracted from x and y so the mouse is in center of red box + mouse_border = [args.inputs.mouse.x - 50, args.inputs.mouse.y - 50, 100, 100, 255, 0, 0] + args.outputs.borders << mouse_border + $gtk.reset if args.inputs.keyboard.key_down.r +end + +# resets game, and assigns star count given by user +def reset_with count: count + $gtk.reset + $gtk.args.state.star_count = count +end diff --git a/samples/14_sprite_limits_static_references/license-for-sample.txt b/samples/14_sprite_limits_static_references/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/14_sprite_limits_static_references/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/14_sprite_limits_static_references/sprites/star.png b/samples/14_sprite_limits_static_references/sprites/star.png Binary files differnew file mode 100644 index 0000000..e0ee0f9 --- /dev/null +++ b/samples/14_sprite_limits_static_references/sprites/star.png diff --git a/samples/15_collision_limits/app/main.rb b/samples/15_collision_limits/app/main.rb new file mode 100644 index 0000000..01ad308 --- /dev/null +++ b/samples/15_collision_limits/app/main.rb @@ -0,0 +1,55 @@ +=begin + + Reminders: + - find_all: Finds all elements of a collection that meet certain requirements. + In this sample app, we're finding all bodies that intersect with the center body. + + - args.outputs.solids: An array. The values generate a solid. + The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE] + For more information about solids, go to mygame/documentation/03-solids-and-borders.md. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect. + +=end + +# This code demonstrates moving objects that loop around once they exceed the scope of the screen, +# which has dimensions of 1280 by 720, and also detects collisions between objects called "bodies". + +def body_count num + $gtk.args.state.other_bodies = num.map { [1280 * rand, 720 * rand, 10, 10] } # other_bodies set using num collection +end + +def tick args + + # Center body's values are set using an array + # Map is used to set values of 2000 other bodies + # All bodies that intersect with center body are stored in collisions collection + args.state.center_body ||= [640 - 100, 360 - 100, 200, 200] # calculations done to place body in center + args.state.other_bodies ||= 2000.map { [1280 * rand, 720 * rand, 10, 10] } # 2000 bodies given random position on screen + + # finds all bodies that intersect with center body, stores them in collisions + collisions = args.state.other_bodies.find_all { |b| b.intersect_rect? args.state.center_body } + + args.borders << args.state.center_body # outputs center body as a black border + + # transparency changes based on number of collisions; the more collisions, the redder (more transparent) the box becomes + args.solids << [args.state.center_body, 255, 0, 0, collisions.length * 5] # center body is red solid + args.solids << args.state.other_bodies # other bodies are output as (black) solids, as well + + args.labels << [10, 30, args.gtk.current_framerate] # outputs frame rate in bottom left corner + + # Bodies are returned to bottom left corner if positions exceed scope of screen + args.state.other_bodies.each do |b| # for each body in the other_bodies collection + b.x += 5 # x and y are both incremented by 5 + b.y += 5 + b.x = 0 if b.x > 1280 # x becomes 0 if star exceeds scope of screen (goes too far right) + b.y = 0 if b.y > 720 # y becomes 0 if star exceeds scope of screen (goes too far up) + end +end + +# Resets the game. +$gtk.reset diff --git a/samples/15_collision_limits/license-for-sample.txt b/samples/15_collision_limits/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/15_collision_limits/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/18_moddable_game/app/decision.rb b/samples/18_moddable_game/app/decision.rb new file mode 100644 index 0000000..2921076 --- /dev/null +++ b/samples/18_moddable_game/app/decision.rb @@ -0,0 +1,37 @@ +# Hey there! Welcome to Four Decisions. Here is how you +# create your decision tree. Remove =being and =end from the text to +# enable the game (just save the file). Change stuff and see what happens! + +def game + { + starting_decision: :stormy_night, + decisions: { + stormy_night: { + description: 'It was a dark and stormy night. (storyline located in decision.rb)', + option_one: { + description: 'Go to sleep.', + decision: :nap + }, + option_two: { + description: 'Watch a movie.', + decision: :movie + }, + option_three: { + description: 'Go outside.', + decision: :go_outside + }, + option_four: { + description: 'Get a snack.', + decision: :get_a_snack + } + }, + nap: { + description: 'You took a nap. The end.', + option_one: { + description: 'Start over.', + decision: :stormy_night + } + } + } + } +end diff --git a/samples/18_moddable_game/app/main.rb b/samples/18_moddable_game/app/main.rb new file mode 100644 index 0000000..22faad1 --- /dev/null +++ b/samples/18_moddable_game/app/main.rb @@ -0,0 +1,132 @@ +=begin + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The values can be found + using their keys. + + In this sample app, the decisions needed for the game are stored in a hash. In fact, the + decision.rb file contains hashes inside of other hashes! + + Each option is a key in the first hash, but also contains a hash (description and + decision being its keys) as its value. + Go into the decision.rb file and take a look before diving into the code below. + + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - args.keyboard.key_down.KEY: Determines if a key is in the down state or pressed down. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + + - String interpolation: uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + +=end + +# This sample app provides users with a story and multiple decisions that they can choose to make. +# Users can make a decision using their keyboard, and the story will move forward based on user choices. + +# The decisions available to users are stored in the decision.rb file. +# We must have access to it for the game to function properly. +GAME_FILE = 'app/decision.rb' # found in app folder + +require GAME_FILE # require used to load another file, import class/method definitions + +# Instructions are given using labels to users if they have not yet set up their story in the decision.rb file. +# Otherwise, the game is run. +def tick args + if !args.state.loaded && !respond_to?(:game) # if game is not loaded and not responding to game symbol's method + args.labels << [640, 370, 'Hey there! Welcome to Four Decisions.', 0, 1] # a welcome label is shown + args.labels << [640, 340, 'Go to the file called decision.rb and tell me your story.', 0, 1] + elsif respond_to?(:game) # otherwise, if responds to game + args.state.loaded = true + tick_game args # calls tick_game method, runs game + end + + if args.state.tick_count.mod_zero? 60 # update every 60 frames + t = args.gtk.ffi_file.mtime GAME_FILE # mtime returns modification time for named file + if t != args.state.mtime + args.state.mtime = t + require GAME_FILE # require used to load file + args.state.game_definition = nil # game definition and decision are empty + args.state.decision_id = nil + end + end +end + +# Runs methods needed for game to function properly +# Creates a rectangular border around the screen +def tick_game args + defaults args + args.borders << args.grid.rect + render_decision args + process_inputs args +end + +# Sets default values and uses decision.rb file to define game and decision_id +# variable using the starting decision +def defaults args + args.state.game_definition ||= game + args.state.decision_id ||= args.state.game_definition[:starting_decision] +end + +# Outputs the possible decision descriptions the user can choose onto the screen +# as well as what key to press on their keyboard to make their decision +def render_decision args + decision = current_decision args + # text is either the value of decision's description key or warning that no description exists + args.labels << [640, 360, decision[:description] || "No definition found for #{args.state.decision_id}. Please update decision.rb.", 0, 1] # uses string interpolation + + # All decisions are stored in a hash + # The descriptions output onto the screen are the values for the description keys of the hash. + if decision[:option_one] + args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label + args.labels << [10, 335, "(Press 'left' on the keyboard to select this decision)", -5, 0] # label of what key to press to select the decision + end + + if decision[:option_two] + args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description + args.labels << [1270, 335, "(Press 'right' on the keyboard to select this decision)", -5, 2] + end + + if decision[:option_three] + args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description + args.labels << [640, 20, "(Press 'down' on the keyboard to select this decision)", -5, 1] + end + + if decision[:option_four] + args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description + args.labels << [640, 675, "(Press 'up' on the keyboard to select this decision)", -5, 1] + end +end + +# Uses keyboard input from the user to make a decision +# Assigns the decision as the value of the decision_id variable +def process_inputs args + decision = current_decision args # calls current_decision method + + if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists + args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id + end + + if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists + args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id + end + + if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists + args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id + end + + if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists + args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id + end +end + +# Uses decision_id's value to keep track of current decision being made +def current_decision args + args.state.game_definition[:decisions][args.state.decision_id] || {} # either has value or is empty +end + +# Resets the game. +$gtk.reset diff --git a/samples/18_moddable_game/license-for-sample.txt b/samples/18_moddable_game/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/18_moddable_game/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/18_moddable_game/replay.txt b/samples/18_moddable_game/replay.txt new file mode 100644 index 0000000..7de4ea1 --- /dev/null +++ b/samples/18_moddable_game/replay.txt @@ -0,0 +1,701 @@ +replay_version 2.0 +stopped_at 1227 +seed 100 +recorded_at Sun Sep 29 22:35:15 2019 +[:mouse_move, 610, 150, 2, 1, 136] +[:mouse_move, 595, 157, 2, 2, 137] +[:mouse_move, 580, 169, 2, 3, 138] +[:mouse_move, 558, 189, 2, 4, 139] +[:mouse_move, 546, 200, 2, 5, 140] +[:mouse_move, 522, 222, 2, 6, 141] +[:mouse_move, 472, 262, 2, 7, 142] +[:mouse_move, 461, 270, 2, 8, 143] +[:mouse_move, 432, 291, 2, 9, 144] +[:mouse_move, 417, 301, 2, 10, 145] +[:mouse_move, 409, 306, 2, 11, 146] +[:mouse_move, 399, 313, 2, 12, 147] +[:mouse_move, 391, 315, 2, 13, 148] +[:mouse_move, 386, 315, 2, 14, 149] +[:mouse_move, 380, 317, 2, 15, 150] +[:mouse_move, 378, 317, 2, 16, 151] +[:mouse_move, 375, 318, 2, 17, 152] +[:mouse_move, 373, 319, 2, 18, 153] +[:mouse_move, 377, 329, 2, 19, 154] +[:mouse_move, 401, 349, 2, 20, 155] +[:mouse_move, 528, 437, 2, 21, 156] +[:mouse_move, 612, 485, 2, 22, 157] +[:mouse_move, 724, 531, 2, 23, 158] +[:mouse_move, 746, 532, 2, 24, 159] +[:mouse_move, 760, 532, 2, 25, 160] +[:mouse_move, 754, 521, 2, 26, 171] +[:mouse_move, 744, 504, 2, 27, 172] +[:mouse_move, 738, 496, 2, 28, 173] +[:mouse_move, 721, 476, 2, 29, 174] +[:mouse_move, 711, 465, 2, 30, 175] +[:mouse_move, 701, 454, 2, 31, 176] +[:mouse_move, 681, 435, 2, 32, 177] +[:mouse_move, 672, 427, 2, 33, 178] +[:mouse_move, 662, 417, 2, 34, 179] +[:mouse_move, 656, 412, 2, 35, 180] +[:mouse_move, 649, 406, 2, 36, 181] +[:mouse_move, 645, 403, 2, 37, 182] +[:mouse_move, 641, 401, 2, 38, 183] +[:mouse_move, 639, 399, 2, 39, 184] +[:mouse_move, 637, 399, 2, 40, 185] +[:mouse_move, 636, 398, 2, 41, 186] +[:mouse_move, 633, 398, 2, 42, 187] +[:mouse_move, 632, 398, 2, 43, 188] +[:mouse_move, 630, 398, 2, 44, 189] +[:mouse_move, 638, 399, 2, 45, 193] +[:mouse_move, 641, 399, 2, 46, 194] +[:mouse_move, 648, 400, 2, 47, 195] +[:mouse_move, 667, 400, 2, 48, 196] +[:mouse_move, 677, 400, 2, 49, 197] +[:mouse_move, 698, 397, 2, 50, 198] +[:mouse_move, 707, 395, 2, 51, 199] +[:mouse_move, 728, 391, 2, 52, 200] +[:mouse_move, 744, 390, 2, 53, 201] +[:mouse_move, 754, 389, 2, 54, 202] +[:mouse_move, 763, 389, 2, 55, 203] +[:mouse_move, 777, 389, 2, 56, 204] +[:mouse_move, 785, 389, 2, 57, 205] +[:mouse_move, 797, 389, 2, 58, 206] +[:mouse_move, 803, 389, 2, 59, 207] +[:mouse_move, 814, 389, 2, 60, 208] +[:mouse_move, 818, 389, 2, 61, 209] +[:mouse_move, 826, 389, 2, 62, 210] +[:mouse_move, 829, 389, 2, 63, 211] +[:mouse_move, 837, 388, 2, 64, 212] +[:mouse_move, 842, 388, 2, 65, 213] +[:mouse_move, 850, 388, 2, 66, 214] +[:mouse_move, 855, 388, 2, 67, 215] +[:mouse_move, 864, 388, 2, 68, 216] +[:mouse_move, 870, 388, 2, 69, 217] +[:mouse_move, 881, 389, 2, 70, 218] +[:mouse_move, 886, 390, 2, 71, 219] +[:mouse_move, 896, 390, 2, 72, 220] +[:mouse_move, 901, 390, 2, 73, 221] +[:mouse_move, 910, 390, 2, 74, 222] +[:mouse_move, 914, 390, 2, 75, 223] +[:mouse_move, 918, 390, 2, 76, 224] +[:mouse_move, 926, 390, 2, 77, 225] +[:mouse_move, 928, 390, 2, 78, 226] +[:mouse_move, 937, 390, 2, 79, 227] +[:mouse_move, 940, 390, 2, 80, 228] +[:mouse_move, 945, 390, 2, 81, 229] +[:mouse_move, 948, 390, 2, 82, 230] +[:mouse_move, 954, 390, 2, 83, 231] +[:mouse_move, 957, 390, 2, 84, 232] +[:mouse_move, 961, 390, 2, 85, 233] +[:mouse_move, 963, 390, 2, 86, 234] +[:mouse_move, 965, 390, 2, 87, 235] +[:mouse_move, 963, 390, 2, 88, 238] +[:mouse_move, 955, 390, 2, 89, 239] +[:mouse_move, 951, 390, 2, 90, 240] +[:mouse_move, 941, 390, 2, 91, 241] +[:mouse_move, 930, 388, 2, 92, 242] +[:mouse_move, 912, 388, 2, 93, 243] +[:mouse_move, 892, 388, 2, 94, 244] +[:mouse_move, 866, 388, 2, 95, 245] +[:mouse_move, 830, 390, 2, 96, 247] +[:mouse_move, 804, 393, 2, 97, 248] +[:mouse_move, 777, 396, 2, 98, 249] +[:mouse_move, 757, 398, 2, 99, 250] +[:mouse_move, 746, 399, 2, 100, 251] +[:mouse_move, 731, 399, 2, 101, 252] +[:mouse_move, 715, 399, 2, 102, 253] +[:mouse_move, 712, 399, 2, 103, 254] +[:mouse_move, 703, 399, 2, 104, 255] +[:mouse_move, 700, 399, 2, 105, 256] +[:mouse_move, 698, 399, 2, 106, 257] +[:mouse_move, 697, 399, 2, 107, 258] +[:mouse_move, 696, 399, 2, 108, 259] +[:mouse_move, 697, 399, 2, 109, 263] +[:mouse_move, 708, 399, 2, 110, 264] +[:mouse_move, 722, 399, 2, 111, 265] +[:mouse_move, 755, 398, 2, 112, 266] +[:mouse_move, 775, 396, 2, 113, 267] +[:mouse_move, 805, 393, 2, 114, 268] +[:mouse_move, 820, 392, 2, 115, 269] +[:mouse_move, 840, 392, 2, 116, 270] +[:mouse_move, 852, 392, 2, 117, 271] +[:mouse_move, 871, 392, 2, 118, 272] +[:mouse_move, 878, 392, 2, 119, 273] +[:mouse_move, 893, 393, 2, 120, 274] +[:mouse_move, 899, 393, 2, 121, 275] +[:mouse_move, 907, 394, 2, 122, 276] +[:mouse_move, 910, 394, 2, 123, 277] +[:mouse_move, 913, 395, 2, 124, 278] +[:mouse_move, 917, 395, 2, 125, 279] +[:mouse_move, 918, 395, 2, 126, 280] +[:mouse_move, 919, 395, 2, 127, 281] +[:mouse_move, 918, 395, 2, 128, 283] +[:mouse_move, 917, 395, 2, 129, 284] +[:mouse_move, 913, 395, 2, 130, 285] +[:mouse_move, 908, 395, 2, 131, 286] +[:mouse_move, 888, 397, 2, 132, 287] +[:mouse_move, 856, 399, 2, 133, 288] +[:mouse_move, 739, 406, 2, 134, 289] +[:mouse_move, 666, 412, 2, 135, 290] +[:mouse_move, 536, 422, 2, 136, 291] +[:mouse_move, 450, 429, 2, 137, 292] +[:mouse_move, 347, 438, 2, 138, 293] +[:mouse_move, 323, 442, 2, 139, 294] +[:mouse_move, 248, 455, 2, 140, 295] +[:mouse_move, 235, 455, 2, 141, 308] +[:mouse_move, 225, 454, 2, 142, 309] +[:mouse_move, 200, 450, 2, 143, 310] +[:mouse_move, 186, 447, 2, 144, 311] +[:mouse_move, 154, 437, 2, 145, 312] +[:mouse_move, 135, 433, 2, 146, 313] +[:mouse_move, 113, 427, 2, 147, 314] +[:mouse_move, 101, 424, 2, 148, 315] +[:mouse_move, 82, 421, 2, 149, 316] +[:mouse_move, 75, 420, 2, 150, 317] +[:mouse_move, 64, 419, 2, 151, 318] +[:mouse_move, 59, 418, 2, 152, 319] +[:mouse_move, 49, 416, 2, 153, 320] +[:mouse_move, 47, 416, 2, 154, 321] +[:mouse_move, 39, 414, 2, 155, 322] +[:mouse_move, 38, 414, 2, 156, 323] +[:mouse_move, 34, 413, 2, 157, 324] +[:mouse_move, 33, 413, 2, 158, 325] +[:mouse_move, 35, 414, 2, 159, 329] +[:mouse_move, 47, 420, 2, 160, 330] +[:mouse_move, 56, 424, 2, 161, 331] +[:mouse_move, 67, 427, 2, 162, 332] +[:mouse_move, 96, 432, 2, 163, 333] +[:mouse_move, 112, 434, 2, 164, 334] +[:mouse_move, 142, 434, 2, 165, 335] +[:mouse_move, 161, 433, 2, 166, 336] +[:mouse_move, 173, 431, 2, 167, 337] +[:mouse_move, 190, 426, 2, 168, 338] +[:mouse_move, 210, 418, 2, 169, 339] +[:mouse_move, 218, 414, 2, 170, 340] +[:mouse_move, 231, 408, 2, 171, 341] +[:mouse_move, 237, 405, 2, 172, 342] +[:mouse_move, 248, 398, 2, 173, 343] +[:mouse_move, 252, 394, 2, 174, 344] +[:mouse_move, 257, 387, 2, 175, 345] +[:mouse_move, 259, 383, 2, 176, 346] +[:mouse_move, 260, 372, 2, 177, 347] +[:mouse_move, 260, 367, 2, 178, 348] +[:mouse_move, 249, 353, 2, 179, 349] +[:mouse_move, 240, 345, 2, 180, 350] +[:mouse_move, 226, 335, 2, 181, 351] +[:mouse_move, 217, 329, 2, 182, 352] +[:mouse_move, 193, 315, 2, 183, 353] +[:mouse_move, 184, 310, 2, 184, 354] +[:mouse_move, 164, 304, 2, 185, 355] +[:mouse_move, 152, 301, 2, 186, 356] +[:mouse_move, 123, 299, 2, 187, 357] +[:mouse_move, 109, 299, 2, 188, 358] +[:mouse_move, 94, 299, 2, 189, 359] +[:mouse_move, 73, 300, 2, 190, 360] +[:mouse_move, 53, 305, 2, 191, 361] +[:mouse_move, 31, 313, 2, 192, 362] +[:mouse_move, 27, 315, 2, 193, 363] +[:mouse_move, 11, 324, 2, 194, 364] +[:mouse_move, 3, 329, 2, 195, 365] +[:mouse_move, 0, 337, 2, 196, 366] +[:mouse_move, 15, 433, 2, 197, 374] +[:mouse_move, 31, 437, 2, 198, 375] +[:mouse_move, 38, 438, 2, 199, 375] +[:mouse_move, 50, 440, 2, 200, 376] +[:mouse_move, 53, 440, 2, 201, 377] +[:mouse_move, 65, 441, 2, 202, 378] +[:mouse_move, 68, 442, 2, 203, 379] +[:mouse_move, 70, 442, 2, 204, 380] +[:mouse_move, 71, 442, 2, 205, 381] +[:mouse_move, 72, 442, 2, 206, 382] +[:mouse_move, 72, 441, 2, 207, 383] +[:mouse_move, 72, 439, 2, 208, 384] +[:mouse_move, 72, 438, 2, 209, 385] +[:mouse_move, 71, 436, 2, 210, 386] +[:mouse_move, 71, 434, 2, 211, 386] +[:mouse_move, 70, 433, 2, 212, 387] +[:mouse_move, 69, 431, 2, 213, 388] +[:mouse_move, 68, 429, 2, 214, 388] +[:mouse_move, 66, 427, 2, 215, 389] +[:mouse_move, 66, 426, 2, 216, 390] +[:mouse_move, 63, 423, 2, 217, 390] +[:mouse_move, 62, 422, 2, 218, 391] +[:mouse_move, 59, 419, 2, 219, 392] +[:mouse_move, 58, 418, 2, 220, 392] +[:mouse_move, 57, 416, 2, 221, 393] +[:mouse_move, 56, 414, 2, 222, 394] +[:mouse_move, 55, 413, 2, 223, 394] +[:mouse_move, 54, 412, 2, 224, 395] +[:mouse_move, 53, 410, 2, 225, 396] +[:mouse_move, 53, 409, 2, 226, 396] +[:mouse_move, 52, 408, 2, 227, 397] +[:mouse_move, 52, 407, 2, 228, 398] +[:mouse_move, 51, 405, 2, 229, 399] +[:mouse_move, 51, 404, 2, 230, 400] +[:mouse_move, 53, 404, 2, 231, 411] +[:mouse_move, 57, 404, 2, 232, 412] +[:mouse_move, 61, 405, 2, 233, 413] +[:mouse_move, 66, 405, 2, 234, 413] +[:mouse_move, 68, 405, 2, 235, 414] +[:mouse_move, 75, 405, 2, 236, 415] +[:mouse_move, 77, 405, 2, 237, 416] +[:mouse_move, 81, 402, 2, 238, 417] +[:mouse_move, 82, 400, 2, 239, 418] +[:mouse_move, 83, 398, 2, 240, 419] +[:mouse_move, 83, 395, 2, 241, 419] +[:mouse_move, 83, 391, 2, 242, 420] +[:mouse_move, 83, 387, 2, 243, 421] +[:mouse_move, 81, 383, 2, 244, 421] +[:mouse_move, 80, 379, 2, 245, 422] +[:mouse_move, 77, 375, 2, 246, 423] +[:mouse_move, 74, 371, 2, 247, 423] +[:mouse_move, 71, 368, 2, 248, 424] +[:mouse_move, 67, 366, 2, 249, 425] +[:mouse_move, 62, 364, 2, 250, 425] +[:mouse_move, 56, 364, 2, 251, 426] +[:mouse_move, 51, 364, 2, 252, 427] +[:mouse_move, 49, 364, 2, 253, 427] +[:mouse_move, 45, 364, 2, 254, 428] +[:mouse_move, 42, 364, 2, 255, 429] +[:mouse_move, 36, 367, 2, 256, 430] +[:mouse_move, 35, 370, 2, 257, 431] +[:mouse_move, 32, 377, 2, 258, 432] +[:mouse_move, 32, 382, 2, 259, 433] +[:mouse_move, 32, 392, 2, 260, 434] +[:mouse_move, 32, 396, 2, 261, 435] +[:mouse_move, 41, 408, 2, 262, 436] +[:mouse_move, 47, 411, 2, 263, 437] +[:mouse_move, 57, 414, 2, 264, 438] +[:mouse_move, 64, 415, 2, 265, 439] +[:mouse_move, 70, 415, 2, 266, 440] +[:mouse_move, 76, 415, 2, 267, 440] +[:mouse_move, 81, 415, 2, 268, 441] +[:mouse_move, 85, 414, 2, 269, 442] +[:mouse_move, 89, 411, 2, 270, 442] +[:mouse_move, 92, 408, 2, 271, 443] +[:mouse_move, 95, 404, 2, 272, 444] +[:mouse_move, 96, 400, 2, 273, 444] +[:mouse_move, 96, 395, 2, 274, 445] +[:mouse_move, 97, 391, 2, 275, 446] +[:mouse_move, 97, 387, 2, 276, 446] +[:mouse_move, 96, 384, 2, 277, 447] +[:mouse_move, 91, 379, 2, 278, 448] +[:mouse_move, 84, 376, 2, 279, 448] +[:mouse_move, 71, 374, 2, 280, 449] +[:mouse_move, 63, 374, 2, 281, 450] +[:mouse_move, 53, 374, 2, 282, 451] +[:mouse_move, 47, 374, 2, 283, 452] +[:mouse_move, 37, 376, 2, 284, 453] +[:mouse_move, 31, 380, 2, 285, 454] +[:mouse_move, 25, 394, 2, 286, 455] +[:mouse_move, 24, 407, 2, 287, 456] +[:mouse_move, 24, 427, 2, 288, 457] +[:key_down_raw, 1073741904, 0, 2, 289, 512] +[:key_up_raw, 1073741904, 0, 2, 290, 516] +[:mouse_move, 48, 426, 2, 291, 580] +[:mouse_move, 62, 426, 2, 292, 581] +[:mouse_move, 77, 425, 2, 293, 581] +[:mouse_move, 92, 425, 2, 294, 581] +[:mouse_move, 111, 424, 2, 295, 582] +[:mouse_move, 134, 424, 2, 296, 583] +[:mouse_move, 186, 423, 2, 297, 583] +[:mouse_move, 248, 420, 2, 298, 584] +[:mouse_move, 313, 417, 2, 299, 585] +[:mouse_move, 375, 411, 2, 300, 585] +[:mouse_move, 434, 403, 2, 301, 586] +[:mouse_move, 456, 397, 2, 302, 587] +[:mouse_move, 472, 393, 2, 303, 587] +[:mouse_move, 483, 388, 2, 304, 588] +[:mouse_move, 490, 385, 2, 305, 589] +[:mouse_move, 514, 378, 2, 306, 590] +[:mouse_move, 520, 375, 2, 307, 591] +[:mouse_move, 524, 373, 2, 308, 592] +[:mouse_move, 524, 372, 2, 309, 593] +[:mouse_move, 514, 372, 2, 310, 594] +[:mouse_move, 510, 372, 2, 311, 595] +[:mouse_move, 503, 373, 2, 312, 596] +[:mouse_move, 501, 374, 2, 313, 597] +[:mouse_move, 497, 374, 2, 314, 598] +[:mouse_move, 496, 375, 2, 315, 599] +[:mouse_move, 495, 375, 2, 316, 600] +[:mouse_move, 494, 376, 2, 317, 601] +[:mouse_move, 493, 376, 2, 318, 602] +[:mouse_move, 492, 376, 2, 319, 602] +[:mouse_move, 491, 377, 2, 320, 603] +[:mouse_move, 490, 377, 2, 321, 604] +[:mouse_move, 490, 378, 2, 322, 604] +[:mouse_move, 489, 378, 2, 323, 605] +[:mouse_move, 489, 379, 2, 324, 606] +[:mouse_move, 488, 379, 2, 325, 606] +[:mouse_move, 488, 380, 2, 326, 608] +[:mouse_move, 491, 381, 2, 327, 610] +[:mouse_move, 494, 382, 2, 328, 610] +[:mouse_move, 498, 384, 2, 329, 611] +[:mouse_move, 503, 385, 2, 330, 612] +[:mouse_move, 522, 387, 2, 331, 613] +[:mouse_move, 527, 387, 2, 332, 614] +[:mouse_move, 542, 387, 2, 333, 614] +[:mouse_move, 553, 387, 2, 334, 615] +[:mouse_move, 562, 387, 2, 335, 616] +[:mouse_move, 576, 387, 2, 336, 617] +[:mouse_move, 585, 387, 2, 337, 618] +[:mouse_move, 598, 387, 2, 338, 619] +[:mouse_move, 605, 387, 2, 339, 620] +[:mouse_move, 616, 388, 2, 340, 621] +[:mouse_move, 621, 388, 2, 341, 622] +[:mouse_move, 632, 390, 2, 342, 623] +[:mouse_move, 637, 391, 2, 343, 624] +[:mouse_move, 649, 393, 2, 344, 625] +[:mouse_move, 660, 395, 2, 345, 626] +[:mouse_move, 672, 397, 2, 346, 627] +[:mouse_move, 679, 398, 2, 347, 628] +[:mouse_move, 686, 398, 2, 348, 629] +[:mouse_move, 692, 398, 2, 349, 629] +[:mouse_move, 699, 398, 2, 350, 630] +[:mouse_move, 707, 398, 2, 351, 631] +[:mouse_move, 714, 398, 2, 352, 631] +[:mouse_move, 720, 398, 2, 353, 632] +[:mouse_move, 726, 398, 2, 354, 633] +[:mouse_move, 731, 398, 2, 355, 633] +[:mouse_move, 733, 397, 2, 356, 634] +[:mouse_move, 737, 397, 2, 357, 635] +[:mouse_move, 744, 396, 2, 358, 635] +[:mouse_move, 747, 396, 2, 359, 636] +[:mouse_move, 749, 396, 2, 360, 637] +[:mouse_move, 754, 396, 2, 361, 637] +[:mouse_move, 756, 396, 2, 362, 638] +[:mouse_move, 758, 396, 2, 363, 639] +[:mouse_move, 760, 395, 2, 364, 639] +[:mouse_move, 762, 395, 2, 365, 640] +[:mouse_move, 763, 395, 2, 366, 641] +[:mouse_move, 764, 395, 2, 367, 642] +[:mouse_move, 765, 395, 2, 368, 643] +[:mouse_move, 764, 395, 2, 369, 658] +[:mouse_move, 763, 397, 2, 370, 658] +[:mouse_move, 758, 401, 2, 371, 659] +[:mouse_move, 749, 406, 2, 372, 660] +[:mouse_move, 736, 412, 2, 373, 660] +[:mouse_move, 717, 420, 2, 374, 661] +[:mouse_move, 673, 432, 2, 375, 662] +[:mouse_move, 632, 443, 2, 376, 662] +[:mouse_move, 579, 455, 2, 377, 663] +[:mouse_move, 517, 465, 2, 378, 664] +[:mouse_move, 407, 483, 2, 379, 664] +[:mouse_move, 369, 488, 2, 380, 665] +[:mouse_move, 296, 497, 2, 381, 666] +[:mouse_move, 270, 499, 2, 382, 666] +[:mouse_move, 216, 503, 2, 383, 667] +[:mouse_move, 200, 503, 2, 384, 668] +[:mouse_move, 143, 500, 2, 385, 669] +[:mouse_move, 138, 497, 2, 386, 670] +[:mouse_move, 115, 489, 2, 387, 671] +[:mouse_move, 113, 487, 2, 388, 672] +[:mouse_move, 105, 483, 2, 389, 673] +[:mouse_move, 99, 480, 2, 390, 674] +[:mouse_move, 93, 476, 2, 391, 675] +[:mouse_move, 87, 472, 2, 392, 676] +[:mouse_move, 79, 469, 2, 393, 677] +[:mouse_move, 74, 465, 2, 394, 678] +[:mouse_move, 65, 460, 2, 395, 679] +[:mouse_move, 61, 457, 2, 396, 680] +[:mouse_move, 57, 454, 2, 397, 681] +[:mouse_move, 54, 450, 2, 398, 681] +[:mouse_move, 51, 446, 2, 399, 682] +[:mouse_move, 47, 442, 2, 400, 683] +[:mouse_move, 44, 438, 2, 401, 683] +[:mouse_move, 40, 434, 2, 402, 684] +[:mouse_move, 36, 430, 2, 403, 685] +[:mouse_move, 32, 426, 2, 404, 685] +[:mouse_move, 29, 422, 2, 405, 686] +[:mouse_move, 25, 418, 2, 406, 687] +[:mouse_move, 22, 414, 2, 407, 687] +[:mouse_move, 18, 410, 2, 408, 688] +[:mouse_move, 15, 406, 2, 409, 689] +[:mouse_move, 13, 405, 2, 410, 689] +[:mouse_move, 10, 402, 2, 411, 690] +[:mouse_move, 8, 400, 2, 412, 691] +[:mouse_move, 5, 398, 2, 413, 691] +[:mouse_move, 3, 396, 2, 414, 692] +[:mouse_move, 2, 395, 2, 415, 693] +[:mouse_move, 1, 393, 2, 416, 694] +[:mouse_move, 0, 393, 2, 417, 695] +[:mouse_move, 3, 393, 2, 418, 701] +[:mouse_move, 7, 393, 2, 419, 701] +[:mouse_move, 12, 393, 2, 420, 702] +[:mouse_move, 21, 394, 2, 421, 703] +[:mouse_move, 39, 396, 2, 422, 704] +[:mouse_move, 44, 396, 2, 423, 705] +[:mouse_move, 61, 397, 2, 424, 706] +[:mouse_move, 70, 399, 2, 425, 707] +[:mouse_move, 79, 399, 2, 426, 708] +[:mouse_move, 87, 400, 2, 427, 708] +[:mouse_move, 95, 400, 2, 428, 709] +[:mouse_move, 104, 401, 2, 429, 711] +[:mouse_move, 118, 403, 2, 430, 712] +[:mouse_move, 125, 403, 2, 431, 712] +[:mouse_move, 140, 404, 2, 432, 713] +[:mouse_move, 147, 404, 2, 433, 714] +[:mouse_move, 163, 404, 2, 434, 715] +[:mouse_move, 171, 404, 2, 435, 716] +[:mouse_move, 178, 404, 2, 436, 716] +[:mouse_move, 194, 404, 2, 437, 718] +[:mouse_move, 202, 404, 2, 438, 718] +[:mouse_move, 217, 404, 2, 439, 720] +[:mouse_move, 231, 404, 2, 440, 721] +[:mouse_move, 238, 404, 2, 441, 722] +[:mouse_move, 245, 404, 2, 442, 722] +[:mouse_move, 252, 404, 2, 443, 723] +[:mouse_move, 257, 404, 2, 444, 724] +[:mouse_move, 268, 404, 2, 445, 725] +[:mouse_move, 271, 405, 2, 446, 726] +[:mouse_move, 278, 406, 2, 447, 727] +[:mouse_move, 281, 407, 2, 448, 728] +[:mouse_move, 285, 408, 2, 449, 729] +[:mouse_move, 286, 408, 2, 450, 730] +[:mouse_move, 287, 409, 2, 451, 731] +[:mouse_move, 288, 409, 2, 452, 732] +[:mouse_move, 289, 409, 2, 453, 735] +[:key_down_raw, 1073741904, 0, 2, 454, 785] +[:key_up_raw, 1073741904, 0, 2, 455, 789] +[:mouse_move, 289, 408, 2, 456, 840] +[:mouse_move, 291, 393, 2, 457, 841] +[:mouse_move, 296, 381, 2, 458, 842] +[:mouse_move, 316, 352, 2, 459, 843] +[:mouse_move, 328, 334, 2, 460, 844] +[:mouse_move, 350, 300, 2, 461, 845] +[:mouse_move, 364, 279, 2, 462, 845] +[:mouse_move, 387, 242, 2, 463, 846] +[:mouse_move, 410, 206, 2, 464, 847] +[:mouse_move, 420, 192, 2, 465, 847] +[:mouse_move, 439, 168, 2, 466, 848] +[:mouse_move, 446, 161, 2, 467, 849] +[:mouse_move, 459, 146, 2, 468, 849] +[:mouse_move, 469, 137, 2, 469, 850] +[:mouse_move, 471, 134, 2, 470, 851] +[:mouse_move, 477, 128, 2, 471, 851] +[:mouse_move, 479, 125, 2, 472, 852] +[:mouse_move, 481, 123, 2, 473, 853] +[:mouse_move, 482, 121, 2, 474, 853] +[:mouse_move, 482, 120, 2, 475, 854] +[:mouse_move, 482, 119, 2, 476, 855] +[:mouse_move, 480, 117, 2, 477, 855] +[:mouse_move, 478, 115, 2, 478, 856] +[:mouse_move, 475, 113, 2, 479, 857] +[:mouse_move, 473, 110, 2, 480, 857] +[:mouse_move, 473, 109, 2, 481, 858] +[:mouse_move, 471, 106, 2, 482, 859] +[:mouse_move, 469, 102, 2, 483, 860] +[:mouse_move, 469, 98, 2, 484, 861] +[:mouse_move, 469, 94, 2, 485, 861] +[:mouse_move, 470, 91, 2, 486, 862] +[:mouse_move, 472, 86, 2, 487, 863] +[:mouse_move, 476, 81, 2, 488, 864] +[:mouse_move, 477, 78, 2, 489, 865] +[:mouse_move, 480, 75, 2, 490, 866] +[:mouse_move, 481, 74, 2, 491, 867] +[:mouse_move, 482, 73, 2, 492, 868] +[:mouse_move, 482, 72, 2, 493, 869] +[:mouse_move, 484, 72, 2, 494, 873] +[:mouse_move, 486, 72, 2, 495, 874] +[:mouse_move, 488, 73, 2, 496, 874] +[:mouse_move, 492, 74, 2, 497, 875] +[:mouse_move, 497, 75, 2, 498, 876] +[:mouse_move, 502, 76, 2, 499, 876] +[:mouse_move, 509, 77, 2, 500, 877] +[:mouse_move, 517, 77, 2, 501, 878] +[:mouse_move, 530, 78, 2, 502, 878] +[:mouse_move, 540, 79, 2, 503, 879] +[:mouse_move, 550, 79, 2, 504, 880] +[:mouse_move, 555, 80, 2, 505, 880] +[:mouse_move, 563, 81, 2, 506, 881] +[:mouse_move, 572, 81, 2, 507, 882] +[:mouse_move, 580, 82, 2, 508, 882] +[:mouse_move, 587, 82, 2, 509, 883] +[:mouse_move, 593, 82, 2, 510, 884] +[:mouse_move, 599, 82, 2, 511, 884] +[:mouse_move, 602, 83, 2, 512, 885] +[:mouse_move, 608, 83, 2, 513, 886] +[:mouse_move, 616, 83, 2, 514, 887] +[:mouse_move, 620, 84, 2, 515, 888] +[:mouse_move, 627, 84, 2, 516, 889] +[:mouse_move, 631, 84, 2, 517, 890] +[:mouse_move, 636, 84, 2, 518, 890] +[:mouse_move, 640, 84, 2, 519, 891] +[:mouse_move, 645, 84, 2, 520, 892] +[:mouse_move, 656, 84, 2, 521, 893] +[:mouse_move, 661, 84, 2, 522, 894] +[:mouse_move, 671, 84, 2, 523, 895] +[:mouse_move, 676, 84, 2, 524, 896] +[:mouse_move, 682, 83, 2, 525, 897] +[:mouse_move, 689, 82, 2, 526, 898] +[:mouse_move, 693, 82, 2, 527, 899] +[:mouse_move, 696, 81, 2, 528, 899] +[:mouse_move, 700, 81, 2, 529, 900] +[:mouse_move, 704, 81, 2, 530, 901] +[:mouse_move, 707, 80, 2, 531, 901] +[:mouse_move, 711, 80, 2, 532, 902] +[:mouse_move, 714, 79, 2, 533, 903] +[:mouse_move, 718, 79, 2, 534, 903] +[:mouse_move, 720, 79, 2, 535, 904] +[:mouse_move, 724, 78, 2, 536, 905] +[:mouse_move, 727, 77, 2, 537, 905] +[:mouse_move, 730, 76, 2, 538, 906] +[:mouse_move, 733, 76, 2, 539, 907] +[:mouse_move, 737, 75, 2, 540, 907] +[:mouse_move, 740, 75, 2, 541, 908] +[:mouse_move, 742, 74, 2, 542, 909] +[:mouse_move, 746, 74, 2, 543, 909] +[:mouse_move, 749, 73, 2, 544, 910] +[:mouse_move, 753, 73, 2, 545, 911] +[:mouse_move, 760, 73, 2, 546, 912] +[:mouse_move, 763, 73, 2, 547, 913] +[:mouse_move, 767, 72, 2, 548, 913] +[:mouse_move, 768, 72, 2, 549, 914] +[:mouse_move, 771, 72, 2, 550, 915] +[:mouse_move, 777, 71, 2, 551, 916] +[:mouse_move, 778, 70, 2, 552, 917] +[:mouse_move, 781, 70, 2, 553, 918] +[:mouse_move, 782, 70, 2, 554, 919] +[:mouse_move, 784, 70, 2, 555, 920] +[:mouse_move, 786, 70, 2, 556, 921] +[:mouse_move, 788, 70, 2, 557, 922] +[:mouse_move, 789, 70, 2, 558, 923] +[:mouse_move, 790, 70, 2, 559, 924] +[:key_down_raw, 1073741906, 0, 2, 560, 990] +[:key_up_raw, 1073741906, 0, 2, 561, 994] +[:mouse_move, 722, 94, 2, 562, 1047] +[:mouse_move, 699, 106, 2, 563, 1048] +[:mouse_move, 679, 118, 2, 564, 1048] +[:mouse_move, 658, 130, 2, 565, 1049] +[:mouse_move, 640, 142, 2, 566, 1050] +[:mouse_move, 616, 164, 2, 567, 1051] +[:mouse_move, 597, 185, 2, 568, 1052] +[:mouse_move, 579, 211, 2, 569, 1053] +[:mouse_move, 572, 222, 2, 570, 1054] +[:mouse_move, 564, 249, 2, 571, 1055] +[:mouse_move, 561, 269, 2, 572, 1056] +[:mouse_move, 558, 307, 2, 573, 1057] +[:mouse_move, 558, 334, 2, 574, 1058] +[:mouse_move, 560, 370, 2, 575, 1059] +[:mouse_move, 556, 369, 2, 576, 1073] +[:mouse_move, 548, 366, 2, 577, 1074] +[:mouse_move, 533, 361, 2, 578, 1075] +[:mouse_move, 512, 354, 2, 579, 1075] +[:mouse_move, 486, 347, 2, 580, 1076] +[:mouse_move, 455, 342, 2, 581, 1077] +[:mouse_move, 416, 339, 2, 582, 1078] +[:mouse_move, 391, 339, 2, 583, 1079] +[:mouse_move, 354, 341, 2, 584, 1080] +[:mouse_move, 339, 345, 2, 585, 1081] +[:mouse_move, 321, 351, 2, 586, 1082] +[:mouse_move, 312, 354, 2, 587, 1083] +[:mouse_move, 305, 358, 2, 588, 1084] +[:mouse_move, 301, 360, 2, 589, 1085] +[:mouse_move, 297, 364, 2, 590, 1086] +[:mouse_move, 296, 367, 2, 591, 1087] +[:mouse_move, 296, 369, 2, 592, 1088] +[:mouse_move, 296, 372, 2, 593, 1088] +[:mouse_move, 297, 375, 2, 594, 1089] +[:mouse_move, 301, 382, 2, 595, 1090] +[:mouse_move, 308, 387, 2, 596, 1090] +[:mouse_move, 316, 392, 2, 597, 1091] +[:mouse_move, 328, 397, 2, 598, 1092] +[:mouse_move, 352, 407, 2, 599, 1092] +[:mouse_move, 370, 411, 2, 600, 1093] +[:mouse_move, 392, 416, 2, 601, 1094] +[:mouse_move, 418, 419, 2, 602, 1094] +[:mouse_move, 449, 422, 2, 603, 1095] +[:mouse_move, 481, 424, 2, 604, 1096] +[:mouse_move, 517, 428, 2, 605, 1096] +[:mouse_move, 549, 432, 2, 606, 1097] +[:mouse_move, 583, 435, 2, 607, 1098] +[:mouse_move, 617, 438, 2, 608, 1098] +[:mouse_move, 651, 439, 2, 609, 1099] +[:mouse_move, 686, 440, 2, 610, 1100] +[:mouse_move, 718, 443, 2, 611, 1100] +[:mouse_move, 750, 444, 2, 612, 1101] +[:mouse_move, 782, 444, 2, 613, 1102] +[:mouse_move, 795, 444, 2, 614, 1102] +[:mouse_move, 822, 444, 2, 615, 1103] +[:mouse_move, 847, 444, 2, 616, 1104] +[:mouse_move, 867, 441, 2, 617, 1104] +[:mouse_move, 885, 438, 2, 618, 1105] +[:mouse_move, 900, 434, 2, 619, 1106] +[:mouse_move, 917, 427, 2, 620, 1107] +[:mouse_move, 934, 420, 2, 621, 1108] +[:mouse_move, 946, 412, 2, 622, 1109] +[:mouse_move, 953, 406, 2, 623, 1110] +[:mouse_move, 965, 392, 2, 624, 1111] +[:mouse_move, 974, 380, 2, 625, 1112] +[:mouse_move, 983, 359, 2, 626, 1113] +[:mouse_move, 986, 347, 2, 627, 1114] +[:mouse_move, 988, 334, 2, 628, 1115] +[:mouse_move, 990, 318, 2, 629, 1115] +[:mouse_move, 991, 301, 2, 630, 1116] +[:mouse_move, 991, 285, 2, 631, 1117] +[:mouse_move, 987, 270, 2, 632, 1117] +[:mouse_move, 973, 244, 2, 633, 1118] +[:mouse_move, 957, 229, 2, 634, 1119] +[:mouse_move, 934, 214, 2, 635, 1119] +[:mouse_move, 886, 190, 2, 636, 1120] +[:mouse_move, 847, 177, 2, 637, 1121] +[:mouse_move, 804, 167, 2, 638, 1121] +[:mouse_move, 755, 159, 2, 639, 1122] +[:mouse_move, 705, 154, 2, 640, 1123] +[:mouse_move, 682, 153, 2, 641, 1123] +[:mouse_move, 599, 151, 2, 642, 1124] +[:mouse_move, 577, 151, 2, 643, 1125] +[:mouse_move, 532, 151, 2, 644, 1125] +[:mouse_move, 492, 152, 2, 645, 1126] +[:mouse_move, 476, 155, 2, 646, 1127] +[:mouse_move, 444, 158, 2, 647, 1127] +[:mouse_move, 418, 163, 2, 648, 1128] +[:mouse_move, 394, 169, 2, 649, 1129] +[:mouse_move, 373, 174, 2, 650, 1129] +[:mouse_move, 353, 181, 2, 651, 1130] +[:mouse_move, 336, 189, 2, 652, 1131] +[:mouse_move, 307, 203, 2, 653, 1132] +[:mouse_move, 302, 207, 2, 654, 1133] +[:mouse_move, 284, 223, 2, 655, 1134] +[:mouse_move, 272, 236, 2, 656, 1135] +[:mouse_move, 261, 259, 2, 657, 1136] +[:mouse_move, 256, 272, 2, 658, 1137] +[:mouse_move, 251, 300, 2, 659, 1138] +[:mouse_move, 250, 314, 2, 660, 1139] +[:mouse_move, 250, 331, 2, 661, 1140] +[:mouse_move, 250, 334, 2, 662, 1141] +[:mouse_move, 251, 342, 2, 663, 1142] +[:mouse_move, 251, 348, 2, 664, 1142] +[:mouse_move, 255, 358, 2, 665, 1143] +[:mouse_move, 258, 365, 2, 666, 1144] +[:mouse_move, 261, 371, 2, 667, 1144] +[:mouse_move, 266, 378, 2, 668, 1145] +[:mouse_move, 273, 386, 2, 669, 1146] +[:mouse_move, 281, 395, 2, 670, 1146] +[:mouse_move, 286, 400, 2, 671, 1147] +[:mouse_move, 293, 408, 2, 672, 1148] +[:mouse_move, 300, 415, 2, 673, 1148] +[:mouse_move, 315, 427, 2, 674, 1149] +[:mouse_move, 325, 432, 2, 675, 1150] +[:mouse_move, 344, 441, 2, 676, 1150] +[:mouse_move, 358, 446, 2, 677, 1151] +[:mouse_move, 379, 452, 2, 678, 1152] +[:mouse_move, 402, 458, 2, 679, 1152] +[:mouse_move, 425, 464, 2, 680, 1153] +[:mouse_move, 454, 470, 2, 681, 1154] +[:mouse_move, 480, 474, 2, 682, 1154] +[:mouse_move, 511, 478, 2, 683, 1155] +[:mouse_move, 541, 480, 2, 684, 1156] +[:mouse_move, 573, 482, 2, 685, 1156] +[:mouse_move, 609, 485, 2, 686, 1157] +[:mouse_move, 647, 488, 2, 687, 1158] +[:mouse_move, 685, 492, 2, 688, 1158] +[:mouse_move, 719, 496, 2, 689, 1159] +[:mouse_move, 734, 497, 2, 690, 1160] +[:mouse_move, 761, 498, 2, 691, 1160] +[:mouse_move, 769, 498, 2, 692, 1161] +[:mouse_move, 784, 498, 2, 693, 1162] +[:mouse_move, 799, 493, 2, 694, 1163] +[:mouse_move, 802, 491, 2, 695, 1164] +[:key_down_raw, 1073742051, 1024, 2, 696, 1225] +[:key_down_raw, 113, 1024, 2, 697, 1226] diff --git a/samples/19_lowrez_jam/app/lowrez.rb b/samples/19_lowrez_jam/app/lowrez.rb new file mode 100644 index 0000000..78578e2 --- /dev/null +++ b/samples/19_lowrez_jam/app/lowrez.rb @@ -0,0 +1,170 @@ +# Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-) +# Head over to main.rb and study the code there. + +LOWREZ_SIZE = 64 +LOWREZ_ZOOM = 10 +LOWREZ_ZOOMED_SIZE = LOWREZ_SIZE * LOWREZ_ZOOM +LOWREZ_X_OFFSET = (1280 - LOWREZ_ZOOMED_SIZE).half +LOWREZ_Y_OFFSET = ( 720 - LOWREZ_ZOOMED_SIZE).half + +LOWREZ_FONT_XL = -1 +LOWREZ_FONT_XL_HEIGHT = 20 + +LOWREZ_FONT_LG = -3.5 +LOWREZ_FONT_LG_HEIGHT = 15 + +LOWREZ_FONT_MD = -6 +LOWREZ_FONT_MD_HEIGHT = 10 + +LOWREZ_FONT_SM = -8.5 +LOWREZ_FONT_SM_HEIGHT = 5 + +LOWREZ_FONT_PATH = 'fonts/lowrez.ttf' + + +class LowrezOutputs + attr_accessor :width, :height + + def initialize args + @args = args + @background_color ||= [0, 0, 0] + @args.outputs.background_color = @background_color + end + + def background_color + @background_color ||= [0, 0, 0] + end + + def background_color= opts + @background_color = opts + @args.outputs.background_color = @background_color + + outputs_lowrez.solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color] + end + + def outputs_lowrez + return @args.outputs if @args.state.tick_count <= 0 + return @args.outputs[:lowrez] + end + + def solids + outputs_lowrez.solids + end + + def borders + outputs_lowrez.borders + end + + def sprites + outputs_lowrez.sprites + end + + def labels + outputs_lowrez.labels + end + + def default_label + { + x: 0, + y: 63, + text: "", + size_enum: LOWREZ_FONT_SM, + alignment_enum: 0, + r: 0, + g: 0, + b: 0, + a: 255, + font: LOWREZ_FONT_PATH + } + end + + def lines + outputs_lowrez.lines + end + + def primitives + outputs_lowrez.primitives + end + + def click + return nil unless @args.inputs.mouse.click + mouse + end + + def mouse_click + click + end + + def mouse_down + @args.inputs.mouse.down + end + + def mouse_up + @args.inputs.mouse.up + end + + def mouse + [ + ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)), + ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM)) + ] + end + + def mouse_position + mouse + end + + def keyboard + @args.inputs.keyboard + end +end + +class GTK::Args + def init_lowrez + return if @lowrez + @lowrez = LowrezOutputs.new self + end + + def lowrez + @lowrez + end +end + +module GTK + class Runtime + alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__) + + def tick_core + @args.init_lowrez + __original_tick_core__ + + return if @args.state.tick_count <= 0 + + @args.render_target(:lowrez) + .labels + .each do |l| + l.y += 1 + end + + @args.render_target(:lowrez) + .lines + .each do |l| + l.y += 1 + l.y2 += 1 + l.y2 += 1 if l.y1 != l.y2 + l.x2 += 1 if l.x1 != l.x2 + end + + @args.outputs + .sprites << { x: 320, + y: 40, + w: 640, + h: 640, + source_x: 0, + source_y: 0, + source_w: 64, + source_h: 64, + path: :lowrez } + end + end +end diff --git a/samples/19_lowrez_jam/app/main.rb b/samples/19_lowrez_jam/app/main.rb new file mode 100644 index 0000000..a30d75a --- /dev/null +++ b/samples/19_lowrez_jam/app/main.rb @@ -0,0 +1,613 @@ +require 'app/lowrez.rb' + +def tick args + # How to set the background color + args.lowrez.background_color = [255, 255, 255] + + # ==== HELLO WORLD ====================================================== + # Steps to get started: + # 1. ~def tick args~ is the entry point for your game. + # 2. There are quite a few code samples below, remove the "##" + # before each line and save the file to see the changes. + # 3. 0, 0 is in bottom left and 63, 63 is in top right corner. + # 4. Be sure to come to the discord channel if you need + # more help: [[http://discord.dragonruby.org]]. + + # Commenting and uncommenting code: + # - Add a "#" infront of lines to comment out code + # - Remove the "#" infront of lines to comment out code + + # Invoke the hello_world subroutine/method + hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method. + # ======================================================================= + + + # ==== HOW TO RENDER A LABEL ============================================ + # Uncomment the line below to invoke the how_to_render_a_label subroutine/method. + # Note: The method is defined in this file with the signature ~def how_to_render_a_label args~ + # Scroll down to the method to see the details. + + # Remove the "#" at the beginning of the line below + # how_to_render_a_label args # <---- remove the "#" at the begging of this line to run the method + # ======================================================================= + + + # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================ + # Remove the "#" at the beginning of the line below + # how_to_render_solids args + # ======================================================================= + + + # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ======================== + # Remove the "#" at the beginning of the line below + # how_to_render_borders args + # ======================================================================= + + + # ==== HOW TO RENDER A LINE ============================================= + # Remove the "#" at the beginning of the line below + # how_to_render_lines args + # ======================================================================= + + + # == HOW TO RENDER A SPRITE ============================================= + # Remove the "#" at the beginning of the line below + # how_to_render_sprites args + # ======================================================================= + + + # ==== HOW TO MOVE A SPRITE BASED OFF OF USER INPUT ===================== + # Remove the "#" at the beginning of the line below + # how_to_move_a_sprite args + # ======================================================================= + + + # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ========================== + # Remove the "#" at the beginning of the line below + # how_to_animate_a_sprite args + # ======================================================================= + + + # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =========================== + # Remove the "#" at the beginning of the line below + # how_to_animate_a_sprite_sheet args + # ======================================================================= + + + # ==== HOW TO DETERMINE COLLISION ============================================= + # Remove the "#" at the beginning of the line below + # how_to_determine_collision args + # ======================================================================= + + + # ==== HOW TO CREATE BUTTONS ================================================== + # Remove the "#" at the beginning of the line below + # how_to_create_buttons args + # ======================================================================= + + + # ==== The line below renders a debug grid, mouse information, and current tick + render_debug args +end + +def hello_world args + args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 } + + args.lowrez.labels << { + x: 32, + y: 63, + text: "lowrezjam 2020", + size_enum: LOWREZ_FONT_SM, + alignment_enum: 1, + r: 0, + g: 0, + b: 0, + a: 255, + font: LOWREZ_FONT_PATH + } + + args.lowrez.sprites << { + x: 32 - 10, + y: 32 - 10, + w: 20, + h: 20, + path: 'sprites/lowrez-ship-blue.png', + a: args.state.tick_count % 255, + angle: args.state.tick_count % 360 + } +end + + +# ======================================================================= +# ==== HOW TO RENDER A LABEL ============================================ +# ======================================================================= +def how_to_render_a_label args + # NOTE: Text is aligned from the TOP LEFT corner + + # Render an EXTRA LARGE/XL label (remove the "#" in front of each line below) + args.lowrez.labels << { x: 0, y: 57, text: "Hello World", + size_enum: LOWREZ_FONT_XL, + r: 0, g: 0, b: 0, a: 255, + font: LOWREZ_FONT_PATH } + + # Render a LARGE/LG label (remove the "#" in front of each line below) + args.lowrez.labels << { x: 0, y: 36, text: "Hello World", + size_enum: LOWREZ_FONT_LG, + r: 0, g: 0, b: 0, a: 255, + font: LOWREZ_FONT_PATH } + + # Render a MEDIUM/MD label (remove the "#" in front of each line below) + args.lowrez.labels << { x: 0, y: 20, text: "Hello World", + size_enum: LOWREZ_FONT_MD, + r: 0, g: 0, b: 0, a: 255, + font: LOWREZ_FONT_PATH } + + # Render a SMALL/SM label (remove the "#" in front of each line below) + args.lowrez.labels << { x: 0, y: 9, text: "Hello World", + size_enum: LOWREZ_FONT_SM, + r: 0, g: 0, b: 0, a: 255, + font: LOWREZ_FONT_PATH } + + # You are provided args.lowrez.default_label which returns a Hash that you + # can ~merge~ properties with + # Example 1 + args.lowrez.labels << args.lowrez + .default_label + .merge(text: "Default") + + # Example 2 + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 31, + text: "Default", + r: 128, + g: 128, + b: 128) +end + +## # ============================================================================= +## # ==== HOW TO RENDER FILLED SQUARES (SOLIDS) ================================== +## # ============================================================================= +def how_to_render_solids args + # Render a red square at 0, 0 with a width and height of 1 + args.lowrez.solids << { x: 0, y: 0, w: 1, h: 1, r: 255, g: 0, b: 0, a: 255 } + + # Render a red square at 1, 1 with a width and height of 2 + args.lowrez.solids << { x: 1, y: 1, w: 2, h: 2, r: 255, g: 0, b: 0, a: 255 } + + # Render a red square at 3, 3 with a width and height of 3 + args.lowrez.solids << { x: 3, y: 3, w: 3, h: 3, r: 255, g: 0, b: 0 } + + # Render a red square at 6, 6 with a width and height of 4 + args.lowrez.solids << { x: 6, y: 6, w: 4, h: 4, r: 255, g: 0, b: 0 } +end + +## # ============================================================================= +## # ==== HOW TO RENDER UNFILLED SQUARES (BORDERS) =============================== +## # ============================================================================= +def how_to_render_borders args + # Render a red square at 0, 0 with a width and height of 3 + args.lowrez.borders << { x: 0, y: 0, w: 3, h: 3, r: 255, g: 0, b: 0, a: 255 } + + # Render a red square at 3, 3 with a width and height of 3 + args.lowrez.borders << { x: 3, y: 3, w: 4, h: 4, r: 255, g: 0, b: 0, a: 255 } + + # Render a red square at 5, 5 with a width and height of 4 + args.lowrez.borders << { x: 7, y: 7, w: 5, h: 5, r: 255, g: 0, b: 0, a: 255 } +end + +## # ============================================================================= +## # ==== HOW TO RENDER A LINE =================================================== +## # ============================================================================= +def how_to_render_lines args + # Render a horizontal line at the bottom + args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 0, r: 255 } + + # Render a vertical line at the left + args.lowrez.lines << { x: 0, y: 0, x2: 0, y2: 63, r: 255 } + + # Render a diagonal line starting from the bottom left and going to the top right + args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 63, r: 255 } +end + +## # ============================================================================= +## # == HOW TO RENDER A SPRITE =================================================== +## # ============================================================================= +def how_to_render_sprites args + # Loop 10 times and create 10 sprites in 10 positions + # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/lowrez-ship-blue.png' + 10.times do |i| + args.lowrez.sprites << { + x: i * 5, + y: i * 5, + w: 5, + h: 5, + path: 'sprites/lowrez-ship-blue.png' + } + end + + # Given an array of positions create sprites + positions = [ + { x: 10, y: 42 }, + { x: 15, y: 45 }, + { x: 22, y: 33 }, + ] + + positions.each do |position| + # use Ruby's ~Hash#merge~ function to create a sprite + args.lowrez.sprites << position.merge(path: 'sprites/lowrez-ship-red.png', + w: 5, + h: 5) + end +end + +## # ============================================================================= +## # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ========================== +## # ============================================================================= +def how_to_animate_a_sprite args + # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds + start_animation_on_tick = 180 + + # STEP 2: Get the frame_index given the start tick. + sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites? + hold_for: 4, # how long to hold each sprite? + repeat: true # should it repeat? + + # STEP 3: frame_index will return nil if the frame hasn't arrived yet + if sprite_index + # if the sprite_index is populated, use it to determine the sprite path and render it + sprite_path = "sprites/explosion-#{sprite_index}.png" + args.lowrez.sprites << { x: 0, y: 0, w: 64, h: 64, path: sprite_path } + else + # if the sprite_index is nil, render a countdown instead + countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1) + + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 32, + y: 32, + text: "Count Down: #{countdown_in_seconds}", + alignment_enum: 1) + end + + # render the current tick and the resolved sprite index + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 0, + y: 11, + text: "Tick: #{args.state.tick_count}") + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 0, + y: 5, + text: "sprite_index: #{sprite_index}") +end + +## # ============================================================================= +## # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) ================================= +## # ============================================================================= +def how_to_animate_a_sprite_sheet args + # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds + start_animation_on_tick = 180 + + # STEP 2: Get the frame_index given the start tick. + sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites? + hold_for: 4, # how long to hold each sprite? + repeat: true # should it repeat? + + # STEP 3: frame_index will return nil if the frame hasn't arrived yet + if sprite_index + # if the sprite_index is populated, use it to determine the source rectangle and render it + args.lowrez.sprites << { + x: 0, + y: 0, + w: 64, + h: 64, + path: "sprites/explosion-sheet.png", + source_x: 32 * sprite_index, + source_y: 0, + source_w: 32, + source_h: 32 + } + else + # if the sprite_index is nil, render a countdown instead + countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1) + + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 32, + y: 32, + text: "Count Down: #{countdown_in_seconds}", + alignment_enum: 1) + end + + # render the current tick and the resolved sprite index + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 0, + y: 11, + text: "tick: #{args.state.tick_count}") + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 0, + y: 5, + text: "sprite_index: #{sprite_index}") +end + +## # ============================================================================= +## # ==== HOW TO STORE STATE, ACCEPT INPUT, AND RENDER SPRITE BASED OFF OF STATE = +## # ============================================================================= +def how_to_move_a_sprite args + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 32, + y: 62, text: "Use Arrow Keys", + alignment_enum: 1) + + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 32, + y: 56, text: "Use WASD", + alignment_enum: 1) + + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 32, + y: 50, text: "Or Click", + alignment_enum: 1) + + # set the initial values for x and y using ||= ("or equal operator") + args.state.ship.x ||= 0 + args.state.ship.y ||= 0 + + # if a mouse click occurs, update the ship's x and y to be the location of the click + if args.lowrez.mouse_click + args.state.ship.x = args.lowrez.mouse_click.x + args.state.ship.y = args.lowrez.mouse_click.y + end + + # if a or left arrow is pressed/held, decrement the ships x position + if args.lowrez.keyboard.left + args.state.ship.x -= 1 + end + + # if d or right arrow is pressed/held, increment the ships x position + if args.lowrez.keyboard.right + args.state.ship.x += 1 + end + + # if s or down arrow is pressed/held, decrement the ships y position + if args.lowrez.keyboard.down + args.state.ship.y -= 1 + end + + # if w or up arrow is pressed/held, increment the ships y position + if args.lowrez.keyboard.up + args.state.ship.y += 1 + end + + # render the sprite to the screen using the position stored in args.state.ship + args.lowrez.sprites << { + x: args.state.ship.x, + y: args.state.ship.y, + w: 5, + h: 5, + path: 'sprites/lowrez-ship-blue.png', + # parameters beyond this point are optional + angle: 0, # Note: rotation angle is denoted in degrees NOT radians + r: 255, + g: 255, + b: 255, + a: 255 + } +end + +# ======================================================================= +# ==== HOW TO DETERMINE COLLISION ======================================= +# ======================================================================= +def how_to_determine_collision args + # Render the instructions + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 32, + y: 62, text: "Click Anywhere", + alignment_enum: 1) + + # if a mouse click occurs: + # - set ship_one if it isn't set + # - set ship_two if it isn't set + # - otherwise reset ship one and ship two + if args.lowrez.mouse_click + # is ship_one set? + if !args.state.ship_one + args.state.ship_one = { x: args.lowrez.mouse_click.x - 10, + y: args.lowrez.mouse_click.y - 10, + w: 20, + h: 20 } + # is ship_one set? + elsif !args.state.ship_two + args.state.ship_two = { x: args.lowrez.mouse_click.x - 10, + y: args.lowrez.mouse_click.y - 10, + w: 20, + h: 20 } + # should we reset? + else + args.state.ship_one = nil + args.state.ship_two = nil + end + end + + # render ship one if it's set + if args.state.ship_one + # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha + # render ship one + args.lowrez.sprites << args.state.ship_one.merge(path: 'sprites/lowrez-ship-blue.png', a: 100) + end + + if args.state.ship_two + # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha + # render ship two + args.lowrez.sprites << args.state.ship_two.merge(path: 'sprites/lowrez-ship-red.png', a: 100) + end + + # if both ship one and ship two are set, then determine collision + if args.state.ship_one && args.state.ship_two + # collision is determined using the intersect_rect? method + if args.state.ship_one.intersect_rect? args.state.ship_two + # if collision occurred, render the words collision! + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 31, + y: 5, + text: "Collision!", + alignment_enum: 1) + else + # if collision occurred, render the words no collision. + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 31, + y: 5, + text: "No Collision.", + alignment_enum: 1) + end + else + # if both ship one and ship two aren't set, then render -- + args.lowrez.labels << args.lowrez + .default_label + .merge(x: 31, + y: 6, + text: "--", + alignment_enum: 1) + end +end + +## # ============================================================================= +## # ==== HOW TO CREATE BUTTONS ================================================== +## # ============================================================================= +def how_to_create_buttons args + # Define a button style + args.state.button_style = { w: 62, h: 10, r: 80, g: 80, b: 80 } + args.state.label_style = { r: 80, g: 80, b: 80 } + + # Render instructions + args.state.button_message ||= "Press a Button!" + args.lowrez.labels << args.lowrez + .default_label + .merge(args.state.label_style) + .merge(x: 32, + y: 62, + text: args.state.button_message, + alignment_enum: 1) + + + # Creates button one using a border and a label + args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32) + args.lowrez.borders << args.state.button_one_border + args.lowrez.labels << args.lowrez + .default_label + .merge(args.state.label_style) + .merge(x: args.state.button_one_border.x + 2, + y: args.state.button_one_border.y + LOWREZ_FONT_SM_HEIGHT + 2, + text: "Button One") + + # Creates button two using a border and a label + args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20) + + args.lowrez.borders << args.state.button_two_border + args.lowrez.labels << args.lowrez + .default_label + .merge(args.state.label_style) + .merge(x: args.state.button_two_border.x + 2, + y: args.state.button_two_border.y + LOWREZ_FONT_SM_HEIGHT + 2, + text: "Button Two") + + # Initialize the state variable that tracks which button was clicked to "" (empty stringI + args.state.last_button_clicked ||= "--" + + # If a click occurs, check to see if either button one, or button two was clicked + # using the inside_rect? method of the mouse + # set args.state.last_button_clicked accordingly + if args.lowrez.mouse_click + if args.lowrez.mouse_click.inside_rect? args.state.button_one_border + args.state.last_button_clicked = "One Clicked!" + elsif args.lowrez.mouse_click.inside_rect? args.state.button_two_border + args.state.last_button_clicked = "Two Clicked!" + else + args.state.last_button_clicked = "--" + end + end + + # Render the current value of args.state.last_button_clicked + args.lowrez.labels << args.lowrez + .default_label + .merge(args.state.label_style) + .merge(x: 32, + y: 5, + text: args.state.last_button_clicked, + alignment_enum: 1) +end + + +def render_debug args + if !args.state.grid_rendered + 65.map_with_index do |i| + args.outputs.static_debug << { + x: LOWREZ_X_OFFSET, + y: LOWREZ_Y_OFFSET + (i * 10), + x2: LOWREZ_X_OFFSET + LOWREZ_ZOOMED_SIZE, + y2: LOWREZ_Y_OFFSET + (i * 10), + r: 128, + g: 128, + b: 128, + a: 80 + }.line + + args.outputs.static_debug << { + x: LOWREZ_X_OFFSET + (i * 10), + y: LOWREZ_Y_OFFSET, + x2: LOWREZ_X_OFFSET + (i * 10), + y2: LOWREZ_Y_OFFSET + LOWREZ_ZOOMED_SIZE, + r: 128, + g: 128, + b: 128, + a: 80 + }.line + end + end + + args.state.grid_rendered = true + + args.state.last_click ||= 0 + args.state.last_up ||= 0 + args.state.last_click = args.state.tick_count if args.lowrez.mouse_down # you can also use args.lowrez.click + args.state.last_up = args.state.tick_count if args.lowrez.mouse_up + args.state.label_style = { size_enum: -1.5 } + + args.state.watch_list = [ + "args.state.tick_count is: #{args.state.tick_count}", + "args.lowrez.mouse_position is: #{args.lowrez.mouse_position.x}, #{args.lowrez.mouse_position.y}", + "args.lowrez.mouse_down tick: #{args.state.last_click || "never"}", + "args.lowrez.mouse_up tick: #{args.state.last_up || "false"}", + ] + + args.outputs.debug << args.state + .watch_list + .map_with_index do |text, i| + { + x: 5, + y: 720 - (i * 20), + text: text, + size_enum: -1.5 + }.label + end + + args.outputs.debug << { + x: 640, + y: 25, + text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.", + size_enum: -0.5, + alignment_enum: 1 + }.label +end + +$gtk.reset diff --git a/samples/19_lowrez_jam/fonts/lowrez.ttf b/samples/19_lowrez_jam/fonts/lowrez.ttf Binary files differnew file mode 100644 index 0000000..2682cb0 --- /dev/null +++ b/samples/19_lowrez_jam/fonts/lowrez.ttf diff --git a/samples/19_lowrez_jam/sprites/explosion-0.png b/samples/19_lowrez_jam/sprites/explosion-0.png Binary files differnew file mode 100644 index 0000000..f48636f --- /dev/null +++ b/samples/19_lowrez_jam/sprites/explosion-0.png diff --git a/samples/19_lowrez_jam/sprites/explosion-1.png b/samples/19_lowrez_jam/sprites/explosion-1.png Binary files differnew file mode 100644 index 0000000..b4018d9 --- /dev/null +++ b/samples/19_lowrez_jam/sprites/explosion-1.png diff --git a/samples/19_lowrez_jam/sprites/explosion-2.png b/samples/19_lowrez_jam/sprites/explosion-2.png Binary files differnew file mode 100644 index 0000000..3abaedd --- /dev/null +++ b/samples/19_lowrez_jam/sprites/explosion-2.png diff --git a/samples/19_lowrez_jam/sprites/explosion-3.png b/samples/19_lowrez_jam/sprites/explosion-3.png Binary files differnew file mode 100644 index 0000000..fe94a5a --- /dev/null +++ b/samples/19_lowrez_jam/sprites/explosion-3.png diff --git a/samples/19_lowrez_jam/sprites/explosion-4.png b/samples/19_lowrez_jam/sprites/explosion-4.png Binary files differnew file mode 100644 index 0000000..ed04237 --- /dev/null +++ b/samples/19_lowrez_jam/sprites/explosion-4.png diff --git a/samples/19_lowrez_jam/sprites/explosion-5.png b/samples/19_lowrez_jam/sprites/explosion-5.png Binary files differnew file mode 100644 index 0000000..2cd8f06 --- /dev/null +++ b/samples/19_lowrez_jam/sprites/explosion-5.png diff --git a/samples/19_lowrez_jam/sprites/explosion-6.png b/samples/19_lowrez_jam/sprites/explosion-6.png Binary files differnew file mode 100644 index 0000000..e55909c --- /dev/null +++ b/samples/19_lowrez_jam/sprites/explosion-6.png diff --git a/samples/19_lowrez_jam/sprites/explosion-sheet.png b/samples/19_lowrez_jam/sprites/explosion-sheet.png Binary files differnew file mode 100644 index 0000000..8559a5c --- /dev/null +++ b/samples/19_lowrez_jam/sprites/explosion-sheet.png diff --git a/samples/19_lowrez_jam/sprites/lowrez-ship-blue.png b/samples/19_lowrez_jam/sprites/lowrez-ship-blue.png Binary files differnew file mode 100644 index 0000000..7a3d3aa --- /dev/null +++ b/samples/19_lowrez_jam/sprites/lowrez-ship-blue.png diff --git a/samples/19_lowrez_jam/sprites/lowrez-ship-red.png b/samples/19_lowrez_jam/sprites/lowrez-ship-red.png Binary files differnew file mode 100644 index 0000000..dd1a1d4 --- /dev/null +++ b/samples/19_lowrez_jam/sprites/lowrez-ship-red.png diff --git a/samples/20_roguelike_starting_point/app/main.rb b/samples/20_roguelike_starting_point/app/main.rb new file mode 100644 index 0000000..66ff027 --- /dev/null +++ b/samples/20_roguelike_starting_point/app/main.rb @@ -0,0 +1,439 @@ +=begin + + APIs listing that haven't been encountered in previous sample apps: + + - lambda: A way to define a block and its parameters with special syntax. + For example, the syntax of lambda looks like this: + my_lambda = -> { puts "This is my lambda" } + + Reminders: + - args.outputs.labels: An array. The values generate a label. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels. + + - ARRAY#inside_rect?: Returns whether or not the point is inside a rect. + + - product: Returns an array of all combinations of elements from all arrays. + + - find: Finds all elements of a collection that meet requirements. + + - abs: Returns the absolute value. + +=end + +# This sample app allows the player to move around in the dungeon, which becomes more or less visible +# depending on the player's location, and also has enemies. + +class Game + attr_accessor :args, :state, :inputs, :outputs, :grid + + # Calls all the methods needed for the game to run properly. + def tick + defaults + render_canvas + render_dungeon + render_player + render_enemies + print_cell_coordinates + calc_canvas + input_move + input_click_map + end + + # Sets default values and initializes variables + def defaults + outputs.background_color = [0, 0, 0] # black background + + # Initializes empty canvas, dungeon, and enemies collections. + state.canvas ||= [] + state.dungeon ||= [] + state.enemies ||= [] + + # If state.area doesn't have value, load_area_one and derive_dungeon_from_area methods are called + if !state.area + load_area_one + derive_dungeon_from_area + + # Changing these values will change the position of player + state.x = 7 + state.y = 5 + + # Creates new enemies, sets their values, and adds them to the enemies collection. + state.enemies << state.new_entity(:enemy) do |e| # declares each enemy as new entity + e.x = 13 # position + e.y = 5 + e.previous_hp = 3 + e.hp = 3 + e.max_hp = 3 + e.is_dead = false # the enemy is alive + end + + update_line_of_sight # updates line of sight by adding newly visible cells + end + end + + # Adds elements into the state.area collection + # The dungeon is derived using the coordinates of this collection + def load_area_one + state.area ||= [] + state.area << [8, 6] + state.area << [7, 6] + state.area << [7, 7] + state.area << [8, 9] + state.area << [7, 8] + state.area << [7, 9] + state.area << [6, 4] + state.area << [7, 3] + state.area << [7, 4] + state.area << [6, 5] + state.area << [7, 5] + state.area << [8, 5] + state.area << [8, 4] + state.area << [1, 1] + state.area << [0, 1] + state.area << [0, 2] + state.area << [1, 2] + state.area << [2, 2] + state.area << [2, 1] + state.area << [2, 3] + state.area << [1, 3] + state.area << [1, 4] + state.area << [2, 4] + state.area << [2, 5] + state.area << [1, 5] + state.area << [2, 6] + state.area << [3, 6] + state.area << [4, 6] + state.area << [4, 7] + state.area << [4, 8] + state.area << [5, 8] + state.area << [5, 9] + state.area << [6, 9] + state.area << [7, 10] + state.area << [7, 11] + state.area << [7, 12] + state.area << [7, 12] + state.area << [7, 13] + state.area << [8, 13] + state.area << [9, 13] + state.area << [10, 13] + state.area << [11, 13] + state.area << [12, 13] + state.area << [12, 12] + state.area << [8, 12] + state.area << [9, 12] + state.area << [10, 12] + state.area << [11, 12] + state.area << [12, 11] + state.area << [13, 11] + state.area << [13, 10] + state.area << [13, 9] + state.area << [13, 8] + state.area << [13, 7] + state.area << [13, 6] + state.area << [12, 6] + state.area << [14, 6] + state.area << [14, 5] + state.area << [13, 5] + state.area << [12, 5] + state.area << [12, 4] + state.area << [13, 4] + state.area << [14, 4] + state.area << [1, 6] + state.area << [6, 6] + end + + # Starts with an empty dungeon collection, and adds dungeon cells into it. + def derive_dungeon_from_area + state.dungeon = [] # starts as empty collection + + state.area.each do |a| # for each element of the area collection + state.dungeon << state.new_entity(:dungeon_cell) do |d| # declares each dungeon cell as new entity + d.x = a.x # dungeon cell position using coordinates from area + d.y = a.y + d.is_visible = false # cell is not visible + d.alpha = 0 # not transparent at all + d.border = [left_margin + a.x * grid_size, + bottom_margin + a.y * grid_size, + grid_size, + grid_size, + *blue, + 255] # sets border definition for dungeon cell + d # returns dungeon cell + end + end + end + + def left_margin + 40 # sets left margin + end + + def bottom_margin + 60 # sets bottom margin + end + + def grid_size + 40 # sets size of grid square + end + + # Updates the line of sight by calling the thick_line_of_sight method and + # adding dungeon cells to the newly_visible collection + def update_line_of_sight + variations = [-1, 0, 1] + # creates collection of newly visible dungeon cells + newly_visible = variations.product(variations).flat_map do |rise, run| # combo of all elements + thick_line_of_sight state.x, state.y, rise, run, 15, # calls thick_line_of_sight method + lambda { |x, y| dungeon_cell_exists? x, y } # checks whether or not cell exists + end.uniq# removes duplicates + + state.dungeon.each do |d| # perform action on each element of dungeons collection + d.is_visible = newly_visible.find { |v| v.x == d.x && v.y == d.y } # finds match inside newly_visible collection + end + end + + #Returns a boolean value + def dungeon_cell_exists? x, y + # Finds cell coordinates inside dungeon collection to determine if dungeon cell exists + state.dungeon.find { |d| d.x == x && d.y == y } + end + + # Calls line_of_sight method to add elements to result collection + def thick_line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda + result = [] + result += line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda + result += line_of_sight start_x - 1, start_y, rise, run, distance, cell_exists_lambda # one left + result += line_of_sight start_x + 1, start_y, rise, run, distance, cell_exists_lambda # one right + result + end + + # Adds points to the result collection to create the player's line of sight + def line_of_sight start_x, start_y, rise, run, distance, cell_exists_lambda + result = [] # starts as empty collection + points = points_on_line start_x, start_y, rise, run, distance # calls points_on_line method + points.each do |p| # for each point in collection + if cell_exists_lambda.call(p.x, p.y) # if the cell exists + result << p # add it to result collection + else # if cell does not exist + return result # return result collection as it is + end + end + + result # return result collection + end + + # Finds the coordinates of the points on the line by performing calculations + def points_on_line start_x, start_y, rise, run, distance + distance.times.map do |i| # perform an action + [start_x + run * i, start_y + rise * i] # definition of point + end + end + + def render_canvas + return + outputs.borders << state.canvas.map do |c| # on each element of canvas collection + c.border # outputs border + end + end + + # Outputs the dungeon cells. + def render_dungeon + outputs.solids << [0, 0, grid.w, grid.h] # outputs black background for grid + + # Sets the alpha value (opacity) for each dungeon cell and calls the cell_border method. + outputs.borders << state.dungeon.map do |d| # for each element in dungeon collection + d.alpha += if d.is_visible # if cell is visible + 255.fdiv(30) # increment opacity (transparency) + else # if cell is not visible + 255.fdiv(600) * -1 # decrease opacity + end + d.alpha = d.alpha.cap_min_max(0, 255) + cell_border d.x, d.y, [*blue, d.alpha] # sets blue border using alpha value + end.reject_nil + end + + # Sets definition of a cell border using the parameters + def cell_border x, y, color = nil + [left_margin + x * grid_size, + bottom_margin + y * grid_size, + grid_size, + grid_size, + *color] + end + + # Sets the values for the player and outputs it as a label + def render_player + outputs.labels << [grid_x(state.x) + 20, # positions "@" text in center of grid square + grid_y(state.y) + 35, + "@", # player is represented by a white "@" character + 1, 1, *white] + end + + def grid_x x + left_margin + x * grid_size # positions horizontally on grid + end + + def grid_y y + bottom_margin + y * grid_size # positions vertically on grid + end + + # Outputs enemies onto the screen. + def render_enemies + state.enemies.map do |e| # for each enemy in the collection + alpha = 255 # set opacity (full transparency) + + # Outputs an enemy using a label. + outputs.labels << [ + left_margin + 20 + e.x * grid_size, # positions enemy's "r" text in center of grid square + bottom_margin + 35 + e.y * grid_size, + "r", # enemy's text + 1, 1, *white, alpha] + + # Creates a red border around an enemy. + outputs.borders << [grid_x(e.x), grid_y(e.y), grid_size, grid_size, *red] + end + end + + #White labels are output for the cell coordinates of each element in the dungeon collection. + def print_cell_coordinates + return unless state.debug + state.dungeon.each do |d| + outputs.labels << [grid_x(d.x) + 2, + grid_y(d.y) - 2, + "#{d.x},#{d.y}", + -2, 0, *white] + end + end + + # Adds new elements into the canvas collection and sets their values. + def calc_canvas + return if state.canvas.length > 0 # return if canvas collection has at least one element + 15.times do |x| # 15 times perform an action + 15.times do |y| + state.canvas << state.new_entity(:canvas) do |c| # declare canvas element as new entity + c.x = x # set position + c.y = y + c.border = [left_margin + x * grid_size, + bottom_margin + y * grid_size, + grid_size, + grid_size, + *white, 30] # sets border definition + end + end + end + end + + # Updates x and y values of the player, and updates player's line of sight + def input_move + x, y, x_diff, y_diff = input_target_cell + + return unless dungeon_cell_exists? x, y # player can't move there if a dungeon cell doesn't exist in that location + return if enemy_at x, y # player can't move there if there is an enemy in that location + + state.x += x_diff # increments x by x_diff (so player moves left or right) + state.y += y_diff # same with y and y_diff ( so player moves up or down) + update_line_of_sight # updates visible cells + end + + def enemy_at x, y + # Finds if coordinates exist in enemies collection and enemy is not dead + state.enemies.find { |e| e.x == x && e.y == y && !e.is_dead } + end + + #M oves the user based on their keyboard input and sets values for target cell + def input_target_cell + if inputs.keyboard.key_down.up # if "up" key is in "down" state + [state.x, state.y + 1, 0, 1] # user moves up + elsif inputs.keyboard.key_down.down # if "down" key is pressed + [state.x, state.y - 1, 0, -1] # user moves down + elsif inputs.keyboard.key_down.left # if "left" key is pressed + [state.x - 1, state.y, -1, 0] # user moves left + elsif inputs.keyboard.key_down.right # if "right" key is pressed + [state.x + 1, state.y, 1, 0] # user moves right + else + nil # otherwise, empty + end + end + + # Goes through the canvas collection to find if the mouse was clicked inside of the borders of an element. + def input_click_map + return unless inputs.mouse.click # return unless the mouse is clicked + canvas_entry = state.canvas.find do |c| # find element from canvas collection that meets requirements + inputs.mouse.click.inside_rect? c.border # find border that mouse was clicked inside of + end + puts canvas_entry # prints canvas_entry value + end + + # Sets the definition of a label using the parameters. + def label text, x, y, color = nil + color ||= white # color is initialized to white + [x, y, text, 1, 1, *color] # sets label definition + end + + def green + [60, 200, 100] # sets color saturation to shade of green + end + + def blue + [50, 50, 210] # sets color saturation to shade of blue + end + + def white + [255, 255, 255] # sets color saturation to white + end + + def red + [230, 80, 80] # sets color saturation to shade of red + end + + def orange + [255, 80, 60] # sets color saturation to shade of orange + end + + def pink + [255, 0, 200] # sets color saturation to shade of pink + end + + def gray + [75, 75, 75] # sets color saturation to shade of gray + end + + # Recolors the border using the parameters. + def recolor_border border, r, g, b + border[4] = r + border[5] = g + border[6] = b + border + end + + # Returns a boolean value. + def visible? cell + # finds cell's coordinates inside visible_cells collections to determine if cell is visible + state.visible_cells.find { |c| c.x == cell.x && c.y == cell.y} + end + + # Exports dungeon by printing dungeon cell coordinates + def export_dungeon + state.dungeon.each do |d| # on each element of dungeon collection + puts "state.dungeon << [#{d.x}, #{d.y}]" # prints cell coordinates + end + end + + def distance_to_cell cell + distance_to state.x, cell.x, state.y, cell.y # calls distance_to method + end + + def distance_to from_x, x, from_y, y + (from_x - x).abs + (from_y - y).abs # finds distance between two cells using coordinates + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.state = args.state + $game.inputs = args.inputs + $game.outputs = args.outputs + $game.grid = args.grid + $game.tick +end diff --git a/samples/20_roguelike_starting_point/license-for-sample.txt b/samples/20_roguelike_starting_point/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/20_roguelike_starting_point/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/20_roguelike_starting_point/replay.txt b/samples/20_roguelike_starting_point/replay.txt new file mode 100644 index 0000000..a2b4c52 --- /dev/null +++ b/samples/20_roguelike_starting_point/replay.txt @@ -0,0 +1,555 @@ +replay_version 2.0 +stopped_at 1731 +seed 100 +recorded_at Sun Sep 29 22:38:52 2019 +[:mouse_move, 785, 468, 2, 1, 114] +[:mouse_move, 756, 468, 2, 2, 115] +[:mouse_move, 745, 468, 2, 3, 117] +[:mouse_move, 718, 470, 2, 4, 118] +[:mouse_move, 705, 472, 2, 5, 119] +[:mouse_move, 680, 476, 2, 6, 120] +[:mouse_move, 668, 478, 2, 7, 121] +[:mouse_move, 606, 492, 2, 8, 122] +[:mouse_move, 581, 499, 2, 9, 123] +[:mouse_move, 523, 511, 2, 10, 124] +[:mouse_move, 417, 527, 2, 11, 125] +[:mouse_move, 387, 528, 2, 12, 126] +[:mouse_move, 344, 528, 2, 13, 127] +[:mouse_move, 324, 526, 2, 14, 128] +[:mouse_move, 295, 520, 2, 15, 129] +[:mouse_move, 285, 518, 2, 16, 130] +[:mouse_move, 276, 515, 2, 17, 131] +[:mouse_move, 255, 512, 2, 18, 132] +[:mouse_move, 244, 511, 2, 19, 133] +[:mouse_move, 228, 511, 2, 20, 134] +[:mouse_move, 213, 513, 2, 21, 135] +[:mouse_move, 194, 523, 2, 22, 136] +[:mouse_move, 190, 526, 2, 23, 137] +[:mouse_move, 183, 532, 2, 24, 138] +[:mouse_move, 180, 533, 2, 25, 139] +[:mouse_move, 177, 536, 2, 26, 140] +[:mouse_move, 177, 537, 2, 27, 141] +[:mouse_move, 193, 537, 2, 28, 142] +[:mouse_move, 208, 536, 2, 29, 143] +[:mouse_move, 222, 536, 2, 30, 144] +[:mouse_move, 232, 535, 2, 31, 145] +[:mouse_move, 241, 535, 2, 32, 146] +[:mouse_move, 245, 535, 2, 33, 147] +[:mouse_move, 249, 535, 2, 34, 148] +[:mouse_move, 250, 535, 2, 35, 149] +[:mouse_move, 251, 535, 2, 36, 150] +[:mouse_move, 252, 534, 2, 37, 151] +[:mouse_move, 256, 531, 2, 38, 152] +[:mouse_move, 259, 527, 2, 39, 153] +[:mouse_move, 265, 520, 2, 40, 154] +[:mouse_move, 270, 515, 2, 41, 155] +[:mouse_move, 274, 511, 2, 42, 156] +[:mouse_move, 282, 501, 2, 43, 157] +[:mouse_move, 293, 490, 2, 44, 159] +[:mouse_move, 295, 489, 2, 45, 160] +[:mouse_move, 299, 487, 2, 46, 161] +[:mouse_move, 301, 485, 2, 47, 162] +[:mouse_move, 303, 484, 2, 48, 163] +[:mouse_move, 304, 484, 2, 49, 164] +[:mouse_move, 306, 484, 2, 50, 165] +[:mouse_move, 307, 484, 2, 51, 166] +[:mouse_move, 308, 484, 2, 52, 167] +[:mouse_move, 310, 484, 2, 53, 168] +[:mouse_move, 314, 484, 2, 54, 169] +[:mouse_move, 316, 484, 2, 55, 170] +[:mouse_move, 317, 484, 2, 56, 171] +[:mouse_move, 318, 484, 2, 57, 172] +[:mouse_move, 319, 484, 2, 58, 173] +[:key_down_raw, 1073741906, 0, 2, 59, 232] +[:key_up_raw, 1073741906, 0, 2, 60, 237] +[:key_down_raw, 1073741906, 0, 2, 61, 243] +[:key_up_raw, 1073741906, 0, 2, 62, 247] +[:key_down_raw, 1073741906, 0, 2, 63, 254] +[:key_up_raw, 1073741906, 0, 2, 64, 257] +[:key_down_raw, 1073741906, 0, 2, 65, 266] +[:key_up_raw, 1073741906, 0, 2, 66, 272] +[:key_down_raw, 1073741906, 0, 2, 67, 279] +[:key_up_raw, 1073741906, 0, 2, 68, 284] +[:key_down_raw, 1073741905, 0, 2, 69, 326] +[:key_up_raw, 1073741905, 0, 2, 70, 334] +[:key_down_raw, 1073741904, 0, 2, 71, 421] +[:key_up_raw, 1073741904, 0, 2, 72, 428] +[:key_down_raw, 1073741904, 0, 2, 73, 438] +[:key_up_raw, 1073741904, 0, 2, 74, 445] +[:key_down_raw, 1073741905, 0, 2, 75, 459] +[:key_up_raw, 1073741905, 0, 2, 76, 466] +[:key_down_raw, 1073741904, 0, 2, 77, 480] +[:key_up_raw, 1073741904, 0, 2, 78, 488] +[:key_down_raw, 1073741905, 0, 2, 79, 499] +[:key_up_raw, 1073741905, 0, 2, 80, 507] +[:mouse_move, 289, 484, 2, 81, 545] +[:mouse_move, 274, 484, 2, 82, 546] +[:mouse_move, 244, 484, 2, 83, 547] +[:mouse_move, 231, 485, 2, 84, 548] +[:mouse_move, 208, 485, 2, 85, 549] +[:mouse_move, 199, 485, 2, 86, 550] +[:mouse_move, 178, 485, 2, 87, 551] +[:mouse_move, 174, 485, 2, 88, 552] +[:mouse_move, 162, 483, 2, 89, 553] +[:mouse_move, 159, 482, 2, 90, 554] +[:mouse_move, 157, 477, 2, 91, 555] +[:mouse_move, 157, 473, 2, 92, 556] +[:mouse_move, 161, 465, 2, 93, 557] +[:mouse_move, 165, 459, 2, 94, 558] +[:mouse_move, 174, 449, 2, 95, 559] +[:mouse_move, 179, 443, 2, 96, 560] +[:mouse_move, 191, 431, 2, 97, 561] +[:mouse_move, 196, 425, 2, 98, 562] +[:mouse_move, 205, 413, 2, 99, 563] +[:mouse_move, 210, 408, 2, 100, 564] +[:mouse_move, 212, 406, 2, 101, 565] +[:mouse_move, 219, 397, 2, 102, 566] +[:mouse_move, 223, 395, 2, 103, 567] +[:mouse_move, 228, 390, 2, 104, 568] +[:mouse_move, 230, 388, 2, 105, 569] +[:mouse_move, 233, 386, 2, 106, 570] +[:mouse_move, 234, 385, 2, 107, 571] +[:mouse_move, 235, 384, 2, 108, 573] +[:mouse_move, 234, 384, 2, 109, 580] +[:mouse_move, 234, 382, 2, 110, 622] +[:mouse_move, 234, 379, 2, 111, 623] +[:mouse_move, 236, 374, 2, 112, 624] +[:mouse_move, 237, 371, 2, 113, 625] +[:mouse_move, 240, 366, 2, 114, 626] +[:mouse_move, 241, 364, 2, 115, 627] +[:mouse_move, 243, 362, 2, 116, 628] +[:mouse_move, 243, 361, 2, 117, 629] +[:mouse_move, 242, 361, 2, 118, 632] +[:mouse_move, 239, 361, 2, 119, 633] +[:mouse_move, 229, 367, 2, 120, 634] +[:mouse_move, 223, 372, 2, 121, 635] +[:mouse_move, 208, 385, 2, 122, 636] +[:mouse_move, 198, 393, 2, 123, 637] +[:mouse_move, 179, 410, 2, 124, 638] +[:mouse_move, 169, 421, 2, 125, 639] +[:mouse_move, 149, 440, 2, 126, 640] +[:mouse_move, 139, 451, 2, 127, 641] +[:mouse_move, 127, 465, 2, 128, 642] +[:mouse_move, 119, 473, 2, 129, 643] +[:mouse_move, 108, 486, 2, 130, 644] +[:mouse_move, 103, 491, 2, 131, 645] +[:mouse_move, 98, 496, 2, 132, 646] +[:mouse_move, 96, 498, 2, 133, 647] +[:mouse_move, 94, 500, 2, 134, 648] +[:mouse_move, 92, 501, 2, 135, 649] +[:mouse_move, 91, 502, 2, 136, 650] +[:mouse_move, 92, 500, 2, 137, 653] +[:mouse_move, 95, 498, 2, 138, 654] +[:mouse_move, 105, 488, 2, 139, 655] +[:mouse_move, 112, 482, 2, 140, 656] +[:mouse_move, 128, 463, 2, 141, 657] +[:mouse_move, 138, 450, 2, 142, 658] +[:mouse_move, 159, 419, 2, 143, 659] +[:mouse_move, 168, 403, 2, 144, 660] +[:mouse_move, 182, 382, 2, 145, 661] +[:mouse_move, 188, 370, 2, 146, 662] +[:mouse_move, 200, 354, 2, 147, 663] +[:mouse_move, 205, 348, 2, 148, 664] +[:mouse_move, 214, 338, 2, 149, 665] +[:mouse_move, 218, 335, 2, 150, 666] +[:mouse_move, 222, 331, 2, 151, 667] +[:mouse_move, 224, 330, 2, 152, 668] +[:mouse_move, 226, 328, 2, 153, 669] +[:mouse_move, 227, 328, 2, 154, 670] +[:mouse_move, 222, 329, 2, 155, 674] +[:mouse_move, 219, 332, 2, 156, 675] +[:mouse_move, 207, 342, 2, 157, 676] +[:mouse_move, 201, 350, 2, 158, 677] +[:mouse_move, 184, 370, 2, 159, 678] +[:mouse_move, 173, 384, 2, 160, 679] +[:mouse_move, 151, 415, 2, 161, 680] +[:mouse_move, 140, 431, 2, 162, 681] +[:mouse_move, 119, 458, 2, 163, 682] +[:mouse_move, 114, 463, 2, 164, 683] +[:mouse_move, 99, 478, 2, 165, 684] +[:mouse_move, 97, 480, 2, 166, 685] +[:mouse_move, 88, 490, 2, 167, 686] +[:mouse_move, 85, 493, 2, 168, 687] +[:mouse_move, 82, 496, 2, 169, 688] +[:mouse_move, 81, 497, 2, 170, 689] +[:mouse_move, 82, 497, 2, 171, 692] +[:mouse_move, 84, 496, 2, 172, 693] +[:mouse_move, 94, 489, 2, 173, 694] +[:mouse_move, 101, 482, 2, 174, 695] +[:mouse_move, 119, 463, 2, 175, 696] +[:mouse_move, 129, 451, 2, 176, 697] +[:mouse_move, 151, 426, 2, 177, 698] +[:mouse_move, 155, 420, 2, 178, 699] +[:mouse_move, 172, 401, 2, 179, 700] +[:mouse_move, 178, 393, 2, 180, 701] +[:mouse_move, 185, 387, 2, 181, 702] +[:mouse_move, 197, 376, 2, 182, 703] +[:mouse_move, 202, 371, 2, 183, 704] +[:mouse_move, 209, 365, 2, 184, 705] +[:mouse_move, 215, 360, 2, 185, 706] +[:mouse_move, 218, 357, 2, 186, 707] +[:mouse_move, 222, 353, 2, 187, 708] +[:mouse_move, 225, 351, 2, 188, 709] +[:mouse_move, 226, 350, 2, 189, 710] +[:mouse_move, 227, 348, 2, 190, 711] +[:mouse_move, 228, 348, 2, 191, 712] +[:mouse_move, 229, 347, 2, 192, 713] +[:mouse_move, 229, 346, 2, 193, 715] +[:mouse_move, 225, 352, 2, 194, 721] +[:mouse_move, 219, 361, 2, 195, 722] +[:mouse_move, 201, 385, 2, 196, 723] +[:mouse_move, 193, 393, 2, 197, 724] +[:mouse_move, 165, 424, 2, 198, 725] +[:mouse_move, 151, 439, 2, 199, 726] +[:mouse_move, 127, 468, 2, 200, 727] +[:mouse_move, 116, 480, 2, 201, 728] +[:mouse_move, 106, 490, 2, 202, 729] +[:mouse_move, 92, 504, 2, 203, 730] +[:mouse_move, 84, 512, 2, 204, 731] +[:mouse_move, 77, 519, 2, 205, 732] +[:mouse_move, 73, 523, 2, 206, 733] +[:mouse_move, 69, 527, 2, 207, 734] +[:mouse_move, 68, 527, 2, 208, 735] +[:mouse_move, 68, 528, 2, 209, 736] +[:mouse_move, 70, 525, 2, 210, 738] +[:mouse_move, 73, 522, 2, 211, 739] +[:mouse_move, 86, 511, 2, 212, 740] +[:mouse_move, 93, 503, 2, 213, 741] +[:mouse_move, 117, 477, 2, 214, 742] +[:mouse_move, 123, 469, 2, 215, 743] +[:mouse_move, 156, 427, 2, 216, 744] +[:mouse_move, 169, 407, 2, 217, 745] +[:mouse_move, 187, 376, 2, 218, 746] +[:mouse_move, 199, 356, 2, 219, 747] +[:mouse_move, 221, 318, 2, 220, 748] +[:mouse_move, 231, 302, 2, 221, 749] +[:mouse_move, 250, 276, 2, 222, 750] +[:mouse_move, 260, 266, 2, 223, 751] +[:mouse_move, 267, 259, 2, 224, 752] +[:mouse_move, 272, 254, 2, 225, 753] +[:mouse_move, 279, 247, 2, 226, 754] +[:mouse_move, 281, 245, 2, 227, 755] +[:mouse_move, 282, 245, 2, 228, 756] +[:mouse_move, 283, 244, 2, 229, 757] +[:key_down_raw, 1073741906, 0, 2, 230, 813] +[:key_up_raw, 1073741906, 0, 2, 231, 820] +[:key_down_raw, 1073741903, 0, 2, 232, 833] +[:key_up_raw, 1073741903, 0, 2, 233, 840] +[:key_down_raw, 1073741903, 0, 2, 234, 848] +[:key_up_raw, 1073741903, 0, 2, 235, 855] +[:key_down_raw, 1073741906, 0, 2, 236, 862] +[:key_up_raw, 1073741906, 0, 2, 237, 870] +[:key_down_raw, 1073741903, 0, 2, 238, 880] +[:key_up_raw, 1073741903, 0, 2, 239, 901] +[:key_down_raw, 1073741903, 0, 2, 240, 917] +[:key_up_raw, 1073741903, 0, 2, 241, 924] +[:key_down_raw, 1073741905, 0, 2, 242, 943] +[:key_up_raw, 1073741905, 0, 2, 243, 948] +[:key_down_raw, 1073741905, 0, 2, 244, 952] +[:key_up_raw, 1073741905, 0, 2, 245, 956] +[:key_down_raw, 1073741905, 0, 2, 246, 960] +[:key_up_raw, 1073741905, 0, 2, 247, 963] +[:key_down_raw, 1073741905, 0, 2, 248, 967] +[:key_up_raw, 1073741905, 0, 2, 249, 972] +[:mouse_move, 244, 247, 2, 250, 997] +[:mouse_move, 229, 253, 2, 251, 998] +[:mouse_move, 174, 283, 2, 252, 999] +[:mouse_move, 152, 299, 2, 253, 1000] +[:mouse_move, 133, 313, 2, 254, 1001] +[:mouse_move, 63, 372, 2, 255, 1002] +[:mouse_move, 53, 384, 2, 256, 1003] +[:mouse_move, 40, 399, 2, 257, 1004] +[:mouse_move, 20, 424, 2, 258, 1005] +[:mouse_move, 13, 440, 2, 259, 1006] +[:mouse_move, 12, 445, 2, 260, 1007] +[:mouse_move, 12, 450, 2, 261, 1008] +[:mouse_move, 12, 451, 2, 262, 1009] +[:mouse_move, 13, 454, 2, 263, 1010] +[:mouse_move, 14, 454, 2, 264, 1011] +[:mouse_move, 15, 455, 2, 265, 1012] +[:mouse_move, 15, 454, 2, 266, 1014] +[:mouse_move, 15, 452, 2, 267, 1015] +[:mouse_move, 15, 447, 2, 268, 1016] +[:mouse_move, 15, 443, 2, 269, 1017] +[:mouse_move, 16, 438, 2, 270, 1018] +[:mouse_move, 17, 435, 2, 271, 1019] +[:mouse_move, 19, 431, 2, 272, 1020] +[:mouse_move, 20, 430, 2, 273, 1021] +[:mouse_move, 22, 428, 2, 274, 1022] +[:mouse_move, 23, 427, 2, 275, 1023] +[:mouse_move, 25, 426, 2, 276, 1024] +[:mouse_move, 26, 426, 2, 277, 1025] +[:mouse_move, 29, 426, 2, 278, 1026] +[:mouse_move, 30, 426, 2, 279, 1028] +[:mouse_move, 31, 427, 2, 280, 1029] +[:mouse_move, 32, 428, 2, 281, 1030] +[:mouse_move, 33, 431, 2, 282, 1031] +[:mouse_move, 34, 432, 2, 283, 1032] +[:mouse_move, 35, 437, 2, 284, 1033] +[:mouse_move, 36, 439, 2, 285, 1034] +[:mouse_move, 37, 444, 2, 286, 1035] +[:mouse_move, 39, 449, 2, 287, 1036] +[:mouse_move, 44, 460, 2, 288, 1037] +[:mouse_move, 45, 464, 2, 289, 1038] +[:mouse_move, 52, 475, 2, 290, 1039] +[:mouse_move, 55, 479, 2, 291, 1040] +[:mouse_move, 62, 485, 2, 292, 1041] +[:mouse_move, 66, 487, 2, 293, 1042] +[:mouse_move, 74, 488, 2, 294, 1043] +[:mouse_move, 79, 488, 2, 295, 1044] +[:mouse_move, 89, 484, 2, 296, 1045] +[:mouse_move, 95, 480, 2, 297, 1046] +[:mouse_move, 111, 468, 2, 298, 1047] +[:mouse_move, 115, 466, 2, 299, 1048] +[:mouse_move, 134, 453, 2, 300, 1049] +[:mouse_move, 142, 447, 2, 301, 1050] +[:mouse_move, 160, 437, 2, 302, 1051] +[:mouse_move, 170, 431, 2, 303, 1052] +[:mouse_move, 179, 425, 2, 304, 1053] +[:mouse_move, 192, 417, 2, 305, 1054] +[:mouse_move, 200, 411, 2, 306, 1055] +[:mouse_move, 213, 401, 2, 307, 1056] +[:mouse_move, 219, 396, 2, 308, 1057] +[:mouse_move, 230, 386, 2, 309, 1058] +[:mouse_move, 238, 375, 2, 310, 1059] +[:mouse_move, 244, 363, 2, 311, 1060] +[:mouse_move, 247, 355, 2, 312, 1061] +[:mouse_move, 253, 341, 2, 313, 1062] +[:mouse_move, 255, 335, 2, 314, 1063] +[:mouse_move, 257, 321, 2, 315, 1064] +[:mouse_move, 258, 309, 2, 316, 1065] +[:mouse_move, 257, 298, 2, 317, 1066] +[:mouse_move, 255, 291, 2, 318, 1067] +[:mouse_move, 249, 281, 2, 319, 1068] +[:mouse_move, 242, 271, 2, 320, 1069] +[:mouse_move, 233, 264, 2, 321, 1070] +[:mouse_move, 226, 260, 2, 322, 1071] +[:mouse_move, 207, 252, 2, 323, 1072] +[:mouse_move, 203, 251, 2, 324, 1073] +[:mouse_move, 185, 249, 2, 325, 1074] +[:mouse_move, 178, 249, 2, 326, 1075] +[:mouse_move, 161, 249, 2, 327, 1076] +[:mouse_move, 153, 250, 2, 328, 1077] +[:mouse_move, 139, 256, 2, 329, 1078] +[:mouse_move, 132, 259, 2, 330, 1079] +[:mouse_move, 120, 269, 2, 331, 1080] +[:mouse_move, 110, 279, 2, 332, 1081] +[:mouse_move, 104, 287, 2, 333, 1082] +[:mouse_move, 93, 304, 2, 334, 1083] +[:mouse_move, 87, 313, 2, 335, 1084] +[:mouse_move, 80, 326, 2, 336, 1085] +[:mouse_move, 75, 335, 2, 337, 1086] +[:mouse_move, 69, 351, 2, 338, 1087] +[:mouse_move, 67, 359, 2, 339, 1088] +[:mouse_move, 64, 376, 2, 340, 1089] +[:mouse_move, 64, 383, 2, 341, 1090] +[:mouse_move, 62, 399, 2, 342, 1091] +[:mouse_move, 62, 406, 2, 343, 1092] +[:mouse_move, 62, 418, 2, 344, 1093] +[:mouse_move, 62, 423, 2, 345, 1094] +[:mouse_move, 66, 433, 2, 346, 1095] +[:mouse_move, 69, 437, 2, 347, 1096] +[:mouse_move, 78, 444, 2, 348, 1097] +[:mouse_move, 86, 450, 2, 349, 1098] +[:mouse_move, 102, 457, 2, 350, 1099] +[:mouse_move, 112, 458, 2, 351, 1100] +[:mouse_move, 136, 461, 2, 352, 1101] +[:mouse_move, 142, 461, 2, 353, 1102] +[:mouse_move, 162, 460, 2, 354, 1103] +[:mouse_move, 172, 459, 2, 355, 1104] +[:mouse_move, 188, 454, 2, 356, 1105] +[:mouse_move, 195, 451, 2, 357, 1106] +[:mouse_move, 211, 443, 2, 358, 1107] +[:mouse_move, 214, 440, 2, 359, 1108] +[:mouse_move, 222, 432, 2, 360, 1109] +[:mouse_move, 233, 412, 2, 361, 1110] +[:mouse_move, 238, 400, 2, 362, 1111] +[:mouse_move, 248, 375, 2, 363, 1112] +[:mouse_move, 250, 370, 2, 364, 1113] +[:mouse_move, 258, 351, 2, 365, 1114] +[:mouse_move, 261, 343, 2, 366, 1115] +[:mouse_move, 264, 328, 2, 367, 1116] +[:mouse_move, 264, 321, 2, 368, 1117] +[:mouse_move, 265, 307, 2, 369, 1118] +[:mouse_move, 265, 305, 2, 370, 1119] +[:mouse_move, 264, 296, 2, 371, 1120] +[:mouse_move, 262, 289, 2, 372, 1121] +[:mouse_move, 257, 282, 2, 373, 1122] +[:mouse_move, 252, 277, 2, 374, 1123] +[:mouse_move, 237, 271, 2, 375, 1124] +[:mouse_move, 227, 269, 2, 376, 1125] +[:mouse_move, 211, 268, 2, 377, 1126] +[:mouse_move, 201, 268, 2, 378, 1127] +[:mouse_move, 177, 268, 2, 379, 1128] +[:mouse_move, 168, 269, 2, 380, 1129] +[:mouse_move, 149, 274, 2, 381, 1130] +[:mouse_move, 137, 279, 2, 382, 1131] +[:mouse_move, 124, 288, 2, 383, 1132] +[:mouse_move, 116, 294, 2, 384, 1133] +[:mouse_move, 102, 307, 2, 385, 1134] +[:mouse_move, 91, 319, 2, 386, 1135] +[:mouse_move, 88, 323, 2, 387, 1136] +[:mouse_move, 73, 344, 2, 388, 1137] +[:mouse_move, 68, 353, 2, 389, 1138] +[:mouse_move, 57, 374, 2, 390, 1139] +[:mouse_move, 52, 386, 2, 391, 1140] +[:mouse_move, 44, 412, 2, 392, 1141] +[:mouse_move, 42, 418, 2, 393, 1142] +[:mouse_move, 36, 437, 2, 394, 1143] +[:mouse_move, 34, 445, 2, 395, 1144] +[:mouse_move, 33, 453, 2, 396, 1145] +[:mouse_move, 32, 457, 2, 397, 1146] +[:mouse_move, 32, 466, 2, 398, 1147] +[:mouse_move, 33, 468, 2, 399, 1148] +[:mouse_move, 38, 475, 2, 400, 1149] +[:mouse_move, 44, 482, 2, 401, 1150] +[:mouse_move, 56, 492, 2, 402, 1151] +[:mouse_move, 64, 496, 2, 403, 1152] +[:mouse_move, 81, 503, 2, 404, 1153] +[:mouse_move, 92, 503, 2, 405, 1154] +[:mouse_move, 106, 503, 2, 406, 1155] +[:mouse_move, 115, 501, 2, 407, 1156] +[:mouse_move, 134, 492, 2, 408, 1157] +[:mouse_move, 147, 485, 2, 409, 1158] +[:mouse_move, 163, 471, 2, 410, 1159] +[:mouse_move, 171, 463, 2, 411, 1160] +[:mouse_move, 183, 451, 2, 412, 1161] +[:mouse_move, 202, 425, 2, 413, 1163] +[:mouse_move, 215, 401, 2, 414, 1164] +[:mouse_move, 217, 395, 2, 415, 1165] +[:mouse_move, 226, 373, 2, 416, 1166] +[:mouse_move, 234, 357, 2, 417, 1167] +[:mouse_move, 238, 343, 2, 418, 1168] +[:mouse_move, 240, 334, 2, 419, 1169] +[:mouse_move, 247, 310, 2, 420, 1170] +[:mouse_move, 249, 299, 2, 421, 1171] +[:mouse_move, 250, 290, 2, 422, 1172] +[:mouse_move, 251, 283, 2, 423, 1173] +[:mouse_move, 251, 269, 2, 424, 1174] +[:mouse_move, 248, 263, 2, 425, 1175] +[:mouse_move, 237, 256, 2, 426, 1176] +[:mouse_move, 229, 254, 2, 427, 1177] +[:mouse_move, 210, 250, 2, 428, 1178] +[:mouse_move, 199, 249, 2, 429, 1179] +[:mouse_move, 184, 248, 2, 430, 1180] +[:mouse_move, 173, 248, 2, 431, 1181] +[:mouse_move, 153, 248, 2, 432, 1182] +[:mouse_move, 145, 249, 2, 433, 1183] +[:mouse_move, 138, 251, 2, 434, 1184] +[:mouse_move, 125, 257, 2, 435, 1185] +[:mouse_move, 121, 260, 2, 436, 1186] +[:mouse_move, 112, 267, 2, 437, 1187] +[:mouse_move, 101, 280, 2, 438, 1188] +[:mouse_move, 97, 287, 2, 439, 1189] +[:mouse_move, 86, 306, 2, 440, 1190] +[:mouse_move, 81, 316, 2, 441, 1191] +[:mouse_move, 79, 322, 2, 442, 1192] +[:mouse_move, 70, 345, 2, 443, 1193] +[:mouse_move, 63, 365, 2, 444, 1194] +[:mouse_move, 59, 389, 2, 445, 1195] +[:mouse_move, 59, 401, 2, 446, 1196] +[:mouse_move, 59, 416, 2, 447, 1197] +[:mouse_move, 59, 425, 2, 448, 1198] +[:mouse_move, 60, 439, 2, 449, 1199] +[:mouse_move, 60, 442, 2, 450, 1200] +[:mouse_move, 64, 454, 2, 451, 1201] +[:mouse_move, 66, 457, 2, 452, 1202] +[:mouse_move, 70, 462, 2, 453, 1203] +[:mouse_move, 74, 464, 2, 454, 1204] +[:mouse_move, 81, 467, 2, 455, 1205] +[:mouse_move, 85, 468, 2, 456, 1206] +[:mouse_move, 97, 469, 2, 457, 1207] +[:mouse_move, 107, 469, 2, 458, 1208] +[:mouse_move, 124, 471, 2, 459, 1209] +[:mouse_move, 134, 471, 2, 460, 1210] +[:mouse_move, 148, 471, 2, 461, 1211] +[:mouse_move, 161, 468, 2, 462, 1212] +[:mouse_move, 178, 457, 2, 463, 1213] +[:mouse_move, 186, 451, 2, 464, 1214] +[:mouse_move, 202, 434, 2, 465, 1215] +[:mouse_move, 210, 424, 2, 466, 1216] +[:mouse_move, 227, 400, 2, 467, 1217] +[:mouse_move, 234, 388, 2, 468, 1218] +[:mouse_move, 237, 383, 2, 469, 1219] +[:mouse_move, 250, 360, 2, 470, 1220] +[:mouse_move, 254, 351, 2, 471, 1221] +[:mouse_move, 261, 334, 2, 472, 1222] +[:mouse_move, 262, 326, 2, 473, 1223] +[:mouse_move, 264, 312, 2, 474, 1224] +[:mouse_move, 265, 305, 2, 475, 1225] +[:mouse_move, 265, 293, 2, 476, 1226] +[:mouse_move, 265, 287, 2, 477, 1227] +[:mouse_move, 259, 272, 2, 478, 1228] +[:mouse_move, 255, 267, 2, 479, 1229] +[:mouse_move, 246, 260, 2, 480, 1230] +[:mouse_move, 239, 257, 2, 481, 1231] +[:mouse_move, 226, 253, 2, 482, 1232] +[:mouse_move, 213, 251, 2, 483, 1233] +[:mouse_move, 194, 251, 2, 484, 1234] +[:mouse_move, 184, 252, 2, 485, 1235] +[:mouse_move, 163, 259, 2, 486, 1236] +[:mouse_move, 153, 263, 2, 487, 1237] +[:mouse_move, 133, 274, 2, 488, 1238] +[:mouse_move, 128, 278, 2, 489, 1239] +[:mouse_move, 107, 297, 2, 490, 1240] +[:mouse_move, 100, 305, 2, 491, 1241] +[:mouse_move, 86, 324, 2, 492, 1242] +[:mouse_move, 79, 335, 2, 493, 1243] +[:mouse_move, 74, 348, 2, 494, 1244] +[:mouse_move, 66, 388, 2, 495, 1245] +[:mouse_move, 66, 399, 2, 496, 1246] +[:mouse_move, 68, 429, 2, 497, 1247] +[:mouse_move, 73, 441, 2, 498, 1248] +[:mouse_move, 83, 452, 2, 499, 1249] +[:mouse_move, 89, 457, 2, 500, 1250] +[:mouse_move, 97, 462, 2, 501, 1251] +[:key_down_raw, 1073741906, 0, 2, 502, 1292] +[:key_up_raw, 1073741906, 0, 2, 503, 1296] +[:key_down_raw, 1073741906, 0, 2, 504, 1309] +[:key_up_raw, 1073741906, 0, 2, 505, 1314] +[:key_down_raw, 1073741906, 0, 2, 506, 1319] +[:key_up_raw, 1073741906, 0, 2, 507, 1322] +[:key_down_raw, 1073741906, 0, 2, 508, 1327] +[:key_up_raw, 1073741906, 0, 2, 509, 1331] +[:key_down_raw, 1073741906, 0, 2, 510, 1336] +[:key_up_raw, 1073741906, 0, 2, 511, 1339] +[:key_down_raw, 1073741906, 0, 2, 512, 1345] +[:key_up_raw, 1073741906, 0, 2, 513, 1348] +[:key_down_raw, 1073741906, 0, 2, 514, 1354] +[:key_up_raw, 1073741906, 0, 2, 515, 1358] +[:key_down_raw, 1073741906, 0, 2, 516, 1362] +[:key_up_raw, 1073741906, 0, 2, 517, 1370] +[:key_down_raw, 1073741903, 0, 2, 518, 1386] +[:key_up_raw, 1073741903, 0, 2, 519, 1392] +[:key_down_raw, 1073741903, 0, 2, 520, 1397] +[:key_up_raw, 1073741903, 0, 2, 521, 1401] +[:key_down_raw, 1073741903, 0, 2, 522, 1407] +[:key_up_raw, 1073741903, 0, 2, 523, 1412] +[:key_down_raw, 1073741903, 0, 2, 524, 1415] +[:key_up_raw, 1073741903, 0, 2, 525, 1421] +[:key_down_raw, 1073741903, 0, 2, 526, 1428] +[:key_up_raw, 1073741903, 0, 2, 527, 1436] +[:key_down_raw, 1073741905, 0, 2, 528, 1446] +[:key_up_raw, 1073741905, 0, 2, 529, 1458] +[:key_down_raw, 1073741905, 0, 2, 530, 1466] +[:key_up_raw, 1073741905, 0, 2, 531, 1472] +[:key_down_raw, 1073741903, 0, 2, 532, 1479] +[:key_up_raw, 1073741903, 0, 2, 533, 1489] +[:key_down_raw, 1073741905, 0, 2, 534, 1513] +[:key_up_raw, 1073741905, 0, 2, 535, 1517] +[:key_down_raw, 1073741905, 0, 2, 536, 1522] +[:key_up_raw, 1073741905, 0, 2, 537, 1526] +[:key_down_raw, 1073741905, 0, 2, 538, 1531] +[:key_up_raw, 1073741905, 0, 2, 539, 1535] +[:key_down_raw, 1073741905, 0, 2, 540, 1540] +[:key_up_raw, 1073741905, 0, 2, 541, 1544] +[:key_down_raw, 1073741905, 0, 2, 542, 1549] +[:key_up_raw, 1073741905, 0, 2, 543, 1554] +[:key_down_raw, 1073741905, 0, 2, 544, 1558] +[:key_up_raw, 1073741905, 0, 2, 545, 1564] +[:key_down_raw, 1073742051, 1024, 2, 546, 1663] +[:key_down_raw, 114, 1024, 2, 547, 1664] +[:key_up_raw, 114, 1024, 2, 548, 1669] +[:key_up_raw, 1073742051, 0, 2, 549, 1677] +[:key_down_raw, 1073742051, 1024, 2, 550, 1729] +[:key_down_raw, 113, 1024, 2, 551, 1730] diff --git a/samples/20_roguelike_starting_point_two/app/constants.rb b/samples/20_roguelike_starting_point_two/app/constants.rb new file mode 100644 index 0000000..37dd493 --- /dev/null +++ b/samples/20_roguelike_starting_point_two/app/constants.rb @@ -0,0 +1,8 @@ +SHOW_LEGEND = true +SOURCE_TILE_SIZE = 16 +DESTINATION_TILE_SIZE = 16 +TILE_SHEET_SIZE = 256 +TILE_R = 0 +TILE_G = 0 +TILE_B = 0 +TILE_A = 255 diff --git a/samples/20_roguelike_starting_point_two/app/legend.rb b/samples/20_roguelike_starting_point_two/app/legend.rb new file mode 100644 index 0000000..4d07b79 --- /dev/null +++ b/samples/20_roguelike_starting_point_two/app/legend.rb @@ -0,0 +1,65 @@ +def tick_legend args + return unless SHOW_LEGEND + + legend_padding = 16 + legend_x = 1280 - TILE_SHEET_SIZE - legend_padding + legend_y = 720 - TILE_SHEET_SIZE - legend_padding + tile_sheet_sprite = [legend_x, + legend_y, + TILE_SHEET_SIZE, + TILE_SHEET_SIZE, + 'sprites/simple-mood-16x16.png', 0, + TILE_A, + TILE_R, + TILE_G, + TILE_B] + + if args.inputs.mouse.point.inside_rect? tile_sheet_sprite + mouse_row = args.inputs.mouse.point.y.idiv(SOURCE_TILE_SIZE) + tile_row = 15 - (mouse_row - legend_y.idiv(SOURCE_TILE_SIZE)) + + mouse_col = args.inputs.mouse.point.x.idiv(SOURCE_TILE_SIZE) + tile_col = (mouse_col - legend_x.idiv(SOURCE_TILE_SIZE)) + + args.outputs.primitives << [legend_x - legend_padding * 2, + mouse_row * SOURCE_TILE_SIZE, 256 + legend_padding * 2, 16, 128, 128, 128, 64].solid + + args.outputs.primitives << [mouse_col * SOURCE_TILE_SIZE, + legend_y - legend_padding * 2, 16, 256 + legend_padding * 2, 128, 128, 128, 64].solid + + sprite_key = sprite_lookup.find { |k, v| v == [tile_row, tile_col] } + if sprite_key + member_name, _ = sprite_key + member_name = member_name_as_code member_name + args.outputs.labels << [660, 70, "# CODE SAMPLE (place in the tick_game method located in main.rb)", -1, 0] + args.outputs.labels << [660, 50, "# GRID_X, GRID_Y, TILE_KEY", -1, 0] + args.outputs.labels << [660, 30, "args.outputs.sprites << tile_in_game( 5, 6, #{member_name} )", -1, 0] + else + args.outputs.labels << [660, 50, "Tile [#{tile_row}, #{tile_col}] not found. Add a key and value to app/sprite_lookup.rb:", -1, 0] + args.outputs.labels << [660, 30, "{ \"some_string\" => [#{tile_row}, #{tile_col}] } OR { some_symbol: [#{tile_row}, #{tile_col}] }.", -1, 0] + end + + end + + # render the sprite in the top right with a padding to the top and right so it's + # not flush against the edge + args.outputs.sprites << tile_sheet_sprite + + # carefully place some ascii arrows to show the legend labels + args.outputs.labels << [895, 707, "ROW --->"] + args.outputs.labels << [943, 412, " ^"] + args.outputs.labels << [943, 412, " |"] + args.outputs.labels << [943, 394, "COL ---+"] + + # use the tile sheet to print out row and column numbers + args.outputs.sprites << 16.map_with_index do |i| + sprite_key = i % 10 + [ + tile(1280 - TILE_SHEET_SIZE - legend_padding * 2 - SOURCE_TILE_SIZE, + 720 - legend_padding * 2 - (SOURCE_TILE_SIZE * i), + sprite(sprite_key)), + tile(1280 - TILE_SHEET_SIZE - SOURCE_TILE_SIZE + (SOURCE_TILE_SIZE * i), + 720 - TILE_SHEET_SIZE - legend_padding * 3, sprite(sprite_key)) + ] + end +end diff --git a/samples/20_roguelike_starting_point_two/app/main.rb b/samples/20_roguelike_starting_point_two/app/main.rb new file mode 100644 index 0000000..bd5f521 --- /dev/null +++ b/samples/20_roguelike_starting_point_two/app/main.rb @@ -0,0 +1,97 @@ +require 'app/constants.rb' +require 'app/sprite_lookup.rb' +require 'app/legend.rb' + +def tick args + tick_game args + tick_legend args +end + +def tick_game args + # setup the grid + args.state.grid.padding = 104 + args.state.grid.size = 512 + + # set up your game + # initialize the game/game defaults. ||= means that you only initialize it if + # the value isn't alread initialized + args.state.player.x ||= 0 + args.state.player.y ||= 0 + + args.state.enemies ||= [ + { x: 10, y: 10, type: :goblin, tile_key: :G }, + { x: 15, y: 30, type: :rat, tile_key: :R } + ] + + args.state.info_message ||= "Use arrow keys to move around." + + # handle keyboard input + # keyboard input (arrow keys to move player) + new_player_x = args.state.player.x + new_player_y = args.state.player.y + player_direction = "" + player_moved = false + if args.inputs.keyboard.key_down.up + new_player_y += 1 + player_direction = "north" + player_moved = true + elsif args.inputs.keyboard.key_down.down + new_player_y -= 1 + player_direction = "south" + player_moved = true + elsif args.inputs.keyboard.key_down.right + new_player_x += 1 + player_direction = "east" + player_moved = true + elsif args.inputs.keyboard.key_down.left + new_player_x -= 1 + player_direction = "west" + player_moved = true + end + + #handle game logic + # determine if there is an enemy on that square, + # if so, don't let the player move there + if player_moved + found_enemy = args.state.enemies.find do |e| + e[:x] == new_player_x && e[:y] == new_player_y + end + + if !found_enemy + args.state.player.x = new_player_x + args.state.player.y = new_player_y + args.state.info_message = "You moved #{player_direction}." + else + args.state.info_message = "You cannot move into a square an enemy occupies." + end + end + + args.outputs.sprites << tile_in_game(args.state.player.x, + args.state.player.y, '@') + + # render game + # render enemies at locations + args.outputs.sprites << args.state.enemies.map do |e| + tile_in_game(e[:x], e[:y], e[:tile_key]) + end + + # render the border + border_x = args.state.grid.padding - DESTINATION_TILE_SIZE + border_y = args.state.grid.padding - DESTINATION_TILE_SIZE + border_size = args.state.grid.size + DESTINATION_TILE_SIZE * 2 + + args.outputs.borders << [border_x, + border_y, + border_size, + border_size] + + # render label stuff + args.outputs.labels << [border_x, border_y - 10, "Current player location is: #{args.state.player.x}, #{args.state.player.y}"] + args.outputs.labels << [border_x, border_y + 25 + border_size, args.state.info_message] +end + +def tile_in_game x, y, tile_key + tile($gtk.args.state.grid.padding + x * DESTINATION_TILE_SIZE, + $gtk.args.state.grid.padding + y * DESTINATION_TILE_SIZE, + tile_key) +end diff --git a/samples/20_roguelike_starting_point_two/app/sprite_lookup.rb b/samples/20_roguelike_starting_point_two/app/sprite_lookup.rb new file mode 100644 index 0000000..f129e25 --- /dev/null +++ b/samples/20_roguelike_starting_point_two/app/sprite_lookup.rb @@ -0,0 +1,124 @@ +def sprite_lookup + { + 0 => [3, 0], + 1 => [3, 1], + 2 => [3, 2], + 3 => [3, 3], + 4 => [3, 4], + 5 => [3, 5], + 6 => [3, 6], + 7 => [3, 7], + 8 => [3, 8], + 9 => [3, 9], + '@' => [4, 0], + A: [ 4, 1], + B: [ 4, 2], + C: [ 4, 3], + D: [ 4, 4], + E: [ 4, 5], + F: [ 4, 6], + G: [ 4, 7], + H: [ 4, 8], + I: [ 4, 9], + J: [ 4, 10], + K: [ 4, 11], + L: [ 4, 12], + M: [ 4, 13], + N: [ 4, 14], + O: [ 4, 15], + P: [ 5, 0], + Q: [ 5, 1], + R: [ 5, 2], + S: [ 5, 3], + T: [ 5, 4], + U: [ 5, 5], + V: [ 5, 6], + W: [ 5, 7], + X: [ 5, 8], + Y: [ 5, 9], + Z: [ 5, 10], + a: [ 6, 1], + b: [ 6, 2], + c: [ 6, 3], + d: [ 6, 4], + e: [ 6, 5], + f: [ 6, 6], + g: [ 6, 7], + h: [ 6, 8], + i: [ 6, 9], + j: [ 6, 10], + k: [ 6, 11], + l: [ 6, 12], + m: [ 6, 13], + n: [ 6, 14], + o: [ 6, 15], + p: [ 7, 0], + q: [ 7, 1], + r: [ 7, 2], + s: [ 7, 3], + t: [ 7, 4], + u: [ 7, 5], + v: [ 7, 6], + w: [ 7, 7], + x: [ 7, 8], + y: [ 7, 9], + z: [ 7, 10], + '|' => [ 7, 12] + } +end + +def sprite key + $gtk.args.state.reserved.sprite_lookup[key] +end + +def member_name_as_code raw_member_name + if raw_member_name.is_a? Symbol + ":#{raw_member_name}" + elsif raw_member_name.is_a? String + "'#{raw_member_name}'" + elsif raw_member_name.is_a? Fixnum + "#{raw_member_name}" + else + "UNKNOWN: #{raw_member_name}" + end +end + +def tile x, y, tile_row_column_or_key + tile_extended x, y, DESTINATION_TILE_SIZE, DESTINATION_TILE_SIZE, TILE_R, TILE_G, TILE_B, TILE_A, tile_row_column_or_key +end + +def tile_extended x, y, w, h, r, g, b, a, tile_row_column_or_key + row_or_key, column = tile_row_column_or_key + if !column + row, column = sprite row_or_key + else + row, column = row_or_key, column + end + + if !row + member_name = member_name_as_code tile_row_column_or_key + raise "Unabled to find a sprite for #{member_name}. Make sure the value exists in app/sprite_lookup.rb." + end + + # Sprite provided by Rogue Yun + # http://www.bay12forums.com/smf/index.php?topic=144897.0 + # License: Public Domain + + { + x: x, + y: y, + w: w, + h: h, + tile_x: column * 16, + tile_y: (row * 16), + tile_w: 16, + tile_h: 16, + r: r, + g: g, + b: b, + a: a, + path: 'sprites/simple-mood-16x16.png' + } +end + +$gtk.args.state.reserved.sprite_lookup = sprite_lookup diff --git a/samples/20_roguelike_starting_point_two/license-for-sample.txt b/samples/20_roguelike_starting_point_two/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/20_roguelike_starting_point_two/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/20_roguelike_starting_point_two/sprites/simple-mood-16x16.png b/samples/20_roguelike_starting_point_two/sprites/simple-mood-16x16.png Binary files differnew file mode 100644 index 0000000..0eca11e --- /dev/null +++ b/samples/20_roguelike_starting_point_two/sprites/simple-mood-16x16.png diff --git a/samples/21_mailbox_usage/app/mailbox.rb b/samples/21_mailbox_usage/app/mailbox.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/samples/21_mailbox_usage/app/mailbox.rb diff --git a/samples/21_mailbox_usage/app/main.rb b/samples/21_mailbox_usage/app/main.rb new file mode 100644 index 0000000..251931b --- /dev/null +++ b/samples/21_mailbox_usage/app/main.rb @@ -0,0 +1,28 @@ +MAILBOX_SAVE_PATH = 'app/mailbox.rb' + +def tick args + args.gtk.suppress_mailbox = false + args.state.send_to_mailbox = [220, 360, 200, 50] + args.state.clear_mailbox = [220, 300, 200, 50] + args.state.mailbox_values ||= [] + args.outputs.borders << args.state.send_to_mailbox + args.outputs.borders << args.state.clear_mailbox + args.outputs.labels << [230, 390, "Send to Mailbox"] + args.outputs.labels << [230, 325, "Clear Mailbox"] + + if args.inputs.mouse.click + if args.inputs.mouse.click.point.inside_rect?(args.state.send_to_mailbox) + current_text = args.gtk.read_file("app/mailbox.rb") || '' + code = "$gtk.args.state.mailbox_values << 'code written to file called mailbox.rb at tick_count #{args.state.tick_count}'" + args.gtk.write_file(MAILBOX_SAVE_PATH, current_text + "\n" + code) + elsif args.inputs.mouse.click.point.inside_rect?(args.state.clear_mailbox) + current_text = args.gtk.read_file("app/mailbox.rb") || '' + code = "$gtk.args.state.mailbox_values = []" + args.gtk.write_file(MAILBOX_SAVE_PATH, current_text + "\n" + code) + end + end + + args.state.mailbox_values.each_with_index.map do |v, i| + args.outputs.labels << [640, 680 + i * -30, v] + end +end diff --git a/samples/21_mailbox_usage/license-for-sample-app.txt b/samples/21_mailbox_usage/license-for-sample-app.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/21_mailbox_usage/license-for-sample-app.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/21_mailbox_usage/replay.txt b/samples/21_mailbox_usage/replay.txt new file mode 100644 index 0000000..5232057 --- /dev/null +++ b/samples/21_mailbox_usage/replay.txt @@ -0,0 +1,123 @@ +replay_version 2.0 +stopped_at 605 +seed 100 +recorded_at Sun Sep 29 23:11:00 2019 +[:mouse_move, 87, 234, 2, 1, 29] +[:mouse_move, 95, 238, 2, 2, 30] +[:mouse_move, 111, 246, 2, 3, 31] +[:mouse_move, 119, 251, 2, 4, 32] +[:mouse_move, 152, 267, 2, 5, 33] +[:mouse_move, 159, 271, 2, 6, 34] +[:mouse_move, 180, 284, 2, 7, 35] +[:mouse_move, 183, 286, 2, 8, 36] +[:mouse_move, 194, 294, 2, 9, 37] +[:mouse_move, 197, 296, 2, 10, 38] +[:mouse_move, 200, 302, 2, 11, 39] +[:mouse_move, 200, 304, 2, 12, 40] +[:mouse_move, 199, 311, 2, 13, 41] +[:mouse_move, 198, 316, 2, 14, 42] +[:mouse_move, 196, 321, 2, 15, 43] +[:mouse_move, 196, 324, 2, 16, 44] +[:mouse_move, 196, 330, 2, 17, 45] +[:mouse_move, 199, 331, 2, 18, 46] +[:mouse_move, 204, 332, 2, 19, 47] +[:mouse_move, 223, 333, 2, 20, 48] +[:mouse_move, 246, 333, 2, 21, 49] +[:mouse_move, 271, 330, 2, 22, 50] +[:mouse_move, 277, 329, 2, 23, 51] +[:mouse_move, 290, 329, 2, 24, 52] +[:mouse_move, 295, 328, 2, 25, 53] +[:mouse_move, 302, 328, 2, 26, 54] +[:mouse_move, 303, 328, 2, 27, 55] +[:mouse_move, 304, 328, 2, 28, 56] +[:mouse_move, 305, 328, 2, 29, 57] +[:mouse_button_pressed, 1, 0, 1, 30, 64] +[:mouse_button_up, 1, 0, 1, 31, 73] +[:mouse_button_pressed, 1, 0, 1, 32, 113] +[:mouse_button_up, 1, 0, 1, 33, 118] +[:mouse_button_pressed, 1, 0, 1, 34, 125] +[:mouse_button_up, 1, 0, 1, 35, 129] +[:mouse_button_pressed, 1, 0, 1, 36, 134] +[:mouse_button_up, 1, 0, 1, 37, 140] +[:mouse_button_pressed, 1, 0, 1, 38, 144] +[:mouse_button_up, 1, 0, 1, 39, 149] +[:mouse_button_pressed, 1, 0, 1, 40, 156] +[:mouse_button_up, 1, 0, 1, 41, 162] +[:mouse_move, 305, 338, 2, 42, 259] +[:mouse_move, 304, 346, 2, 43, 260] +[:mouse_move, 303, 361, 2, 44, 261] +[:mouse_move, 301, 370, 2, 45, 262] +[:mouse_move, 298, 379, 2, 46, 263] +[:mouse_move, 297, 385, 2, 47, 264] +[:mouse_move, 296, 388, 2, 48, 265] +[:mouse_move, 294, 392, 2, 49, 266] +[:mouse_move, 294, 394, 2, 50, 267] +[:mouse_move, 293, 395, 2, 51, 268] +[:mouse_move, 293, 396, 2, 52, 269] +[:mouse_button_pressed, 1, 0, 1, 53, 291] +[:mouse_button_up, 1, 0, 1, 54, 297] +[:mouse_move, 293, 395, 2, 55, 324] +[:mouse_move, 295, 387, 2, 56, 325] +[:mouse_move, 297, 374, 2, 57, 326] +[:mouse_move, 299, 366, 2, 58, 327] +[:mouse_move, 300, 358, 2, 59, 328] +[:mouse_move, 301, 354, 2, 60, 329] +[:mouse_move, 302, 349, 2, 61, 330] +[:mouse_move, 303, 348, 2, 62, 331] +[:mouse_move, 303, 347, 2, 63, 332] +[:mouse_move, 303, 346, 2, 64, 333] +[:mouse_move, 303, 345, 2, 65, 338] +[:mouse_move, 303, 344, 2, 66, 340] +[:mouse_move, 304, 343, 2, 67, 342] +[:mouse_move, 304, 342, 2, 68, 344] +[:mouse_move, 304, 341, 2, 69, 345] +[:mouse_move, 305, 339, 2, 70, 347] +[:mouse_move, 305, 338, 2, 71, 349] +[:mouse_button_pressed, 1, 0, 1, 72, 390] +[:mouse_button_up, 1, 0, 1, 73, 397] +[:mouse_button_pressed, 1, 0, 1, 74, 419] +[:mouse_button_up, 1, 0, 1, 75, 425] +[:mouse_button_pressed, 1, 0, 1, 76, 430] +[:mouse_button_up, 1, 0, 1, 77, 436] +[:mouse_button_pressed, 1, 0, 1, 78, 440] +[:mouse_button_up, 1, 0, 1, 79, 445] +[:mouse_button_pressed, 1, 0, 1, 80, 449] +[:mouse_button_up, 1, 0, 1, 81, 454] +[:mouse_button_pressed, 1, 0, 1, 82, 459] +[:mouse_button_up, 1, 0, 1, 83, 464] +[:mouse_move, 305, 341, 2, 84, 503] +[:mouse_move, 305, 352, 2, 85, 504] +[:mouse_move, 305, 356, 2, 86, 505] +[:mouse_move, 305, 365, 2, 87, 506] +[:mouse_move, 305, 370, 2, 88, 507] +[:mouse_move, 305, 374, 2, 89, 508] +[:mouse_move, 305, 379, 2, 90, 509] +[:mouse_move, 305, 381, 2, 91, 510] +[:mouse_move, 305, 385, 2, 92, 511] +[:mouse_move, 305, 387, 2, 93, 512] +[:mouse_move, 304, 390, 2, 94, 513] +[:mouse_move, 304, 392, 2, 95, 514] +[:mouse_move, 304, 394, 2, 96, 515] +[:mouse_move, 304, 396, 2, 97, 516] +[:mouse_move, 304, 397, 2, 98, 517] +[:mouse_button_pressed, 1, 0, 1, 99, 535] +[:mouse_button_up, 1, 0, 1, 100, 541] +[:mouse_move, 304, 396, 2, 101, 553] +[:mouse_move, 303, 389, 2, 102, 554] +[:mouse_move, 302, 383, 2, 103, 555] +[:mouse_move, 294, 352, 2, 104, 556] +[:mouse_move, 286, 328, 2, 105, 557] +[:mouse_move, 264, 263, 2, 106, 558] +[:mouse_move, 251, 232, 2, 107, 559] +[:mouse_move, 230, 190, 2, 108, 560] +[:mouse_move, 217, 167, 2, 109, 561] +[:mouse_move, 193, 128, 2, 110, 562] +[:mouse_move, 171, 99, 2, 111, 563] +[:mouse_move, 165, 90, 2, 112, 564] +[:mouse_move, 144, 62, 2, 113, 565] +[:mouse_move, 140, 56, 2, 114, 566] +[:mouse_move, 126, 35, 2, 115, 567] +[:mouse_move, 119, 27, 2, 116, 568] +[:mouse_move, 109, 11, 2, 117, 569] +[:mouse_move, 105, 5, 2, 118, 570] +[:mouse_move, 99, 0, 2, 119, 571] diff --git a/samples/22_trace_debugging/app/main.rb b/samples/22_trace_debugging/app/main.rb new file mode 100644 index 0000000..33f15b3 --- /dev/null +++ b/samples/22_trace_debugging/app/main.rb @@ -0,0 +1,53 @@ +class Game + attr_gtk + + def method1 num + method2 num + end + + def method2 num + method3 num + end + + def method3 num + method4 num + end + + def method4 num + if num == 1 + puts "UNLUCKY #{num}." + state.unlucky_count += 1 + if state.unlucky_count > 3 + raise "NAT 1 finally occurred. Check app/trace.txt for all method invocation history." + end + else + puts "LUCKY #{num}." + end + end + + def tick + state.roll_history ||= [] + state.roll_history << rand(20) + 1 + state.countdown ||= 600 + state.countdown -= 1 + state.unlucky_count ||= 0 + outputs.labels << [640, 360, "A dice roll of 1 will cause an exception.", 0, 1] + if state.countdown > 0 + outputs.labels << [640, 340, "Dice roll countdown: #{state.countdown}", 0, 1] + else + state.attempts ||= 0 + state.attempts += 1 + outputs.labels << [640, 340, "ROLLING! #{state.attempts}", 0, 1] + end + return if state.countdown > 0 + method1 state.roll_history[-1] + end +end + +$game = Game.new + +def tick args + trace! $game # <------------------- TRACING ENABLED FOR THIS OBJECT + $game.args = args + $game.tick +end diff --git a/samples/22_trace_debugging/license-for-sample.txt b/samples/22_trace_debugging/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/22_trace_debugging/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/22_trace_debugging_classes/app/main.rb b/samples/22_trace_debugging_classes/app/main.rb new file mode 100644 index 0000000..a6804ae --- /dev/null +++ b/samples/22_trace_debugging_classes/app/main.rb @@ -0,0 +1,22 @@ +class Foobar + def initialize + trace! # Trace is added to the constructor. + end + + def clicky args + return unless args.inputs.mouse.click + try_rand rand + end + + def try_rand num + return if num < 0.9 + raise "Exception finally occurred. Take a look at logs/trace.txt #{num}." + end +end + +def tick args + args.labels << [640, 360, "Start clicking. Eventually an exception will be thrown. Then look at logs/trace.txt.", 0, 1] + args.state.foobar = Foobar.new if args.tick_count + return unless args.state.foobar + args.state.foobar.clicky args +end diff --git a/samples/23_hexagonal_grid/app/main.rb b/samples/23_hexagonal_grid/app/main.rb new file mode 100644 index 0000000..b522ace --- /dev/null +++ b/samples/23_hexagonal_grid/app/main.rb @@ -0,0 +1,68 @@ +class HexagonTileGame + attr_gtk + + def defaults + state.tile_scale = 1.3 + state.tile_size = 80 + state.tile_w = Math.sqrt(3) * state.tile_size.half + state.tile_h = state.tile_size * 3/4 + state.tiles_x_count = 1280.idiv(state.tile_w) - 1 + state.tiles_y_count = 720.idiv(state.tile_h) - 1 + state.world_width_px = state.tiles_x_count * state.tile_w + state.world_height_px = state.tiles_y_count * state.tile_h + state.world_x_offset = (1280 - state.world_width_px).half + state.world_y_offset = (720 - state.world_height_px).half + state.tiles ||= state.tiles_x_count.map_with_ys(state.tiles_y_count) do |ordinal_x, ordinal_y| + { + ordinal_x: ordinal_x, + ordinal_y: ordinal_y, + offset_x: (ordinal_y.even?) ? + (state.world_x_offset + state.tile_w.half.half) : + (state.world_x_offset - state.tile_w.half.half), + offset_y: state.world_y_offset, + w: state.tile_w, + h: state.tile_h, + type: :blank, + path: "sprites/hexagon-gray.png", + a: 20 + }.associate do |h| + h.merge(x: h[:offset_x] + h[:ordinal_x] * h[:w], + y: h[:offset_y] + h[:ordinal_y] * h[:h]).scale_rect(state.tile_scale) + end.associate do |h| + h.merge(center: { + x: h[:x] + h[:w].half, + y: h[:y] + h[:h].half + }, radius: [h[:w].half, h[:h].half].max) + end + end + end + + def input + if inputs.click + tile = state.tiles.find { |t| inputs.click.point_inside_circle? t[:center], t[:radius] } + if tile + tile[:a] = 255 + tile[:path] = "sprites/hexagon-black.png" + end + end + end + + def tick + defaults + input + render + end + + def render + outputs.sprites << state.tiles + end +end + +$game = HexagonTileGame.new + +def tick args + $game.args = args + $game.tick +end + +$gtk.reset diff --git a/samples/23_hexagonal_grid/license-for-sample.txt b/samples/23_hexagonal_grid/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/23_hexagonal_grid/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/23_hexagonal_grid/replay.txt b/samples/23_hexagonal_grid/replay.txt new file mode 100644 index 0000000..9e646bc --- /dev/null +++ b/samples/23_hexagonal_grid/replay.txt @@ -0,0 +1,276 @@ +replay_version 2.0 +stopped_at 488 +seed 100 +recorded_at Sat Feb 01 20:02:13 2020 +[:mouse_move, 643, 259, 2, 1, 46] +[:mouse_move, 618, 246, 2, 2, 47] +[:mouse_move, 544, 211, 2, 3, 48] +[:mouse_move, 477, 179, 2, 4, 49] +[:mouse_move, 435, 158, 2, 5, 50] +[:mouse_move, 350, 117, 2, 6, 51] +[:mouse_move, 304, 96, 2, 7, 52] +[:mouse_move, 267, 84, 2, 8, 53] +[:mouse_move, 242, 76, 2, 9, 54] +[:mouse_move, 188, 72, 2, 10, 55] +[:mouse_move, 164, 75, 2, 11, 56] +[:mouse_move, 151, 81, 2, 12, 57] +[:mouse_move, 135, 89, 2, 13, 58] +[:mouse_move, 117, 102, 2, 14, 59] +[:mouse_move, 114, 105, 2, 15, 59] +[:mouse_move, 99, 116, 2, 16, 60] +[:mouse_move, 90, 121, 2, 17, 61] +[:mouse_move, 81, 130, 2, 18, 62] +[:mouse_move, 75, 136, 2, 19, 63] +[:mouse_move, 72, 149, 2, 20, 64] +[:mouse_move, 66, 183, 2, 21, 65] +[:mouse_move, 64, 218, 2, 22, 66] +[:mouse_move, 64, 273, 2, 23, 67] +[:mouse_move, 70, 305, 2, 24, 68] +[:mouse_move, 85, 347, 2, 25, 69] +[:mouse_move, 133, 418, 2, 26, 70] +[:mouse_move, 174, 441, 2, 27, 71] +[:mouse_move, 225, 453, 2, 28, 72] +[:mouse_move, 277, 453, 2, 29, 73] +[:mouse_move, 328, 448, 2, 30, 74] +[:mouse_move, 421, 434, 2, 31, 75] +[:mouse_move, 492, 433, 2, 32, 76] +[:mouse_move, 571, 433, 2, 33, 77] +[:mouse_move, 656, 432, 2, 34, 78] +[:mouse_move, 824, 403, 2, 35, 79] +[:mouse_move, 903, 386, 2, 36, 80] +[:mouse_move, 996, 373, 2, 37, 81] +[:mouse_move, 1053, 371, 2, 38, 82] +[:mouse_move, 1092, 371, 2, 39, 83] +[:mouse_move, 1098, 372, 2, 40, 84] +[:mouse_move, 1117, 368, 2, 41, 92] +[:mouse_move, 1148, 368, 2, 42, 93] +[:mouse_move, 1212, 381, 2, 43, 94] +[:mouse_move, 1246, 398, 2, 44, 95] +[:mouse_move, 1282, 423, 2, 45, 96] +[:mouse_move, 1303, 449, 2, 46, 97] +[:mouse_move, 1309, 465, 2, 47, 98] +[:mouse_move, 1314, 481, 2, 48, 99] +[:mouse_move, 1314, 497, 2, 49, 100] +[:mouse_move, 1301, 504, 2, 50, 101] +[:mouse_move, 1288, 507, 2, 51, 102] +[:mouse_move, 1259, 515, 2, 52, 103] +[:mouse_move, 1238, 523, 2, 53, 104] +[:mouse_move, 1225, 529, 2, 54, 105] +[:mouse_move, 1216, 531, 2, 55, 106] +[:mouse_move, 1207, 533, 2, 56, 107] +[:mouse_move, 1205, 532, 2, 57, 108] +[:mouse_move, 1207, 526, 2, 58, 109] +[:mouse_move, 1213, 518, 2, 59, 110] +[:mouse_move, 1222, 507, 2, 60, 111] +[:mouse_move, 1233, 493, 2, 61, 112] +[:mouse_move, 1237, 482, 2, 62, 113] +[:mouse_move, 1239, 468, 2, 63, 114] +[:mouse_move, 1239, 444, 2, 64, 115] +[:mouse_move, 1237, 413, 2, 65, 116] +[:mouse_move, 1235, 403, 2, 66, 117] +[:mouse_move, 1234, 395, 2, 67, 118] +[:mouse_move, 1234, 392, 2, 68, 119] +[:mouse_move, 1234, 390, 2, 69, 120] +[:mouse_move, 1234, 389, 2, 70, 122] +[:mouse_move, 1234, 386, 2, 71, 123] +[:mouse_move, 1233, 386, 2, 72, 125] +[:mouse_move, 1190, 395, 2, 73, 126] +[:mouse_move, 1054, 412, 2, 74, 127] +[:mouse_move, 862, 421, 2, 75, 128] +[:mouse_move, 720, 421, 2, 76, 129] +[:mouse_move, 616, 419, 2, 77, 130] +[:mouse_move, 580, 416, 2, 78, 131] +[:mouse_move, 567, 410, 2, 79, 140] +[:mouse_move, 518, 394, 2, 80, 141] +[:mouse_move, 422, 388, 2, 81, 142] +[:mouse_move, 292, 398, 2, 82, 143] +[:mouse_move, 217, 420, 2, 83, 144] +[:mouse_move, 139, 449, 2, 84, 145] +[:mouse_move, 116, 460, 2, 85, 146] +[:mouse_move, 99, 472, 2, 86, 147] +[:mouse_move, 91, 485, 2, 87, 148] +[:mouse_move, 91, 494, 2, 88, 149] +[:mouse_move, 94, 514, 2, 89, 150] +[:mouse_move, 99, 530, 2, 90, 151] +[:mouse_move, 101, 545, 2, 91, 152] +[:mouse_move, 102, 566, 2, 92, 153] +[:mouse_move, 98, 582, 2, 93, 154] +[:mouse_move, 89, 601, 2, 94, 155] +[:mouse_move, 87, 610, 2, 95, 156] +[:mouse_move, 84, 617, 2, 96, 157] +[:mouse_move, 83, 622, 2, 97, 158] +[:mouse_move, 83, 624, 2, 98, 159] +[:mouse_move, 83, 625, 2, 99, 160] +[:mouse_move, 82, 628, 2, 100, 165] +[:mouse_move, 81, 635, 2, 101, 166] +[:mouse_move, 78, 651, 2, 102, 167] +[:mouse_move, 76, 658, 2, 103, 168] +[:mouse_move, 75, 663, 2, 104, 169] +[:mouse_move, 74, 665, 2, 105, 170] +[:mouse_move, 73, 665, 2, 106, 171] +[:mouse_move, 73, 663, 2, 107, 173] +[:mouse_move, 73, 661, 2, 108, 174] +[:mouse_move, 73, 658, 2, 109, 175] +[:mouse_move, 74, 653, 2, 110, 176] +[:mouse_move, 74, 652, 2, 111, 177] +[:mouse_move, 75, 651, 2, 112, 178] +[:mouse_move, 75, 650, 2, 113, 180] +[:mouse_button_pressed, 1, 0, 1, 114, 184] +[:mouse_button_up, 1, 0, 1, 115, 187] +[:mouse_move, 77, 650, 2, 116, 194] +[:mouse_move, 86, 650, 2, 117, 195] +[:mouse_move, 117, 650, 2, 118, 196] +[:mouse_move, 136, 650, 2, 119, 197] +[:mouse_move, 156, 648, 2, 120, 198] +[:mouse_move, 164, 647, 2, 121, 199] +[:mouse_move, 167, 646, 2, 122, 200] +[:mouse_move, 168, 646, 2, 123, 201] +[:mouse_move, 167, 646, 2, 124, 202] +[:mouse_move, 165, 647, 2, 125, 203] +[:mouse_move, 164, 647, 2, 126, 205] +[:mouse_move, 163, 647, 2, 127, 206] +[:mouse_button_pressed, 1, 0, 1, 128, 210] +[:mouse_button_up, 1, 0, 1, 129, 214] +[:mouse_move, 170, 647, 2, 130, 224] +[:mouse_move, 179, 647, 2, 131, 225] +[:mouse_move, 200, 647, 2, 132, 226] +[:mouse_move, 215, 647, 2, 133, 227] +[:mouse_move, 222, 647, 2, 134, 228] +[:mouse_move, 227, 647, 2, 135, 229] +[:mouse_move, 228, 647, 2, 136, 230] +[:mouse_button_pressed, 1, 0, 1, 137, 232] +[:mouse_button_up, 1, 0, 1, 138, 237] +[:mouse_move, 236, 645, 2, 139, 250] +[:mouse_move, 246, 644, 2, 140, 251] +[:mouse_move, 260, 643, 2, 141, 252] +[:mouse_move, 274, 643, 2, 142, 253] +[:mouse_move, 286, 645, 2, 143, 254] +[:mouse_move, 291, 646, 2, 144, 255] +[:mouse_move, 293, 646, 2, 145, 256] +[:mouse_button_pressed, 1, 0, 1, 146, 257] +[:mouse_move, 294, 647, 2, 147, 257] +[:mouse_button_up, 1, 0, 1, 148, 262] +[:mouse_move, 293, 642, 2, 149, 279] +[:mouse_move, 285, 616, 2, 150, 280] +[:mouse_move, 233, 414, 2, 151, 281] +[:mouse_move, 177, 198, 2, 152, 282] +[:mouse_move, 158, 131, 2, 153, 283] +[:mouse_move, 148, 98, 2, 154, 284] +[:mouse_move, 135, 65, 2, 155, 285] +[:mouse_move, 130, 58, 2, 156, 286] +[:mouse_move, 126, 56, 2, 157, 287] +[:mouse_move, 122, 55, 2, 158, 288] +[:mouse_move, 120, 55, 2, 159, 289] +[:mouse_move, 117, 55, 2, 160, 290] +[:mouse_move, 113, 55, 2, 161, 291] +[:mouse_move, 109, 56, 2, 162, 292] +[:mouse_move, 105, 56, 2, 163, 293] +[:mouse_move, 101, 56, 2, 164, 294] +[:mouse_move, 92, 57, 2, 165, 295] +[:mouse_move, 89, 57, 2, 166, 296] +[:mouse_move, 86, 57, 2, 167, 297] +[:mouse_move, 85, 57, 2, 168, 298] +[:mouse_move, 84, 57, 2, 169, 299] +[:mouse_button_pressed, 1, 0, 1, 170, 299] +[:mouse_button_up, 1, 0, 1, 171, 302] +[:mouse_move, 85, 57, 2, 172, 305] +[:mouse_move, 90, 57, 2, 173, 306] +[:mouse_move, 98, 57, 2, 174, 307] +[:mouse_move, 117, 57, 2, 175, 308] +[:mouse_move, 124, 57, 2, 176, 309] +[:mouse_move, 131, 57, 2, 177, 310] +[:mouse_move, 133, 57, 2, 178, 311] +[:mouse_move, 134, 57, 2, 179, 312] +[:mouse_move, 135, 57, 2, 180, 314] +[:mouse_button_pressed, 1, 0, 1, 181, 314] +[:mouse_button_up, 1, 0, 1, 182, 318] +[:mouse_move, 137, 57, 2, 183, 320] +[:mouse_move, 146, 57, 2, 184, 321] +[:mouse_move, 155, 57, 2, 185, 322] +[:mouse_move, 169, 57, 2, 186, 323] +[:mouse_move, 184, 57, 2, 187, 324] +[:mouse_move, 190, 57, 2, 188, 324] +[:mouse_move, 200, 57, 2, 189, 325] +[:mouse_move, 206, 57, 2, 190, 326] +[:mouse_move, 211, 57, 2, 191, 327] +[:mouse_move, 216, 57, 2, 192, 328] +[:mouse_move, 217, 57, 2, 193, 330] +[:mouse_button_pressed, 1, 0, 1, 194, 332] +[:mouse_button_up, 1, 0, 1, 195, 335] +[:mouse_move, 220, 57, 2, 196, 337] +[:mouse_move, 243, 57, 2, 197, 338] +[:mouse_move, 267, 57, 2, 198, 339] +[:mouse_move, 283, 57, 2, 199, 340] +[:mouse_move, 292, 57, 2, 200, 341] +[:mouse_move, 299, 57, 2, 201, 342] +[:mouse_move, 298, 57, 2, 202, 346] +[:mouse_move, 297, 57, 2, 203, 348] +[:mouse_move, 296, 57, 2, 204, 350] +[:mouse_button_pressed, 1, 0, 1, 205, 352] +[:mouse_button_up, 1, 0, 1, 206, 355] +[:mouse_move, 298, 57, 2, 207, 364] +[:mouse_move, 405, 53, 2, 208, 365] +[:mouse_move, 681, 55, 2, 209, 366] +[:mouse_move, 983, 86, 2, 210, 367] +[:mouse_move, 1117, 92, 2, 211, 368] +[:mouse_move, 1249, 93, 2, 212, 369] +[:mouse_move, 1299, 89, 2, 213, 370] +[:mouse_move, 1321, 85, 2, 214, 371] +[:mouse_move, 1314, 72, 2, 215, 378] +[:mouse_move, 1277, 66, 2, 216, 379] +[:mouse_move, 1249, 61, 2, 217, 380] +[:mouse_move, 1223, 56, 2, 218, 381] +[:mouse_move, 1212, 54, 2, 219, 382] +[:mouse_move, 1203, 50, 2, 220, 383] +[:mouse_move, 1200, 49, 2, 221, 384] +[:mouse_move, 1195, 46, 2, 222, 385] +[:mouse_move, 1191, 44, 2, 223, 386] +[:mouse_move, 1186, 42, 2, 224, 387] +[:mouse_move, 1184, 41, 2, 225, 388] +[:mouse_move, 1181, 41, 2, 226, 389] +[:mouse_button_pressed, 1, 0, 1, 227, 390] +[:mouse_move, 1181, 40, 2, 228, 390] +[:mouse_button_up, 1, 0, 1, 229, 393] +[:mouse_move, 1157, 44, 2, 230, 400] +[:mouse_move, 1085, 71, 2, 231, 401] +[:mouse_move, 1011, 102, 2, 232, 402] +[:mouse_move, 928, 141, 2, 233, 403] +[:mouse_move, 763, 235, 2, 234, 404] +[:mouse_move, 702, 276, 2, 235, 405] +[:mouse_move, 644, 318, 2, 236, 406] +[:mouse_move, 620, 338, 2, 237, 407] +[:mouse_move, 599, 357, 2, 238, 408] +[:mouse_move, 592, 363, 2, 239, 409] +[:mouse_move, 589, 365, 2, 240, 410] +[:mouse_move, 588, 365, 2, 241, 411] +[:mouse_move, 588, 366, 2, 242, 412] +[:mouse_move, 588, 365, 2, 243, 415] +[:mouse_move, 590, 365, 2, 244, 417] +[:mouse_move, 592, 364, 2, 245, 418] +[:mouse_move, 592, 363, 2, 246, 420] +[:mouse_move, 593, 362, 2, 247, 421] +[:mouse_button_pressed, 1, 0, 1, 248, 422] +[:mouse_button_up, 1, 0, 1, 249, 427] +[:mouse_move, 587, 359, 2, 250, 454] +[:mouse_move, 554, 341, 2, 251, 455] +[:mouse_move, 325, 237, 2, 252, 456] +[:mouse_move, 196, 188, 2, 253, 457] +[:mouse_move, 141, 167, 2, 254, 458] +[:mouse_move, 94, 147, 2, 255, 459] +[:mouse_move, 56, 125, 2, 256, 460] +[:mouse_move, 46, 119, 2, 257, 461] +[:mouse_move, 39, 113, 2, 258, 462] +[:mouse_move, 37, 110, 2, 259, 463] +[:mouse_move, 35, 105, 2, 260, 464] +[:mouse_move, 33, 101, 2, 261, 465] +[:mouse_move, 28, 90, 2, 262, 466] +[:mouse_move, 26, 82, 2, 263, 467] +[:mouse_move, 20, 66, 2, 264, 468] +[:mouse_move, 9, 42, 2, 265, 469] +[:mouse_move, 3, 32, 2, 266, 470] +[:mouse_move, -4, 18, 2, 267, 471] +[:mouse_move, -8, 11, 2, 268, 472] +[:mouse_move, -11, 7, 2, 269, 473] +[:mouse_move, -13, 5, 2, 270, 474] +[:mouse_move, -17, 1, 2, 271, 475] +[:mouse_move, -19, 0, 2, 272, 476] diff --git a/samples/23_hexagonal_grid/sprites/hexagon-black.png b/samples/23_hexagonal_grid/sprites/hexagon-black.png Binary files differnew file mode 100644 index 0000000..f50c872 --- /dev/null +++ b/samples/23_hexagonal_grid/sprites/hexagon-black.png diff --git a/samples/23_hexagonal_grid/sprites/hexagon-gray.png b/samples/23_hexagonal_grid/sprites/hexagon-gray.png Binary files differnew file mode 100644 index 0000000..e8c4c5a --- /dev/null +++ b/samples/23_hexagonal_grid/sprites/hexagon-gray.png diff --git a/samples/23_isometric_grid/app/main.rb b/samples/23_isometric_grid/app/main.rb new file mode 100644 index 0000000..28bea32 --- /dev/null +++ b/samples/23_isometric_grid/app/main.rb @@ -0,0 +1,262 @@ +class Isometric + attr_accessor :grid, :inputs, :state, :outputs + + def tick + defaults + render + calc + process_inputs + end + + def defaults + state.quantity ||= 6 #Size of grid + state.tileSize ||= [262 / 2, 194 / 2] #width and heigth of orange tiles + state.tileGrid ||= [] #Holds ordering of tiles + state.currentSpriteLocation ||= -1 #Current Sprite hovering location + state.tileCords ||= [] #Physical, rendering cordinates + state.initCords ||= [640 - (state.quantity / 2 * state.tileSize[0]), 330] #Location of tile (0, 0) + state.sideSize ||= [state.tileSize[0] / 2, 242 / 2] #Purple & green cube face size + state.mode ||= :delete #Switches between :delete and :insert + state.spriteSelection ||= [['river', 0, 0, 262 / 2, 194 / 2], + ['mountain', 0, 0, 262 / 2, 245 / 2], + ['ocean', 0, 0, 262 / 2, 194 / 2]] #Storage for sprite information + #['name', deltaX, deltaY, sizeW, sizeH] + #^delta refers to distance from tile cords + + #Orders tiles based on tile placement and fancy math. Very left: 0,0. Very bottom: quantity-1, 0, etc + if state.tileGrid == [] + tempX = 0 + tempY = 0 + tempLeft = false + tempRight = false + count = 0 + (state.quantity * state.quantity).times do + if tempY == 0 + tempLeft = true + end + if tempX == (state.quantity - 1) + tempRight = true + end + state.tileGrid.push([tempX, tempY, true, tempLeft, tempRight, count]) + #orderX, orderY, exists?, leftSide, rightSide, order + tempX += 1 + if tempX == state.quantity + tempX = 0 + tempY += 1 + end + tempLeft = false + tempRight = false + count += 1 + end + end + + #Calculates physical cordinates for tiles + if state.tileCords == [] + state.tileCords = state.tileGrid.map do + |val| + x = (state.initCords[0]) + ((val[0] + val[1]) * state.tileSize[0] / 2) + y = (state.initCords[1]) + (-1 * val[0] * state.tileSize[1] / 2) + (val[1] * state.tileSize[1] / 2) + [x, y, val[2], val[3], val[4], val[5], -1] #-1 represents sprite on top of tile. -1 for now + end + end + + end + + def render + renderBackground + renderLeft + renderRight + renderTiles + renderObjects + renderLabels + end + + def renderBackground + outputs.solids << [0, 0, 1280, 720, 0, 0, 0] #Background color + end + + def renderLeft + #Shows the pink left cube face + outputs.sprites << state.tileCords.map do + |val| + if val[2] == true && val[3] == true #Checks if the tile exists and right face needs to be rendered + [val[0], val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], + state.sideSize[1], 'sprites/leftSide.png'] + end + end + end + + def renderRight + #Shows the green right cube face + outputs.sprites << state.tileCords.map do + |val| + if val[2] == true && val[4] == true #Checks if it exists & checks if right face needs to be rendered + [val[0] + state.tileSize[0] / 2, val[1] + (state.tileSize[1] / 2) - state.sideSize[1], state.sideSize[0], + state.sideSize[1], 'sprites/rightSide.png'] + end + end + end + + def renderTiles + #Shows the tile itself. Important that it's rendered after the two above! + outputs.sprites << state.tileCords.map do + |val| + if val[2] == true #Chcekcs if tile needs to be rendered + if val[5] == state.currentSpriteLocation + [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/selectedTile.png'] + else + [val[0], val[1], state.tileSize[0], state.tileSize[1], 'sprites/tile.png'] + end + end + end + end + + def renderObjects + #Renders the sprites on top of the tiles. Order of rendering: top corner to right corner and cascade down until left corner + #to bottom corner. + a = (state.quantity * state.quantity) - state.quantity + iter = 0 + loop do + if state.tileCords[a][2] == true && state.tileCords[a][6] != -1 + outputs.sprites << [state.tileCords[a][0] + state.spriteSelection[state.tileCords[a][6]][1], + state.tileCords[a][1] + state.spriteSelection[state.tileCords[a][6]][2], + state.spriteSelection[state.tileCords[a][6]][3], state.spriteSelection[state.tileCords[a][6]][4], + 'sprites/' + state.spriteSelection[state.tileCords[a][6]][0] + '.png'] + end + iter += 1 + a += 1 + a -= state.quantity * 2 if iter == state.quantity + iter = 0 if iter == state.quantity + break if a < 0 + end + end + + def renderLabels + #Labels + outputs.labels << [50, 680, 'Click to delete!', 5, 0, 255, 255, 255, 255] if state.mode == :delete + outputs.labels << [50, 640, 'Press \'i\' for insert mode!', 5, 0, 255, 255, 255, 255] if state.mode == :delete + outputs.labels << [50, 680, 'Click to insert!', 5, 0, 255, 255, 255, 255] if state.mode == :insert + outputs.labels << [50, 640, 'Press \'d\' for delete mode!', 5, 0, 255, 255, 255, 255] if state.mode == :insert + end + + def calc + calcCurrentHover + end + + def calcCurrentHover + #This determines what tile the mouse is hovering (or last hovering) over + x = inputs.mouse.position.x + y = inputs.mouse.position.y + m = (state.tileSize[1] / state.tileSize[0]) #slope + state.tileCords.map do + |val| + #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) + next unless val[0] < x && x < val[0] + state.tileSize[0] + next unless val[1] < y && y < val[1] + state.tileSize[1] + next unless val[2] == true + tempBool = false + if x == val[0] + (state.tileSize[0] / 2) + #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond + tempBool = true + elsif x < state.tileSize[0] / 2 + val[0] + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond + tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) + tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) + #Checks to see if the mouse click y value is between those temp y values + tempBool = true if y < tempY1 && y > tempY2 + elsif x > state.tileSize[0] / 2 + val[0] + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond + tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] + #Checks to see if the mouse click y value is between those temp y values + tempBool = true if y > tempY1 && y < tempY2 + end + + if tempBool == true + state.currentSpriteLocation = val[5] #Current sprite location set to the order value + end + end + end + + def process_inputs + #Makes development much faster and easier + if inputs.keyboard.key_up.r + $dragon.reset + end + checkTileSelected + switchModes + end + + def checkTileSelected + if inputs.mouse.down + x = inputs.mouse.down.point.x + y = inputs.mouse.down.point.y + m = (state.tileSize[1] / state.tileSize[0]) #slope + state.tileCords.map do + |val| + #Conditions that makes runtime faster. Checks if the mouse click was between tile dimensions (rectangle collision) + next unless val[0] < x && x < val[0] + state.tileSize[0] + next unless val[1] < y && y < val[1] + state.tileSize[1] + next unless val[2] == true + tempBool = false + if x == val[0] + (state.tileSize[0] / 2) + #The height of a diamond is the height of the diamond, so if x equals that exact point, it must be inside the diamond + tempBool = true + elsif x < state.tileSize[0] / 2 + val[0] + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the left half of diamond + tempY1 = (m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) + tempY2 = (-1 * m * (x - val[0])) + val[1] + (state.tileSize[1] / 2) + #Checks to see if the mouse click y value is between those temp y values + tempBool = true if y < tempY1 && y > tempY2 + elsif x > state.tileSize[0] / 2 + val[0] + #Uses y = (m) * (x - x1) + y1 to determine the y values for the two diamond lines on the right half of diamond + tempY1 = (m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + tempY2 = (-1 * m * (x - val[0] - (state.tileSize[0] / 2))) + val[1] + state.tileSize[1] + #Checks to see if the mouse click y value is between those temp y values + tempBool = true if y > tempY1 && y < tempY2 + end + + if tempBool == true + if state.mode == :delete + val[2] = false + state.tileGrid[val[5]][2] = false #Unnecessary because never used again but eh, I like consistency + state.tileCords[val[5]][2] = false #Ensures that the tile isn't rendered + unless state.tileGrid[val[5]][0] == 0 #If tile is the left most tile in the row, right doesn't get rendered + state.tileGrid[val[5] - 1][4] = true #Why the order value is amazing + state.tileCords[val[5] - 1][4] = true + end + unless state.tileGrid[val[5]][1] == state.quantity - 1 #Same but left side + state.tileGrid[val[5] + state.quantity][3] = true + state.tileCords[val[5] + state.quantity][3] = true + end + elsif state.mode == :insert + #adds the current sprite value selected to tileCords. (changes from the -1 earlier) + val[6] = rand(state.spriteSelection.length) + end + end + end + end + end + + def switchModes + #Switches between insert and delete modes + if inputs.keyboard.key_up.i && state.mode == :delete + state.mode = :insert + inputs.keyboard.clear + elsif inputs.keyboard.key_up.d && state.mode == :insert + state.mode = :delete + inputs.keyboard.clear + end + end + +end + +$isometric = Isometric.new + +def tick args + $isometric.grid = args.grid + $isometric.inputs = args.inputs + $isometric.state = args.state + $isometric.outputs = args.outputs + $isometric.tick +end diff --git a/samples/23_isometric_grid/app/tests.rb b/samples/23_isometric_grid/app/tests.rb new file mode 100644 index 0000000..925f321 --- /dev/null +++ b/samples/23_isometric_grid/app/tests.rb @@ -0,0 +1,24 @@ +# For advanced users: +# You can put some quick verification tests here, any method +# that starts with the `test_` will be run when you save this file. + +# here is an example test and game + +class MySuperHappyFunGame + attr_gtk + + def tick + outputs.solids << [100, 100, 300, 300] + end +end + +def test_universe args, assert + game = MySuperHappyFunGame.new + game.args = args + game.tick + assert.true! args.outputs.solids.length == 1, "failure: a solid was not added after tick" + assert.false! 1 == 2, "failure: some how, 1 equals 2, the world is ending" + puts "test_universe completed successfully" +end + +$gtk.tests.start diff --git a/samples/23_isometric_grid/license-for-sample.txt b/samples/23_isometric_grid/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/23_isometric_grid/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/23_isometric_grid/metadata/game_metadata.txt b/samples/23_isometric_grid/metadata/game_metadata.txt new file mode 100644 index 0000000..1b03500 --- /dev/null +++ b/samples/23_isometric_grid/metadata/game_metadata.txt @@ -0,0 +1,6 @@ +#devid=myname +#devtitle=My Name +#gameid=mygame +#gametitle=My Game +#version=0.1 +#icon=metadata/icon.png diff --git a/samples/23_isometric_grid/metadata/icon.png b/samples/23_isometric_grid/metadata/icon.png Binary files differnew file mode 100644 index 0000000..e20e8c2 --- /dev/null +++ b/samples/23_isometric_grid/metadata/icon.png diff --git a/samples/23_isometric_grid/replay.txt b/samples/23_isometric_grid/replay.txt new file mode 100644 index 0000000..1cf14a2 --- /dev/null +++ b/samples/23_isometric_grid/replay.txt @@ -0,0 +1,579 @@ +replay_version 2.0 +stopped_at 1116 +seed 100 +recorded_at Sat Feb 01 20:04:50 2020 +[:mouse_move, -27, 201, 2, 1, 76] +[:mouse_move, -23, 204, 2, 2, 77] +[:mouse_move, -12, 212, 2, 3, 78] +[:mouse_move, -5, 220, 2, 4, 79] +[:mouse_move, -2, 219, 2, 5, 96] +[:mouse_move, 4, 217, 2, 6, 97] +[:mouse_move, 24, 209, 2, 7, 98] +[:mouse_move, 38, 202, 2, 8, 99] +[:mouse_move, 66, 194, 2, 9, 100] +[:mouse_move, 71, 192, 2, 10, 101] +[:mouse_move, 86, 187, 2, 11, 102] +[:mouse_move, 92, 185, 2, 12, 103] +[:mouse_move, 99, 183, 2, 13, 104] +[:mouse_move, 100, 182, 2, 14, 105] +[:mouse_move, 101, 182, 2, 15, 106] +[:mouse_move, 102, 181, 2, 16, 107] +[:mouse_move, 102, 180, 2, 17, 112] +[:mouse_button_pressed, 1, 0, 1, 18, 114] +[:mouse_button_up, 1, 0, 1, 19, 120] +[:mouse_move, 103, 174, 2, 20, 135] +[:mouse_move, 105, 169, 2, 21, 136] +[:mouse_move, 107, 156, 2, 22, 137] +[:mouse_move, 108, 147, 2, 23, 138] +[:mouse_move, 108, 122, 2, 24, 139] +[:mouse_move, 104, 108, 2, 25, 140] +[:mouse_move, 101, 102, 2, 26, 141] +[:mouse_move, 94, 92, 2, 27, 142] +[:mouse_move, 90, 89, 2, 28, 143] +[:mouse_move, 83, 85, 2, 29, 144] +[:mouse_move, 78, 83, 2, 30, 145] +[:mouse_move, 72, 81, 2, 31, 146] +[:mouse_move, 69, 80, 2, 32, 147] +[:mouse_move, 66, 78, 2, 33, 148] +[:mouse_move, 65, 78, 2, 34, 149] +[:mouse_move, 64, 78, 2, 35, 150] +[:mouse_move, 64, 77, 2, 36, 151] +[:mouse_move, 69, 77, 2, 37, 154] +[:mouse_move, 74, 77, 2, 38, 155] +[:mouse_move, 96, 76, 2, 39, 156] +[:mouse_move, 118, 76, 2, 40, 157] +[:mouse_move, 145, 75, 2, 41, 158] +[:mouse_move, 162, 74, 2, 42, 159] +[:mouse_move, 183, 73, 2, 43, 160] +[:mouse_move, 196, 72, 2, 44, 161] +[:mouse_move, 215, 70, 2, 45, 162] +[:mouse_move, 218, 70, 2, 46, 163] +[:mouse_move, 228, 69, 2, 47, 164] +[:mouse_move, 232, 69, 2, 48, 165] +[:mouse_move, 233, 69, 2, 49, 166] +[:mouse_move, 236, 69, 2, 50, 167] +[:mouse_move, 237, 69, 2, 51, 168] +[:mouse_move, 243, 70, 2, 52, 169] +[:mouse_move, 244, 70, 2, 53, 170] +[:mouse_move, 247, 70, 2, 54, 171] +[:mouse_move, 249, 70, 2, 55, 172] +[:mouse_move, 250, 70, 2, 56, 173] +[:mouse_move, 251, 70, 2, 57, 175] +[:mouse_move, 249, 70, 2, 58, 184] +[:mouse_move, 236, 70, 2, 59, 185] +[:mouse_move, 222, 70, 2, 60, 186] +[:mouse_move, 170, 71, 2, 61, 187] +[:mouse_move, 138, 75, 2, 62, 188] +[:mouse_move, 70, 87, 2, 63, 189] +[:mouse_move, 56, 91, 2, 64, 190] +[:mouse_move, 21, 100, 2, 65, 191] +[:mouse_move, 1, 107, 2, 66, 192] +[:mouse_move, -7, 110, 2, 67, 193] +[:mouse_move, -14, 114, 2, 68, 194] +[:mouse_move, -17, 115, 2, 69, 195] +[:mouse_move, -17, 116, 2, 70, 196] +[:mouse_move, -9, 117, 2, 71, 197] +[:mouse_move, 22, 119, 2, 72, 198] +[:mouse_move, 44, 119, 2, 73, 199] +[:mouse_move, 84, 120, 2, 74, 200] +[:mouse_move, 107, 120, 2, 75, 201] +[:mouse_move, 120, 120, 2, 76, 202] +[:mouse_move, 132, 120, 2, 77, 203] +[:mouse_move, 145, 120, 2, 78, 204] +[:mouse_move, 148, 120, 2, 79, 205] +[:mouse_move, 150, 120, 2, 80, 206] +[:mouse_move, 151, 120, 2, 81, 207] +[:mouse_move, 152, 120, 2, 82, 220] +[:mouse_move, 153, 120, 2, 83, 301] +[:mouse_move, 156, 120, 2, 84, 302] +[:mouse_move, 158, 120, 2, 85, 303] +[:mouse_move, 163, 120, 2, 86, 304] +[:mouse_move, 165, 120, 2, 87, 305] +[:mouse_move, 168, 118, 2, 88, 306] +[:mouse_move, 170, 116, 2, 89, 307] +[:mouse_move, 172, 113, 2, 90, 308] +[:mouse_move, 173, 110, 2, 91, 309] +[:mouse_move, 176, 104, 2, 92, 310] +[:mouse_move, 176, 101, 2, 93, 311] +[:mouse_move, 176, 93, 2, 94, 312] +[:mouse_move, 176, 89, 2, 95, 313] +[:mouse_move, 173, 85, 2, 96, 314] +[:mouse_move, 172, 83, 2, 97, 315] +[:mouse_move, 171, 78, 2, 98, 316] +[:mouse_move, 170, 76, 2, 99, 317] +[:mouse_move, 169, 73, 2, 100, 318] +[:mouse_move, 168, 72, 2, 101, 319] +[:mouse_move, 164, 70, 2, 102, 320] +[:mouse_move, 161, 68, 2, 103, 321] +[:mouse_move, 152, 68, 2, 104, 322] +[:mouse_move, 147, 68, 2, 105, 323] +[:mouse_move, 140, 68, 2, 106, 324] +[:mouse_move, 134, 68, 2, 107, 325] +[:mouse_move, 126, 70, 2, 108, 326] +[:mouse_move, 123, 72, 2, 109, 327] +[:mouse_move, 118, 77, 2, 110, 328] +[:mouse_move, 116, 82, 2, 111, 329] +[:mouse_move, 112, 94, 2, 112, 330] +[:mouse_move, 110, 101, 2, 113, 331] +[:mouse_move, 110, 114, 2, 114, 332] +[:mouse_move, 110, 122, 2, 115, 333] +[:mouse_move, 114, 126, 2, 116, 334] +[:mouse_move, 120, 130, 2, 117, 335] +[:mouse_move, 125, 132, 2, 118, 336] +[:mouse_move, 139, 133, 2, 119, 337] +[:mouse_move, 147, 133, 2, 120, 338] +[:mouse_move, 162, 133, 2, 121, 339] +[:mouse_move, 168, 131, 2, 122, 340] +[:mouse_move, 178, 125, 2, 123, 341] +[:mouse_move, 179, 124, 2, 124, 342] +[:mouse_move, 186, 117, 2, 125, 343] +[:mouse_move, 188, 113, 2, 126, 344] +[:mouse_move, 189, 101, 2, 127, 345] +[:mouse_move, 189, 97, 2, 128, 346] +[:mouse_move, 186, 87, 2, 129, 347] +[:mouse_move, 183, 82, 2, 130, 348] +[:mouse_move, 176, 75, 2, 131, 349] +[:mouse_move, 167, 71, 2, 132, 350] +[:mouse_move, 155, 71, 2, 133, 351] +[:mouse_move, 149, 71, 2, 134, 352] +[:mouse_move, 140, 71, 2, 135, 353] +[:mouse_move, 137, 73, 2, 136, 354] +[:mouse_move, 134, 74, 2, 137, 355] +[:mouse_move, 131, 76, 2, 138, 356] +[:mouse_move, 130, 76, 2, 139, 357] +[:mouse_move, 130, 77, 2, 140, 358] +[:mouse_move, 130, 78, 2, 141, 360] +[:mouse_move, 131, 78, 2, 142, 362] +[:key_down_raw, 105, 0, 2, 143, 365] +[:key_up_raw, 105, 0, 2, 144, 370] +[:mouse_move, 135, 78, 2, 145, 391] +[:mouse_move, 141, 78, 2, 146, 392] +[:mouse_move, 176, 87, 2, 147, 393] +[:mouse_move, 216, 103, 2, 148, 394] +[:mouse_move, 384, 182, 2, 149, 395] +[:mouse_move, 464, 234, 2, 150, 396] +[:mouse_move, 574, 322, 2, 151, 397] +[:mouse_move, 599, 344, 2, 152, 398] +[:mouse_move, 649, 384, 2, 153, 399] +[:mouse_move, 648, 388, 2, 154, 413] +[:mouse_move, 646, 393, 2, 155, 414] +[:mouse_move, 641, 403, 2, 156, 415] +[:mouse_move, 635, 410, 2, 157, 416] +[:mouse_move, 626, 422, 2, 158, 417] +[:mouse_move, 614, 433, 2, 159, 418] +[:mouse_move, 613, 435, 2, 160, 419] +[:mouse_move, 608, 438, 2, 161, 420] +[:mouse_move, 605, 440, 2, 162, 421] +[:mouse_move, 604, 440, 2, 163, 422] +[:mouse_move, 603, 441, 2, 164, 423] +[:mouse_move, 602, 441, 2, 165, 431] +[:mouse_button_pressed, 1, 0, 1, 166, 433] +[:mouse_button_up, 1, 0, 1, 167, 439] +[:mouse_move, 603, 441, 2, 168, 444] +[:mouse_move, 606, 438, 2, 169, 445] +[:mouse_move, 613, 434, 2, 170, 446] +[:mouse_move, 622, 426, 2, 171, 447] +[:mouse_move, 624, 423, 2, 172, 448] +[:mouse_move, 634, 413, 2, 173, 449] +[:mouse_move, 635, 411, 2, 174, 450] +[:mouse_move, 641, 404, 2, 175, 451] +[:mouse_move, 642, 403, 2, 176, 452] +[:mouse_move, 644, 400, 2, 177, 453] +[:mouse_move, 645, 398, 2, 178, 454] +[:mouse_move, 646, 397, 2, 179, 455] +[:mouse_move, 646, 396, 2, 180, 457] +[:mouse_button_pressed, 1, 0, 1, 181, 459] +[:mouse_button_up, 1, 0, 1, 182, 465] +[:mouse_move, 649, 396, 2, 183, 468] +[:mouse_move, 653, 396, 2, 184, 469] +[:mouse_move, 664, 397, 2, 185, 470] +[:mouse_move, 666, 398, 2, 186, 471] +[:mouse_move, 676, 405, 2, 187, 472] +[:mouse_move, 679, 408, 2, 188, 473] +[:mouse_move, 684, 416, 2, 189, 474] +[:mouse_move, 685, 417, 2, 190, 475] +[:mouse_move, 688, 420, 2, 191, 476] +[:mouse_move, 688, 422, 2, 192, 477] +[:mouse_move, 689, 424, 2, 193, 478] +[:mouse_move, 690, 426, 2, 194, 479] +[:mouse_move, 692, 428, 2, 195, 480] +[:mouse_move, 693, 429, 2, 196, 481] +[:mouse_move, 694, 430, 2, 197, 482] +[:mouse_move, 695, 432, 2, 198, 483] +[:mouse_button_pressed, 1, 0, 1, 199, 485] +[:mouse_move, 696, 432, 2, 200, 485] +[:mouse_button_up, 1, 0, 1, 201, 492] +[:mouse_move, 699, 430, 2, 202, 496] +[:mouse_move, 705, 427, 2, 203, 497] +[:mouse_move, 709, 425, 2, 204, 498] +[:mouse_move, 718, 421, 2, 205, 499] +[:mouse_move, 725, 418, 2, 206, 500] +[:mouse_move, 736, 412, 2, 207, 501] +[:mouse_move, 742, 410, 2, 208, 502] +[:mouse_move, 750, 406, 2, 209, 503] +[:mouse_move, 753, 405, 2, 210, 504] +[:mouse_move, 759, 402, 2, 211, 505] +[:mouse_move, 761, 400, 2, 212, 506] +[:mouse_move, 764, 398, 2, 213, 507] +[:mouse_move, 765, 397, 2, 214, 508] +[:mouse_move, 768, 397, 2, 215, 509] +[:mouse_move, 769, 396, 2, 216, 510] +[:mouse_move, 770, 396, 2, 217, 512] +[:mouse_button_pressed, 1, 0, 1, 218, 514] +[:mouse_move, 770, 395, 2, 219, 514] +[:mouse_button_up, 1, 0, 1, 220, 523] +[:mouse_move, 770, 394, 2, 221, 528] +[:mouse_move, 770, 393, 2, 222, 530] +[:mouse_move, 762, 389, 2, 223, 532] +[:mouse_move, 757, 387, 2, 224, 533] +[:mouse_move, 741, 379, 2, 225, 534] +[:mouse_move, 737, 377, 2, 226, 535] +[:mouse_move, 718, 369, 2, 227, 536] +[:mouse_move, 711, 364, 2, 228, 537] +[:mouse_move, 701, 356, 2, 229, 538] +[:mouse_move, 699, 354, 2, 230, 539] +[:mouse_move, 694, 348, 2, 231, 540] +[:mouse_move, 692, 346, 2, 232, 541] +[:mouse_move, 690, 344, 2, 233, 542] +[:mouse_move, 690, 343, 2, 234, 543] +[:mouse_move, 689, 342, 2, 235, 544] +[:mouse_button_pressed, 1, 0, 1, 236, 546] +[:mouse_button_up, 1, 0, 1, 237, 554] +[:mouse_move, 689, 340, 2, 238, 555] +[:mouse_move, 689, 339, 2, 239, 556] +[:mouse_move, 686, 333, 2, 240, 557] +[:mouse_move, 684, 330, 2, 241, 558] +[:mouse_move, 681, 325, 2, 242, 559] +[:mouse_move, 678, 322, 2, 243, 560] +[:mouse_move, 673, 315, 2, 244, 561] +[:mouse_move, 669, 312, 2, 245, 562] +[:mouse_move, 665, 308, 2, 246, 563] +[:mouse_move, 664, 307, 2, 247, 564] +[:mouse_move, 660, 304, 2, 248, 565] +[:mouse_move, 659, 302, 2, 249, 566] +[:mouse_move, 656, 301, 2, 250, 567] +[:mouse_move, 653, 300, 2, 251, 568] +[:mouse_move, 651, 299, 2, 252, 569] +[:mouse_move, 650, 298, 2, 253, 570] +[:mouse_move, 649, 298, 2, 254, 571] +[:mouse_move, 648, 297, 2, 255, 572] +[:mouse_button_pressed, 1, 0, 1, 256, 573] +[:mouse_button_up, 1, 0, 1, 257, 580] +[:mouse_move, 645, 297, 2, 258, 582] +[:mouse_move, 641, 297, 2, 259, 583] +[:mouse_move, 628, 297, 2, 260, 584] +[:mouse_move, 620, 297, 2, 261, 585] +[:mouse_move, 606, 297, 2, 262, 586] +[:mouse_move, 590, 297, 2, 263, 587] +[:mouse_move, 571, 297, 2, 264, 588] +[:mouse_move, 567, 297, 2, 265, 589] +[:mouse_move, 550, 297, 2, 266, 590] +[:mouse_move, 544, 297, 2, 267, 591] +[:mouse_move, 535, 296, 2, 268, 592] +[:mouse_move, 531, 295, 2, 269, 593] +[:mouse_move, 526, 293, 2, 270, 594] +[:mouse_move, 525, 293, 2, 271, 595] +[:mouse_move, 523, 291, 2, 272, 596] +[:mouse_move, 522, 290, 2, 273, 598] +[:mouse_move, 522, 289, 2, 274, 599] +[:mouse_move, 522, 288, 2, 275, 601] +[:mouse_button_pressed, 1, 0, 1, 276, 604] +[:mouse_move, 521, 288, 2, 277, 604] +[:mouse_button_up, 1, 0, 1, 278, 612] +[:mouse_move, 514, 283, 2, 279, 652] +[:mouse_move, 505, 277, 2, 280, 653] +[:mouse_move, 477, 262, 2, 281, 654] +[:mouse_move, 443, 241, 2, 282, 655] +[:mouse_move, 348, 187, 2, 283, 656] +[:mouse_move, 288, 155, 2, 284, 657] +[:mouse_move, 169, 90, 2, 285, 658] +[:mouse_move, 147, 77, 2, 286, 659] +[:mouse_move, 118, 61, 2, 287, 660] +[:mouse_move, 94, 48, 2, 288, 661] +[:mouse_move, 62, 28, 2, 289, 662] +[:mouse_move, 51, 20, 2, 290, 663] +[:mouse_move, 44, 17, 2, 291, 664] +[:mouse_move, 39, 12, 2, 292, 665] +[:mouse_move, 38, 11, 2, 293, 666] +[:mouse_move, 36, 11, 2, 294, 667] +[:mouse_move, 36, 10, 2, 295, 668] +[:mouse_move, 38, 19, 2, 296, 671] +[:mouse_move, 41, 24, 2, 297, 672] +[:mouse_move, 45, 36, 2, 298, 673] +[:mouse_move, 48, 39, 2, 299, 674] +[:mouse_move, 51, 49, 2, 300, 675] +[:mouse_move, 53, 53, 2, 301, 676] +[:mouse_move, 56, 60, 2, 302, 677] +[:mouse_move, 57, 62, 2, 303, 678] +[:mouse_move, 60, 70, 2, 304, 679] +[:mouse_move, 65, 77, 2, 305, 680] +[:mouse_move, 73, 86, 2, 306, 681] +[:mouse_move, 77, 91, 2, 307, 682] +[:mouse_move, 89, 101, 2, 308, 683] +[:mouse_move, 97, 105, 2, 309, 684] +[:mouse_move, 117, 114, 2, 310, 685] +[:mouse_move, 122, 116, 2, 311, 686] +[:mouse_move, 137, 118, 2, 312, 687] +[:mouse_move, 150, 119, 2, 313, 688] +[:mouse_move, 155, 119, 2, 314, 689] +[:mouse_move, 165, 119, 2, 315, 690] +[:mouse_move, 170, 117, 2, 316, 691] +[:mouse_move, 174, 114, 2, 317, 692] +[:mouse_move, 177, 112, 2, 318, 693] +[:mouse_move, 180, 108, 2, 319, 694] +[:mouse_move, 181, 106, 2, 320, 695] +[:mouse_move, 182, 99, 2, 321, 696] +[:mouse_move, 182, 96, 2, 322, 697] +[:mouse_move, 180, 91, 2, 323, 698] +[:mouse_move, 179, 88, 2, 324, 699] +[:mouse_move, 173, 83, 2, 325, 700] +[:mouse_move, 168, 80, 2, 326, 701] +[:mouse_move, 154, 78, 2, 327, 702] +[:mouse_move, 150, 78, 2, 328, 703] +[:mouse_move, 141, 78, 2, 329, 704] +[:mouse_move, 138, 78, 2, 330, 705] +[:mouse_move, 132, 78, 2, 331, 706] +[:mouse_move, 130, 78, 2, 332, 707] +[:mouse_move, 128, 78, 2, 333, 708] +[:mouse_move, 126, 80, 2, 334, 709] +[:mouse_move, 124, 83, 2, 335, 710] +[:mouse_move, 124, 85, 2, 336, 711] +[:mouse_move, 123, 88, 2, 337, 712] +[:mouse_move, 122, 91, 2, 338, 713] +[:mouse_move, 122, 96, 2, 339, 714] +[:mouse_move, 122, 97, 2, 340, 715] +[:mouse_move, 122, 100, 2, 341, 716] +[:mouse_move, 122, 101, 2, 342, 717] +[:mouse_move, 125, 103, 2, 343, 718] +[:mouse_move, 128, 103, 2, 344, 719] +[:mouse_move, 135, 104, 2, 345, 720] +[:mouse_move, 146, 104, 2, 346, 721] +[:mouse_move, 152, 104, 2, 347, 722] +[:mouse_move, 160, 102, 2, 348, 723] +[:mouse_move, 164, 101, 2, 349, 724] +[:mouse_move, 169, 98, 2, 350, 725] +[:mouse_move, 171, 97, 2, 351, 726] +[:mouse_move, 173, 91, 2, 352, 727] +[:mouse_move, 173, 88, 2, 353, 728] +[:mouse_move, 172, 75, 2, 354, 729] +[:mouse_move, 167, 68, 2, 355, 730] +[:mouse_move, 153, 53, 2, 356, 731] +[:mouse_move, 146, 45, 2, 357, 732] +[:mouse_move, 122, 35, 2, 358, 733] +[:mouse_move, 109, 33, 2, 359, 734] +[:mouse_move, 83, 30, 2, 360, 735] +[:mouse_move, 70, 30, 2, 361, 736] +[:mouse_move, 54, 34, 2, 362, 737] +[:mouse_move, 45, 37, 2, 363, 738] +[:mouse_move, 35, 44, 2, 364, 739] +[:mouse_move, 26, 53, 2, 365, 740] +[:mouse_move, 21, 72, 2, 366, 741] +[:mouse_move, 20, 87, 2, 367, 742] +[:mouse_move, 20, 110, 2, 368, 743] +[:mouse_move, 20, 122, 2, 369, 744] +[:mouse_move, 32, 147, 2, 370, 745] +[:mouse_move, 46, 158, 2, 371, 746] +[:mouse_move, 76, 168, 2, 372, 747] +[:mouse_move, 122, 177, 2, 373, 748] +[:mouse_move, 149, 182, 2, 374, 749] +[:mouse_move, 186, 185, 2, 375, 750] +[:mouse_move, 208, 185, 2, 376, 751] +[:mouse_move, 228, 182, 2, 377, 752] +[:mouse_move, 240, 177, 2, 378, 753] +[:mouse_move, 259, 160, 2, 379, 754] +[:mouse_move, 264, 148, 2, 380, 755] +[:mouse_move, 268, 120, 2, 381, 756] +[:mouse_move, 269, 103, 2, 382, 757] +[:mouse_move, 268, 82, 2, 383, 758] +[:mouse_move, 261, 61, 2, 384, 759] +[:mouse_move, 237, 35, 2, 385, 760] +[:mouse_move, 221, 26, 2, 386, 761] +[:mouse_move, 174, 17, 2, 387, 762] +[:mouse_move, 161, 17, 2, 388, 763] +[:mouse_move, 107, 17, 2, 389, 764] +[:mouse_move, 84, 19, 2, 390, 765] +[:mouse_move, 59, 26, 2, 391, 766] +[:mouse_move, 48, 30, 2, 392, 767] +[:mouse_move, 23, 46, 2, 393, 768] +[:mouse_move, 18, 55, 2, 394, 769] +[:mouse_move, 13, 69, 2, 395, 770] +[:mouse_move, 12, 76, 2, 396, 771] +[:mouse_move, 12, 85, 2, 397, 772] +[:mouse_move, 13, 97, 2, 398, 773] +[:mouse_move, 19, 102, 2, 399, 774] +[:mouse_move, 36, 105, 2, 400, 775] +[:mouse_move, 46, 106, 2, 401, 776] +[:mouse_move, 62, 107, 2, 402, 777] +[:mouse_move, 73, 107, 2, 403, 778] +[:mouse_move, 83, 107, 2, 404, 779] +[:mouse_move, 112, 118, 2, 405, 818] +[:mouse_move, 141, 134, 2, 406, 819] +[:mouse_move, 230, 194, 2, 407, 820] +[:mouse_move, 324, 265, 2, 408, 821] +[:mouse_move, 423, 340, 2, 409, 822] +[:key_down_raw, 100, 0, 2, 410, 823] +[:key_up_raw, 100, 0, 2, 411, 823] +[:mouse_move, 452, 361, 2, 412, 823] +[:mouse_move, 473, 376, 2, 413, 823] +[:mouse_move, 487, 385, 2, 414, 824] +[:mouse_move, 490, 382, 2, 415, 837] +[:mouse_move, 497, 379, 2, 416, 838] +[:mouse_move, 509, 371, 2, 417, 839] +[:mouse_move, 517, 366, 2, 418, 840] +[:mouse_move, 528, 360, 2, 419, 841] +[:mouse_move, 532, 358, 2, 420, 842] +[:mouse_move, 538, 354, 2, 421, 843] +[:mouse_move, 541, 352, 2, 422, 844] +[:mouse_move, 545, 348, 2, 423, 845] +[:mouse_move, 546, 346, 2, 424, 846] +[:mouse_move, 548, 343, 2, 425, 847] +[:mouse_move, 549, 340, 2, 426, 848] +[:mouse_move, 552, 329, 2, 427, 849] +[:mouse_move, 554, 324, 2, 428, 850] +[:mouse_move, 558, 314, 2, 429, 851] +[:mouse_move, 562, 309, 2, 430, 852] +[:mouse_move, 567, 298, 2, 431, 853] +[:mouse_move, 568, 296, 2, 432, 854] +[:mouse_move, 571, 290, 2, 433, 855] +[:mouse_move, 572, 286, 2, 434, 856] +[:mouse_move, 573, 285, 2, 435, 857] +[:mouse_move, 574, 283, 2, 436, 858] +[:mouse_move, 574, 282, 2, 437, 860] +[:mouse_move, 574, 281, 2, 438, 861] +[:mouse_move, 576, 280, 2, 439, 863] +[:mouse_move, 576, 279, 2, 440, 864] +[:mouse_move, 576, 277, 2, 441, 865] +[:mouse_move, 577, 274, 2, 442, 866] +[:mouse_move, 577, 273, 2, 443, 867] +[:mouse_move, 578, 269, 2, 444, 868] +[:mouse_move, 579, 268, 2, 445, 869] +[:mouse_move, 580, 265, 2, 446, 870] +[:mouse_move, 581, 265, 2, 447, 871] +[:mouse_move, 583, 263, 2, 448, 872] +[:mouse_move, 585, 262, 2, 449, 873] +[:mouse_move, 589, 260, 2, 450, 874] +[:mouse_move, 593, 259, 2, 451, 875] +[:mouse_move, 599, 258, 2, 452, 876] +[:mouse_move, 603, 258, 2, 453, 877] +[:mouse_move, 606, 258, 2, 454, 878] +[:mouse_move, 610, 259, 2, 455, 879] +[:mouse_move, 613, 260, 2, 456, 880] +[:mouse_move, 614, 261, 2, 457, 881] +[:mouse_move, 616, 264, 2, 458, 882] +[:mouse_move, 617, 265, 2, 459, 883] +[:mouse_move, 618, 267, 2, 460, 884] +[:mouse_move, 618, 269, 2, 461, 885] +[:mouse_move, 619, 272, 2, 462, 886] +[:mouse_move, 619, 273, 2, 463, 887] +[:mouse_move, 620, 274, 2, 464, 888] +[:mouse_move, 620, 275, 2, 465, 889] +[:mouse_button_pressed, 1, 0, 1, 466, 893] +[:mouse_button_up, 1, 0, 1, 467, 899] +[:mouse_move, 618, 275, 2, 468, 906] +[:mouse_move, 603, 279, 2, 469, 907] +[:mouse_move, 595, 282, 2, 470, 908] +[:mouse_move, 568, 291, 2, 471, 909] +[:mouse_move, 553, 294, 2, 472, 910] +[:mouse_move, 533, 298, 2, 473, 911] +[:mouse_move, 522, 300, 2, 474, 912] +[:mouse_move, 512, 302, 2, 475, 913] +[:mouse_move, 503, 304, 2, 476, 914] +[:mouse_move, 502, 304, 2, 477, 915] +[:mouse_move, 500, 304, 2, 478, 916] +[:mouse_move, 499, 304, 2, 479, 917] +[:mouse_button_pressed, 1, 0, 1, 480, 921] +[:mouse_button_up, 1, 0, 1, 481, 926] +[:mouse_move, 499, 305, 2, 482, 930] +[:mouse_move, 499, 307, 2, 483, 931] +[:mouse_move, 506, 328, 2, 484, 932] +[:mouse_move, 513, 344, 2, 485, 933] +[:mouse_move, 525, 372, 2, 486, 934] +[:mouse_move, 528, 377, 2, 487, 935] +[:mouse_move, 535, 393, 2, 488, 936] +[:mouse_move, 545, 409, 2, 489, 937] +[:mouse_move, 549, 414, 2, 490, 938] +[:mouse_move, 552, 420, 2, 491, 939] +[:mouse_move, 554, 421, 2, 492, 940] +[:mouse_move, 556, 424, 2, 493, 941] +[:mouse_move, 558, 425, 2, 494, 942] +[:mouse_move, 560, 427, 2, 495, 943] +[:mouse_move, 561, 429, 2, 496, 944] +[:mouse_move, 563, 430, 2, 497, 945] +[:mouse_move, 564, 432, 2, 498, 946] +[:mouse_move, 564, 434, 2, 499, 947] +[:mouse_move, 565, 434, 2, 500, 948] +[:mouse_move, 565, 435, 2, 501, 949] +[:mouse_move, 566, 435, 2, 502, 950] +[:mouse_button_pressed, 1, 0, 1, 503, 953] +[:mouse_button_up, 1, 0, 1, 504, 959] +[:mouse_move, 566, 436, 2, 505, 963] +[:mouse_move, 566, 437, 2, 506, 964] +[:mouse_move, 570, 445, 2, 507, 965] +[:mouse_move, 576, 454, 2, 508, 966] +[:mouse_move, 579, 459, 2, 509, 967] +[:mouse_move, 584, 465, 2, 510, 968] +[:mouse_move, 586, 468, 2, 511, 969] +[:mouse_move, 590, 471, 2, 512, 970] +[:mouse_move, 593, 472, 2, 513, 971] +[:mouse_move, 597, 473, 2, 514, 972] +[:mouse_move, 598, 473, 2, 515, 973] +[:mouse_move, 602, 474, 2, 516, 974] +[:mouse_move, 603, 474, 2, 517, 975] +[:mouse_move, 609, 474, 2, 518, 976] +[:mouse_move, 610, 474, 2, 519, 977] +[:mouse_move, 613, 474, 2, 520, 978] +[:mouse_move, 614, 474, 2, 521, 979] +[:mouse_move, 615, 474, 2, 522, 980] +[:mouse_move, 616, 474, 2, 523, 981] +[:mouse_button_pressed, 1, 0, 1, 524, 982] +[:mouse_button_up, 1, 0, 1, 525, 988] +[:mouse_move, 617, 474, 2, 526, 991] +[:mouse_move, 625, 473, 2, 527, 992] +[:mouse_move, 632, 472, 2, 528, 993] +[:mouse_move, 653, 466, 2, 529, 994] +[:mouse_move, 663, 462, 2, 530, 995] +[:mouse_move, 696, 453, 2, 531, 996] +[:mouse_move, 713, 449, 2, 532, 997] +[:mouse_move, 723, 446, 2, 533, 998] +[:mouse_move, 730, 445, 2, 534, 999] +[:mouse_move, 732, 444, 2, 535, 1000] +[:mouse_move, 736, 444, 2, 536, 1001] +[:mouse_move, 734, 444, 2, 537, 1005] +[:mouse_button_pressed, 1, 0, 1, 538, 1009] +[:mouse_button_up, 1, 0, 1, 539, 1017] +[:mouse_move, 734, 442, 2, 540, 1020] +[:mouse_move, 734, 440, 2, 541, 1021] +[:mouse_move, 727, 434, 2, 542, 1022] +[:mouse_move, 715, 427, 2, 543, 1023] +[:mouse_move, 690, 418, 2, 544, 1024] +[:mouse_move, 682, 416, 2, 545, 1025] +[:mouse_move, 666, 408, 2, 546, 1026] +[:mouse_move, 663, 407, 2, 547, 1027] +[:mouse_move, 652, 401, 2, 548, 1028] +[:mouse_move, 649, 397, 2, 549, 1029] +[:mouse_move, 646, 394, 2, 550, 1030] +[:mouse_move, 645, 393, 2, 551, 1031] +[:mouse_move, 645, 390, 2, 552, 1032] +[:mouse_move, 645, 388, 2, 553, 1033] +[:mouse_move, 645, 387, 2, 554, 1034] +[:mouse_move, 645, 386, 2, 555, 1035] +[:mouse_button_pressed, 1, 0, 1, 556, 1037] +[:mouse_button_up, 1, 0, 1, 557, 1043] +[:mouse_move, 644, 386, 2, 558, 1063] +[:mouse_move, 638, 382, 2, 559, 1064] +[:mouse_move, 629, 376, 2, 560, 1065] +[:mouse_move, 617, 368, 2, 561, 1066] +[:mouse_move, 553, 329, 2, 562, 1067] +[:mouse_move, 507, 299, 2, 563, 1068] +[:mouse_move, 331, 208, 2, 564, 1069] +[:mouse_move, 288, 186, 2, 565, 1070] +[:mouse_move, 125, 107, 2, 566, 1071] +[:mouse_move, 98, 93, 2, 567, 1072] +[:mouse_move, 37, 55, 2, 568, 1073] +[:mouse_move, 5, 35, 2, 569, 1074] +[:mouse_move, -23, 10, 2, 570, 1075] +[:mouse_move, -23, 7, 2, 571, 1094] +[:mouse_move, -23, 5, 2, 572, 1095] +[:mouse_move, -24, 2, 2, 573, 1096] +[:mouse_move, -24, 0, 2, 574, 1097] +[:mouse_move, -24, 0, 2, 575, 1099] diff --git a/samples/23_isometric_grid/sprites/leftSide.png b/samples/23_isometric_grid/sprites/leftSide.png Binary files differnew file mode 100644 index 0000000..1fc0060 --- /dev/null +++ b/samples/23_isometric_grid/sprites/leftSide.png diff --git a/samples/23_isometric_grid/sprites/mountain.png b/samples/23_isometric_grid/sprites/mountain.png Binary files differnew file mode 100644 index 0000000..5794464 --- /dev/null +++ b/samples/23_isometric_grid/sprites/mountain.png diff --git a/samples/23_isometric_grid/sprites/ocean.png b/samples/23_isometric_grid/sprites/ocean.png Binary files differnew file mode 100644 index 0000000..fbf5fc1 --- /dev/null +++ b/samples/23_isometric_grid/sprites/ocean.png diff --git a/samples/23_isometric_grid/sprites/rightSide.png b/samples/23_isometric_grid/sprites/rightSide.png Binary files differnew file mode 100644 index 0000000..d74ff14 --- /dev/null +++ b/samples/23_isometric_grid/sprites/rightSide.png diff --git a/samples/23_isometric_grid/sprites/river.png b/samples/23_isometric_grid/sprites/river.png Binary files differnew file mode 100644 index 0000000..eb51890 --- /dev/null +++ b/samples/23_isometric_grid/sprites/river.png diff --git a/samples/23_isometric_grid/sprites/selectedTile.png b/samples/23_isometric_grid/sprites/selectedTile.png Binary files differnew file mode 100644 index 0000000..3719cac --- /dev/null +++ b/samples/23_isometric_grid/sprites/selectedTile.png diff --git a/samples/23_isometric_grid/sprites/tile.png b/samples/23_isometric_grid/sprites/tile.png Binary files differnew file mode 100644 index 0000000..4a4f690 --- /dev/null +++ b/samples/23_isometric_grid/sprites/tile.png diff --git a/samples/24_http_example/app/main.rb b/samples/24_http_example/app/main.rb new file mode 100644 index 0000000..53ece84 --- /dev/null +++ b/samples/24_http_example/app/main.rb @@ -0,0 +1,53 @@ +def tick args + args.outputs.background_color = [0, 0, 0] + + # Show a warning at the start. + args.state.warning_debounce ||= 11 * 60 + if args.state.warning_debounce > 0 + args.state.warning_debounce -= 1 + args.outputs.labels << [640, 600, "This app shows random images from the Internet.", 10, 1, 255, 255, 255] + args.outputs.labels << [640, 500, "Quit in the next few seconds if this is a problem.", 10, 1, 255, 255, 255] + args.outputs.labels << [640, 350, "#{(args.state.warning_debounce / 60.0).to_i}", 10, 1, 255, 255, 255] + return + end + + args.state.download_debounce ||= 0 # start immediately, reset to non zero later. + args.state.photos ||= [] + + # Put a little pause between each download. + if args.state.download.nil? + if args.state.download_debounce > 0 + args.state.download_debounce -= 1 + else + args.state.download = $gtk.http_get 'https://picsum.photos/200/300.jpg' + end + end + + if !args.state.download.nil? + if args.state.download[:complete] + if args.state.download[:http_response_code] == 200 + fname = "sprites/#{args.state.photos.length}.jpg" + $gtk.write_file fname, args.state.download[:response_data] + args.state.photos << [ 100 + rand(1080), 500 - rand(480), fname, rand(80) - 40 ] + end + args.state.download = nil + args.state.download_debounce = (rand(3) + 2) * 60 + end + end + + # draw any downloaded photos... + args.state.photos.each { |i| + args.outputs.primitives << [i[0], i[1], 200, 300, i[2], i[3]].sprite + } + + # Draw a download progress bar... + args.outputs.primitives << [0, 0, 1280, 30, 0, 0, 0, 255].solid + if !args.state.download.nil? + br = args.state.download[:response_read] + total = args.state.download[:response_total] + if total != 0 + pct = br.to_f / total.to_f + args.outputs.primitives << [0, 0, 1280 * pct, 30, 0, 0, 255, 255].solid + end + end +end diff --git a/samples/24_http_example/license-for-sample.txt b/samples/24_http_example/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/24_http_example/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/24_http_example/metadata/game_metadata.txt b/samples/24_http_example/metadata/game_metadata.txt new file mode 100644 index 0000000..53de213 --- /dev/null +++ b/samples/24_http_example/metadata/game_metadata.txt @@ -0,0 +1,6 @@ +devid=dragonruby +devtitle=DragonRuby LLC +gameid=httpexample +gametitle=DragonRuby GTK HTTP Example +version=0.1 +icon=metadata/icon.png diff --git a/samples/24_http_example/metadata/icon.png b/samples/24_http_example/metadata/icon.png Binary files differnew file mode 100644 index 0000000..57254fe --- /dev/null +++ b/samples/24_http_example/metadata/icon.png diff --git a/samples/25_3d_experiment_01_square/app/main.rb b/samples/25_3d_experiment_01_square/app/main.rb new file mode 100644 index 0000000..fc95291 --- /dev/null +++ b/samples/25_3d_experiment_01_square/app/main.rb @@ -0,0 +1,50 @@ +STARTX = 0.0 +STARTY = 0.0 +ENDY = 20.0 +ENDX = 20.0 +SPINPOINT = 10 +SPINDURATION = 400 +POINTSIZE = 8 +BOXDEPTH = 40 +YAW = 1 +DISTANCE = 10 + +def tick args + args.outputs.background_color = [0, 0, 0] + a = Math.sin(args.state.tick_count / SPINDURATION) * Math.tan(args.state.tick_count / SPINDURATION) + s = Math.sin(a) + c = Math.cos(a) + x = STARTX + y = STARTY + offset_x = (1280 - (ENDX - STARTX)) / 2 + offset_y = (360 - (ENDY - STARTY)) / 2 + + srand(1) + while y < ENDY do + while x < ENDX do + if (y == STARTY || + y == (ENDY / 0.5) * 2 || + y == (ENDY / 0.5) * 2 + 0.5 || + y == ENDY - 0.5 || + x == STARTX || + x == ENDX - 0.5) + z = rand(BOXDEPTH) + z *= Math.sin(a / 2) + x -= SPINPOINT + u = (x * c) - (z * s) + v = (x * s) + (z * c) + k = DISTANCE.fdiv(100) + (v / 500 * YAW) + u = u / k + v = y / k + w = POINTSIZE / 10 / k + args.outputs.sprites << { x: offset_x + u - w, y: offset_y + v - w, w: w, h: w, path: 'sprites/square-blue.png'} + x += SPINPOINT + end + x += 0.5 + end + y += 0.5 + x = STARTX + end +end + +$gtk.reset diff --git a/samples/25_3d_experiment_01_square/sprites/square-blue.png b/samples/25_3d_experiment_01_square/sprites/square-blue.png Binary files differnew file mode 100644 index 0000000..b840849 --- /dev/null +++ b/samples/25_3d_experiment_01_square/sprites/square-blue.png diff --git a/samples/26_jam_craft/app/main.rb b/samples/26_jam_craft/app/main.rb new file mode 100644 index 0000000..d7478e4 --- /dev/null +++ b/samples/26_jam_craft/app/main.rb @@ -0,0 +1,423 @@ +# ================================================== +# A NOTE TO JAM CRAFT PARTICIPANTS: +# The comments and code in here are just as small piece of DragonRuby's capabilities. +# Be sure to check out the rest of the sample apps. Start with README.txt and go from there! +# ================================================== + +# def tick args is the entry point into your game. This function is called at +# a fixed update time of 60hz (60 fps). +def tick args + # The defaults function intitializes the game. + defaults args + + # After the game is initialized, render it. + render args + + # After rendering the player should be able to respond to input. + input args + + # After responding to input, the game performs any additional calculations. + calc args +end + +def defaults args + # hide the mouse cursor for this game, we are going to render our own cursor + if args.state.tick_count == 0 + args.gtk.hide_cursor + end + + args.state.click_ripples ||= [] + + # everything is on a 1280x720 virtual canvas, so you can + # hardcode locations + + # define the borders for where the inventory is located + # args.state is a data structure that accepts any arbitrary parameters + # so you can create an object graph without having to create any classes. + + # Bottom left is 0, 0. Top right is 1280, 720. + # The inventory area is at the top of the screen + # the number 80 is the size of all the sprites, so that is what is being + # used to decide the with and height + args.state.sprite_size = 80 + + args.state.inventory_border.w = args.state.sprite_size * 10 + args.state.inventory_border.h = args.state.sprite_size * 3 + args.state.inventory_border.x = 10 + args.state.inventory_border.y = 710 - args.state.inventory_border.h + + # define the borders for where the crafting area is located + # the crafting area is below the inventory area + # the number 80 is the size of all the sprites, so that is what is being + # used to decide the with and height + args.state.craft_border.x = 10 + args.state.craft_border.y = 220 + args.state.craft_border.w = args.state.sprite_size * 3 + args.state.craft_border.h = args.state.sprite_size * 3 + + # define the area where results are located + # the crafting result is to the right of the craft area + args.state.result_border.x = 10 + args.state.sprite_size * 3 + args.state.sprite_size + args.state.result_border.y = 220 + args.state.sprite_size + args.state.result_border.w = args.state.sprite_size + args.state.result_border.h = args.state.sprite_size + + # initialize items for the first time if they are nil + # you start with 15 wood, 1 chest, and 5 plank + # Ruby has built in syntax for dictionaries (they look a lot like json objects). + # Ruby also has a special type called a Symbol denoted with a : followed by a word. + # Symbols are nice because they remove the need for magic strings. + if !args.state.items + args.state.items = [ + { + id: :wood, # :wood is a Symbol, this is better than using "wood" for the id + quantity: 15, + path: 'sprites/wood.png', + location: :inventory, + ordinal_x: 0, ordinal_y: 0 + }, + { + id: :chest, + quantity: 1, + path: 'sprites/chest.png', + location: :inventory, + ordinal_x: 1, ordinal_y: 0 + }, + { + id: :plank, + quantity: 5, + path: 'sprites/plank.png', + location: :inventory, + ordinal_x: 2, ordinal_y: 0 + }, + ] + + # after initializing the oridinal positions, derive the pixel + # locations assuming that the width and height are 80 + args.state.items.each { |item| set_inventory_position args, item } + end + + # define all the oridinal positions of the inventory slots + if !args.state.inventory_area + args.state.inventory_area = [ + { ordinal_x: 0, ordinal_y: 0 }, + { ordinal_x: 1, ordinal_y: 0 }, + { ordinal_x: 2, ordinal_y: 0 }, + { ordinal_x: 3, ordinal_y: 0 }, + { ordinal_x: 4, ordinal_y: 0 }, + { ordinal_x: 5, ordinal_y: 0 }, + { ordinal_x: 6, ordinal_y: 0 }, + { ordinal_x: 7, ordinal_y: 0 }, + { ordinal_x: 8, ordinal_y: 0 }, + { ordinal_x: 9, ordinal_y: 0 }, + { ordinal_x: 0, ordinal_y: 1 }, + { ordinal_x: 1, ordinal_y: 1 }, + { ordinal_x: 2, ordinal_y: 1 }, + { ordinal_x: 3, ordinal_y: 1 }, + { ordinal_x: 4, ordinal_y: 1 }, + { ordinal_x: 5, ordinal_y: 1 }, + { ordinal_x: 6, ordinal_y: 1 }, + { ordinal_x: 7, ordinal_y: 1 }, + { ordinal_x: 8, ordinal_y: 1 }, + { ordinal_x: 9, ordinal_y: 1 }, + { ordinal_x: 0, ordinal_y: 2 }, + { ordinal_x: 1, ordinal_y: 2 }, + { ordinal_x: 2, ordinal_y: 2 }, + { ordinal_x: 3, ordinal_y: 2 }, + { ordinal_x: 4, ordinal_y: 2 }, + { ordinal_x: 5, ordinal_y: 2 }, + { ordinal_x: 6, ordinal_y: 2 }, + { ordinal_x: 7, ordinal_y: 2 }, + { ordinal_x: 8, ordinal_y: 2 }, + { ordinal_x: 9, ordinal_y: 2 }, + ] + + # after initializing the oridinal positions, derive the pixel + # locations assuming that the width and height are 80 + args.state.inventory_area.each { |i| set_inventory_position args, i } + + # if you want to see the result you can use the Ruby function called "puts". + # Uncomment this line to see the value. + # puts args.state.inventory_area + + # You can see all things written via puts in DragonRuby's Console, or under logs/log.txt. + # To bring up DragonRuby's Console, press the ~ key within the game. + end + + # define all the oridinal positions of the craft slots + if !args.state.craft_area + args.state.craft_area = [ + { ordinal_x: 0, ordinal_y: 0 }, + { ordinal_x: 0, ordinal_y: 1 }, + { ordinal_x: 0, ordinal_y: 2 }, + { ordinal_x: 1, ordinal_y: 0 }, + { ordinal_x: 1, ordinal_y: 1 }, + { ordinal_x: 1, ordinal_y: 2 }, + { ordinal_x: 2, ordinal_y: 0 }, + { ordinal_x: 2, ordinal_y: 1 }, + { ordinal_x: 2, ordinal_y: 2 }, + ] + + # after initializing the oridinal positions, derive the pixel + # locations assuming that the width and height are 80 + args.state.craft_area.each { |c| set_craft_position args, c } + end +end + + +def render args + # for the results area, create a sprite that show its boundaries + args.outputs.primitives << { x: args.state.result_border.x, + y: args.state.result_border.y, + w: args.state.result_border.w, + h: args.state.result_border.h, + path: 'sprites/border-black.png' } + + # for each inventory spot, create a sprite + # args.outputs.primitives is how DragonRuby performs a render. + # Adding a single hash or multiple hashes to this array will tell + # DragonRuby to render those primitives on that frame. + + # The .map function on Array is used instead of any kind of looping. + # .map returns a new object for every object within an Array. + args.outputs.primitives << args.state.inventory_area.map do |a| + { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } + end + + # for each craft spot, create a sprite + args.outputs.primitives << args.state.craft_area.map do |a| + { x: a.x, y: a.y, w: a.w, h: a.h, path: 'sprites/border-black.png' } + end + + # after the borders have been rendered, render the + # items within those slots (and allow for highlighting) + # if an item isn't currently being held + allow_inventory_highlighting = !args.state.held_item + + # go through each item and render them + # use Array's find_all method to remove any items that are currently being held + args.state.items.find_all { |item| item[:location] != :held }.map do |item| + # if an item is currently being held, don't render it in it's spot within the + # inventory or craft area (this is handled via the find_all method). + + # the item_prefab returns a hash containing all the visual components of an item. + # the main sprite, the black background, the quantity text, and a hover indication + # if the mouse is currently hovering over the item. + args.outputs.primitives << item_prefab(args, item, allow_inventory_highlighting, args.inputs.mouse) + end + + # The last thing we want to render is the item currently being held. + args.outputs.primitives << item_prefab(args, args.state.held_item, allow_inventory_highlighting, args.inputs.mouse) + + args.outputs.primitives << args.state.click_ripples + + # render a mouse cursor since we have the OS cursor hidden + args.outputs.primitives << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } +end + +# Alrighty! This is where all the fun happens +def input args + # if the mouse is clicked and not item is currently being held + # args.state.held_item is nil when the game starts. + # If the player clicks, the property args.inputs.mouse.click will + # be a non nil value, we don't want to process any of the code here + # if the mouse hasn't been clicked + return if !args.inputs.mouse.click + + # if a click occurred, add a ripple to the ripple queue + args.state.click_ripples << { x: args.inputs.mouse.x - 5, y: args.inputs.mouse.y - 5, w: 10, h: 10, path: 'sprites/circle-gray.png', a: 128 } + + # if the mouse has been clicked, and no item is currently held... + if !args.state.held_item + # see if any of the items intersect the pointer using the inside_rect? method + # the find method will either return the first object that returns true + # for the match clause, or it'll return nil if nothing matches the match clause + found = args.state.items.find do |item| + # for each item in args.state.items, run the following boolean check + args.inputs.mouse.click.point.inside_rect?(item) + end + + # if an item intersects the mouse pointer, then set the item's location to :held and + # set args.state.held_item to the item for later reference + if found + args.state.held_item = found + found[:location] = :held + end + + # if the mouse is clicked and an item is currently beign held.... + elsif args.state.held_item + # determine if a slot within the craft area was clicked + craft_area = args.state.craft_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } + + # also determine if a slot within the inventory area was clicked + inventory_area = args.state.inventory_area.find { |a| args.inputs.mouse.click.point.inside_rect? a } + + # if the click was within a craft area + if craft_area + # check to see if an item is already there and ignore the click if an item is found + # item_at_craft_slot is a helper method that returns an item or nil for a given oridinal + # position + item_already_there = item_at_craft_slot args, craft_area[:ordinal_x], craft_area[:ordinal_y] + + # if an item *doesn't* exist in the craft area + if !item_already_there + # if the quantity they are currently holding is greater than 1 + if args.state.held_item[:quantity] > 1 + # remove one item (creating a seperate item of the same type), and place it + # at the oridinal position and location of the craft area + # the .merge method on Hash creates a new Hash, but updates any values + # passed as arguments to merge + new_item = args.state.held_item.merge(quantity: 1, + location: :craft, + ordinal_x: craft_area[:ordinal_x], + ordinal_y: craft_area[:ordinal_y]) + + # after the item is crated, place it into the args.state.items collection + args.state.items << new_item + + # then subtract one from the held item + args.state.held_item[:quantity] -= 1 + + # if the craft area is available and there is only one item being held + elsif args.state.held_item[:quantity] == 1 + # instead of creating any new items just set the location of the held item + # to the oridinal position of the craft area, and then nil out the + # held item state so that a new item can be picked up + args.state.held_item[:location] = :craft + args.state.held_item[:ordinal_x] = craft_area[:ordinal_x] + args.state.held_item[:ordinal_y] = craft_area[:ordinal_y] + args.state.held_item = nil + end + end + + # if the selected area is an inventory area (as opposed to within the craft area) + elsif inventory_area + + # check to see if there is already an item in that inventory slot + # the item_at_inventory_slot helper method returns an item or nil + item_already_there = item_at_inventory_slot args, inventory_area[:ordinal_x], inventory_area[:ordinal_y] + + # if there is already an item there, and the item types/id match + if item_already_there && item_already_there[:id] == args.state.held_item[:id] + # then merge the item quantities + held_quantity = args.state.held_item[:quantity] + item_already_there[:quantity] += held_quantity + + # remove the item being held from the items collection (since it's quantity is now 0) + args.state.items.reject! { |i| i[:location] == :held } + + # nil out the held_item so a new item can be picked up + args.state.held_item = nil + + # if there currently isn't an item there, then put the held item in the slot + elsif !item_already_there + args.state.held_item[:location] = :inventory + args.state.held_item[:ordinal_x] = inventory_area[:ordinal_x] + args.state.held_item[:ordinal_y] = inventory_area[:ordinal_y] + + # nil out the held_item so a new item can be picked up + args.state.held_item = nil + end + end + end +end + +# the calc method is executed after input +def calc args + # make sure that the real position of the inventory + # items are updated every frame to ensure that they + # are placed correctly given their location and oridinal positions + # instead of using .map, here we use .each (since we are not returning a new item and just updating the items in place) + args.state.items.each do |item| + # based on the location of the item, invoke the correct pixel conversion method + if item[:location] == :inventory + set_inventory_position args, item + elsif item[:location] == :craft + set_craft_position args, item + elsif item[:location] == :held + # if the item is held, center the item around the mouse pointer + args.state.held_item.x = args.inputs.mouse.x - args.state.held_item.w.half + args.state.held_item.y = args.inputs.mouse.y - args.state.held_item.h.half + end + end + + # for each hash/sprite in the click ripples queue, + # expand its size by 20 percent and decrease its alpha + # by 10. + args.state.click_ripples.each do |ripple| + delta_w = ripple.w * 1.2 - ripple.w + delta_h = ripple.h * 1.2 - ripple.h + ripple.x -= delta_w.half + ripple.y -= delta_h.half + ripple.w += delta_w + ripple.h += delta_h + ripple.a -= 10 + end + + # remove any items from the collection where the alpha value is less than equal to + # zero using the reject! method (reject with an exclamation point at the end changes the + # array value in place, while reject without the exclamation point returns a new array). + args.state.click_ripples.reject! { |ripple| ripple.a <= 0 } +end + +# helper function for finding an item at a craft slot +def item_at_craft_slot args, ordinal_x, ordinal_y + args.state.items.find { |i| i[:location] == :craft && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } +end + +# helper function for finding an item at an inventory slot +def item_at_inventory_slot args, ordinal_x, ordinal_y + args.state.items.find { |i| i[:location] == :inventory && i[:ordinal_x] == ordinal_x && i[:ordinal_y] == ordinal_y } +end + +# helper function that creates a visual representation of an item +def item_prefab args, item, should_highlight, mouse + return nil unless item + + overlay = nil + + x = item.x + y = item.y + w = item.w + h = item.h + + if should_highlight && mouse.point.inside_rect?(item) + overlay = { x: x, y: y, w: w, h: h, path: "sprites/square-blue.png", a: 130, } + end + + [ + # sprites are hashes with a path property, this is the main sprite + { x: x, y: y, w: args.state.sprite_size, h: args.state.sprite_size, path: item[:path], }, + + # this represents the black area in the bottom right corner of the main sprite so that the + # quantity is visible + { x: x + 55, y: y, w: 25, h: 25, path: "sprites/square-black.png", }, # sprites are hashes with a path property + + # labels are hashes with a text property + { x: x + 56, y: y + 22, text: "#{item[:quantity]}", r: 255, g: 255, b: 255, }, + + # this is the mouse overlay, if the overlay isn't applicable, then this value will be nil (nil values will not be rendered) + overlay + ] +end + +# helper function for deriving the position of an item within inventory +def set_inventory_position args, item + item.x = args.state.inventory_border.x + item[:ordinal_x] * 80 + item.y = (args.state.inventory_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 + item.w = 80 + item.h = 80 +end + +# helper function for deriving the position of an item within the craft area +def set_craft_position args, item + item.x = args.state.craft_border.x + item[:ordinal_x] * 80 + item.y = (args.state.craft_border.y + args.state.inventory_border.h - 80) - item[:ordinal_y] * 80 + item.w = 80 + item.h = 80 +end + +# Any lines outside of a function will be executed when the file is reloaded. +# So every time you save main.rb, the game will be reset. +# Comment out the line below if you don't want this to happen. +$gtk.reset diff --git a/samples/26_jam_craft/license-for-sample-app.txt b/samples/26_jam_craft/license-for-sample-app.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/26_jam_craft/license-for-sample-app.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/26_jam_craft/replay.txt b/samples/26_jam_craft/replay.txt new file mode 100644 index 0000000..67f1963 --- /dev/null +++ b/samples/26_jam_craft/replay.txt @@ -0,0 +1,1012 @@ +replay_version 2.0 +stopped_at 1438 +seed 100 +recorded_at Fri Mar 27 00:18:13 2020 +[:key_up_raw, 13, 0, 2, 1, 1] +[:mouse_move, 259, 448, 2, 2, 31] +[:mouse_move, 252, 412, 2, 3, 32] +[:mouse_move, 251, 372, 2, 4, 33] +[:mouse_move, 251, 347, 2, 5, 34] +[:mouse_move, 251, 332, 2, 6, 35] +[:mouse_move, 252, 312, 2, 7, 36] +[:mouse_move, 252, 304, 2, 8, 37] +[:mouse_move, 252, 292, 2, 9, 38] +[:mouse_move, 248, 265, 2, 10, 39] +[:mouse_move, 242, 246, 2, 11, 40] +[:mouse_move, 237, 243, 2, 12, 55] +[:mouse_move, 225, 233, 2, 13, 56] +[:mouse_move, 208, 223, 2, 14, 57] +[:mouse_move, 199, 217, 2, 15, 58] +[:mouse_move, 175, 198, 2, 16, 59] +[:mouse_move, 161, 186, 2, 17, 60] +[:mouse_move, 144, 169, 2, 18, 61] +[:mouse_move, 136, 160, 2, 19, 62] +[:mouse_move, 124, 144, 2, 20, 63] +[:mouse_move, 120, 137, 2, 21, 64] +[:mouse_move, 116, 132, 2, 22, 65] +[:mouse_move, 109, 119, 2, 23, 66] +[:mouse_move, 105, 114, 2, 24, 67] +[:mouse_move, 99, 107, 2, 25, 68] +[:mouse_move, 97, 104, 2, 26, 69] +[:mouse_move, 93, 100, 2, 27, 70] +[:mouse_move, 92, 98, 2, 28, 71] +[:mouse_move, 88, 94, 2, 29, 72] +[:mouse_move, 87, 92, 2, 30, 73] +[:mouse_move, 82, 85, 2, 31, 74] +[:mouse_move, 79, 81, 2, 32, 75] +[:mouse_move, 77, 77, 2, 33, 76] +[:mouse_move, 76, 75, 2, 34, 77] +[:mouse_move, 74, 72, 2, 35, 78] +[:mouse_move, 73, 71, 2, 36, 79] +[:mouse_move, 73, 69, 2, 37, 80] +[:mouse_move, 72, 69, 2, 38, 81] +[:mouse_button_pressed, 1, 0, 1, 39, 83] +[:mouse_button_up, 1, 0, 1, 40, 88] +[:mouse_move, 72, 76, 2, 41, 99] +[:mouse_move, 72, 99, 2, 42, 100] +[:mouse_move, 74, 115, 2, 43, 101] +[:mouse_move, 76, 155, 2, 44, 102] +[:mouse_move, 79, 180, 2, 45, 103] +[:mouse_move, 80, 223, 2, 46, 104] +[:mouse_move, 81, 230, 2, 47, 105] +[:mouse_move, 82, 259, 2, 48, 106] +[:mouse_move, 82, 268, 2, 49, 107] +[:mouse_move, 81, 283, 2, 50, 108] +[:mouse_move, 80, 285, 2, 51, 109] +[:mouse_move, 78, 291, 2, 52, 110] +[:mouse_move, 77, 293, 2, 53, 111] +[:mouse_move, 75, 295, 2, 54, 112] +[:mouse_move, 73, 296, 2, 55, 114] +[:mouse_move, 72, 296, 2, 56, 115] +[:mouse_move, 72, 297, 2, 57, 116] +[:mouse_move, 69, 298, 2, 58, 117] +[:mouse_move, 68, 299, 2, 59, 118] +[:mouse_move, 66, 300, 2, 60, 119] +[:mouse_move, 65, 301, 2, 61, 120] +[:mouse_move, 64, 302, 2, 62, 121] +[:mouse_move, 63, 303, 2, 63, 122] +[:mouse_move, 62, 304, 2, 64, 123] +[:mouse_button_pressed, 1, 0, 1, 65, 126] +[:mouse_move, 61, 304, 2, 66, 126] +[:mouse_button_up, 1, 0, 1, 67, 132] +[:mouse_move, 67, 304, 2, 68, 132] +[:mouse_move, 76, 304, 2, 69, 133] +[:mouse_move, 94, 304, 2, 70, 135] +[:mouse_move, 101, 304, 2, 71, 136] +[:mouse_move, 108, 304, 2, 72, 137] +[:mouse_move, 112, 304, 2, 73, 138] +[:mouse_move, 115, 304, 2, 74, 139] +[:mouse_move, 117, 304, 2, 75, 140] +[:mouse_move, 118, 304, 2, 76, 141] +[:mouse_move, 119, 304, 2, 77, 142] +[:mouse_button_pressed, 1, 0, 1, 78, 144] +[:mouse_button_up, 1, 0, 1, 79, 149] +[:mouse_move, 127, 304, 2, 80, 149] +[:mouse_move, 139, 304, 2, 81, 150] +[:mouse_move, 146, 304, 2, 82, 151] +[:mouse_move, 162, 304, 2, 83, 152] +[:mouse_move, 166, 304, 2, 84, 153] +[:mouse_move, 180, 304, 2, 85, 154] +[:mouse_move, 183, 304, 2, 86, 155] +[:mouse_move, 189, 304, 2, 87, 156] +[:mouse_move, 192, 304, 2, 88, 157] +[:mouse_move, 194, 304, 2, 89, 158] +[:mouse_move, 195, 304, 2, 90, 159] +[:mouse_move, 196, 304, 2, 91, 161] +[:mouse_button_pressed, 1, 0, 1, 92, 163] +[:mouse_button_up, 1, 0, 1, 93, 168] +[:mouse_move, 196, 301, 2, 94, 170] +[:mouse_move, 198, 297, 2, 95, 171] +[:mouse_move, 201, 286, 2, 96, 172] +[:mouse_move, 202, 279, 2, 97, 173] +[:mouse_move, 204, 266, 2, 98, 174] +[:mouse_move, 205, 259, 2, 99, 175] +[:mouse_move, 208, 246, 2, 100, 176] +[:mouse_move, 208, 244, 2, 101, 177] +[:mouse_move, 209, 236, 2, 102, 178] +[:mouse_move, 209, 234, 2, 103, 179] +[:mouse_move, 210, 230, 2, 104, 180] +[:mouse_move, 210, 228, 2, 105, 182] +[:mouse_move, 210, 227, 2, 106, 189] +[:mouse_button_pressed, 1, 0, 1, 107, 190] +[:mouse_button_up, 1, 0, 1, 108, 195] +[:mouse_move, 210, 224, 2, 109, 206] +[:mouse_move, 210, 221, 2, 110, 207] +[:mouse_move, 210, 218, 2, 111, 208] +[:mouse_move, 210, 208, 2, 112, 209] +[:mouse_move, 210, 196, 2, 113, 210] +[:mouse_move, 210, 169, 2, 114, 211] +[:mouse_move, 210, 162, 2, 115, 212] +[:mouse_move, 211, 146, 2, 116, 213] +[:mouse_move, 211, 139, 2, 117, 214] +[:mouse_move, 212, 129, 2, 118, 215] +[:mouse_move, 212, 127, 2, 119, 216] +[:mouse_move, 212, 124, 2, 120, 217] +[:mouse_move, 212, 123, 2, 121, 218] +[:mouse_move, 212, 121, 2, 122, 219] +[:mouse_move, 212, 119, 2, 123, 221] +[:mouse_move, 213, 118, 2, 124, 222] +[:mouse_move, 213, 116, 2, 125, 223] +[:mouse_move, 213, 114, 2, 126, 225] +[:mouse_move, 213, 113, 2, 127, 226] +[:mouse_move, 213, 110, 2, 128, 227] +[:mouse_move, 213, 107, 2, 129, 228] +[:mouse_move, 214, 102, 2, 130, 229] +[:mouse_move, 215, 98, 2, 131, 230] +[:mouse_move, 216, 83, 2, 132, 231] +[:mouse_move, 216, 79, 2, 133, 232] +[:mouse_move, 216, 71, 2, 134, 233] +[:mouse_move, 216, 67, 2, 135, 235] +[:mouse_move, 216, 66, 2, 136, 236] +[:mouse_move, 216, 65, 2, 137, 237] +[:mouse_button_pressed, 1, 0, 1, 138, 240] +[:mouse_button_up, 1, 0, 1, 139, 246] +[:mouse_move, 216, 67, 2, 140, 246] +[:mouse_move, 216, 69, 2, 141, 247] +[:mouse_move, 216, 72, 2, 142, 248] +[:mouse_move, 216, 74, 2, 143, 249] +[:mouse_move, 216, 76, 2, 144, 250] +[:mouse_move, 216, 79, 2, 145, 251] +[:mouse_move, 216, 84, 2, 146, 252] +[:mouse_move, 216, 90, 2, 147, 253] +[:mouse_move, 210, 118, 2, 148, 254] +[:mouse_move, 206, 138, 2, 149, 255] +[:mouse_move, 193, 190, 2, 150, 256] +[:mouse_move, 191, 202, 2, 151, 257] +[:mouse_move, 178, 248, 2, 152, 258] +[:mouse_move, 172, 269, 2, 153, 259] +[:mouse_move, 166, 287, 2, 154, 260] +[:mouse_move, 152, 316, 2, 155, 261] +[:mouse_move, 144, 328, 2, 156, 262] +[:mouse_move, 134, 341, 2, 157, 263] +[:mouse_move, 129, 349, 2, 158, 264] +[:mouse_move, 119, 361, 2, 159, 265] +[:mouse_move, 115, 365, 2, 160, 266] +[:mouse_move, 110, 370, 2, 161, 267] +[:mouse_move, 107, 373, 2, 162, 268] +[:mouse_move, 103, 376, 2, 163, 269] +[:mouse_move, 102, 377, 2, 164, 270] +[:mouse_move, 100, 379, 2, 165, 271] +[:mouse_move, 99, 381, 2, 166, 272] +[:mouse_move, 97, 385, 2, 167, 273] +[:mouse_move, 97, 388, 2, 168, 274] +[:mouse_move, 97, 398, 2, 169, 275] +[:mouse_move, 97, 402, 2, 170, 276] +[:mouse_move, 99, 407, 2, 171, 277] +[:mouse_move, 100, 409, 2, 172, 278] +[:mouse_move, 102, 411, 2, 173, 279] +[:mouse_move, 103, 411, 2, 174, 280] +[:mouse_move, 104, 412, 2, 175, 281] +[:mouse_move, 105, 412, 2, 176, 282] +[:mouse_move, 106, 411, 2, 177, 283] +[:mouse_move, 107, 410, 2, 178, 284] +[:mouse_move, 109, 407, 2, 179, 285] +[:mouse_move, 109, 406, 2, 180, 286] +[:mouse_move, 110, 405, 2, 181, 287] +[:mouse_move, 112, 401, 2, 182, 288] +[:mouse_move, 114, 398, 2, 183, 289] +[:mouse_move, 115, 395, 2, 184, 290] +[:mouse_move, 116, 394, 2, 185, 291] +[:mouse_move, 116, 392, 2, 186, 292] +[:mouse_move, 117, 391, 2, 187, 293] +[:mouse_button_pressed, 1, 0, 1, 188, 295] +[:mouse_button_up, 1, 0, 1, 189, 300] +[:mouse_move, 116, 391, 2, 190, 302] +[:mouse_move, 114, 391, 2, 191, 303] +[:mouse_move, 105, 391, 2, 192, 304] +[:mouse_move, 99, 391, 2, 193, 305] +[:mouse_move, 90, 390, 2, 194, 306] +[:mouse_move, 88, 390, 2, 195, 307] +[:mouse_move, 81, 390, 2, 196, 308] +[:mouse_move, 79, 390, 2, 197, 309] +[:mouse_move, 77, 389, 2, 198, 310] +[:mouse_move, 76, 389, 2, 199, 311] +[:mouse_move, 75, 389, 2, 200, 312] +[:mouse_button_pressed, 1, 0, 1, 201, 314] +[:mouse_button_up, 1, 0, 1, 202, 320] +[:mouse_move, 75, 395, 2, 203, 322] +[:mouse_move, 75, 401, 2, 204, 323] +[:mouse_move, 75, 410, 2, 205, 324] +[:mouse_move, 75, 416, 2, 206, 325] +[:mouse_move, 75, 422, 2, 207, 326] +[:mouse_move, 75, 424, 2, 208, 327] +[:mouse_move, 75, 427, 2, 209, 328] +[:mouse_move, 75, 428, 2, 210, 330] +[:mouse_move, 75, 429, 2, 211, 332] +[:mouse_move, 75, 430, 2, 212, 334] +[:mouse_move, 75, 431, 2, 213, 335] +[:mouse_move, 75, 432, 2, 214, 336] +[:mouse_move, 74, 433, 2, 215, 337] +[:mouse_button_pressed, 1, 0, 1, 216, 339] +[:mouse_move, 74, 434, 2, 217, 339] +[:mouse_button_up, 1, 0, 1, 218, 345] +[:mouse_move, 74, 433, 2, 219, 346] +[:mouse_move, 74, 432, 2, 220, 347] +[:mouse_move, 74, 421, 2, 221, 348] +[:mouse_move, 74, 413, 2, 222, 349] +[:mouse_move, 74, 397, 2, 223, 350] +[:mouse_move, 74, 360, 2, 224, 351] +[:mouse_move, 74, 315, 2, 225, 352] +[:mouse_move, 74, 305, 2, 226, 353] +[:mouse_move, 74, 265, 2, 227, 354] +[:mouse_move, 74, 259, 2, 228, 355] +[:mouse_move, 74, 255, 2, 229, 356] +[:mouse_move, 74, 237, 2, 230, 357] +[:mouse_move, 73, 232, 2, 231, 358] +[:mouse_move, 72, 225, 2, 232, 359] +[:mouse_move, 71, 223, 2, 233, 360] +[:mouse_move, 71, 221, 2, 234, 361] +[:mouse_move, 71, 220, 2, 235, 362] +[:mouse_move, 71, 219, 2, 236, 364] +[:mouse_move, 70, 218, 2, 237, 369] +[:mouse_move, 70, 217, 2, 238, 371] +[:mouse_button_pressed, 1, 0, 1, 239, 373] +[:mouse_button_up, 1, 0, 1, 240, 378] +[:mouse_move, 70, 216, 2, 241, 383] +[:mouse_move, 73, 209, 2, 242, 384] +[:mouse_move, 75, 204, 2, 243, 385] +[:mouse_move, 83, 187, 2, 244, 386] +[:mouse_move, 87, 178, 2, 245, 387] +[:mouse_move, 92, 165, 2, 246, 388] +[:mouse_move, 95, 158, 2, 247, 389] +[:mouse_move, 100, 146, 2, 248, 390] +[:mouse_move, 102, 142, 2, 249, 391] +[:mouse_move, 106, 134, 2, 250, 392] +[:mouse_move, 108, 131, 2, 251, 393] +[:mouse_move, 111, 124, 2, 252, 394] +[:mouse_move, 112, 121, 2, 253, 395] +[:mouse_move, 116, 115, 2, 254, 396] +[:mouse_move, 118, 111, 2, 255, 397] +[:mouse_move, 121, 105, 2, 256, 398] +[:mouse_move, 123, 101, 2, 257, 399] +[:mouse_move, 126, 95, 2, 258, 400] +[:mouse_move, 127, 92, 2, 259, 401] +[:mouse_move, 129, 86, 2, 260, 402] +[:mouse_move, 130, 84, 2, 261, 403] +[:mouse_move, 130, 81, 2, 262, 404] +[:mouse_move, 131, 80, 2, 263, 405] +[:mouse_move, 131, 78, 2, 264, 406] +[:mouse_move, 131, 76, 2, 265, 407] +[:mouse_move, 131, 75, 2, 266, 409] +[:mouse_button_pressed, 1, 0, 1, 267, 410] +[:mouse_move, 131, 74, 2, 268, 410] +[:mouse_button_up, 1, 0, 1, 269, 415] +[:mouse_move, 131, 94, 2, 270, 415] +[:mouse_move, 131, 115, 2, 271, 416] +[:mouse_move, 131, 167, 2, 272, 417] +[:mouse_move, 127, 320, 2, 273, 419] +[:mouse_move, 127, 337, 2, 274, 420] +[:mouse_move, 127, 361, 2, 275, 421] +[:mouse_move, 127, 433, 2, 276, 422] +[:mouse_move, 127, 463, 2, 277, 423] +[:mouse_move, 127, 480, 2, 278, 424] +[:mouse_move, 127, 490, 2, 279, 425] +[:mouse_move, 127, 499, 2, 280, 426] +[:mouse_move, 127, 510, 2, 281, 427] +[:mouse_move, 127, 514, 2, 282, 428] +[:mouse_move, 127, 521, 2, 283, 429] +[:mouse_move, 127, 523, 2, 284, 430] +[:mouse_move, 127, 525, 2, 285, 431] +[:mouse_move, 126, 528, 2, 286, 432] +[:mouse_move, 126, 531, 2, 287, 433] +[:mouse_move, 124, 536, 2, 288, 434] +[:mouse_move, 124, 540, 2, 289, 435] +[:mouse_move, 123, 549, 2, 290, 436] +[:mouse_move, 122, 553, 2, 291, 437] +[:mouse_move, 121, 558, 2, 292, 438] +[:mouse_move, 121, 561, 2, 293, 439] +[:mouse_move, 121, 562, 2, 294, 440] +[:mouse_move, 121, 557, 2, 295, 442] +[:mouse_move, 121, 548, 2, 296, 443] +[:mouse_move, 122, 535, 2, 297, 444] +[:mouse_move, 124, 528, 2, 298, 445] +[:mouse_move, 126, 521, 2, 299, 446] +[:mouse_move, 126, 517, 2, 300, 447] +[:mouse_move, 127, 510, 2, 301, 448] +[:mouse_move, 127, 506, 2, 302, 449] +[:mouse_move, 127, 499, 2, 303, 450] +[:mouse_move, 128, 495, 2, 304, 451] +[:mouse_move, 128, 493, 2, 305, 452] +[:mouse_move, 128, 487, 2, 306, 453] +[:mouse_move, 128, 484, 2, 307, 454] +[:mouse_move, 129, 482, 2, 308, 455] +[:mouse_move, 129, 480, 2, 309, 456] +[:mouse_move, 129, 478, 2, 310, 458] +[:mouse_move, 129, 476, 2, 311, 459] +[:mouse_move, 129, 475, 2, 312, 460] +[:mouse_move, 129, 473, 2, 313, 461] +[:mouse_move, 129, 472, 2, 314, 462] +[:mouse_move, 129, 471, 2, 315, 464] +[:mouse_button_pressed, 1, 0, 1, 316, 465] +[:mouse_button_up, 1, 0, 1, 317, 470] +[:mouse_move, 137, 471, 2, 318, 480] +[:mouse_move, 144, 471, 2, 319, 481] +[:mouse_move, 151, 471, 2, 320, 482] +[:mouse_move, 162, 472, 2, 321, 483] +[:mouse_move, 168, 472, 2, 322, 484] +[:mouse_move, 190, 468, 2, 323, 485] +[:mouse_move, 200, 463, 2, 324, 486] +[:mouse_move, 212, 455, 2, 325, 487] +[:mouse_move, 217, 448, 2, 326, 488] +[:mouse_move, 222, 435, 2, 327, 489] +[:mouse_move, 223, 423, 2, 328, 490] +[:mouse_move, 219, 408, 2, 329, 491] +[:mouse_move, 213, 401, 2, 330, 492] +[:mouse_move, 197, 390, 2, 331, 493] +[:mouse_move, 189, 385, 2, 332, 494] +[:mouse_move, 177, 381, 2, 333, 495] +[:mouse_move, 170, 380, 2, 334, 496] +[:mouse_move, 162, 379, 2, 335, 497] +[:mouse_move, 159, 379, 2, 336, 498] +[:mouse_move, 153, 379, 2, 337, 499] +[:mouse_move, 150, 379, 2, 338, 500] +[:mouse_move, 147, 379, 2, 339, 501] +[:mouse_move, 146, 379, 2, 340, 502] +[:mouse_move, 145, 379, 2, 341, 503] +[:mouse_move, 144, 379, 2, 342, 504] +[:mouse_button_pressed, 1, 0, 1, 343, 508] +[:mouse_move, 143, 379, 2, 344, 508] +[:mouse_button_up, 1, 0, 1, 345, 514] +[:mouse_move, 143, 376, 2, 346, 524] +[:mouse_move, 142, 360, 2, 347, 525] +[:mouse_move, 142, 352, 2, 348, 526] +[:mouse_move, 140, 321, 2, 349, 527] +[:mouse_move, 140, 315, 2, 350, 528] +[:mouse_move, 140, 291, 2, 351, 529] +[:mouse_move, 141, 282, 2, 352, 530] +[:mouse_move, 142, 274, 2, 353, 531] +[:mouse_move, 142, 270, 2, 354, 532] +[:mouse_move, 142, 266, 2, 355, 533] +[:mouse_move, 142, 265, 2, 356, 534] +[:mouse_move, 142, 264, 2, 357, 535] +[:mouse_move, 142, 261, 2, 358, 536] +[:mouse_move, 142, 260, 2, 359, 537] +[:mouse_move, 141, 257, 2, 360, 538] +[:mouse_move, 140, 256, 2, 361, 539] +[:mouse_move, 139, 252, 2, 362, 540] +[:mouse_move, 138, 250, 2, 363, 541] +[:mouse_move, 137, 246, 2, 364, 542] +[:mouse_move, 136, 245, 2, 365, 543] +[:mouse_move, 136, 241, 2, 366, 544] +[:mouse_move, 135, 240, 2, 367, 545] +[:mouse_move, 135, 238, 2, 368, 546] +[:mouse_move, 134, 237, 2, 369, 547] +[:mouse_move, 134, 236, 2, 370, 548] +[:mouse_button_pressed, 1, 0, 1, 371, 549] +[:mouse_button_up, 1, 0, 1, 372, 554] +[:mouse_move, 134, 235, 2, 373, 555] +[:mouse_move, 134, 237, 2, 374, 556] +[:mouse_move, 134, 241, 2, 375, 557] +[:mouse_move, 134, 245, 2, 376, 558] +[:mouse_move, 134, 249, 2, 377, 559] +[:mouse_move, 132, 266, 2, 378, 560] +[:mouse_move, 125, 284, 2, 379, 561] +[:mouse_move, 113, 304, 2, 380, 562] +[:mouse_move, 102, 317, 2, 381, 563] +[:mouse_move, 88, 333, 2, 382, 564] +[:mouse_move, 81, 341, 2, 383, 565] +[:mouse_move, 72, 348, 2, 384, 566] +[:mouse_move, 69, 352, 2, 385, 567] +[:mouse_move, 64, 357, 2, 386, 568] +[:mouse_move, 63, 358, 2, 387, 569] +[:mouse_move, 61, 361, 2, 388, 570] +[:mouse_move, 61, 362, 2, 389, 571] +[:mouse_move, 60, 363, 2, 390, 572] +[:mouse_move, 60, 364, 2, 391, 573] +[:mouse_move, 60, 367, 2, 392, 574] +[:mouse_move, 59, 368, 2, 393, 575] +[:mouse_move, 59, 371, 2, 394, 576] +[:mouse_move, 58, 372, 2, 395, 577] +[:mouse_move, 58, 375, 2, 396, 578] +[:mouse_move, 58, 376, 2, 397, 579] +[:mouse_move, 57, 379, 2, 398, 580] +[:mouse_move, 57, 380, 2, 399, 581] +[:mouse_move, 57, 382, 2, 400, 582] +[:mouse_button_pressed, 1, 0, 1, 401, 583] +[:mouse_move, 56, 382, 2, 402, 583] +[:mouse_button_up, 1, 0, 1, 403, 589] +[:mouse_move, 68, 353, 2, 404, 589] +[:mouse_move, 75, 341, 2, 405, 590] +[:mouse_move, 83, 326, 2, 406, 591] +[:mouse_move, 88, 318, 2, 407, 592] +[:mouse_move, 97, 304, 2, 408, 593] +[:mouse_move, 102, 293, 2, 409, 594] +[:mouse_move, 108, 279, 2, 410, 595] +[:mouse_move, 109, 276, 2, 411, 596] +[:mouse_move, 111, 270, 2, 412, 597] +[:mouse_move, 113, 263, 2, 413, 598] +[:mouse_move, 117, 257, 2, 414, 599] +[:mouse_move, 117, 254, 2, 415, 600] +[:mouse_move, 119, 251, 2, 416, 601] +[:mouse_move, 120, 251, 2, 417, 602] +[:mouse_move, 121, 248, 2, 418, 603] +[:mouse_move, 122, 247, 2, 419, 604] +[:mouse_move, 123, 245, 2, 420, 605] +[:mouse_move, 123, 244, 2, 421, 606] +[:mouse_move, 124, 243, 2, 422, 607] +[:mouse_move, 125, 242, 2, 423, 608] +[:mouse_move, 125, 241, 2, 424, 609] +[:mouse_move, 126, 240, 2, 425, 610] +[:mouse_move, 127, 238, 2, 426, 612] +[:mouse_move, 127, 237, 2, 427, 613] +[:mouse_move, 128, 234, 2, 428, 614] +[:mouse_move, 128, 233, 2, 429, 615] +[:mouse_move, 129, 229, 2, 430, 616] +[:mouse_move, 129, 228, 2, 431, 617] +[:mouse_move, 129, 227, 2, 432, 618] +[:mouse_button_pressed, 1, 0, 1, 433, 619] +[:mouse_move, 129, 226, 2, 434, 619] +[:mouse_button_up, 1, 0, 1, 435, 624] +[:mouse_move, 129, 230, 2, 436, 625] +[:mouse_move, 129, 237, 2, 437, 626] +[:mouse_move, 129, 250, 2, 438, 627] +[:mouse_move, 127, 256, 2, 439, 628] +[:mouse_move, 124, 264, 2, 440, 629] +[:mouse_move, 123, 267, 2, 441, 630] +[:mouse_move, 121, 272, 2, 442, 631] +[:mouse_move, 116, 283, 2, 443, 632] +[:mouse_move, 113, 288, 2, 444, 633] +[:mouse_move, 108, 303, 2, 445, 634] +[:mouse_move, 104, 313, 2, 446, 635] +[:mouse_move, 97, 328, 2, 447, 636] +[:mouse_move, 94, 336, 2, 448, 637] +[:mouse_move, 89, 348, 2, 449, 638] +[:mouse_move, 86, 355, 2, 450, 639] +[:mouse_move, 84, 364, 2, 451, 640] +[:mouse_move, 83, 369, 2, 452, 641] +[:mouse_move, 82, 378, 2, 453, 642] +[:mouse_move, 82, 382, 2, 454, 643] +[:mouse_move, 82, 388, 2, 455, 644] +[:mouse_move, 82, 391, 2, 456, 645] +[:mouse_move, 82, 396, 2, 457, 646] +[:mouse_move, 82, 399, 2, 458, 647] +[:mouse_move, 82, 403, 2, 459, 648] +[:mouse_move, 82, 404, 2, 460, 649] +[:mouse_move, 82, 408, 2, 461, 650] +[:mouse_move, 82, 409, 2, 462, 651] +[:mouse_move, 81, 412, 2, 463, 652] +[:mouse_move, 81, 413, 2, 464, 653] +[:mouse_move, 79, 417, 2, 465, 654] +[:mouse_move, 79, 419, 2, 466, 655] +[:mouse_move, 77, 423, 2, 467, 656] +[:mouse_move, 76, 425, 2, 468, 657] +[:mouse_move, 74, 428, 2, 469, 658] +[:mouse_move, 73, 430, 2, 470, 659] +[:mouse_move, 72, 431, 2, 471, 660] +[:mouse_move, 69, 433, 2, 472, 661] +[:mouse_move, 68, 434, 2, 473, 662] +[:mouse_move, 65, 437, 2, 474, 663] +[:mouse_move, 64, 437, 2, 475, 664] +[:mouse_move, 62, 439, 2, 476, 665] +[:mouse_move, 61, 439, 2, 477, 666] +[:mouse_button_pressed, 1, 0, 1, 478, 667] +[:mouse_move, 60, 440, 2, 479, 667] +[:mouse_button_up, 1, 0, 1, 480, 672] +[:mouse_move, 60, 432, 2, 481, 672] +[:mouse_move, 61, 423, 2, 482, 673] +[:mouse_move, 62, 417, 2, 483, 674] +[:mouse_move, 66, 406, 2, 484, 675] +[:mouse_move, 68, 401, 2, 485, 676] +[:mouse_move, 75, 384, 2, 486, 677] +[:mouse_move, 77, 378, 2, 487, 678] +[:mouse_move, 89, 348, 2, 488, 679] +[:mouse_move, 92, 340, 2, 489, 680] +[:mouse_move, 96, 325, 2, 490, 681] +[:mouse_move, 103, 305, 2, 491, 682] +[:mouse_move, 106, 294, 2, 492, 683] +[:mouse_move, 113, 277, 2, 493, 684] +[:mouse_move, 115, 271, 2, 494, 685] +[:mouse_move, 120, 260, 2, 495, 686] +[:mouse_move, 121, 256, 2, 496, 687] +[:mouse_move, 123, 251, 2, 497, 688] +[:mouse_move, 124, 248, 2, 498, 689] +[:mouse_move, 125, 244, 2, 499, 690] +[:mouse_move, 125, 241, 2, 500, 691] +[:mouse_move, 126, 237, 2, 501, 692] +[:mouse_move, 127, 235, 2, 502, 693] +[:mouse_move, 128, 232, 2, 503, 694] +[:mouse_move, 129, 229, 2, 504, 695] +[:mouse_move, 131, 224, 2, 505, 696] +[:mouse_move, 131, 222, 2, 506, 697] +[:mouse_move, 133, 218, 2, 507, 698] +[:mouse_move, 134, 215, 2, 508, 699] +[:mouse_move, 136, 211, 2, 509, 700] +[:mouse_move, 136, 210, 2, 510, 701] +[:mouse_move, 136, 209, 2, 511, 702] +[:mouse_button_pressed, 1, 0, 1, 512, 704] +[:mouse_button_up, 1, 0, 1, 513, 709] +[:mouse_move, 136, 212, 2, 514, 710] +[:mouse_move, 136, 227, 2, 515, 711] +[:mouse_move, 136, 232, 2, 516, 712] +[:mouse_move, 136, 247, 2, 517, 713] +[:mouse_move, 136, 253, 2, 518, 714] +[:mouse_move, 136, 275, 2, 519, 715] +[:mouse_move, 136, 284, 2, 520, 716] +[:mouse_move, 136, 315, 2, 521, 717] +[:mouse_move, 136, 325, 2, 522, 718] +[:mouse_move, 136, 358, 2, 523, 719] +[:mouse_move, 136, 377, 2, 524, 720] +[:mouse_move, 136, 413, 2, 525, 721] +[:mouse_move, 136, 430, 2, 526, 722] +[:mouse_move, 138, 463, 2, 527, 723] +[:mouse_move, 138, 469, 2, 528, 724] +[:mouse_move, 140, 486, 2, 529, 725] +[:mouse_move, 141, 494, 2, 530, 726] +[:mouse_move, 142, 504, 2, 531, 727] +[:mouse_move, 142, 507, 2, 532, 728] +[:mouse_move, 142, 510, 2, 533, 729] +[:mouse_move, 142, 511, 2, 534, 730] +[:mouse_move, 142, 510, 2, 535, 735] +[:mouse_move, 142, 509, 2, 536, 736] +[:mouse_move, 141, 508, 2, 537, 737] +[:mouse_move, 141, 506, 2, 538, 738] +[:mouse_move, 141, 504, 2, 539, 739] +[:mouse_move, 141, 500, 2, 540, 740] +[:mouse_move, 141, 496, 2, 541, 741] +[:mouse_move, 141, 490, 2, 542, 742] +[:mouse_move, 141, 487, 2, 543, 743] +[:mouse_move, 141, 481, 2, 544, 744] +[:mouse_move, 141, 480, 2, 545, 745] +[:mouse_move, 141, 478, 2, 546, 746] +[:mouse_move, 141, 477, 2, 547, 748] +[:mouse_button_pressed, 1, 0, 1, 548, 748] +[:mouse_button_up, 1, 0, 1, 549, 753] +[:mouse_move, 150, 468, 2, 550, 761] +[:mouse_move, 154, 463, 2, 551, 762] +[:mouse_move, 165, 447, 2, 552, 763] +[:mouse_move, 177, 430, 2, 553, 764] +[:mouse_move, 195, 402, 2, 554, 765] +[:mouse_move, 205, 384, 2, 555, 766] +[:mouse_move, 227, 354, 2, 556, 767] +[:mouse_move, 235, 342, 2, 557, 768] +[:mouse_move, 253, 319, 2, 558, 769] +[:mouse_move, 262, 309, 2, 559, 770] +[:mouse_move, 273, 295, 2, 560, 771] +[:mouse_move, 280, 287, 2, 561, 772] +[:mouse_move, 285, 280, 2, 562, 773] +[:mouse_move, 289, 276, 2, 563, 774] +[:mouse_move, 293, 271, 2, 564, 775] +[:mouse_move, 295, 268, 2, 565, 776] +[:mouse_move, 296, 265, 2, 566, 777] +[:mouse_move, 297, 263, 2, 567, 778] +[:mouse_move, 297, 262, 2, 568, 779] +[:mouse_move, 298, 258, 2, 569, 780] +[:mouse_move, 298, 257, 2, 570, 781] +[:mouse_move, 298, 252, 2, 571, 782] +[:mouse_move, 298, 249, 2, 572, 783] +[:mouse_move, 298, 245, 2, 573, 784] +[:mouse_move, 297, 243, 2, 574, 785] +[:mouse_move, 296, 236, 2, 575, 786] +[:mouse_move, 295, 234, 2, 576, 787] +[:mouse_move, 294, 230, 2, 577, 788] +[:mouse_move, 293, 228, 2, 578, 789] +[:mouse_move, 293, 225, 2, 579, 790] +[:mouse_move, 292, 224, 2, 580, 791] +[:mouse_move, 292, 223, 2, 581, 792] +[:mouse_move, 291, 222, 2, 582, 794] +[:mouse_button_pressed, 1, 0, 1, 583, 794] +[:mouse_button_up, 1, 0, 1, 584, 799] +[:mouse_move, 291, 223, 2, 585, 802] +[:mouse_move, 291, 226, 2, 586, 803] +[:mouse_move, 291, 231, 2, 587, 804] +[:mouse_move, 291, 234, 2, 588, 805] +[:mouse_move, 291, 241, 2, 589, 806] +[:mouse_move, 289, 245, 2, 590, 807] +[:mouse_move, 284, 258, 2, 591, 808] +[:mouse_move, 280, 265, 2, 592, 809] +[:mouse_move, 271, 281, 2, 593, 810] +[:mouse_move, 268, 285, 2, 594, 811] +[:mouse_move, 258, 298, 2, 595, 812] +[:mouse_move, 254, 304, 2, 596, 813] +[:mouse_move, 246, 311, 2, 597, 814] +[:mouse_move, 245, 312, 2, 598, 815] +[:mouse_move, 240, 316, 2, 599, 816] +[:mouse_move, 238, 317, 2, 600, 817] +[:mouse_move, 235, 318, 2, 601, 818] +[:mouse_move, 233, 319, 2, 602, 819] +[:mouse_move, 232, 319, 2, 603, 820] +[:mouse_move, 231, 319, 2, 604, 821] +[:mouse_move, 230, 319, 2, 605, 822] +[:mouse_move, 229, 319, 2, 606, 824] +[:mouse_button_pressed, 1, 0, 1, 607, 829] +[:mouse_button_up, 1, 0, 1, 608, 834] +[:mouse_move, 229, 318, 2, 609, 845] +[:mouse_move, 229, 312, 2, 610, 846] +[:mouse_move, 229, 309, 2, 611, 847] +[:mouse_move, 229, 298, 2, 612, 848] +[:mouse_move, 229, 283, 2, 613, 849] +[:mouse_move, 229, 276, 2, 614, 850] +[:mouse_move, 229, 268, 2, 615, 851] +[:mouse_move, 229, 264, 2, 616, 852] +[:mouse_move, 229, 257, 2, 617, 853] +[:mouse_move, 228, 254, 2, 618, 854] +[:mouse_move, 228, 252, 2, 619, 855] +[:mouse_move, 227, 247, 2, 620, 856] +[:mouse_move, 227, 246, 2, 621, 857] +[:mouse_move, 227, 244, 2, 622, 858] +[:mouse_move, 227, 243, 2, 623, 859] +[:mouse_move, 227, 242, 2, 624, 860] +[:mouse_move, 226, 242, 2, 625, 861] +[:mouse_move, 226, 241, 2, 626, 862] +[:mouse_move, 226, 240, 2, 627, 864] +[:mouse_move, 225, 239, 2, 628, 865] +[:mouse_move, 225, 237, 2, 629, 866] +[:mouse_move, 224, 236, 2, 630, 867] +[:mouse_move, 223, 234, 2, 631, 868] +[:mouse_move, 223, 233, 2, 632, 869] +[:mouse_move, 222, 232, 2, 633, 870] +[:mouse_move, 222, 231, 2, 634, 871] +[:mouse_button_pressed, 1, 0, 1, 635, 872] +[:mouse_button_up, 1, 0, 1, 636, 877] +[:mouse_move, 221, 233, 2, 637, 879] +[:mouse_move, 220, 237, 2, 638, 880] +[:mouse_move, 213, 245, 2, 639, 881] +[:mouse_move, 209, 250, 2, 640, 882] +[:mouse_move, 199, 259, 2, 641, 883] +[:mouse_move, 194, 263, 2, 642, 884] +[:mouse_move, 187, 268, 2, 643, 885] +[:mouse_move, 184, 271, 2, 644, 886] +[:mouse_move, 177, 275, 2, 645, 887] +[:mouse_move, 173, 277, 2, 646, 888] +[:mouse_move, 166, 282, 2, 647, 889] +[:mouse_move, 164, 283, 2, 648, 890] +[:mouse_move, 160, 286, 2, 649, 891] +[:mouse_move, 158, 287, 2, 650, 892] +[:mouse_move, 156, 288, 2, 651, 893] +[:mouse_move, 156, 289, 2, 652, 894] +[:mouse_move, 155, 289, 2, 653, 895] +[:mouse_button_pressed, 1, 0, 1, 654, 898] +[:mouse_button_up, 1, 0, 1, 655, 903] +[:mouse_move, 155, 285, 2, 656, 904] +[:mouse_move, 155, 282, 2, 657, 905] +[:mouse_move, 155, 274, 2, 658, 906] +[:mouse_move, 155, 268, 2, 659, 907] +[:mouse_move, 155, 246, 2, 660, 908] +[:mouse_move, 155, 238, 2, 661, 909] +[:mouse_move, 155, 216, 2, 662, 910] +[:mouse_move, 155, 212, 2, 663, 911] +[:mouse_move, 155, 201, 2, 664, 912] +[:mouse_move, 155, 195, 2, 665, 913] +[:mouse_move, 155, 187, 2, 666, 914] +[:mouse_move, 155, 184, 2, 667, 915] +[:mouse_move, 155, 178, 2, 668, 916] +[:mouse_move, 154, 176, 2, 669, 917] +[:mouse_move, 154, 173, 2, 670, 918] +[:mouse_move, 154, 172, 2, 671, 919] +[:mouse_move, 153, 169, 2, 672, 920] +[:mouse_move, 152, 167, 2, 673, 921] +[:mouse_move, 151, 163, 2, 674, 922] +[:mouse_move, 150, 161, 2, 675, 923] +[:mouse_move, 149, 157, 2, 676, 924] +[:mouse_move, 148, 156, 2, 677, 925] +[:mouse_move, 146, 152, 2, 678, 926] +[:mouse_move, 146, 151, 2, 679, 927] +[:mouse_move, 145, 150, 2, 680, 928] +[:mouse_move, 144, 148, 2, 681, 929] +[:mouse_button_pressed, 1, 0, 1, 682, 931] +[:mouse_move, 143, 147, 2, 683, 931] +[:mouse_button_up, 1, 0, 1, 684, 937] +[:mouse_move, 143, 149, 2, 685, 937] +[:mouse_move, 142, 154, 2, 686, 938] +[:mouse_move, 138, 171, 2, 687, 939] +[:mouse_move, 132, 182, 2, 688, 940] +[:mouse_move, 119, 207, 2, 689, 941] +[:mouse_move, 109, 220, 2, 690, 942] +[:mouse_move, 98, 234, 2, 691, 943] +[:mouse_move, 91, 242, 2, 692, 944] +[:mouse_move, 74, 265, 2, 693, 945] +[:mouse_move, 68, 273, 2, 694, 946] +[:mouse_move, 57, 292, 2, 695, 947] +[:mouse_move, 55, 297, 2, 696, 948] +[:mouse_move, 52, 306, 2, 697, 949] +[:mouse_move, 51, 309, 2, 698, 950] +[:mouse_move, 49, 312, 2, 699, 951] +[:mouse_move, 49, 314, 2, 700, 952] +[:mouse_move, 49, 316, 2, 701, 953] +[:mouse_move, 49, 317, 2, 702, 954] +[:mouse_move, 49, 318, 2, 703, 955] +[:mouse_move, 49, 319, 2, 704, 958] +[:mouse_button_pressed, 1, 0, 1, 705, 961] +[:mouse_button_up, 1, 0, 1, 706, 966] +[:mouse_move, 49, 318, 2, 707, 967] +[:mouse_move, 49, 316, 2, 708, 968] +[:mouse_move, 52, 308, 2, 709, 969] +[:mouse_move, 54, 302, 2, 710, 970] +[:mouse_move, 60, 287, 2, 711, 971] +[:mouse_move, 64, 277, 2, 712, 972] +[:mouse_move, 71, 254, 2, 713, 973] +[:mouse_move, 76, 241, 2, 714, 974] +[:mouse_move, 80, 230, 2, 715, 975] +[:mouse_move, 86, 212, 2, 716, 976] +[:mouse_move, 91, 202, 2, 717, 977] +[:mouse_move, 96, 188, 2, 718, 978] +[:mouse_move, 99, 182, 2, 719, 979] +[:mouse_move, 101, 176, 2, 720, 980] +[:mouse_move, 102, 173, 2, 721, 981] +[:mouse_move, 104, 170, 2, 722, 982] +[:mouse_move, 105, 168, 2, 723, 983] +[:mouse_move, 106, 165, 2, 724, 984] +[:mouse_move, 107, 164, 2, 725, 985] +[:mouse_move, 108, 163, 2, 726, 986] +[:mouse_move, 108, 162, 2, 727, 987] +[:mouse_move, 109, 161, 2, 728, 988] +[:mouse_move, 109, 160, 2, 729, 990] +[:mouse_move, 110, 159, 2, 730, 991] +[:mouse_move, 110, 158, 2, 731, 992] +[:mouse_move, 111, 157, 2, 732, 993] +[:mouse_move, 111, 155, 2, 733, 994] +[:mouse_move, 112, 155, 2, 734, 995] +[:mouse_move, 112, 154, 2, 735, 996] +[:mouse_move, 113, 153, 2, 736, 997] +[:mouse_move, 113, 152, 2, 737, 998] +[:mouse_button_pressed, 1, 0, 1, 738, 999] +[:mouse_button_up, 1, 0, 1, 739, 1004] +[:mouse_move, 112, 154, 2, 740, 1014] +[:mouse_move, 109, 155, 2, 741, 1015] +[:mouse_move, 105, 159, 2, 742, 1016] +[:mouse_move, 101, 160, 2, 743, 1017] +[:mouse_move, 95, 164, 2, 744, 1018] +[:mouse_move, 89, 168, 2, 745, 1019] +[:mouse_move, 82, 172, 2, 746, 1020] +[:mouse_move, 81, 173, 2, 747, 1021] +[:mouse_move, 76, 177, 2, 748, 1022] +[:mouse_move, 75, 179, 2, 749, 1023] +[:mouse_move, 72, 182, 2, 750, 1024] +[:mouse_move, 70, 185, 2, 751, 1025] +[:mouse_move, 68, 187, 2, 752, 1026] +[:mouse_move, 68, 189, 2, 753, 1027] +[:mouse_move, 67, 190, 2, 754, 1028] +[:mouse_move, 66, 191, 2, 755, 1029] +[:mouse_move, 66, 192, 2, 756, 1030] +[:mouse_move, 65, 192, 2, 757, 1031] +[:mouse_move, 65, 193, 2, 758, 1032] +[:mouse_button_pressed, 1, 0, 1, 759, 1033] +[:mouse_button_up, 1, 0, 1, 760, 1039] +[:mouse_move, 69, 193, 2, 761, 1039] +[:mouse_move, 87, 195, 2, 762, 1041] +[:mouse_move, 91, 195, 2, 763, 1042] +[:mouse_move, 104, 198, 2, 764, 1043] +[:mouse_move, 106, 198, 2, 765, 1044] +[:mouse_move, 114, 200, 2, 766, 1045] +[:mouse_move, 116, 201, 2, 767, 1046] +[:mouse_move, 119, 201, 2, 768, 1047] +[:mouse_move, 120, 201, 2, 769, 1049] +[:mouse_move, 121, 201, 2, 770, 1050] +[:mouse_button_pressed, 1, 0, 1, 771, 1054] +[:mouse_button_up, 1, 0, 1, 772, 1060] +[:mouse_move, 122, 201, 2, 773, 1064] +[:mouse_move, 124, 198, 2, 774, 1065] +[:mouse_move, 126, 195, 2, 775, 1066] +[:mouse_move, 128, 192, 2, 776, 1067] +[:mouse_move, 128, 190, 2, 777, 1068] +[:mouse_move, 129, 186, 2, 778, 1069] +[:mouse_move, 129, 182, 2, 779, 1070] +[:mouse_move, 130, 178, 2, 780, 1071] +[:mouse_move, 130, 175, 2, 781, 1072] +[:mouse_move, 131, 169, 2, 782, 1073] +[:mouse_move, 131, 164, 2, 783, 1074] +[:mouse_move, 132, 161, 2, 784, 1075] +[:mouse_move, 134, 152, 2, 785, 1076] +[:mouse_move, 135, 148, 2, 786, 1077] +[:mouse_move, 135, 142, 2, 787, 1078] +[:mouse_move, 136, 139, 2, 788, 1079] +[:mouse_move, 137, 135, 2, 789, 1080] +[:mouse_move, 137, 134, 2, 790, 1081] +[:mouse_move, 137, 132, 2, 791, 1082] +[:mouse_button_pressed, 1, 0, 1, 792, 1083] +[:mouse_button_up, 1, 0, 1, 793, 1088] +[:mouse_move, 139, 137, 2, 794, 1088] +[:mouse_move, 139, 139, 2, 795, 1089] +[:mouse_move, 145, 147, 2, 796, 1090] +[:mouse_move, 148, 151, 2, 797, 1091] +[:mouse_move, 159, 164, 2, 798, 1092] +[:mouse_move, 163, 169, 2, 799, 1093] +[:mouse_move, 171, 177, 2, 800, 1094] +[:mouse_move, 175, 182, 2, 801, 1095] +[:mouse_move, 184, 191, 2, 802, 1096] +[:mouse_move, 187, 194, 2, 803, 1097] +[:mouse_move, 191, 197, 2, 804, 1098] +[:mouse_move, 196, 202, 2, 805, 1099] +[:mouse_move, 198, 203, 2, 806, 1100] +[:mouse_move, 202, 205, 2, 807, 1101] +[:mouse_move, 204, 206, 2, 808, 1102] +[:mouse_move, 206, 208, 2, 809, 1103] +[:mouse_move, 207, 209, 2, 810, 1104] +[:mouse_move, 208, 209, 2, 811, 1105] +[:mouse_move, 209, 210, 2, 812, 1106] +[:mouse_move, 210, 210, 2, 813, 1107] +[:mouse_move, 210, 211, 2, 814, 1109] +[:mouse_move, 211, 212, 2, 815, 1110] +[:mouse_move, 211, 213, 2, 816, 1111] +[:mouse_move, 212, 214, 2, 817, 1112] +[:mouse_move, 212, 215, 2, 818, 1113] +[:mouse_move, 212, 216, 2, 819, 1115] +[:mouse_button_pressed, 1, 0, 1, 820, 1115] +[:mouse_move, 213, 216, 2, 821, 1115] +[:mouse_button_up, 1, 0, 1, 822, 1120] +[:mouse_move, 213, 217, 2, 823, 1126] +[:mouse_move, 215, 218, 2, 824, 1127] +[:mouse_move, 216, 219, 2, 825, 1128] +[:mouse_move, 218, 221, 2, 826, 1129] +[:mouse_move, 219, 222, 2, 827, 1130] +[:mouse_move, 221, 222, 2, 828, 1131] +[:mouse_move, 221, 223, 2, 829, 1133] +[:mouse_move, 222, 223, 2, 830, 1135] +[:mouse_button_pressed, 1, 0, 1, 831, 1138] +[:mouse_button_up, 1, 0, 1, 832, 1143] +[:mouse_move, 222, 222, 2, 833, 1144] +[:mouse_move, 222, 219, 2, 834, 1145] +[:mouse_move, 217, 210, 2, 835, 1146] +[:mouse_move, 213, 205, 2, 836, 1147] +[:mouse_move, 203, 190, 2, 837, 1148] +[:mouse_move, 195, 181, 2, 838, 1149] +[:mouse_move, 182, 164, 2, 839, 1150] +[:mouse_move, 174, 155, 2, 840, 1151] +[:mouse_move, 158, 140, 2, 841, 1152] +[:mouse_move, 154, 137, 2, 842, 1153] +[:mouse_move, 142, 127, 2, 843, 1154] +[:mouse_move, 136, 123, 2, 844, 1155] +[:mouse_move, 127, 116, 2, 845, 1156] +[:mouse_move, 124, 113, 2, 846, 1157] +[:mouse_move, 117, 109, 2, 847, 1158] +[:mouse_move, 113, 106, 2, 848, 1159] +[:mouse_move, 107, 102, 2, 849, 1160] +[:mouse_move, 104, 99, 2, 850, 1161] +[:mouse_move, 96, 93, 2, 851, 1162] +[:mouse_move, 91, 90, 2, 852, 1163] +[:mouse_move, 85, 84, 2, 853, 1164] +[:mouse_move, 79, 79, 2, 854, 1165] +[:mouse_move, 74, 75, 2, 855, 1166] +[:mouse_move, 72, 73, 2, 856, 1167] +[:mouse_move, 69, 71, 2, 857, 1168] +[:mouse_move, 65, 67, 2, 858, 1169] +[:mouse_move, 63, 66, 2, 859, 1170] +[:mouse_move, 61, 63, 2, 860, 1171] +[:mouse_move, 60, 63, 2, 861, 1172] +[:mouse_move, 58, 62, 2, 862, 1173] +[:mouse_move, 58, 61, 2, 863, 1174] +[:mouse_move, 57, 61, 2, 864, 1176] +[:mouse_move, 57, 60, 2, 865, 1177] +[:mouse_button_pressed, 1, 0, 1, 866, 1179] +[:mouse_button_up, 1, 0, 1, 867, 1185] +[:mouse_move, 60, 65, 2, 868, 1185] +[:mouse_move, 65, 73, 2, 869, 1186] +[:mouse_move, 83, 110, 2, 870, 1187] +[:mouse_move, 93, 134, 2, 871, 1188] +[:mouse_move, 98, 150, 2, 872, 1189] +[:mouse_move, 99, 154, 2, 873, 1190] +[:mouse_move, 107, 171, 2, 874, 1191] +[:mouse_move, 109, 176, 2, 875, 1192] +[:mouse_move, 115, 186, 2, 876, 1193] +[:mouse_move, 116, 188, 2, 877, 1194] +[:mouse_move, 118, 190, 2, 878, 1195] +[:mouse_move, 119, 193, 2, 879, 1196] +[:mouse_move, 119, 194, 2, 880, 1197] +[:mouse_move, 120, 196, 2, 881, 1198] +[:mouse_move, 121, 197, 2, 882, 1200] +[:mouse_move, 121, 198, 2, 883, 1201] +[:mouse_move, 121, 199, 2, 884, 1202] +[:mouse_move, 122, 200, 2, 885, 1204] +[:mouse_move, 122, 201, 2, 886, 1205] +[:mouse_move, 122, 202, 2, 887, 1206] +[:mouse_move, 122, 203, 2, 888, 1208] +[:mouse_move, 123, 204, 2, 889, 1209] +[:mouse_button_pressed, 1, 0, 1, 890, 1211] +[:mouse_button_up, 1, 0, 1, 891, 1216] +[:mouse_move, 123, 203, 2, 892, 1218] +[:mouse_move, 123, 201, 2, 893, 1219] +[:mouse_move, 124, 189, 2, 894, 1220] +[:mouse_move, 124, 185, 2, 895, 1221] +[:mouse_move, 124, 180, 2, 896, 1222] +[:mouse_move, 124, 169, 2, 897, 1223] +[:mouse_move, 124, 158, 2, 898, 1224] +[:mouse_move, 125, 139, 2, 899, 1225] +[:mouse_move, 125, 134, 2, 900, 1226] +[:mouse_move, 127, 120, 2, 901, 1227] +[:mouse_move, 127, 118, 2, 902, 1228] +[:mouse_move, 128, 109, 2, 903, 1229] +[:mouse_move, 128, 107, 2, 904, 1230] +[:mouse_move, 128, 101, 2, 905, 1231] +[:mouse_move, 128, 98, 2, 906, 1232] +[:mouse_move, 128, 95, 2, 907, 1233] +[:mouse_move, 128, 90, 2, 908, 1234] +[:mouse_move, 128, 88, 2, 909, 1235] +[:mouse_move, 129, 83, 2, 910, 1236] +[:mouse_move, 129, 78, 2, 911, 1237] +[:mouse_move, 129, 76, 2, 912, 1238] +[:mouse_move, 129, 71, 2, 913, 1239] +[:mouse_move, 129, 69, 2, 914, 1240] +[:mouse_move, 129, 66, 2, 915, 1241] +[:mouse_move, 129, 65, 2, 916, 1242] +[:mouse_move, 129, 63, 2, 917, 1243] +[:mouse_move, 129, 62, 2, 918, 1244] +[:mouse_move, 129, 61, 2, 919, 1246] +[:mouse_button_pressed, 1, 0, 1, 920, 1247] +[:mouse_button_up, 1, 0, 1, 921, 1252] +[:mouse_move, 140, 85, 2, 922, 1254] +[:mouse_move, 155, 98, 2, 923, 1255] +[:mouse_move, 174, 106, 2, 924, 1256] +[:mouse_move, 186, 109, 2, 925, 1257] +[:mouse_move, 203, 115, 2, 926, 1258] +[:mouse_move, 213, 117, 2, 927, 1259] +[:mouse_move, 229, 123, 2, 928, 1260] +[:mouse_move, 231, 124, 2, 929, 1261] +[:mouse_move, 246, 130, 2, 930, 1262] +[:mouse_move, 249, 131, 2, 931, 1263] +[:mouse_move, 251, 132, 2, 932, 1264] +[:mouse_move, 257, 135, 2, 933, 1265] +[:mouse_move, 263, 140, 2, 934, 1266] +[:mouse_move, 265, 142, 2, 935, 1267] +[:mouse_move, 271, 155, 2, 936, 1268] +[:mouse_move, 272, 158, 2, 937, 1269] +[:mouse_move, 273, 164, 2, 938, 1270] +[:mouse_move, 275, 171, 2, 939, 1271] +[:mouse_move, 275, 176, 2, 940, 1272] +[:mouse_move, 276, 181, 2, 941, 1273] +[:mouse_move, 277, 183, 2, 942, 1274] +[:mouse_move, 277, 187, 2, 943, 1275] +[:mouse_move, 277, 189, 2, 944, 1276] +[:mouse_move, 277, 192, 2, 945, 1277] +[:mouse_move, 277, 194, 2, 946, 1278] +[:mouse_move, 277, 198, 2, 947, 1279] +[:mouse_move, 277, 200, 2, 948, 1280] +[:mouse_move, 277, 202, 2, 949, 1281] +[:mouse_move, 277, 203, 2, 950, 1282] +[:mouse_move, 277, 204, 2, 951, 1283] +[:mouse_button_pressed, 1, 0, 1, 952, 1284] +[:mouse_button_up, 1, 0, 1, 953, 1289] +[:mouse_move, 277, 203, 2, 954, 1289] +[:mouse_move, 277, 202, 2, 955, 1289] +[:mouse_move, 277, 200, 2, 956, 1290] +[:mouse_move, 277, 195, 2, 957, 1291] +[:mouse_move, 277, 192, 2, 958, 1292] +[:mouse_move, 272, 185, 2, 959, 1293] +[:mouse_move, 269, 181, 2, 960, 1294] +[:mouse_move, 260, 171, 2, 961, 1295] +[:mouse_move, 257, 166, 2, 962, 1296] +[:mouse_move, 252, 157, 2, 963, 1297] +[:mouse_move, 250, 153, 2, 964, 1298] +[:mouse_move, 246, 145, 2, 965, 1299] +[:mouse_move, 246, 144, 2, 966, 1300] +[:mouse_move, 242, 136, 2, 967, 1301] +[:mouse_move, 242, 135, 2, 968, 1302] +[:mouse_move, 240, 131, 2, 969, 1303] +[:mouse_move, 240, 129, 2, 970, 1304] +[:mouse_move, 238, 124, 2, 971, 1305] +[:mouse_move, 237, 123, 2, 972, 1306] +[:mouse_move, 235, 117, 2, 973, 1307] +[:mouse_move, 234, 114, 2, 974, 1308] +[:mouse_move, 231, 106, 2, 975, 1309] +[:mouse_move, 230, 101, 2, 976, 1310] +[:mouse_move, 229, 100, 2, 977, 1311] +[:mouse_move, 226, 92, 2, 978, 1312] +[:mouse_move, 225, 90, 2, 979, 1313] +[:mouse_move, 223, 85, 2, 980, 1314] +[:mouse_move, 222, 83, 2, 981, 1315] +[:mouse_move, 221, 79, 2, 982, 1316] +[:mouse_move, 220, 78, 2, 983, 1317] +[:mouse_move, 219, 74, 2, 984, 1318] +[:mouse_move, 219, 73, 2, 985, 1319] +[:mouse_move, 218, 71, 2, 986, 1320] +[:mouse_move, 217, 70, 2, 987, 1321] +[:mouse_move, 217, 69, 2, 988, 1322] +[:mouse_button_pressed, 1, 0, 1, 989, 1324] +[:mouse_move, 217, 68, 2, 990, 1324] +[:mouse_button_up, 1, 0, 1, 991, 1330] +[:mouse_move, 220, 69, 2, 992, 1333] +[:mouse_move, 224, 70, 2, 993, 1334] +[:mouse_move, 246, 79, 2, 994, 1335] +[:mouse_move, 262, 86, 2, 995, 1336] +[:mouse_move, 333, 124, 2, 996, 1337] +[:mouse_move, 368, 145, 2, 997, 1338] +[:mouse_move, 452, 201, 2, 998, 1339] +[:mouse_move, 469, 215, 2, 999, 1340] +[:mouse_move, 506, 244, 2, 1000, 1341] +[:mouse_move, 574, 304, 2, 1001, 1342] +[:mouse_move, 599, 333, 2, 1002, 1343] +[:mouse_move, 626, 364, 2, 1003, 1344] +[:mouse_move, 640, 385, 2, 1004, 1345] +[:mouse_move, 654, 419, 2, 1005, 1346] +[:key_down_raw, 96, 0, 2, 1006, 1356] +[:key_up_raw, 96, 0, 2, 1007, 1360] +[:key_down_raw, 13, 0, 2, 1008, 1438] diff --git a/samples/26_jam_craft/sprites/border-black.png b/samples/26_jam_craft/sprites/border-black.png Binary files differnew file mode 100644 index 0000000..c9d0bad --- /dev/null +++ b/samples/26_jam_craft/sprites/border-black.png diff --git a/samples/26_jam_craft/sprites/chest.png b/samples/26_jam_craft/sprites/chest.png Binary files differnew file mode 100644 index 0000000..9d8181c --- /dev/null +++ b/samples/26_jam_craft/sprites/chest.png diff --git a/samples/26_jam_craft/sprites/circle-gray.png b/samples/26_jam_craft/sprites/circle-gray.png Binary files differnew file mode 100644 index 0000000..960f191 --- /dev/null +++ b/samples/26_jam_craft/sprites/circle-gray.png diff --git a/samples/26_jam_craft/sprites/plank.png b/samples/26_jam_craft/sprites/plank.png Binary files differnew file mode 100644 index 0000000..80730f6 --- /dev/null +++ b/samples/26_jam_craft/sprites/plank.png diff --git a/samples/26_jam_craft/sprites/square-black.png b/samples/26_jam_craft/sprites/square-black.png Binary files differnew file mode 100644 index 0000000..cea7bd7 --- /dev/null +++ b/samples/26_jam_craft/sprites/square-black.png diff --git a/samples/26_jam_craft/sprites/square-blue.png b/samples/26_jam_craft/sprites/square-blue.png Binary files differnew file mode 100644 index 0000000..b840849 --- /dev/null +++ b/samples/26_jam_craft/sprites/square-blue.png diff --git a/samples/26_jam_craft/sprites/wood.png b/samples/26_jam_craft/sprites/wood.png Binary files differnew file mode 100644 index 0000000..9bf0200 --- /dev/null +++ b/samples/26_jam_craft/sprites/wood.png diff --git a/samples/99_sample_game_basic_gorillas/CREDITS.txt b/samples/99_sample_game_basic_gorillas/CREDITS.txt new file mode 100644 index 0000000..7503a2a --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/CREDITS.txt @@ -0,0 +1,3 @@ +code: Amir Rajan, https://twitter.com/amirrajan +graphics: Nick Culbertson, https://twitter.com/MobyPixel + diff --git a/samples/99_sample_game_basic_gorillas/app/main.rb b/samples/99_sample_game_basic_gorillas/app/main.rb new file mode 100644 index 0000000..53f9a4f --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/app/main.rb @@ -0,0 +1,373 @@ +class YouSoBasicGorillas + attr_accessor :outputs, :grid, :state, :inputs + + def tick + defaults + render + calc + process_inputs + end + + def defaults + outputs.background_color = [33, 32, 87] + state.building_spacing = 1 + state.building_room_spacing = 15 + state.building_room_width = 10 + state.building_room_height = 15 + state.building_heights = [4, 4, 6, 8, 15, 20, 18] + state.building_room_sizes = [5, 4, 6, 7] + state.gravity = 0.25 + state.first_strike ||= :player_1 + state.buildings ||= [] + state.holes ||= [] + state.player_1_score ||= 0 + state.player_2_score ||= 0 + state.wind ||= 0 + end + + def render + render_stage + render_value_insertion + render_gorillas + render_holes + render_banana + render_game_over + render_score + render_wind + end + + def render_score + outputs.primitives << [0, 0, 1280, 31, fancy_white].solid + outputs.primitives << [1, 1, 1279, 29].solid + outputs.labels << [ 10, 25, "Score: #{state.player_1_score}", 0, 0, fancy_white] + outputs.labels << [1270, 25, "Score: #{state.player_2_score}", 0, 2, fancy_white] + end + + def render_wind + outputs.primitives << [640, 12, state.wind * 500 + state.wind * 10 * rand, 4, 35, 136, 162].solid + outputs.lines << [640, 30, 640, 0, fancy_white] + end + + def render_game_over + return unless state.over + outputs.primitives << [grid.rect, 0, 0, 0, 200].solid + outputs.primitives << [640, 370, "Game Over!!", 5, 1, fancy_white].label + if state.winner == :player_1 + outputs.primitives << [640, 340, "Player 1 Wins!!", 5, 1, fancy_white].label + else + outputs.primitives << [640, 340, "Player 2 Wins!!", 5, 1, fancy_white].label + end + end + + def render_stage + return unless state.stage_generated + return if state.stage_rendered + + outputs.static_solids << [grid.rect, 33, 32, 87] + outputs.static_solids << state.buildings.map(&:solids) + state.stage_rendered = true + end + + def render_gorilla gorilla, id + return unless gorilla + if state.banana && state.banana.owner == gorilla + animation_index = state.banana.created_at.frame_index(3, 5, false) + end + if !animation_index + outputs.sprites << [gorilla.solid, "sprites/#{id}-idle.png"] + else + outputs.sprites << [gorilla.solid, "sprites/#{id}-#{animation_index}.png"] + end + end + + def render_gorillas + render_gorilla state.player_1, :left + render_gorilla state.player_2, :right + end + + def render_value_insertion + return if state.banana + return if state.over + + if state.current_turn == :player_1_angle + outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}_", fancy_white] + elsif state.current_turn == :player_1_velocity + outputs.labels << [ 10, 710, "Angle: #{state.player_1_angle}", fancy_white] + outputs.labels << [ 10, 690, "Velocity: #{state.player_1_velocity}_", fancy_white] + elsif state.current_turn == :player_2_angle + outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}_", fancy_white] + elsif state.current_turn == :player_2_velocity + outputs.labels << [1120, 710, "Angle: #{state.player_2_angle}", fancy_white] + outputs.labels << [1120, 690, "Velocity: #{state.player_2_velocity}_", fancy_white] + end + end + + def render_banana + return unless state.banana + rotation = state.tick_count.%(360) * 20 + rotation *= -1 if state.banana.dx > 0 + outputs.sprites << [state.banana.x, state.banana.y, 15, 15, 'sprites/banana.png', rotation] + end + + def render_holes + outputs.sprites << state.holes.map do |s| + animation_index = s.created_at.frame_index(7, 3, false) + if animation_index + [s.sprite, [s.sprite.rect, "sprites/explosion#{animation_index}.png" ]] + else + s.sprite + end + end + end + + def calc + calc_generate_stage + calc_current_turn + calc_banana + end + + def calc_current_turn + return if state.current_turn + + state.current_turn = :player_1_angle + state.current_turn = :player_2_angle if state.first_strike == :player_2 + end + + def calc_generate_stage + return if state.stage_generated + + state.buildings << building_prefab(state.building_spacing + -20, *random_building_size) + 8.numbers.inject(state.buildings) do |buildings, i| + buildings << + building_prefab(state.building_spacing + + state.buildings.last.right, + *random_building_size) + end + + building_two = state.buildings[1] + state.player_1 = new_player(building_two.x + building_two.w.fdiv(2), + building_two.h) + + building_nine = state.buildings[-3] + state.player_2 = new_player(building_nine.x + building_nine.w.fdiv(2), + building_nine.h) + state.stage_generated = true + state.wind = 1.randomize(:ratio, :sign) + end + + def new_player x, y + state.new_entity(:gorilla) do |p| + p.x = x - 25 + p.y = y + p.solid = [p.x, p.y, 50, 50] + end + end + + def calc_banana + return unless state.banana + + state.banana.x += state.banana.dx + state.banana.dx += state.wind.fdiv(50) + state.banana.y += state.banana.dy + state.banana.dy -= state.gravity + banana_collision = [state.banana.x, state.banana.y, 10, 10] + + if state.player_1 && banana_collision.intersect_rect?(state.player_1.solid) + state.over = true + if state.banana.owner == state.player_2 + state.winner = :player_2 + else + state.winner = :player_1 + end + + state.player_2_score += 1 + elsif state.player_2 && banana_collision.intersect_rect?(state.player_2.solid) + state.over = true + if state.banana.owner == state.player_2 + state.winner = :player_1 + else + state.winner = :player_2 + end + state.player_1_score += 1 + end + + if state.over + place_hole + return + end + + return if state.holes.any? do |h| + h.sprite.scale_rect(0.8, 0.5, 0.5).intersect_rect? [state.banana.x, state.banana.y, 10, 10] + end + + return unless state.banana.y < 0 || state.buildings.any? do |b| + b.rect.intersect_rect? [state.banana.x, state.banana.y, 1, 1] + end + + place_hole + end + + def place_hole + return unless state.banana + + state.holes << state.new_entity(:banana) do |b| + b.sprite = [state.banana.x - 20, state.banana.y - 20, 40, 40, 'sprites/hole.png'] + end + + state.banana = nil + end + + def process_inputs_main + return if state.banana + return if state.over + + if inputs.keyboard.key_down.enter + input_execute_turn + elsif inputs.keyboard.key_down.backspace + state.as_hash[state.current_turn] ||= "" + state.as_hash[state.current_turn] = state.as_hash[state.current_turn][0..-2] + elsif inputs.keyboard.key_down.char + state.as_hash[state.current_turn] ||= "" + state.as_hash[state.current_turn] += inputs.keyboard.key_down.char + end + end + + def process_inputs_game_over + return unless state.over + return unless inputs.keyboard.key_down.truthy_keys.any? + state.over = false + outputs.static_solids.clear + state.buildings.clear + state.holes.clear + state.stage_generated = false + state.stage_rendered = false + if state.first_strike == :player_1 + state.first_strike = :player_2 + else + state.first_strike = :player_1 + end + end + + def process_inputs + process_inputs_main + process_inputs_game_over + end + + def input_execute_turn + return if state.banana + + if state.current_turn == :player_1_angle && parse_or_clear!(:player_1_angle) + state.current_turn = :player_1_velocity + elsif state.current_turn == :player_1_velocity && parse_or_clear!(:player_1_velocity) + state.current_turn = :player_2_angle + state.banana = + new_banana(state.player_1, + state.player_1.x + 25, + state.player_1.y + 60, + state.player_1_angle, + state.player_1_velocity) + elsif state.current_turn == :player_2_angle && parse_or_clear!(:player_2_angle) + state.current_turn = :player_2_velocity + elsif state.current_turn == :player_2_velocity && parse_or_clear!(:player_2_velocity) + state.current_turn = :player_1_angle + state.banana = + new_banana(state.player_2, + state.player_2.x + 25, + state.player_2.y + 60, + 180 - state.player_2_angle, + state.player_2_velocity) + end + + if state.banana + state.player_1_angle = nil + state.player_1_velocity = nil + state.player_2_angle = nil + state.player_2_velocity = nil + end + end + + def random_building_size + [state.building_heights.sample, state.building_room_sizes.sample] + end + + def int? v + v.to_i.to_s == v.to_s + end + + def random_building_color + [[ 99, 0, 107], + [ 35, 64, 124], + [ 35, 136, 162], + ].sample + end + + def random_window_color + [[ 88, 62, 104], + [253, 224, 187]].sample + end + + def windows_for_building starting_x, floors, rooms + floors.-(1).combinations(rooms - 1).map do |floor, room| + [starting_x + + state.building_room_width.*(room) + + state.building_room_spacing.*(room + 1), + state.building_room_height.*(floor) + + state.building_room_spacing.*(floor + 1), + state.building_room_width, + state.building_room_height, + random_window_color] + end + end + + def building_prefab starting_x, floors, rooms + state.new_entity(:building) do |b| + b.x = starting_x + b.y = 0 + b.w = state.building_room_width.*(rooms) + + state.building_room_spacing.*(rooms + 1) + b.h = state.building_room_height.*(floors) + + state.building_room_spacing.*(floors + 1) + b.right = b.x + b.w + b.rect = [b.x, b.y, b.w, b.h] + b.solids = [[b.x - 1, b.y, b.w + 2, b.h + 1, fancy_white], + [b.x, b.y, b.w, b.h, random_building_color], + windows_for_building(b.x, floors, rooms)] + end + end + + def parse_or_clear! game_prop + if int? state.as_hash[game_prop] + state.as_hash[game_prop] = state.as_hash[game_prop].to_i + return true + end + + state.as_hash[game_prop] = nil + return false + end + + def new_banana owner, x, y, angle, velocity + state.new_entity(:banana) do |b| + b.owner = owner + b.x = x + b.y = y + b.angle = angle % 360 + b.velocity = velocity / 5 + b.dx = b.angle.vector_x(b.velocity) + b.dy = b.angle.vector_y(b.velocity) + end + end + + def fancy_white + [253, 252, 253] + end +end + +$you_so_basic_gorillas = YouSoBasicGorillas.new + +def tick args + $you_so_basic_gorillas.outputs = args.outputs + $you_so_basic_gorillas.grid = args.grid + $you_so_basic_gorillas.state = args.state + $you_so_basic_gorillas.inputs = args.inputs + $you_so_basic_gorillas.tick +end diff --git a/samples/99_sample_game_basic_gorillas/app/repl.rb b/samples/99_sample_game_basic_gorillas/app/repl.rb new file mode 100644 index 0000000..4428c4b --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/app/repl.rb @@ -0,0 +1,17 @@ +begin + if $gtk.args.state.current_turn == :player_1_angle + $gtk.args.state.player_1_angle = "#{60 + 10.randomize(:ratio).to_i}" + $you_so_basic_gorillas.input_execute_turn + $gtk.args.state.player_1_velocity = "#{30 + 20.randomize(:ratio).to_i}" + $you_so_basic_gorillas.input_execute_turn + elsif $gtk.args.state.current_turn == :player_2_angle + $gtk.args.state.player_2_angle = "#{60 + 10.randomize(:ratio).to_i}" + $you_so_basic_gorillas.input_execute_turn + $gtk.args.state.player_2_velocity = "#{30 + 20.randomize(:ratio).to_i}" + $you_so_basic_gorillas.input_execute_turn + else + $you_so_basic_gorillas.input_execute_turn + end +rescue Exception => e + puts e +end diff --git a/samples/99_sample_game_basic_gorillas/app/tests.rb b/samples/99_sample_game_basic_gorillas/app/tests.rb new file mode 100644 index 0000000..e108574 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/app/tests.rb @@ -0,0 +1,4 @@ +$gtk.reset 100 +$gtk.supress_framerate_warning = true +$gtk.require 'app/tests/building_generation_tests.rb' +$gtk.tests.start diff --git a/samples/99_sample_game_basic_gorillas/app/tests/building_generation_tests.rb b/samples/99_sample_game_basic_gorillas/app/tests/building_generation_tests.rb new file mode 100644 index 0000000..bbad57a --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/app/tests/building_generation_tests.rb @@ -0,0 +1,15 @@ +def test_solids args, assert + game = YouSoBasicGorillas.new + game.outputs = args.outputs + game.grid = args.grid + game.state = args.state + game.inputs = args.inputs + game.tick + assert.true! args.state.stage_generated, "stage wasn't generated but it should have been" + game.tick + assert.true! args.outputs.static_solids.length > 0, "stage wasn't rendered" + number_of_building_components = (args.state.buildings.map { |b| 2 + b.solids[2].length }.inject do |sum, v| (sum || 0) + v end) + the_only_background = 1 + static_solids = args.outputs.static_solids.length + assert.true! static_solids == the_only_background.+(number_of_building_components), "not all parts of the buildings and background were rendered" +end diff --git a/samples/99_sample_game_basic_gorillas/license-for-sample.txt b/samples/99_sample_game_basic_gorillas/license-for-sample.txt new file mode 100644 index 0000000..8fa4d42 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC (code), Nick Culbertson @mobypixel (art) + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_game_basic_gorillas/metadata/game_metadata.txt b/samples/99_sample_game_basic_gorillas/metadata/game_metadata.txt new file mode 100644 index 0000000..38d9894 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/metadata/game_metadata.txt @@ -0,0 +1,6 @@ +devid=dragonruby +devtitle=DragonRuby LLC +gameid=basicgorillas +gametitle=Basic Gorillas +version=1.1 +icon=sprites/left-0.png diff --git a/samples/99_sample_game_basic_gorillas/replay.txt b/samples/99_sample_game_basic_gorillas/replay.txt new file mode 100644 index 0000000..a1d4eab --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/replay.txt @@ -0,0 +1,719 @@ +replay_version 2.0 +stopped_at 1814 +seed 100 +recorded_at Sun Sep 29 23:27:50 2019 +[:mouse_move, 20, 450, 2, 1, 32] +[:mouse_move, 61, 422, 2, 2, 33] +[:mouse_move, 64, 417, 2, 3, 34] +[:mouse_move, 67, 413, 2, 4, 35] +[:mouse_move, 77, 402, 2, 5, 36] +[:mouse_move, 78, 397, 2, 6, 37] +[:mouse_move, 79, 393, 2, 7, 38] +[:mouse_move, 79, 392, 2, 8, 39] +[:mouse_move, 79, 401, 2, 9, 41] +[:mouse_move, 80, 426, 2, 10, 42] +[:mouse_move, 85, 444, 2, 11, 43] +[:mouse_move, 97, 477, 2, 12, 44] +[:mouse_move, 100, 482, 2, 13, 45] +[:mouse_move, 113, 496, 2, 14, 46] +[:mouse_move, 118, 498, 2, 15, 47] +[:mouse_move, 123, 499, 2, 16, 48] +[:mouse_move, 131, 493, 2, 17, 49] +[:mouse_move, 132, 485, 2, 18, 50] +[:mouse_move, 133, 462, 2, 19, 51] +[:mouse_move, 133, 448, 2, 20, 52] +[:mouse_move, 125, 402, 2, 21, 53] +[:mouse_move, 120, 380, 2, 22, 54] +[:mouse_move, 106, 336, 2, 23, 55] +[:mouse_move, 97, 310, 2, 24, 56] +[:mouse_move, 72, 250, 2, 25, 57] +[:mouse_move, 58, 216, 2, 26, 58] +[:mouse_move, 48, 188, 2, 27, 59] +[:mouse_move, 39, 166, 2, 28, 60] +[:mouse_move, 35, 156, 2, 29, 61] +[:mouse_move, 33, 150, 2, 30, 62] +[:mouse_move, 33, 145, 2, 31, 75] +[:mouse_move, 33, 128, 2, 32, 76] +[:mouse_move, 33, 119, 2, 33, 77] +[:mouse_move, 33, 106, 2, 34, 78] +[:mouse_move, 33, 101, 2, 35, 79] +[:mouse_move, 33, 90, 2, 36, 80] +[:mouse_move, 33, 83, 2, 37, 81] +[:mouse_move, 31, 74, 2, 38, 82] +[:mouse_move, 29, 68, 2, 39, 83] +[:mouse_move, 26, 60, 2, 40, 84] +[:mouse_move, 25, 59, 2, 41, 85] +[:mouse_move, 23, 53, 2, 42, 86] +[:mouse_move, 22, 51, 2, 43, 87] +[:mouse_move, 21, 50, 2, 44, 88] +[:mouse_move, 21, 49, 2, 45, 89] +[:mouse_move, 19, 48, 2, 46, 90] +[:mouse_move, 15, 46, 2, 47, 92] +[:mouse_move, 12, 44, 2, 48, 93] +[:mouse_move, 11, 43, 2, 49, 94] +[:mouse_move, 9, 42, 2, 50, 95] +[:mouse_move, 9, 41, 2, 51, 96] +[:mouse_move, 8, 41, 2, 52, 97] +[:mouse_move, 9, 41, 2, 53, 104] +[:mouse_move, 12, 42, 2, 54, 105] +[:mouse_move, 17, 44, 2, 55, 106] +[:mouse_move, 21, 44, 2, 56, 107] +[:mouse_move, 25, 45, 2, 57, 108] +[:mouse_move, 34, 46, 2, 58, 109] +[:mouse_move, 43, 46, 2, 59, 110] +[:mouse_move, 48, 47, 2, 60, 111] +[:mouse_move, 53, 47, 2, 61, 112] +[:mouse_move, 61, 48, 2, 62, 113] +[:mouse_move, 66, 48, 2, 63, 114] +[:mouse_move, 74, 49, 2, 64, 115] +[:mouse_move, 84, 51, 2, 65, 116] +[:mouse_move, 88, 51, 2, 66, 117] +[:mouse_move, 95, 52, 2, 67, 118] +[:mouse_move, 98, 52, 2, 68, 119] +[:mouse_move, 104, 52, 2, 69, 120] +[:mouse_move, 108, 52, 2, 70, 121] +[:mouse_move, 111, 52, 2, 71, 122] +[:mouse_move, 115, 51, 2, 72, 123] +[:mouse_move, 116, 50, 2, 73, 124] +[:mouse_move, 118, 49, 2, 74, 125] +[:mouse_move, 119, 49, 2, 75, 126] +[:mouse_move, 120, 49, 2, 76, 127] +[:mouse_move, 121, 48, 2, 77, 128] +[:mouse_move, 122, 48, 2, 78, 130] +[:mouse_move, 123, 48, 2, 79, 132] +[:mouse_move, 124, 48, 2, 80, 133] +[:mouse_move, 125, 48, 2, 81, 136] +[:mouse_move, 125, 49, 2, 82, 141] +[:mouse_move, 115, 67, 2, 83, 152] +[:mouse_move, 109, 101, 2, 84, 153] +[:mouse_move, 93, 189, 2, 85, 154] +[:mouse_move, 81, 254, 2, 86, 155] +[:mouse_move, 67, 327, 2, 87, 156] +[:mouse_move, 40, 469, 2, 88, 157] +[:mouse_move, 35, 496, 2, 89, 158] +[:mouse_move, 24, 556, 2, 90, 159] +[:mouse_move, 23, 566, 2, 91, 160] +[:mouse_move, 20, 586, 2, 92, 161] +[:mouse_move, 19, 595, 2, 93, 162] +[:mouse_move, 18, 603, 2, 94, 163] +[:mouse_move, 18, 605, 2, 95, 164] +[:mouse_move, 18, 606, 2, 96, 165] +[:mouse_move, 19, 606, 2, 97, 166] +[:mouse_move, 20, 606, 2, 98, 168] +[:mouse_move, 21, 606, 2, 99, 169] +[:mouse_move, 21, 607, 2, 100, 170] +[:mouse_move, 24, 608, 2, 101, 171] +[:mouse_move, 27, 609, 2, 102, 172] +[:mouse_move, 37, 616, 2, 103, 173] +[:mouse_move, 45, 621, 2, 104, 174] +[:mouse_move, 67, 631, 2, 105, 175] +[:mouse_move, 81, 636, 2, 106, 176] +[:mouse_move, 114, 645, 2, 107, 177] +[:mouse_move, 129, 647, 2, 108, 178] +[:mouse_move, 151, 646, 2, 109, 179] +[:mouse_move, 176, 635, 2, 110, 180] +[:mouse_move, 179, 630, 2, 111, 181] +[:mouse_move, 190, 605, 2, 112, 182] +[:mouse_move, 193, 582, 2, 113, 183] +[:mouse_move, 193, 572, 2, 114, 184] +[:mouse_move, 193, 556, 2, 115, 185] +[:mouse_move, 190, 535, 2, 116, 186] +[:mouse_move, 187, 523, 2, 117, 187] +[:mouse_move, 179, 509, 2, 118, 188] +[:mouse_move, 172, 502, 2, 119, 189] +[:mouse_move, 159, 500, 2, 120, 190] +[:mouse_move, 152, 500, 2, 121, 191] +[:mouse_move, 142, 507, 2, 122, 192] +[:mouse_move, 137, 513, 2, 123, 193] +[:mouse_move, 129, 527, 2, 124, 194] +[:mouse_move, 125, 540, 2, 125, 195] +[:mouse_move, 125, 558, 2, 126, 196] +[:mouse_move, 127, 566, 2, 127, 197] +[:mouse_move, 135, 578, 2, 128, 198] +[:mouse_move, 144, 590, 2, 129, 199] +[:mouse_move, 159, 597, 2, 130, 200] +[:mouse_move, 171, 599, 2, 131, 201] +[:mouse_move, 179, 599, 2, 132, 202] +[:mouse_move, 185, 599, 2, 133, 203] +[:mouse_move, 200, 590, 2, 134, 204] +[:mouse_move, 206, 579, 2, 135, 205] +[:mouse_move, 206, 565, 2, 136, 206] +[:mouse_move, 206, 558, 2, 137, 207] +[:mouse_move, 197, 541, 2, 138, 208] +[:mouse_move, 191, 537, 2, 139, 209] +[:mouse_move, 183, 535, 2, 140, 210] +[:mouse_move, 166, 535, 2, 141, 211] +[:mouse_move, 155, 541, 2, 142, 212] +[:mouse_move, 133, 569, 2, 143, 213] +[:mouse_move, 127, 585, 2, 144, 214] +[:mouse_move, 127, 602, 2, 145, 215] +[:mouse_move, 132, 626, 2, 146, 216] +[:mouse_move, 138, 630, 2, 147, 217] +[:mouse_move, 144, 631, 2, 148, 218] +[:mouse_move, 162, 627, 2, 149, 219] +[:mouse_move, 180, 609, 2, 150, 220] +[:mouse_move, 212, 530, 2, 151, 221] +[:mouse_move, 221, 476, 2, 152, 222] +[:mouse_move, 227, 388, 2, 153, 223] +[:mouse_move, 227, 336, 2, 154, 224] +[:mouse_move, 219, 256, 2, 155, 225] +[:mouse_move, 209, 225, 2, 156, 226] +[:mouse_move, 183, 173, 2, 157, 227] +[:mouse_move, 175, 163, 2, 158, 228] +[:mouse_move, 161, 140, 2, 159, 229] +[:mouse_move, 158, 136, 2, 160, 230] +[:mouse_move, 147, 121, 2, 161, 231] +[:mouse_move, 144, 116, 2, 162, 232] +[:mouse_move, 138, 107, 2, 163, 233] +[:mouse_move, 136, 104, 2, 164, 234] +[:mouse_move, 132, 99, 2, 165, 235] +[:mouse_move, 130, 96, 2, 166, 236] +[:mouse_move, 128, 95, 2, 167, 237] +[:mouse_move, 124, 90, 2, 168, 238] +[:mouse_move, 122, 89, 2, 169, 239] +[:mouse_move, 120, 87, 2, 170, 240] +[:mouse_move, 119, 86, 2, 171, 241] +[:mouse_move, 117, 86, 2, 172, 242] +[:mouse_move, 117, 85, 2, 173, 243] +[:mouse_move, 114, 84, 2, 174, 244] +[:mouse_move, 112, 83, 2, 175, 245] +[:mouse_move, 109, 82, 2, 176, 246] +[:key_down_raw, 56, 0, 2, 177, 299] +[:key_up_raw, 56, 0, 2, 178, 304] +[:key_down_raw, 48, 0, 2, 179, 309] +[:key_up_raw, 48, 0, 2, 180, 314] +[:key_down_raw, 13, 0, 2, 181, 346] +[:key_up_raw, 13, 0, 2, 182, 353] +[:key_down_raw, 49, 0, 2, 183, 390] +[:key_up_raw, 49, 0, 2, 184, 393] +[:key_down_raw, 49, 0, 2, 185, 398] +[:key_up_raw, 49, 0, 2, 186, 404] +[:key_down_raw, 53, 0, 2, 187, 410] +[:key_up_raw, 53, 0, 2, 188, 415] +[:key_down_raw, 13, 0, 2, 189, 478] +[:key_up_raw, 13, 0, 2, 190, 484] +[:mouse_move, 128, 84, 2, 191, 539] +[:mouse_move, 153, 89, 2, 192, 540] +[:mouse_move, 181, 97, 2, 193, 541] +[:mouse_move, 216, 107, 2, 194, 542] +[:mouse_move, 292, 129, 2, 195, 543] +[:mouse_move, 367, 151, 2, 196, 544] +[:mouse_move, 465, 178, 2, 197, 545] +[:mouse_move, 520, 193, 2, 198, 546] +[:mouse_move, 572, 207, 2, 199, 547] +[:mouse_move, 581, 209, 2, 200, 548] +[:mouse_move, 600, 215, 2, 201, 549] +[:mouse_move, 607, 217, 2, 202, 550] +[:mouse_move, 614, 220, 2, 203, 551] +[:mouse_move, 614, 221, 2, 204, 684] +[:mouse_move, 617, 223, 2, 205, 686] +[:mouse_move, 619, 224, 2, 206, 687] +[:mouse_move, 629, 230, 2, 207, 688] +[:mouse_move, 641, 234, 2, 208, 689] +[:mouse_move, 676, 242, 2, 209, 690] +[:mouse_move, 718, 248, 2, 210, 691] +[:mouse_move, 797, 251, 2, 211, 692] +[:mouse_move, 817, 251, 2, 212, 693] +[:mouse_move, 888, 236, 2, 213, 694] +[:mouse_move, 916, 224, 2, 214, 695] +[:mouse_move, 933, 210, 2, 215, 696] +[:mouse_move, 957, 191, 2, 216, 697] +[:mouse_move, 960, 189, 2, 217, 713] +[:mouse_move, 965, 186, 2, 218, 714] +[:mouse_move, 975, 180, 2, 219, 715] +[:mouse_move, 988, 174, 2, 220, 716] +[:mouse_move, 1021, 161, 2, 221, 717] +[:mouse_move, 1051, 148, 2, 222, 718] +[:mouse_move, 1079, 136, 2, 223, 719] +[:mouse_move, 1096, 127, 2, 224, 720] +[:mouse_move, 1126, 109, 2, 225, 721] +[:mouse_move, 1131, 106, 2, 226, 722] +[:mouse_move, 1149, 90, 2, 227, 723] +[:mouse_move, 1155, 85, 2, 228, 724] +[:mouse_move, 1161, 79, 2, 229, 725] +[:mouse_move, 1164, 76, 2, 230, 726] +[:mouse_move, 1166, 75, 2, 231, 727] +[:mouse_move, 1168, 73, 2, 232, 728] +[:mouse_move, 1169, 72, 2, 233, 729] +[:mouse_move, 1171, 71, 2, 234, 730] +[:mouse_move, 1172, 71, 2, 235, 731] +[:mouse_move, 1172, 70, 2, 236, 733] +[:mouse_move, 1173, 70, 2, 237, 734] +[:mouse_move, 1173, 69, 2, 238, 741] +[:mouse_move, 1175, 67, 2, 239, 742] +[:mouse_move, 1177, 64, 2, 240, 743] +[:mouse_move, 1183, 58, 2, 241, 744] +[:mouse_move, 1187, 53, 2, 242, 745] +[:mouse_move, 1195, 44, 2, 243, 746] +[:mouse_move, 1197, 42, 2, 244, 747] +[:mouse_move, 1202, 37, 2, 245, 748] +[:mouse_move, 1204, 35, 2, 246, 749] +[:mouse_move, 1205, 34, 2, 247, 750] +[:mouse_move, 1205, 33, 2, 248, 751] +[:mouse_move, 1199, 33, 2, 249, 752] +[:mouse_move, 1185, 33, 2, 250, 753] +[:mouse_move, 1168, 33, 2, 251, 754] +[:mouse_move, 1123, 34, 2, 252, 755] +[:mouse_move, 1096, 35, 2, 253, 756] +[:mouse_move, 1074, 37, 2, 254, 757] +[:mouse_move, 1057, 37, 2, 255, 758] +[:mouse_move, 1043, 39, 2, 256, 759] +[:mouse_move, 1037, 39, 2, 257, 760] +[:mouse_move, 1031, 40, 2, 258, 761] +[:mouse_move, 1030, 40, 2, 259, 762] +[:mouse_move, 1029, 41, 2, 260, 763] +[:mouse_move, 1029, 44, 2, 261, 764] +[:mouse_move, 1033, 56, 2, 262, 765] +[:mouse_move, 1044, 72, 2, 263, 766] +[:mouse_move, 1064, 90, 2, 264, 767] +[:mouse_move, 1078, 100, 2, 265, 768] +[:mouse_move, 1109, 113, 2, 266, 769] +[:mouse_move, 1125, 113, 2, 267, 770] +[:mouse_move, 1154, 107, 2, 268, 771] +[:mouse_move, 1168, 98, 2, 269, 772] +[:mouse_move, 1184, 83, 2, 270, 773] +[:mouse_move, 1194, 74, 2, 271, 774] +[:mouse_move, 1202, 65, 2, 272, 775] +[:mouse_move, 1206, 59, 2, 273, 776] +[:mouse_move, 1210, 49, 2, 274, 777] +[:mouse_move, 1210, 44, 2, 275, 778] +[:mouse_move, 1203, 38, 2, 276, 779] +[:mouse_move, 1198, 36, 2, 277, 780] +[:mouse_move, 1191, 32, 2, 278, 781] +[:mouse_move, 1178, 27, 2, 279, 782] +[:mouse_move, 1172, 24, 2, 280, 783] +[:mouse_move, 1160, 20, 2, 281, 784] +[:mouse_move, 1154, 18, 2, 282, 785] +[:mouse_move, 1141, 18, 2, 283, 786] +[:mouse_move, 1133, 18, 2, 284, 787] +[:mouse_move, 1117, 23, 2, 285, 788] +[:mouse_move, 1110, 28, 2, 286, 789] +[:mouse_move, 1099, 44, 2, 287, 790] +[:mouse_move, 1097, 49, 2, 288, 791] +[:mouse_move, 1093, 59, 2, 289, 792] +[:mouse_move, 1091, 65, 2, 290, 793] +[:mouse_move, 1091, 79, 2, 291, 794] +[:mouse_move, 1095, 82, 2, 292, 795] +[:mouse_move, 1121, 91, 2, 293, 796] +[:mouse_move, 1140, 93, 2, 294, 797] +[:mouse_move, 1172, 97, 2, 295, 798] +[:mouse_move, 1194, 97, 2, 296, 799] +[:mouse_move, 1230, 89, 2, 297, 800] +[:mouse_move, 1237, 84, 2, 298, 801] +[:mouse_move, 1255, 69, 2, 299, 802] +[:mouse_move, 1260, 63, 2, 300, 803] +[:mouse_move, 1264, 44, 2, 301, 804] +[:mouse_move, 1262, 36, 2, 302, 805] +[:mouse_move, 1246, 19, 2, 303, 806] +[:mouse_move, 1235, 12, 2, 304, 807] +[:mouse_move, 1210, 1, 2, 305, 808] +[:mouse_move, 1197, 0, 2, 306, 809] +[:mouse_move, 1153, 0, 2, 307, 812] +[:mouse_move, 1143, 4, 2, 308, 812] +[:mouse_move, 1134, 11, 2, 309, 813] +[:mouse_move, 1126, 19, 2, 310, 814] +[:mouse_move, 1117, 30, 2, 311, 814] +[:mouse_move, 1109, 42, 2, 312, 815] +[:mouse_move, 1101, 56, 2, 313, 816] +[:mouse_move, 1094, 71, 2, 314, 816] +[:mouse_move, 1088, 85, 2, 315, 817] +[:mouse_move, 1085, 98, 2, 316, 818] +[:mouse_move, 1083, 125, 2, 317, 819] +[:mouse_move, 1082, 126, 2, 318, 831] +[:mouse_move, 1074, 136, 2, 319, 832] +[:mouse_move, 1049, 174, 2, 320, 833] +[:mouse_move, 1023, 217, 2, 321, 834] +[:mouse_move, 958, 326, 2, 322, 835] +[:mouse_move, 945, 350, 2, 323, 836] +[:mouse_move, 918, 398, 2, 324, 837] +[:mouse_move, 894, 443, 2, 325, 838] +[:mouse_move, 890, 451, 2, 326, 839] +[:mouse_move, 878, 481, 2, 327, 840] +[:mouse_move, 877, 490, 2, 328, 841] +[:mouse_move, 877, 497, 2, 329, 842] +[:mouse_move, 880, 499, 2, 330, 843] +[:mouse_move, 886, 500, 2, 331, 844] +[:mouse_move, 888, 500, 2, 332, 845] +[:mouse_move, 892, 498, 2, 333, 846] +[:mouse_move, 894, 498, 2, 334, 847] +[:mouse_move, 903, 498, 2, 335, 848] +[:mouse_move, 909, 506, 2, 336, 849] +[:mouse_move, 923, 524, 2, 337, 850] +[:mouse_move, 934, 534, 2, 338, 851] +[:mouse_move, 958, 551, 2, 339, 852] +[:mouse_move, 970, 555, 2, 340, 853] +[:mouse_move, 995, 555, 2, 341, 854] +[:mouse_move, 1007, 551, 2, 342, 855] +[:mouse_move, 1036, 525, 2, 343, 856] +[:mouse_move, 1039, 515, 2, 344, 857] +[:mouse_move, 1052, 467, 2, 345, 858] +[:mouse_move, 1052, 456, 2, 346, 859] +[:mouse_move, 1049, 426, 2, 347, 860] +[:mouse_move, 1041, 415, 2, 348, 861] +[:mouse_move, 1017, 399, 2, 349, 862] +[:mouse_move, 994, 394, 2, 350, 863] +[:mouse_move, 984, 394, 2, 351, 864] +[:mouse_move, 954, 403, 2, 352, 865] +[:mouse_move, 937, 413, 2, 353, 866] +[:mouse_move, 903, 453, 2, 354, 867] +[:mouse_move, 897, 472, 2, 355, 868] +[:mouse_move, 893, 501, 2, 356, 869] +[:mouse_move, 893, 520, 2, 357, 870] +[:mouse_move, 901, 547, 2, 358, 871] +[:mouse_move, 909, 557, 2, 359, 872] +[:mouse_move, 929, 567, 2, 360, 873] +[:mouse_move, 943, 569, 2, 361, 874] +[:mouse_move, 982, 565, 2, 362, 875] +[:mouse_move, 990, 560, 2, 363, 876] +[:mouse_move, 1034, 532, 2, 364, 877] +[:mouse_move, 1039, 524, 2, 365, 878] +[:mouse_move, 1073, 474, 2, 366, 879] +[:mouse_move, 1088, 424, 2, 367, 880] +[:mouse_move, 1094, 334, 2, 368, 881] +[:mouse_move, 1095, 309, 2, 369, 882] +[:mouse_move, 1098, 220, 2, 370, 883] +[:mouse_move, 1103, 182, 2, 371, 884] +[:mouse_move, 1115, 135, 2, 372, 885] +[:mouse_move, 1124, 111, 2, 373, 886] +[:mouse_move, 1136, 83, 2, 374, 887] +[:mouse_move, 1144, 70, 2, 375, 888] +[:mouse_move, 1151, 58, 2, 376, 889] +[:mouse_move, 1154, 52, 2, 377, 890] +[:mouse_move, 1158, 48, 2, 378, 891] +[:mouse_move, 1161, 43, 2, 379, 892] +[:mouse_move, 1162, 41, 2, 380, 893] +[:mouse_move, 1164, 39, 2, 381, 894] +[:mouse_move, 1165, 38, 2, 382, 895] +[:mouse_move, 1166, 37, 2, 383, 896] +[:mouse_move, 1167, 36, 2, 384, 897] +[:mouse_move, 1167, 35, 2, 385, 898] +[:mouse_move, 1168, 35, 2, 386, 899] +[:mouse_move, 1169, 35, 2, 387, 900] +[:key_down_raw, 56, 0, 2, 388, 940] +[:key_up_raw, 56, 0, 2, 389, 945] +[:key_down_raw, 48, 0, 2, 390, 952] +[:key_up_raw, 48, 0, 2, 391, 957] +[:key_down_raw, 13, 0, 2, 392, 1001] +[:key_up_raw, 13, 0, 2, 393, 1006] +[:key_down_raw, 49, 0, 2, 394, 1030] +[:key_up_raw, 49, 0, 2, 395, 1035] +[:key_down_raw, 49, 0, 2, 396, 1041] +[:key_up_raw, 49, 0, 2, 397, 1045] +[:key_down_raw, 53, 0, 2, 398, 1098] +[:key_up_raw, 53, 0, 2, 399, 1101] +[:mouse_move, 1193, 38, 2, 400, 1121] +[:mouse_move, 1236, 52, 2, 401, 1122] +[:mouse_move, 1279, 63, 2, 402, 1123] +[:mouse_move, 1279, 69, 2, 403, 1124] +[:mouse_move, 1277, 36, 2, 404, 1134] +[:mouse_move, 1271, 36, 2, 405, 1135] +[:mouse_move, 1259, 35, 2, 406, 1136] +[:mouse_move, 1250, 35, 2, 407, 1136] +[:mouse_move, 1242, 35, 2, 408, 1137] +[:mouse_move, 1239, 35, 2, 409, 1138] +[:mouse_move, 1230, 36, 2, 410, 1138] +[:mouse_move, 1225, 37, 2, 411, 1139] +[:mouse_move, 1222, 38, 2, 412, 1140] +[:mouse_move, 1220, 38, 2, 413, 1140] +[:mouse_move, 1217, 38, 2, 414, 1141] +[:mouse_move, 1215, 39, 2, 415, 1142] +[:mouse_move, 1213, 39, 2, 416, 1142] +[:mouse_move, 1211, 39, 2, 417, 1143] +[:mouse_move, 1210, 40, 2, 418, 1144] +[:mouse_move, 1208, 41, 2, 419, 1145] +[:mouse_move, 1207, 42, 2, 420, 1146] +[:mouse_move, 1206, 44, 2, 421, 1147] +[:mouse_move, 1205, 44, 2, 422, 1148] +[:mouse_move, 1204, 47, 2, 423, 1149] +[:mouse_move, 1203, 49, 2, 424, 1150] +[:mouse_move, 1202, 51, 2, 425, 1151] +[:mouse_move, 1202, 52, 2, 426, 1152] +[:mouse_move, 1202, 53, 2, 427, 1153] +[:mouse_move, 1202, 54, 2, 428, 1154] +[:mouse_move, 1207, 54, 2, 429, 1155] +[:mouse_move, 1212, 55, 2, 430, 1156] +[:mouse_move, 1223, 56, 2, 431, 1157] +[:mouse_move, 1229, 57, 2, 432, 1158] +[:mouse_move, 1236, 57, 2, 433, 1159] +[:mouse_move, 1240, 57, 2, 434, 1160] +[:mouse_move, 1245, 57, 2, 435, 1161] +[:mouse_move, 1247, 57, 2, 436, 1162] +[:mouse_move, 1249, 57, 2, 437, 1163] +[:mouse_move, 1250, 57, 2, 438, 1163] +[:mouse_move, 1251, 57, 2, 439, 1164] +[:mouse_move, 1252, 57, 2, 440, 1165] +[:mouse_move, 1253, 57, 2, 441, 1165] +[:mouse_move, 1254, 57, 2, 442, 1166] +[:mouse_move, 1255, 57, 2, 443, 1167] +[:mouse_move, 1256, 57, 2, 444, 1168] +[:mouse_move, 1257, 57, 2, 445, 1169] +[:mouse_move, 1258, 57, 2, 446, 1171] +[:mouse_move, 1259, 57, 2, 447, 1171] +[:mouse_move, 1260, 57, 2, 448, 1173] +[:mouse_move, 1259, 57, 2, 449, 1177] +[:mouse_move, 1251, 56, 2, 450, 1178] +[:mouse_move, 1244, 56, 2, 451, 1179] +[:mouse_move, 1234, 56, 2, 452, 1180] +[:mouse_move, 1231, 56, 2, 453, 1181] +[:mouse_move, 1223, 56, 2, 454, 1182] +[:mouse_move, 1220, 56, 2, 455, 1183] +[:mouse_move, 1217, 57, 2, 456, 1184] +[:mouse_move, 1219, 57, 2, 457, 1187] +[:mouse_move, 1227, 58, 2, 458, 1188] +[:mouse_move, 1231, 59, 2, 459, 1189] +[:mouse_move, 1233, 59, 2, 460, 1190] +[:mouse_move, 1236, 59, 2, 461, 1190] +[:mouse_move, 1239, 59, 2, 462, 1191] +[:mouse_move, 1240, 60, 2, 463, 1192] +[:mouse_move, 1241, 60, 2, 464, 1192] +[:mouse_move, 1242, 60, 2, 465, 1193] +[:mouse_move, 1232, 65, 2, 466, 1205] +[:mouse_move, 1219, 74, 2, 467, 1206] +[:mouse_move, 1163, 105, 2, 468, 1207] +[:mouse_move, 1078, 154, 2, 469, 1208] +[:mouse_move, 931, 239, 2, 470, 1209] +[:mouse_move, 896, 263, 2, 471, 1210] +[:mouse_move, 763, 366, 2, 472, 1211] +[:mouse_move, 742, 388, 2, 473, 1212] +[:mouse_move, 667, 471, 2, 474, 1213] +[:mouse_move, 642, 509, 2, 475, 1214] +[:mouse_move, 613, 575, 2, 476, 1215] +[:mouse_move, 611, 588, 2, 477, 1216] +[:mouse_move, 588, 612, 2, 478, 1230] +[:mouse_move, 577, 624, 2, 479, 1231] +[:mouse_move, 532, 667, 2, 480, 1232] +[:mouse_move, 523, 676, 2, 481, 1233] +[:mouse_move, 516, 682, 2, 482, 1234] +[:mouse_move, 511, 686, 2, 483, 1235] +[:mouse_move, 492, 703, 2, 484, 1236] +[:mouse_move, 490, 705, 2, 485, 1237] +[:mouse_move, 489, 706, 2, 486, 1238] +[:mouse_move, 488, 706, 2, 487, 1239] +[:mouse_move, 488, 707, 2, 488, 1240] +[:mouse_move, 488, 708, 2, 489, 1246] +[:mouse_move, 487, 709, 2, 490, 1247] +[:mouse_move, 487, 710, 2, 491, 1248] +[:mouse_move, 488, 710, 2, 492, 1252] +[:mouse_move, 489, 710, 2, 493, 1252] +[:mouse_move, 490, 710, 2, 494, 1253] +[:mouse_move, 492, 709, 2, 495, 1253] +[:mouse_move, 495, 709, 2, 496, 1254] +[:mouse_move, 499, 708, 2, 497, 1255] +[:mouse_move, 501, 708, 2, 498, 1256] +[:mouse_move, 504, 707, 2, 499, 1257] +[:mouse_move, 507, 707, 2, 500, 1258] +[:mouse_move, 509, 707, 2, 501, 1259] +[:mouse_move, 511, 707, 2, 502, 1260] +[:mouse_move, 513, 707, 2, 503, 1261] +[:mouse_move, 515, 707, 2, 504, 1262] +[:mouse_move, 516, 708, 2, 505, 1263] +[:mouse_move, 518, 708, 2, 506, 1264] +[:mouse_move, 520, 708, 2, 507, 1265] +[:mouse_move, 521, 708, 2, 508, 1266] +[:mouse_move, 523, 708, 2, 509, 1267] +[:mouse_move, 525, 708, 2, 510, 1268] +[:mouse_move, 526, 709, 2, 511, 1269] +[:mouse_move, 527, 709, 2, 512, 1269] +[:mouse_move, 528, 709, 2, 513, 1270] +[:mouse_move, 529, 710, 2, 514, 1271] +[:mouse_move, 530, 710, 2, 515, 1272] +[:mouse_move, 531, 711, 2, 516, 1274] +[:mouse_move, 532, 711, 2, 517, 1275] +[:mouse_move, 533, 711, 2, 518, 1275] +[:mouse_move, 536, 712, 2, 519, 1276] +[:mouse_move, 540, 713, 2, 520, 1278] +[:mouse_move, 541, 714, 2, 521, 1279] +[:mouse_move, 543, 714, 2, 522, 1279] +[:mouse_move, 544, 715, 2, 523, 1280] +[:mouse_move, 546, 715, 2, 524, 1281] +[:mouse_move, 548, 715, 2, 525, 1281] +[:mouse_move, 550, 716, 2, 526, 1282] +[:mouse_move, 551, 716, 2, 527, 1283] +[:mouse_move, 555, 716, 2, 528, 1284] +[:mouse_move, 557, 716, 2, 529, 1285] +[:mouse_move, 561, 716, 2, 530, 1286] +[:mouse_move, 563, 716, 2, 531, 1287] +[:mouse_move, 567, 716, 2, 532, 1288] +[:mouse_move, 569, 715, 2, 533, 1289] +[:mouse_move, 572, 715, 2, 534, 1290] +[:mouse_move, 575, 714, 2, 535, 1291] +[:mouse_move, 578, 714, 2, 536, 1292] +[:mouse_move, 580, 714, 2, 537, 1293] +[:mouse_move, 585, 714, 2, 538, 1294] +[:mouse_move, 586, 714, 2, 539, 1295] +[:mouse_move, 588, 714, 2, 540, 1296] +[:mouse_move, 591, 714, 2, 541, 1296] +[:mouse_move, 594, 714, 2, 542, 1297] +[:mouse_move, 596, 714, 2, 543, 1298] +[:mouse_move, 598, 714, 2, 544, 1298] +[:mouse_move, 600, 714, 2, 545, 1299] +[:mouse_move, 602, 714, 2, 546, 1300] +[:mouse_move, 606, 714, 2, 547, 1300] +[:mouse_move, 607, 714, 2, 548, 1301] +[:mouse_move, 611, 714, 2, 549, 1302] +[:mouse_move, 614, 715, 2, 550, 1302] +[:mouse_move, 615, 715, 2, 551, 1303] +[:mouse_move, 619, 716, 2, 552, 1304] +[:mouse_move, 622, 716, 2, 553, 1304] +[:mouse_move, 623, 716, 2, 554, 1305] +[:mouse_move, 628, 717, 2, 555, 1306] +[:mouse_move, 631, 717, 2, 556, 1306] +[:mouse_move, 634, 717, 2, 557, 1307] +[:mouse_move, 637, 717, 2, 558, 1308] +[:mouse_move, 641, 717, 2, 559, 1308] +[:mouse_move, 643, 717, 2, 560, 1309] +[:mouse_move, 647, 717, 2, 561, 1310] +[:mouse_move, 652, 716, 2, 562, 1311] +[:mouse_move, 656, 715, 2, 563, 1312] +[:mouse_move, 660, 713, 2, 564, 1313] +[:mouse_move, 663, 712, 2, 565, 1314] +[:mouse_move, 667, 710, 2, 566, 1315] +[:mouse_move, 669, 709, 2, 567, 1316] +[:mouse_move, 670, 706, 2, 568, 1317] +[:mouse_move, 670, 705, 2, 569, 1318] +[:mouse_move, 669, 702, 2, 570, 1319] +[:mouse_move, 666, 700, 2, 571, 1320] +[:mouse_move, 660, 696, 2, 572, 1321] +[:mouse_move, 656, 695, 2, 573, 1322] +[:mouse_move, 643, 691, 2, 574, 1323] +[:mouse_move, 637, 691, 2, 575, 1324] +[:mouse_move, 628, 690, 2, 576, 1325] +[:mouse_move, 617, 690, 2, 577, 1325] +[:mouse_move, 606, 690, 2, 578, 1326] +[:mouse_move, 596, 690, 2, 579, 1327] +[:mouse_move, 590, 690, 2, 580, 1327] +[:mouse_move, 579, 690, 2, 581, 1328] +[:mouse_move, 569, 691, 2, 582, 1329] +[:mouse_move, 561, 692, 2, 583, 1329] +[:mouse_move, 554, 693, 2, 584, 1330] +[:mouse_move, 546, 693, 2, 585, 1331] +[:mouse_move, 539, 694, 2, 586, 1331] +[:mouse_move, 533, 694, 2, 587, 1332] +[:mouse_move, 527, 695, 2, 588, 1333] +[:mouse_move, 522, 695, 2, 589, 1333] +[:mouse_move, 520, 696, 2, 590, 1334] +[:mouse_move, 516, 696, 2, 591, 1335] +[:mouse_move, 513, 697, 2, 592, 1335] +[:mouse_move, 509, 697, 2, 593, 1336] +[:mouse_move, 507, 698, 2, 594, 1337] +[:mouse_move, 502, 698, 2, 595, 1338] +[:mouse_move, 501, 698, 2, 596, 1339] +[:mouse_move, 500, 699, 2, 597, 1340] +[:mouse_move, 499, 699, 2, 598, 1341] +[:mouse_move, 498, 699, 2, 599, 1342] +[:mouse_move, 498, 700, 2, 600, 1343] +[:mouse_move, 498, 701, 2, 601, 1344] +[:mouse_move, 498, 702, 2, 602, 1345] +[:mouse_move, 503, 704, 2, 603, 1346] +[:mouse_move, 506, 705, 2, 604, 1347] +[:mouse_move, 516, 707, 2, 605, 1348] +[:mouse_move, 521, 708, 2, 606, 1349] +[:mouse_move, 533, 709, 2, 607, 1350] +[:mouse_move, 540, 709, 2, 608, 1351] +[:mouse_move, 555, 710, 2, 609, 1352] +[:mouse_move, 567, 710, 2, 610, 1353] +[:mouse_move, 574, 710, 2, 611, 1354] +[:mouse_move, 583, 710, 2, 612, 1354] +[:mouse_move, 588, 710, 2, 613, 1355] +[:mouse_move, 603, 708, 2, 614, 1356] +[:mouse_move, 611, 707, 2, 615, 1356] +[:mouse_move, 621, 703, 2, 616, 1357] +[:mouse_move, 631, 699, 2, 617, 1358] +[:mouse_move, 642, 694, 2, 618, 1358] +[:mouse_move, 653, 686, 2, 619, 1359] +[:mouse_move, 665, 677, 2, 620, 1360] +[:mouse_move, 686, 659, 2, 621, 1360] +[:mouse_move, 700, 643, 2, 622, 1361] +[:mouse_move, 717, 622, 2, 623, 1362] +[:mouse_move, 765, 543, 2, 624, 1363] +[:mouse_move, 785, 502, 2, 625, 1364] +[:mouse_move, 816, 431, 2, 626, 1365] +[:mouse_move, 835, 388, 2, 627, 1366] +[:mouse_move, 869, 313, 2, 628, 1367] +[:mouse_move, 875, 301, 2, 629, 1368] +[:mouse_move, 906, 233, 2, 630, 1369] +[:mouse_move, 916, 209, 2, 631, 1370] +[:mouse_move, 948, 131, 2, 632, 1371] +[:mouse_move, 962, 87, 2, 633, 1372] +[:mouse_move, 973, 47, 2, 634, 1373] +[:mouse_move, 975, 38, 2, 635, 1374] +[:mouse_move, 979, 9, 2, 636, 1375] +[:mouse_move, 978, 9, 2, 637, 1391] +[:mouse_move, 968, 25, 2, 638, 1392] +[:mouse_move, 959, 37, 2, 639, 1393] +[:mouse_move, 942, 67, 2, 640, 1394] +[:mouse_move, 934, 84, 2, 641, 1395] +[:mouse_move, 912, 130, 2, 642, 1396] +[:mouse_move, 902, 157, 2, 643, 1397] +[:mouse_move, 891, 190, 2, 644, 1398] +[:key_down_raw, 13, 0, 2, 645, 1443] +[:key_up_raw, 13, 0, 2, 646, 1448] +[:mouse_move, 890, 190, 2, 647, 1681] +[:mouse_move, 889, 190, 2, 648, 1682] +[:mouse_move, 887, 190, 2, 649, 1682] +[:mouse_move, 884, 191, 2, 650, 1683] +[:mouse_move, 877, 193, 2, 651, 1684] +[:mouse_move, 868, 195, 2, 652, 1684] +[:mouse_move, 852, 199, 2, 653, 1685] +[:mouse_move, 837, 203, 2, 654, 1686] +[:mouse_move, 815, 207, 2, 655, 1686] +[:mouse_move, 790, 212, 2, 656, 1687] +[:mouse_move, 763, 218, 2, 657, 1688] +[:mouse_move, 733, 223, 2, 658, 1688] +[:mouse_move, 705, 229, 2, 659, 1689] +[:mouse_move, 692, 232, 2, 660, 1690] +[:mouse_move, 647, 243, 2, 661, 1691] +[:mouse_move, 639, 244, 2, 662, 1692] +[:mouse_move, 611, 252, 2, 663, 1693] +[:mouse_move, 601, 255, 2, 664, 1694] +[:mouse_move, 589, 259, 2, 665, 1695] +[:mouse_move, 584, 261, 2, 666, 1696] +[:mouse_move, 576, 265, 2, 667, 1697] +[:mouse_move, 572, 267, 2, 668, 1698] +[:mouse_move, 567, 271, 2, 669, 1699] +[:mouse_move, 565, 273, 2, 670, 1700] +[:mouse_move, 561, 280, 2, 671, 1701] +[:mouse_move, 559, 285, 2, 672, 1702] +[:mouse_move, 556, 297, 2, 673, 1703] +[:mouse_move, 555, 304, 2, 674, 1704] +[:mouse_move, 552, 327, 2, 675, 1705] +[:mouse_move, 552, 338, 2, 676, 1706] +[:mouse_move, 552, 350, 2, 677, 1707] +[:mouse_move, 552, 366, 2, 678, 1707] +[:mouse_move, 554, 380, 2, 679, 1708] +[:mouse_move, 559, 397, 2, 680, 1709] +[:mouse_move, 566, 411, 2, 681, 1709] +[:mouse_move, 575, 426, 2, 682, 1710] +[:mouse_move, 594, 450, 2, 683, 1711] +[:mouse_move, 611, 462, 2, 684, 1711] +[:mouse_move, 631, 472, 2, 685, 1712] +[:mouse_move, 713, 494, 2, 686, 1714] +[:mouse_move, 745, 495, 2, 687, 1715] +[:mouse_move, 777, 495, 2, 688, 1716] +[:mouse_move, 808, 490, 2, 689, 1717] +[:mouse_move, 818, 484, 2, 690, 1717] +[:mouse_move, 825, 480, 2, 691, 1718] +[:mouse_move, 856, 454, 2, 692, 1719] +[:mouse_move, 860, 443, 2, 693, 1719] +[:mouse_move, 861, 431, 2, 694, 1720] +[:mouse_move, 858, 408, 2, 695, 1721] +[:mouse_move, 813, 347, 2, 696, 1722] +[:mouse_move, 798, 334, 2, 697, 1723] +[:mouse_move, 731, 285, 2, 698, 1724] +[:mouse_move, 696, 269, 2, 699, 1725] +[:mouse_move, 629, 253, 2, 700, 1726] +[:mouse_move, 597, 251, 2, 701, 1727] +[:mouse_move, 540, 256, 2, 702, 1728] +[:mouse_move, 516, 267, 2, 703, 1729] +[:mouse_move, 474, 299, 2, 704, 1730] +[:mouse_move, 468, 309, 2, 705, 1731] +[:mouse_move, 441, 353, 2, 706, 1732] +[:mouse_move, 434, 372, 2, 707, 1733] +[:mouse_move, 430, 391, 2, 708, 1734] +[:mouse_move, 430, 397, 2, 709, 1734] +[:mouse_move, 430, 421, 2, 710, 1735] +[:mouse_move, 434, 438, 2, 711, 1736] +[:mouse_move, 447, 447, 2, 712, 1736] +[:mouse_move, 462, 454, 2, 713, 1737] +[:key_down_raw, 1073742051, 1024, 2, 714, 1812] +[:key_down_raw, 113, 1024, 2, 715, 1813] diff --git a/samples/99_sample_game_basic_gorillas/sprites/banana.png b/samples/99_sample_game_basic_gorillas/sprites/banana.png Binary files differnew file mode 100644 index 0000000..b0f4134 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/banana.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/explosion0.png b/samples/99_sample_game_basic_gorillas/sprites/explosion0.png Binary files differnew file mode 100644 index 0000000..e94c644 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/explosion0.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/explosion1.png b/samples/99_sample_game_basic_gorillas/sprites/explosion1.png Binary files differnew file mode 100644 index 0000000..b4018d9 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/explosion1.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/explosion2.png b/samples/99_sample_game_basic_gorillas/sprites/explosion2.png Binary files differnew file mode 100644 index 0000000..3abaedd --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/explosion2.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/explosion3.png b/samples/99_sample_game_basic_gorillas/sprites/explosion3.png Binary files differnew file mode 100644 index 0000000..fe94a5a --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/explosion3.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/explosion4.png b/samples/99_sample_game_basic_gorillas/sprites/explosion4.png Binary files differnew file mode 100644 index 0000000..ed04237 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/explosion4.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/explosion5.png b/samples/99_sample_game_basic_gorillas/sprites/explosion5.png Binary files differnew file mode 100644 index 0000000..2cd8f06 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/explosion5.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/explosion6.png b/samples/99_sample_game_basic_gorillas/sprites/explosion6.png Binary files differnew file mode 100644 index 0000000..e55909c --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/explosion6.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/hole.png b/samples/99_sample_game_basic_gorillas/sprites/hole.png Binary files differnew file mode 100644 index 0000000..cb4e8b3 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/hole.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/left-0.png b/samples/99_sample_game_basic_gorillas/sprites/left-0.png Binary files differnew file mode 100644 index 0000000..096d19c --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/left-0.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/left-1.png b/samples/99_sample_game_basic_gorillas/sprites/left-1.png Binary files differnew file mode 100644 index 0000000..5944578 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/left-1.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/left-2.png b/samples/99_sample_game_basic_gorillas/sprites/left-2.png Binary files differnew file mode 100644 index 0000000..a64f3d8 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/left-2.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/left-idle.png b/samples/99_sample_game_basic_gorillas/sprites/left-idle.png Binary files differnew file mode 100644 index 0000000..21a71dc --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/left-idle.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/right-0.png b/samples/99_sample_game_basic_gorillas/sprites/right-0.png Binary files differnew file mode 100644 index 0000000..57ffd46 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/right-0.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/right-1.png b/samples/99_sample_game_basic_gorillas/sprites/right-1.png Binary files differnew file mode 100644 index 0000000..a921560 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/right-1.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/right-2.png b/samples/99_sample_game_basic_gorillas/sprites/right-2.png Binary files differnew file mode 100644 index 0000000..fc97c90 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/right-2.png diff --git a/samples/99_sample_game_basic_gorillas/sprites/right-idle.png b/samples/99_sample_game_basic_gorillas/sprites/right-idle.png Binary files differnew file mode 100644 index 0000000..2838588 --- /dev/null +++ b/samples/99_sample_game_basic_gorillas/sprites/right-idle.png diff --git a/samples/99_sample_game_clepto_frog/app/main.rb b/samples/99_sample_game_clepto_frog/app/main.rb new file mode 100644 index 0000000..a4eb069 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/app/main.rb @@ -0,0 +1,864 @@ +MAP_FILE_PATH = 'app/map.txt' + +require 'app/map.rb' + +class CleptoFrog + attr_gtk + + def render_ending + state.game_over_at ||= state.tick_count + + outputs.labels << [640, 700, "Clepto Frog", 4, 1] + + if state.tick_count >= (state.game_over_at + 120) + outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy", + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)] + end + + if state.tick_count >= (state.game_over_at + 240) + outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy", + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)] + end + + if state.tick_count >= (state.game_over_at + 360) + outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy", + 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)] + end + + outputs.sprites << [640 - 50, 360 - 50, 100, 100, + "sprites/square-green.png"] + + outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1] + outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1] + + if state.tick_count >= (state.game_over_at + 550) + restart_game + end + end + + def restart_game + state.world = nil + state.x = nil + state.y = nil + state.dx = nil + state.dy = nil + state.stuff_score = 0 + state.stuff_time = 0 + state.intro_tick_count = nil + defaults + state.game_start_at = state.tick_count + state.scene = :game + state.game_over_at = nil + end + + def render_intro + outputs.labels << [640, 700, "Clepto Frog", 4, 1] + if state.tick_count >= 120 + outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy", + 4, 1, 0, 0, 0, 255 * 120.ease(60)] + end + + if state.tick_count >= 240 + outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim", + 4, 1, 0, 0, 0, 255 * 240.ease(60)] + end + + if state.tick_count >= 360 + outputs.labels << [640, 540, "\"Uh...\" - New Guy", + 4, 1, 0, 0, 0, 255 * 360.ease(60)] + end + + if state.tick_count >= 480 + outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim", + 4, 1, 0, 0, 0, 255 * 480.ease(60)] + end + + if state.tick_count >= 600 + outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim", + 4, 1, 0, 0, 0, 255 * 600.ease(60)] + end + + outputs.sprites << [640 - 50, 360 - 50, 100, 100, + "sprites/square-green.png"] + + if state.tick_count == 800 + state.scene = :game + state.game_start_at = state.tick_count + end + end + + def tick + defaults + if state.scene == :intro && state.tick_count <= 800 + render_intro + elsif state.scene == :ending + render_ending + else + render + end + calc + process_inputs + end + + def defaults + state.scene ||= :intro + state.stuff_score ||= 0 + state.stuff_time ||= 0 + state.stuff_best_time ||= nil + state.camera_x ||= 0 + state.camera_y ||= 0 + state.target_camera_scale ||= 1 + state.camera_scale ||= 1 + state.tongue_length ||= 100 + state.dev_action ||= :collision_mode + state.action ||= :aiming + state.tongue_angle ||= 90 + state.tile_size = 64 + state.gravity = -0.1 + state.air = -0.01 + state.player_width = 60 + state.player_height = 60 + state.collision_tolerance = 0.0 + state.previous_tile_size ||= state.tile_size + state.x ||= 2400 + state.y ||= 200 + state.dy ||= 0 + state.dx ||= 0 + attempt_load_world_from_file + state.world_lookup ||= { } + state.world_collision_rects ||= [] + state.mode ||= :creating + state.select_menu ||= [0, 720, 1280, 720] + state.sprite_quantity ||= 20 + state.sprite_coords ||= [] + state.banner_coords ||= [640, 680 + 720] + state.sprite_selected ||= 1 + state.map_saved_at ||= 0 + state.intro_tick_count ||= state.tick_count + if state.sprite_coords == [] + count = 1 + temp_x = 165 + temp_y = 500 + 720 + state.sprite_quantity.times do + state.sprite_coords += [[temp_x, temp_y, count]] + temp_x += 100 + count += 1 + if temp_x > 1280 - (165 + 50) + temp_x = 165 + temp_y -= 75 + end + end + end + end + + def start_of_tongue x = nil, y = nil + x ||= state.x + y ||= state.y + [ + x + state.player_width.half, + y + state.player_height.half + ] + end + + def stage_definition + outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png'] + end + + def render + stage_definition + start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)] + end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)] + + if state.anchor_point + anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)] + outputs.sprites << { x: start_of_tongue_render.x, + y: start_of_tongue_render.y, + w: vw(2), + h: args.geometry.distance(start_of_tongue_render, anchor_point_render), + path: 'sprites/square-pink.png', + angle_anchor_y: 0, + angle: state.tongue_angle - 90 } + else + outputs.sprites << { x: vx(start_of_tongue.x), + y: vy(start_of_tongue.y), + w: vw(2), + h: vh(state.tongue_length), + path: 'sprites/square-pink.png', + angle_anchor_y: 0, + angle: state.tongue_angle - 90 } + end + + outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] } + + if state.god_mode + # SHOW HIDE COLLISIONS + outputs.sprites << state.world.map do |x, y, w, h| + x = vx(x) + y = vy(y) + if x > -80 && x < 1280 && y > -80 && y < 720 + { + x: x, + y: y, + w: vw(w || state.tile_size), + h: vh(h || state.tile_size), + path: 'sprites/square-gray.png', + a: 128 + } + end + end + end + + render_player + outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40] + + # Label in top left of the screen + outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid + outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label + outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label + + if state.god_mode + if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120 + outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label + end + + + # Creates sprite following mouse to help indicate which sprite you have selected + outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y, + state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite + end + + render_mini_map + outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid + end + + def render_mini_map + x, y = 1170, 10 + outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid + outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid + t_start = start_of_tongue + t_end = end_of_tongue + outputs.primitives << [ + x + t_start.x.fdiv(100), y + t_start.y.fdiv(100), + x + t_end.x.fdiv(100), y + t_end.y.fdiv(100), + 255, 255, 255 + ].line + + state.objects.each do |o| + outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid + end + end + + def calc_camera percentage_override = nil + percentage = percentage_override || (0.2 * state.camera_scale) + target_scale = state.target_camera_scale + distance_scale = target_scale - state.camera_scale + state.camera_scale += distance_scale * percentage + + target_x = state.x * state.target_camera_scale + target_y = state.y * state.target_camera_scale + + distance_x = target_x - (state.camera_x + 640) + distance_y = target_y - (state.camera_y + 360) + state.camera_x += distance_x * percentage if distance_x.abs > 1 + state.camera_y += distance_y * percentage if distance_y.abs > 1 + state.camera_x = 0 if state.camera_x < 0 + state.camera_y = 0 if state.camera_y < 0 + end + + def vx x + (x * state.camera_scale) - state.camera_x + end + + def vy y + (y * state.camera_scale) - state.camera_y + end + + def vw w + w * state.camera_scale + end + + def vh h + h * state.camera_scale + end + + def calc + calc_camera + calc_world_lookup + calc_player + calc_on_floor + calc_score + end + + def set_camera_scale v = nil + return if v < 0.1 + state.target_camera_scale = v + end + + def process_inputs_god_mode + return unless state.god_mode + + if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10)) + set_camera_scale state.camera_scale + 0.1 + elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10)) + set_camera_scale state.camera_scale - 0.1 + elsif inputs.keyboard.eight || inputs.keyboard.zero + set_camera_scale 1 + end + + if input_up? + state.y += 10 + state.dy = 0 + elsif input_down? + state.y -= 10 + state.dy = 0 + end + + if input_left? + state.x -= 10 + state.dx = 0 + elsif input_right? + state.x += 10 + state.dx = 0 + end + end + + def process_inputs + if state.scene == :game + process_inputs_player_movement + process_inputs_god_mode + elsif state.scene == :intro + if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space + if Kernel.tick_count < 600 + Kernel.tick_count = 600 + end + end + end + end + + def input_up? + inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k + end + + def input_up_released? + inputs.keyboard.key_up.w || + inputs.keyboard.key_up.up || + inputs.keyboard.key_up.k + end + + def input_down? + inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j + end + + def input_down_released? + inputs.keyboard.key_up.s || + inputs.keyboard.key_up.down || + inputs.keyboard.key_up.j + end + + def input_left? + inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h + end + + def input_right? + inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l + end + + def set_object path, w, h + state.object = path + state.object_w = w + state.object_h = h + end + + def collision_mode + state.dev_action = :collision_mode + end + + def process_inputs_player_movement + if inputs.keyboard.key_down.g + state.god_mode = !state.god_mode + puts state.god_mode + end + + if inputs.keyboard.key_down.u && state.dev_action == :collision_mode + state.world = state.world[0..-2] + state.world_lookup = {} + end + + if inputs.keyboard.key_down.space && !state.anchor_point + state.tongue_length = 0 + state.action = :shooting + outputs.sounds << 'sounds/shooting.wav' + elsif inputs.keyboard.key_down.space + state.action = :aiming + state.anchor_point = nil + state.tongue_length = 100 + end + + if state.anchor_point + if input_up? + if state.tongue_length >= 105 + state.tongue_length -= 5 + state.dy += 0.8 + end + elsif input_down? + state.tongue_length += 5 + state.dy -= 0.8 + end + + if input_left? && state.dx > 1 + state.dx *= 0.98 + elsif input_left? && state.dx < -1 + state.dx *= 1.03 + elsif input_left? && !state.on_floor + state.dx -= 3 + elsif input_right? && state.dx > 1 + state.dx *= 1.03 + elsif input_right? && state.dx < -1 + state.dx *= 0.98 + elsif input_right? && !state.on_floor + state.dx += 3 + end + else + if input_left? + state.tongue_angle += 1.5 + state.tongue_angle = state.tongue_angle + elsif input_right? + state.tongue_angle -= 1.5 + state.tongue_angle = state.tongue_angle + end + end + end + + def add_floors + # floors + state.world += [ + [0, 0, 10000, 40], + [0, 1670, 3250, 60], + [6691, 1653, 3290, 60], + [1521, 3792, 7370, 60], + [0, 5137, 3290, 60] + ] + end + + def attempt_load_world_from_file + return if state.world + # exported_world = gtk.read_file(MAP_FILE_PATH) + state.world = [] + state.objects = [] + + if $collisions + $collisions.map do |x, y, w, h| + state.world << [x, y, w, h] + end + + add_floors + # elsif exported_world + # exported_world.each_line.map do |l| + # tokens = l.strip.split(',') + # x = tokens[0].to_i + # y = tokens[1].to_i + # type = tokens[2].to_i + # if type == 1 + # state.world << [x, y, state.tile_size, state.tile_size] + # elsif type == 2 + # w, h, path = tokens[3..-1] + # state.objects << [x, y, w.to_i, h.to_i, path] + # end + # end + + # add_floors + end + + if $mugs + $mugs.map do |x, y, w, h, path| + state.objects << [x, y, w, h, path] + end + end + end + + def calc_world_lookup + if state.tile_size != state.previous_tile_size + state.previous_tile_size = state.tile_size + state.world_lookup = {} + end + + return if state.world_lookup.keys.length > 0 + return unless state.world.length > 0 + + # Searches through the world and finds the cordinates that exist + state.world_lookup = {} + state.world.each do |x, y, w, h| + state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true + end + + # Assigns collision rects for every sprite drawn + state.world_collision_rects = + state.world_lookup + .keys + .map do |x, y, w, h| + s = state.tile_size + w ||= s + h ||= s + { + args: [x, y, w, h], + left_right: [x, y + 4, w, h - 6], + top: [x + 4, y + 6, w - 8, h - 6], + bottom: [x + 1, y - 1, w - 2, h - 8], + } + end + + end + + def calc_pendulum + return if !state.anchor_point + target_x = state.anchor_point.x - start_of_tongue.x + target_y = state.anchor_point.y - + state.tongue_length - 5 - 20 - state.player_height + + diff_y = state.y - target_y + + if target_x > 0 + state.dx += 0.6 + elsif target_x < 0 + state.dx -= 0.6 + end + + if diff_y > 0 + state.dy -= 0.1 + elsif diff_y < 0 + state.dy += 0.1 + end + + state.dx *= 0.99 + + if state.dy.abs < 2 + state.dy *= 0.8 + else + state.dy *= 0.90 + end + + if state.tongue_length && state.y + state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000) + end + end + + def calc_tongue_angle + return unless state.anchor_point + state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue + state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point) + state.tongue_length = state.tongue_length.greater(100) + end + + def player_from_end_of_tongue + p = state.tongue_angle.vector(state.tongue_length) + derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y] + derived_start.x -= state.player_width.half + derived_start.y -= state.player_height.half + derived_start + end + + def end_of_tongue + p = state.tongue_angle.vector(state.tongue_length) + [start_of_tongue.x + p.x, start_of_tongue.y + p.y] + end + + def calc_shooting + return unless state.action == :shooting + state.tongue_length += 30 + potential_anchor = end_of_tongue + if potential_anchor.x <= 0 + state.anchor_point = potential_anchor + state.action = :anchored + outputs.sounds << 'sounds/attached.wav' + elsif potential_anchor.x >= 10000 + state.anchor_point = potential_anchor + state.action = :anchored + outputs.sounds << 'sounds/attached.wav' + elsif potential_anchor.y <= 0 + state.anchor_point = potential_anchor + state.action = :anchored + outputs.sounds << 'sounds/attached.wav' + elsif potential_anchor.y >= 5875 + state.anchor_point = potential_anchor + state.action = :anchored + outputs.sounds << 'sounds/attached.wav' + else + anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10] + collision = state.world_collision_rects.find_all do |v| + [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect) + end.first + if collision + state.anchor_point = potential_anchor + state.action = :anchored + outputs.sounds << 'sounds/attached.wav' + end + end + end + + def calc_player + calc_shooting + if !state.god_mode + state.dy += state.gravity # Since acceleration is the change in velocity, the change in y (dy) increases every frame + state.dx += state.dx * state.air + end + calc_pendulum + calc_box_collision + calc_edge_collision + if !state.god_mode + state.y += state.dy + state.x += state.dx + end + calc_tongue_angle + end + + def calc_box_collision + return unless state.world_lookup.keys.length > 0 + collision_floor + collision_left + collision_right + collision_ceiling + end + + def calc_edge_collision + # Ensures that player doesn't fall below the map + if next_y < 0 && state.dy < 0 + state.y = 0 + state.dy = state.dy.abs * 0.8 + state.collision_on_y = true + # Ensures player doesn't go insanely high + elsif next_y > 5875 - state.tile_size && state.dy > 0 + state.y = 5875 - state.tile_size + state.dy = state.dy.abs * 0.8 * -1 + state.collision_on_y = true + end + + # Ensures that player remains in the horizontal range its supposed to + if state.x >= 10000 - state.tile_size && state.dx > 0 + state.x = 10000 - state.tile_size + state.dx = state.dx.abs * 0.8 * -1 + state.collision_on_x = true + elsif state.x <= 0 && state.dx < 0 + state.x = 0 + state.dx = state.dx.abs * 0.8 + state.collision_on_x = true + end + end + + def next_y + state.y + state.dy + end + + def next_x + if state.dx < 0 + return (state.x + state.dx) - (state.tile_size - state.player_width) + else + return (state.x + state.dx) + (state.tile_size - state.player_width) + end + end + + def collision_floor + return unless state.dy <= 0 + + player_rect = [state.x, next_y, state.tile_size, state.tile_size] + + # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above) + floor_collisions = state.world_collision_rects + .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless floor_collisions + state.y = floor_collisions[:top].top + state.dy = state.dy.abs * 0.8 + end + + def collision_left + return unless state.dx < 0 + player_rect = [next_x, state.y, state.tile_size, state.tile_size] + + # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above) + left_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless left_side_collisions + state.x = left_side_collisions[:left_right].right + state.dx = state.dy.abs * 0.8 + state.collision_on_x = true + end + + def collision_right + return unless state.dx > 0 + + player_rect = [next_x, state.y, state.tile_size, state.tile_size] + # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above) + right_side_collisions = state.world_collision_rects + .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless right_side_collisions + state.x = right_side_collisions[:left_right].left - state.tile_size + state.dx = state.dx.abs * 0.8 * -1 + state.collision_on_x = true + end + + def collision_ceiling + return unless state.dy > 0 + + player_rect = [state.x, next_y, state.player_width, state.player_height] + + # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above) + ceil_collisions = state.world_collision_rects + .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) } + .first + + return unless ceil_collisions + state.y = ceil_collisions[:bottom].y - state.tile_size + state.dy = state.dy.abs * 0.8 * -1 + state.collision_on_y = true + end + + def to_coord point + # Integer divides (idiv) point.x to turn into grid + # Then, you can just multiply each integer by state.tile_size + # later and huzzah. Grid coordinates + [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)] + end + + def export_map + export_string = state.world.map do |x, y| + "#{x},#{y},1" + end + export_string += state.objects.map do |x, y, w, h, path| + "#{x},#{y},2,#{w},#{h},#{path}" + end + gtk.write_file(MAP_FILE_PATH, export_string.join("\n")) + state.map_saved_at = state.tick_count + end + + def inputs_export_stage + end + + def calc_score + return unless state.scene == :game + player = [state.x, state.y, state.player_width, state.player_height] + collected = state.objects.find_all { |s| s.intersect_rect? player } + state.stuff_score += collected.length + if collected.length > 0 + outputs.sounds << 'sounds/collectable.wav' + end + state.objects = state.objects.reject { |s| collected.include? s } + state.stuff_time += 0.01 + if state.objects.length == 0 + if !state.stuff_best_time || state.stuff_time < state.stuff_best_time + state.stuff_best_time = state.stuff_time + end + state.game_over_at = nil + state.scene = :ending + end + end + + def calc_on_floor + if state.action == :anchored + state.on_floor = false + state.on_floor_debounce = 30 + else + state.on_floor_debounce ||= 30 + + if state.dy.round != 0 + state.on_floor_debounce = 30 + state.on_floor = false + else + state.on_floor_debounce -= 1 + end + + if state.on_floor_debounce <= 0 + state.on_floor_debounce = 0 + state.on_floor = true + end + end + end + + def render_player + path = "sprites/square-green.png" + angle = 0 + # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"] + if state.action == :idle + # outputs.labels << [vx(state.x), vy(state.y), "IDLE"] + path = "sprites/square-green.png" + elsif state.action == :aiming && !state.on_floor + # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"] + angle = state.tongue_angle - 90 + path = "sprites/square-green.png" + elsif state.action == :aiming # ON THE GROUND + # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"] + path = "sprites/square-green.png" + elsif state.action == :shooting && !state.on_floor + # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"] + path = "sprites/square-green.png" + angle = state.tongue_angle - 90 + elsif state.action == :shooting + # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"] + path = "sprites/square-green.png" + elsif state.action == :anchored + # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"] + angle = state.tongue_angle - 90 + path = "sprites/square-green.png" + end + + outputs.sprites << [vx(state.x), + vy(state.y), + vw(state.player_width), + vh(state.player_height), + path, + angle] + end + + def render_player_old + # Player + if state.action == :aiming + path = 'sprites\frg\idle\frog_idle.png' + if state.dx > 2 + #directional right sprite was here but i needa redo it + path = 'sprites\frg\anchor\frog-anchor-0.png' + #directional left sprite was here but i needa redo it + elsif state.dx < -2 + path = 'sprites\frg\anchor\frog-anchor-0.png' + end + outputs.sprites << [vx(state.x), + vy(state.y), + vw(state.player_width), + vh(state.player_height), + path, + (state.tongue_angle - 90)] + elsif state.action == :anchored || state.action == :shooting + outputs.sprites << [vx(state.x), + vy(state.y), + vw(state.player_width), + vw(state.player_height), + 'sprites/animations_povfrog/frog_bwah_up.png', + (state.tongue_angle - 90)] + end + end +end + + +$game = CleptoFrog.new + +def tick args + if args.state.scene == :game + tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360 + end + $game.args = args + $game.tick +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/99_sample_game_clepto_frog/app/map.rb b/samples/99_sample_game_clepto_frog/app/map.rb new file mode 100644 index 0000000..c048c82 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/app/map.rb @@ -0,0 +1,1025 @@ +$collisions = [ + [326, 463, 64, 64], + [274, 462, 64, 64], + [326, 413, 64, 64], + [275, 412, 64, 64], + [124, 651, 64, 64], + [72, 651, 64, 64], + [124, 600, 64, 64], + [69, 599, 64, 64], + [501, 997, 64, 64], + [476, 995, 64, 64], + [3224, 2057, 64, 64], + [3224, 1994, 64, 64], + [3225, 1932, 64, 64], + [3225, 1870, 64, 64], + [3226, 1806, 64, 64], + [3224, 1744, 64, 64], + [3225, 1689, 64, 64], + [3226, 1660, 64, 64], + [3161, 1658, 64, 64], + [3097, 1660, 64, 64], + [3033, 1658, 64, 64], + [2969, 1658, 64, 64], + [2904, 1658, 64, 64], + [2839, 1657, 64, 64], + [2773, 1657, 64, 64], + [2709, 1658, 64, 64], + [2643, 1657, 64, 64], + [2577, 1657, 64, 64], + [2509, 1658, 64, 64], + [2440, 1658, 64, 64], + [2371, 1658, 64, 64], + [2301, 1659, 64, 64], + [2230, 1659, 64, 64], + [2159, 1659, 64, 64], + [2092, 1660, 64, 64], + [2025, 1661, 64, 64], + [1958, 1660, 64, 64], + [1888, 1659, 64, 64], + [1817, 1657, 64, 64], + [1745, 1656, 64, 64], + [1673, 1658, 64, 64], + [1605, 1660, 64, 64], + [1536, 1658, 64, 64], + [1465, 1660, 64, 64], + [1386, 1960, 64, 64], + [1384, 1908, 64, 64], + [1387, 1862, 64, 64], + [1326, 1863, 64, 64], + [1302, 1862, 64, 64], + [1119, 1906, 64, 64], + [1057, 1905, 64, 64], + [994, 1905, 64, 64], + [937, 1904, 64, 64], + [896, 1904, 64, 64], + [1001, 1845, 64, 64], + [1003, 1780, 64, 64], + [1003, 1718, 64, 64], + [692, 1958, 64, 64], + [691, 1900, 64, 64], + [774, 1861, 64, 64], + [712, 1861, 64, 64], + [691, 1863, 64, 64], + [325, 2133, 64, 64], + [275, 2134, 64, 64], + [326, 2082, 64, 64], + [275, 2082, 64, 64], + [124, 2321, 64, 64], + [71, 2320, 64, 64], + [123, 2267, 64, 64], + [71, 2268, 64, 64], + [2354, 1859, 64, 64], + [2292, 1859, 64, 64], + [2231, 1857, 64, 64], + [2198, 1858, 64, 64], + [2353, 1802, 64, 64], + [2296, 1798, 64, 64], + [2233, 1797, 64, 64], + [2200, 1797, 64, 64], + [2352, 1742, 64, 64], + [2288, 1741, 64, 64], + [2230, 1743, 64, 64], + [2196, 1743, 64, 64], + [1736, 460, 64, 64], + [1735, 400, 64, 64], + [1736, 339, 64, 64], + [1736, 275, 64, 64], + [1738, 210, 64, 64], + [1735, 145, 64, 64], + [1735, 87, 64, 64], + [1736, 51, 64, 64], + [539, 289, 64, 64], + [541, 228, 64, 64], + [626, 191, 64, 64], + [572, 192, 64, 64], + [540, 193, 64, 64], + [965, 233, 64, 64], + [904, 234, 64, 64], + [840, 234, 64, 64], + [779, 234, 64, 64], + [745, 236, 64, 64], + [851, 169, 64, 64], + [849, 108, 64, 64], + [852, 50, 64, 64], + [1237, 289, 64, 64], + [1236, 228, 64, 64], + [1238, 197, 64, 64], + [1181, 192, 64, 64], + [1152, 192, 64, 64], + [1443, 605, 64, 64], + [1419, 606, 64, 64], + [1069, 925, 64, 64], + [1068, 902, 64, 64], + [1024, 927, 64, 64], + [1017, 897, 64, 64], + [963, 926, 64, 64], + [958, 898, 64, 64], + [911, 928, 64, 64], + [911, 896, 64, 64], + [2132, 803, 64, 64], + [2081, 803, 64, 64], + [2131, 752, 64, 64], + [2077, 751, 64, 64], + [2615, 649, 64, 64], + [2564, 651, 64, 64], + [2533, 650, 64, 64], + [2027, 156, 64, 64], + [1968, 155, 64, 64], + [1907, 153, 64, 64], + [1873, 155, 64, 64], + [2025, 95, 64, 64], + [1953, 98, 64, 64], + [1894, 100, 64, 64], + [1870, 100, 64, 64], + [2029, 45, 64, 64], + [1971, 48, 64, 64], + [1915, 47, 64, 64], + [1873, 47, 64, 64], + [3956, 288, 64, 64], + [3954, 234, 64, 64], + [4042, 190, 64, 64], + [3990, 190, 64, 64], + [3958, 195, 64, 64], + [3422, 709, 64, 64], + [3425, 686, 64, 64], + [3368, 709, 64, 64], + [3364, 683, 64, 64], + [3312, 711, 64, 64], + [3307, 684, 64, 64], + [3266, 712, 64, 64], + [3269, 681, 64, 64], + [4384, 236, 64, 64], + [4320, 234, 64, 64], + [4257, 235, 64, 64], + [4192, 234, 64, 64], + [4162, 234, 64, 64], + [4269, 171, 64, 64], + [4267, 111, 64, 64], + [4266, 52, 64, 64], + [4580, 458, 64, 64], + [4582, 396, 64, 64], + [4582, 335, 64, 64], + [4581, 275, 64, 64], + [4581, 215, 64, 64], + [4581, 152, 64, 64], + [4582, 89, 64, 64], + [4583, 51, 64, 64], + [4810, 289, 64, 64], + [4810, 227, 64, 64], + [4895, 189, 64, 64], + [4844, 191, 64, 64], + [4809, 191, 64, 64], + [5235, 233, 64, 64], + [5176, 232, 64, 64], + [5118, 230, 64, 64], + [5060, 232, 64, 64], + [5015, 237, 64, 64], + [5123, 171, 64, 64], + [5123, 114, 64, 64], + [5121, 51, 64, 64], + [5523, 461, 64, 64], + [5123, 42, 64, 64], + [5525, 401, 64, 64], + [5525, 340, 64, 64], + [5526, 273, 64, 64], + [5527, 211, 64, 64], + [5525, 150, 64, 64], + [5527, 84, 64, 64], + [5524, 44, 64, 64], + [5861, 288, 64, 64], + [5861, 229, 64, 64], + [5945, 193, 64, 64], + [5904, 193, 64, 64], + [5856, 194, 64, 64], + [6542, 234, 64, 64], + [6478, 235, 64, 64], + [6413, 238, 64, 64], + [6348, 235, 64, 64], + [6285, 236, 64, 64], + [6222, 235, 64, 64], + [6160, 235, 64, 64], + [6097, 236, 64, 64], + [6069, 237, 64, 64], + [6321, 174, 64, 64], + [6318, 111, 64, 64], + [6320, 49, 64, 64], + [6753, 291, 64, 64], + [6752, 227, 64, 64], + [6753, 192, 64, 64], + [6692, 191, 64, 64], + [6668, 193, 64, 64], + [6336, 604, 64, 64], + [6309, 603, 64, 64], + [7264, 461, 64, 64], + [7264, 395, 64, 64], + [7264, 333, 64, 64], + [7264, 270, 64, 64], + [7265, 207, 64, 64], + [7266, 138, 64, 64], + [7264, 78, 64, 64], + [7266, 48, 64, 64], + [7582, 149, 64, 64], + [7524, 147, 64, 64], + [7461, 146, 64, 64], + [7425, 148, 64, 64], + [7580, 86, 64, 64], + [7582, 41, 64, 64], + [7519, 41, 64, 64], + [7460, 40, 64, 64], + [7427, 96, 64, 64], + [7427, 41, 64, 64], + [8060, 288, 64, 64], + [8059, 226, 64, 64], + [8145, 194, 64, 64], + [8081, 194, 64, 64], + [8058, 195, 64, 64], + [8485, 234, 64, 64], + [8422, 235, 64, 64], + [8360, 235, 64, 64], + [8296, 235, 64, 64], + [8266, 237, 64, 64], + [8371, 173, 64, 64], + [8370, 117, 64, 64], + [8372, 59, 64, 64], + [8372, 51, 64, 64], + [9147, 192, 64, 64], + [9063, 287, 64, 64], + [9064, 225, 64, 64], + [9085, 193, 64, 64], + [9063, 194, 64, 64], + [9492, 234, 64, 64], + [9428, 234, 64, 64], + [9365, 235, 64, 64], + [9302, 235, 64, 64], + [9270, 237, 64, 64], + [9374, 172, 64, 64], + [9376, 109, 64, 64], + [9377, 48, 64, 64], + [9545, 1060, 64, 64], + [9482, 1062, 64, 64], + [9423, 1062, 64, 64], + [9387, 1062, 64, 64], + [9541, 999, 64, 64], + [9542, 953, 64, 64], + [9478, 953, 64, 64], + [9388, 999, 64, 64], + [9414, 953, 64, 64], + [9389, 953, 64, 64], + [9294, 1194, 64, 64], + [9245, 1195, 64, 64], + [9297, 1143, 64, 64], + [9245, 1144, 64, 64], + [5575, 1781, 64, 64], + [5574, 1753, 64, 64], + [5522, 1782, 64, 64], + [5518, 1753, 64, 64], + [5472, 1783, 64, 64], + [5471, 1751, 64, 64], + [5419, 1781, 64, 64], + [5421, 1749, 64, 64], + [500, 3207, 64, 64], + [477, 3205, 64, 64], + [1282, 3214, 64, 64], + [1221, 3214, 64, 64], + [1188, 3215, 64, 64], + [1345, 3103, 64, 64], + [1288, 3103, 64, 64], + [1231, 3104, 64, 64], + [1190, 3153, 64, 64], + [1189, 3105, 64, 64], + [2255, 3508, 64, 64], + [2206, 3510, 64, 64], + [2254, 3458, 64, 64], + [2202, 3458, 64, 64], + [2754, 2930, 64, 64], + [2726, 2932, 64, 64], + [3408, 2874, 64, 64], + [3407, 2849, 64, 64], + [3345, 2872, 64, 64], + [3342, 2847, 64, 64], + [3284, 2874, 64, 64], + [3284, 2848, 64, 64], + [3248, 2878, 64, 64], + [3252, 2848, 64, 64], + [3953, 3274, 64, 64], + [3899, 3277, 64, 64], + [3951, 3222, 64, 64], + [3900, 3222, 64, 64], + [4310, 2968, 64, 64], + [4246, 2969, 64, 64], + [4183, 2965, 64, 64], + [4153, 2967, 64, 64], + [4311, 2910, 64, 64], + [4308, 2856, 64, 64], + [4251, 2855, 64, 64], + [4197, 2857, 64, 64], + [5466, 3184, 64, 64], + [5466, 3158, 64, 64], + [5404, 3184, 64, 64], + [5404, 3156, 64, 64], + [5343, 3185, 64, 64], + [5342, 3156, 64, 64], + [5308, 3185, 64, 64], + [5307, 3154, 64, 64], + [6163, 2950, 64, 64], + [6111, 2952, 64, 64], + [6164, 2898, 64, 64], + [6113, 2897, 64, 64], + [7725, 3156, 64, 64], + [7661, 3157, 64, 64], + [7598, 3157, 64, 64], + [7533, 3156, 64, 64], + [7468, 3156, 64, 64], + [7401, 3156, 64, 64], + [7335, 3157, 64, 64], + [7270, 3157, 64, 64], + [7208, 3157, 64, 64], + [7146, 3157, 64, 64], + [7134, 3159, 64, 64], + [6685, 3726, 64, 64], + [6685, 3663, 64, 64], + [6683, 3602, 64, 64], + [6679, 3538, 64, 64], + [6680, 3474, 64, 64], + [6682, 3413, 64, 64], + [6681, 3347, 64, 64], + [6681, 3287, 64, 64], + [6682, 3223, 64, 64], + [6683, 3161, 64, 64], + [6682, 3102, 64, 64], + [6684, 3042, 64, 64], + [6685, 2980, 64, 64], + [6685, 2920, 64, 64], + [6683, 2859, 64, 64], + [6684, 2801, 64, 64], + [6686, 2743, 64, 64], + [6683, 2683, 64, 64], + [6681, 2622, 64, 64], + [6682, 2559, 64, 64], + [6683, 2498, 64, 64], + [6685, 2434, 64, 64], + [6683, 2371, 64, 64], + [6683, 2306, 64, 64], + [6684, 2242, 64, 64], + [6683, 2177, 64, 64], + [6683, 2112, 64, 64], + [6683, 2049, 64, 64], + [6683, 1985, 64, 64], + [6682, 1923, 64, 64], + [6683, 1860, 64, 64], + [6685, 1797, 64, 64], + [6684, 1735, 64, 64], + [6685, 1724, 64, 64], + [7088, 1967, 64, 64], + [7026, 1966, 64, 64], + [6964, 1967, 64, 64], + [6900, 1965, 64, 64], + [6869, 1969, 64, 64], + [6972, 1904, 64, 64], + [6974, 1840, 64, 64], + [6971, 1776, 64, 64], + [6971, 1716, 64, 64], + [7168, 1979, 64, 64], + [7170, 1919, 64, 64], + [7169, 1882, 64, 64], + [7115, 1880, 64, 64], + [7086, 1881, 64, 64], + [7725, 1837, 64, 64], + [7724, 1776, 64, 64], + [7724, 1728, 64, 64], + [7661, 1727, 64, 64], + [7603, 1728, 64, 64], + [7571, 1837, 64, 64], + [7570, 1774, 64, 64], + [7572, 1725, 64, 64], + [7859, 2134, 64, 64], + [7858, 2070, 64, 64], + [7858, 2008, 64, 64], + [7860, 1942, 64, 64], + [7856, 1878, 64, 64], + [7860, 1813, 64, 64], + [7859, 1750, 64, 64], + [7856, 1724, 64, 64], + [8155, 1837, 64, 64], + [8092, 1839, 64, 64], + [8032, 1838, 64, 64], + [7999, 1839, 64, 64], + [8153, 1773, 64, 64], + [8154, 1731, 64, 64], + [8090, 1730, 64, 64], + [8035, 1732, 64, 64], + [8003, 1776, 64, 64], + [8003, 1730, 64, 64], + [8421, 1978, 64, 64], + [8420, 1917, 64, 64], + [8505, 1878, 64, 64], + [8443, 1881, 64, 64], + [8420, 1882, 64, 64], + [8847, 1908, 64, 64], + [8783, 1908, 64, 64], + [8718, 1910, 64, 64], + [8654, 1910, 64, 64], + [8628, 1911, 64, 64], + [8729, 1847, 64, 64], + [8731, 1781, 64, 64], + [8731, 1721, 64, 64], + [9058, 2135, 64, 64], + [9056, 2073, 64, 64], + [9058, 2006, 64, 64], + [9057, 1939, 64, 64], + [9058, 1876, 64, 64], + [9056, 1810, 64, 64], + [9059, 1745, 64, 64], + [9060, 1722, 64, 64], + [9273, 1977, 64, 64], + [9273, 1912, 64, 64], + [9358, 1883, 64, 64], + [9298, 1881, 64, 64], + [9270, 1883, 64, 64], + [9699, 1910, 64, 64], + [9637, 1910, 64, 64], + [9576, 1910, 64, 64], + [9512, 1911, 64, 64], + [9477, 1912, 64, 64], + [9584, 1846, 64, 64], + [9585, 1783, 64, 64], + [9586, 1719, 64, 64], + [8320, 2788, 64, 64], + [8256, 2789, 64, 64], + [8192, 2789, 64, 64], + [8180, 2789, 64, 64], + [8319, 2730, 64, 64], + [8319, 2671, 64, 64], + [8319, 2639, 64, 64], + [8259, 2639, 64, 64], + [8202, 2639, 64, 64], + [8179, 2727, 64, 64], + [8178, 2665, 64, 64], + [8177, 2636, 64, 64], + [9360, 3138, 64, 64], + [9296, 3137, 64, 64], + [9235, 3139, 64, 64], + [9174, 3139, 64, 64], + [9113, 3138, 64, 64], + [9050, 3138, 64, 64], + [8988, 3138, 64, 64], + [8925, 3138, 64, 64], + [8860, 3136, 64, 64], + [8797, 3136, 64, 64], + [8770, 3138, 64, 64], + [8827, 4171, 64, 64], + [8827, 4107, 64, 64], + [8827, 4043, 64, 64], + [8827, 3978, 64, 64], + [8825, 3914, 64, 64], + [8824, 3858, 64, 64], + [9635, 4234, 64, 64], + [9584, 4235, 64, 64], + [9634, 4187, 64, 64], + [9582, 4183, 64, 64], + [9402, 5114, 64, 64], + [9402, 5087, 64, 64], + [9347, 5113, 64, 64], + [9345, 5086, 64, 64], + [9287, 5114, 64, 64], + [9285, 5085, 64, 64], + [9245, 5114, 64, 64], + [9244, 5086, 64, 64], + [9336, 5445, 64, 64], + [9285, 5445, 64, 64], + [9337, 5395, 64, 64], + [9283, 5393, 64, 64], + [8884, 4968, 64, 64], + [8884, 4939, 64, 64], + [8822, 4967, 64, 64], + [8823, 4940, 64, 64], + [8765, 4967, 64, 64], + [8762, 4937, 64, 64], + [8726, 4969, 64, 64], + [8727, 4939, 64, 64], + [7946, 5248, 64, 64], + [7945, 5220, 64, 64], + [7887, 5248, 64, 64], + [7886, 5219, 64, 64], + [7830, 5248, 64, 64], + [7827, 5218, 64, 64], + [7781, 5248, 64, 64], + [7781, 5216, 64, 64], + [6648, 4762, 64, 64], + [6621, 4761, 64, 64], + [5011, 4446, 64, 64], + [4982, 4444, 64, 64], + [4146, 4641, 64, 64], + [4092, 4643, 64, 64], + [4145, 4589, 64, 64], + [4091, 4590, 64, 64], + [4139, 4497, 64, 64], + [4135, 4437, 64, 64], + [4135, 4383, 64, 64], + [4078, 4495, 64, 64], + [4014, 4494, 64, 64], + [3979, 4496, 64, 64], + [4074, 4384, 64, 64], + [4015, 4381, 64, 64], + [3980, 4433, 64, 64], + [3981, 4384, 64, 64], + [3276, 4279, 64, 64], + [3275, 4218, 64, 64], + [3276, 4170, 64, 64], + [3211, 4164, 64, 64], + [3213, 4280, 64, 64], + [3156, 4278, 64, 64], + [3120, 4278, 64, 64], + [3151, 4163, 64, 64], + [3120, 4216, 64, 64], + [3120, 4161, 64, 64], + [1536, 4171, 64, 64], + [1536, 4110, 64, 64], + [1535, 4051, 64, 64], + [1536, 3991, 64, 64], + [1536, 3928, 64, 64], + [1536, 3863, 64, 64], + [1078, 4605, 64, 64], + [1076, 4577, 64, 64], + [1018, 4604, 64, 64], + [1018, 4575, 64, 64], + [957, 4606, 64, 64], + [960, 4575, 64, 64], + [918, 4602, 64, 64], + [918, 4580, 64, 64], + [394, 4164, 64, 64], + [335, 4163, 64, 64], + [274, 4161, 64, 64], + [236, 4163, 64, 64], + [394, 4140, 64, 64], + [329, 4139, 64, 64], + [268, 4139, 64, 64], + [239, 4139, 64, 64], + [4326, 5073, 64, 64], + [4324, 5042, 64, 64], + [4265, 5074, 64, 64], + [4263, 5042, 64, 64], + [4214, 5072, 64, 64], + [4211, 5043, 64, 64], + [4166, 5073, 64, 64], + [4164, 5041, 64, 64], + [4844, 5216, 64, 64], + [4844, 5189, 64, 64], + [4785, 5217, 64, 64], + [4790, 5187, 64, 64], + [4726, 5219, 64, 64], + [4728, 5185, 64, 64], + [4681, 5218, 64, 64], + [4684, 5186, 64, 64], + [4789, 4926, 64, 64], + [4734, 4928, 64, 64], + [4787, 4876, 64, 64], + [4738, 4874, 64, 64], + [4775, 5548, 64, 64], + [4775, 5495, 64, 64], + [4723, 5550, 64, 64], + [4725, 5494, 64, 64], + [1360, 5269, 64, 64], + [1362, 5218, 64, 64], + [1315, 5266, 64, 64], + [1282, 5266, 64, 64], + [1246, 5311, 64, 64], + [1190, 5312, 64, 64], + [1136, 5310, 64, 64], + [1121, 5427, 64, 64], + [1121, 5370, 64, 64], + [1074, 5427, 64, 64], + [1064, 5423, 64, 64], + [1052, 5417, 64, 64], + [1050, 5368, 64, 64], + [1008, 5314, 64, 64], + [997, 5307, 64, 64], + [977, 5299, 64, 64], + [976, 5248, 64, 64], + [825, 5267, 64, 64], + [826, 5213, 64, 64], + [776, 5267, 64, 64], + [768, 5261, 64, 64], + [755, 5256, 64, 64], + [753, 5209, 64, 64], + [1299, 5206, 64, 64], + [1238, 5204, 64, 64], + [1178, 5203, 64, 64], + [1124, 5204, 64, 64], + [1065, 5206, 64, 64], + [1008, 5203, 64, 64], + [977, 5214, 64, 64], + [410, 5313, 64, 64], + [407, 5249, 64, 64], + [411, 5225, 64, 64], + [397, 5217, 64, 64], + [378, 5209, 64, 64], + [358, 5312, 64, 64], + [287, 5427, 64, 64], + [286, 5364, 64, 64], + [300, 5313, 64, 64], + [242, 5427, 64, 64], + [229, 5420, 64, 64], + [217, 5416, 64, 64], + [215, 5364, 64, 64], + [174, 5311, 64, 64], + [165, 5308, 64, 64], + [139, 5300, 64, 64], + [141, 5236, 64, 64], + [141, 5211, 64, 64], + [315, 5208, 64, 64], + [251, 5208, 64, 64], + [211, 5211, 64, 64], + [8050, 4060, 64, 64], + [7992, 4060, 64, 64], + [7929, 4060, 64, 64], + [7866, 4061, 64, 64], + [7828, 4063, 64, 64], + [7934, 4001, 64, 64], + [7935, 3936, 64, 64], + [7935, 3875, 64, 64], + [7622, 4111, 64, 64], + [7623, 4049, 64, 64], + [7707, 4018, 64, 64], + [7663, 4019, 64, 64], + [7623, 4017, 64, 64], + [7193, 4060, 64, 64], + [7131, 4059, 64, 64], + [7070, 4057, 64, 64], + [7008, 4060, 64, 64], + [6977, 4060, 64, 64], + [7080, 3998, 64, 64], + [7081, 3935, 64, 64], + [7080, 3873, 64, 64], + [6855, 4019, 64, 64], + [6790, 4018, 64, 64], + [6770, 4114, 64, 64], + [6770, 4060, 64, 64], + [6768, 4013, 64, 64], + [6345, 4060, 64, 64], + [6284, 4062, 64, 64], + [6222, 4061, 64, 64], + [6166, 4061, 64, 64], + [6124, 4066, 64, 64], + [6226, 3995, 64, 64], + [6226, 3933, 64, 64], + [6228, 3868, 64, 64], + [5916, 4113, 64, 64], + [5918, 4052, 64, 64], + [6001, 4018, 64, 64], + [5941, 4019, 64, 64], + [5918, 4020, 64, 64], + [5501, 4059, 64, 64], + [5439, 4061, 64, 64], + [5376, 4059, 64, 64], + [5312, 4058, 64, 64], + [5285, 4062, 64, 64], + [5388, 3999, 64, 64], + [5385, 3941, 64, 64], + [5384, 3874, 64, 64], + [5075, 4112, 64, 64], + [5074, 4051, 64, 64], + [5158, 4018, 64, 64], + [5095, 4020, 64, 64], + [5073, 4018, 64, 64], + [4549, 3998, 64, 64], + [4393, 3996, 64, 64], + [4547, 3938, 64, 64], + [4547, 3886, 64, 64], + [4488, 3885, 64, 64], + [4427, 3885, 64, 64], + [4395, 3938, 64, 64], + [4395, 3885, 64, 64], + [0, 0, 64, 64], + [0, 1670, 64, 64], + [6691, 1653, 64, 64], + [1521, 3792, 64, 64], + [0, 5137, 64, 64], + [0, 0, 64, 64], + [0, 1670, 64, 64], + [6691, 1653, 64, 64], + [1521, 3792, 64, 64], + [0, 5137, 64, 64], + [1215, 2421, 64, 64], + [1214, 2360, 64, 64], + [1211, 2300, 64, 64], + [1211, 2291, 64, 64], + [1158, 2420, 64, 64], + [1156, 2358, 64, 64], + [1149, 2291, 64, 64], + [1095, 2420, 64, 64], + [1030, 2418, 64, 64], + [966, 2419, 64, 64], + [903, 2419, 64, 64], + [852, 2419, 64, 64], + [1087, 2291, 64, 64], + [1023, 2291, 64, 64], + [960, 2291, 64, 64], + [896, 2292, 64, 64], + [854, 2355, 64, 64], + [854, 2292, 64, 64], + [675, 3017, 64, 64], + [622, 3017, 64, 64], + [676, 2965, 64, 64], + [622, 2965, 64, 64], + [1560, 3212, 64, 64], + [1496, 3212, 64, 64], + [1430, 3211, 64, 64], + [1346, 3214, 64, 64], + [1410, 3213, 64, 64], + [1560, 3147, 64, 64], + [1559, 3105, 64, 64], + [1496, 3105, 64, 64], + [1442, 3105, 64, 64], + [1412, 3106, 64, 64], + [918, 4163, 64, 64], + [854, 4161, 64, 64], + [792, 4160, 64, 64], + [729, 4159, 64, 64], + [666, 4158, 64, 64], + [601, 4158, 64, 64], + [537, 4156, 64, 64], + [918, 4137, 64, 64], + [854, 4137, 64, 64], + [789, 4136, 64, 64], + [726, 4137, 64, 64], + [661, 4137, 64, 64], + [599, 4139, 64, 64], + [538, 4137, 64, 64], + [5378, 4254, 64, 64], + [5440, 4204, 64, 64], + [5405, 4214, 64, 64], + [5350, 4254, 64, 64], + [5439, 4177, 64, 64], + [5413, 4173, 64, 64], + [5399, 4128, 64, 64], + [5352, 4200, 64, 64], + [5352, 4158, 64, 64], + [5392, 4130, 64, 64], + [6216, 4251, 64, 64], + [6190, 4251, 64, 64], + [6279, 4200, 64, 64], + [6262, 4205, 64, 64], + [6233, 4214, 64, 64], + [6280, 4172, 64, 64], + [6256, 4169, 64, 64], + [6239, 4128, 64, 64], + [6231, 4128, 64, 64], + [6191, 4195, 64, 64], + [6190, 4158, 64, 64], + [7072, 4250, 64, 64], + [7046, 4250, 64, 64], + [7133, 4202, 64, 64], + [7107, 4209, 64, 64], + [7086, 4214, 64, 64], + [7133, 4173, 64, 64], + [7108, 4169, 64, 64], + [7092, 4127, 64, 64], + [7084, 4128, 64, 64], + [7047, 4191, 64, 64], + [7047, 4156, 64, 64], + [7926, 4252, 64, 64], + [7900, 4253, 64, 64], + [7987, 4202, 64, 64], + [7965, 4209, 64, 64], + [7942, 4216, 64, 64], + [7989, 4174, 64, 64], + [7970, 4170, 64, 64], + [7949, 4126, 64, 64], + [7901, 4196, 64, 64], + [7900, 4159, 64, 64], + [7941, 4130, 64, 64], + [2847, 379, 64, 64], + [2825, 380, 64, 64], + [2845, 317, 64, 64], + [2829, 316, 64, 64], + [2845, 255, 64, 64], + [2830, 257, 64, 64], + [2845, 202, 64, 64], + [2829, 198, 64, 64], + [2770, 169, 64, 64], + [2708, 170, 64, 64], + [2646, 171, 64, 64], + [2582, 171, 64, 64], + [2518, 171, 64, 64], + [2454, 171, 64, 64], + [2391, 172, 64, 64], + [2332, 379, 64, 64], + [2315, 379, 64, 64], + [2334, 316, 64, 64], + [2315, 317, 64, 64], + [2332, 254, 64, 64], + [2314, 254, 64, 64], + [2335, 192, 64, 64], + [2311, 192, 64, 64], + [2846, 142, 64, 64], + [2784, 140, 64, 64], + [2846, 79, 64, 64], + [2847, 41, 64, 64], + [2783, 80, 64, 64], + [2790, 39, 64, 64], + [2727, 41, 64, 64], + [2665, 43, 64, 64], + [2605, 43, 64, 64], + [2543, 44, 64, 64], + [2480, 45, 64, 64], + [2419, 45, 64, 64], + [2357, 44, 64, 64], + [2313, 129, 64, 64], + [2313, 70, 64, 64], + [2314, 40, 64, 64], + [2517, 2385, 64, 64], + [2452, 2385, 64, 64], + [2390, 2386, 64, 64], + [2328, 2386, 64, 64], + [2264, 2386, 64, 64], + [2200, 2386, 64, 64], + [2137, 2387, 64, 64], + [2071, 2385, 64, 64], + [2016, 2389, 64, 64], + [2517, 2341, 64, 64], + [2518, 2316, 64, 64], + [2456, 2316, 64, 64], + [2393, 2316, 64, 64], + [2328, 2317, 64, 64], + [2264, 2316, 64, 64], + [2207, 2318, 64, 64], + [2144, 2317, 64, 64], + [2081, 2316, 64, 64], + [2015, 2342, 64, 64], + [2016, 2315, 64, 64], + [869, 3709, 64, 64], + [819, 3710, 64, 64], + [869, 3658, 64, 64], + [820, 3658, 64, 64], + [0, 0, 64, 64], + [0, 1670, 64, 64], + [6691, 1653, 64, 64], + [1521, 3792, 64, 64], + [0, 5137, 64, 64], + [3898, 2400, 64, 64], + [3835, 2400, 64, 64], + [3771, 2400, 64, 64], + [3708, 2401, 64, 64], + [3646, 2401, 64, 64], + [3587, 2401, 64, 64], + [3530, 2401, 64, 64], + [3897, 2340, 64, 64], + [3897, 2295, 64, 64], + [3834, 2296, 64, 64], + [3773, 2295, 64, 64], + [3710, 2296, 64, 64], + [3656, 2295, 64, 64], + [3593, 2294, 64, 64], + [3527, 2339, 64, 64], + [3531, 2293, 64, 64], + [4152, 2903, 64, 64], + [4155, 2858, 64, 64], + [3942, 1306, 64, 64], + [3942, 1279, 64, 64], + [3879, 1306, 64, 64], + [3881, 1278, 64, 64], + [3819, 1305, 64, 64], + [3819, 1277, 64, 64], + [3756, 1306, 64, 64], + [3756, 1277, 64, 64], + [3694, 1306, 64, 64], + [3695, 1277, 64, 64], + [3631, 1306, 64, 64], + [3632, 1278, 64, 64], + [3565, 1306, 64, 64], + [3567, 1279, 64, 64], + [4432, 1165, 64, 64], + [4408, 1163, 64, 64], + [5123, 1003, 64, 64], + [5065, 1002, 64, 64], + [5042, 1002, 64, 64], + [6020, 1780, 64, 64], + [6020, 1756, 64, 64], + [5959, 1780, 64, 64], + [5959, 1752, 64, 64], + [5897, 1779, 64, 64], + [5899, 1752, 64, 64], + [5836, 1779, 64, 64], + [5836, 1751, 64, 64], + [5776, 1780, 64, 64], + [5776, 1754, 64, 64], + [5717, 1780, 64, 64], + [5716, 1752, 64, 64], + [5658, 1781, 64, 64], + [5658, 1755, 64, 64], + [5640, 1781, 64, 64], + [5640, 1754, 64, 64], + [5832, 2095, 64, 64], + [5782, 2093, 64, 64], + [5832, 2044, 64, 64], + [5777, 2043, 64, 64], + [4847, 2577, 64, 64], + [4795, 2577, 64, 64], + [4846, 2526, 64, 64], + [4794, 2526, 64, 64], + [8390, 923, 64, 64], + [8363, 922, 64, 64], + [7585, 1084, 64, 64], + [7582, 1058, 64, 64], + [7525, 1084, 64, 64], + [7524, 1056, 64, 64], + [7478, 1085, 64, 64], + [7476, 1055, 64, 64], + [7421, 1086, 64, 64], + [7421, 1052, 64, 64], + [7362, 1085, 64, 64], + [7361, 1053, 64, 64], + [7307, 1087, 64, 64], + [7307, 1054, 64, 64], + [7258, 1086, 64, 64], + [7255, 1058, 64, 64], + [7203, 1083, 64, 64], + [7203, 1055, 64, 64], + [7161, 1085, 64, 64], + [7158, 1057, 64, 64], + [7100, 1083, 64, 64], + [7099, 1058, 64, 64], + [7038, 1082, 64, 64], + [7038, 1058, 64, 64], + [6982, 1083, 64, 64], + [6984, 1057, 64, 64], + [0, 0, 64, 64], + [0, 1670, 64, 64], + [6691, 1653, 64, 64], + [1521, 3792, 64, 64], + [0, 5137, 64, 64], + [0, 0, 64, 64], + [0, 1670, 64, 64], + [6691, 1653, 64, 64], + [1521, 3792, 64, 64], + [0, 5137, 64, 64], + [0, 0, 64, 64], + [0, 1670, 64, 64], + [6691, 1653, 64, 64], + [1521, 3792, 64, 64], + [0, 5137, 64, 64], + [8346, 424, 64, 64], + [8407, 376, 64, 64], + [8375, 386, 64, 64], + [8407, 347, 64, 64], + [8388, 343, 64, 64], + [8320, 423, 64, 64], + [8319, 363, 64, 64], + [8368, 303, 64, 64], + [8359, 303, 64, 64], + [8318, 330, 64, 64], + [9369, 425, 64, 64], + [9340, 425, 64, 64], + [9431, 376, 64, 64], + [9414, 382, 64, 64], + [9387, 391, 64, 64], + [9431, 349, 64, 64], + [9412, 344, 64, 64], + [9392, 305, 64, 64], + [9339, 365, 64, 64], + [9341, 333, 64, 64], + [9384, 301, 64, 64], + [7673, 1896, 64, 64], + [7642, 1834, 64, 64], + [7646, 1901, 64, 64], + [4500, 4054, 64, 64], + [4476, 4055, 64, 64], + [4459, 3997, 64, 64], + [76, 5215, 64, 64], + [39, 5217, 64, 64], +] + +$mugs = [ + [85, 87, 39, 43, "sprites/square-orange.png"], + [958, 1967, 39, 43, "sprites/square-orange.png"], + [2537, 1734, 39, 43, "sprites/square-orange.png"], + [3755, 2464, 39, 43, "sprites/square-orange.png"], + [1548, 3273, 39, 43, "sprites/square-orange.png"], + [2050, 220, 39, 43, "sprites/square-orange.png"], + [854, 297, 39, 43, "sprites/square-orange.png"], + [343, 526, 39, 43, "sprites/square-orange.png"], + [3454, 772, 39, 43, "sprites/square-orange.png"], + [5041, 298, 39, 43, "sprites/square-orange.png"], + [6089, 300, 39, 43, "sprites/square-orange.png"], + [6518, 295, 39, 43, "sprites/square-orange.png"], + [7661, 47, 39, 43, "sprites/square-orange.png"], + [9392, 1125, 39, 43, "sprites/square-orange.png"], + [7298, 1152, 39, 43, "sprites/square-orange.png"], + [5816, 1843, 39, 43, "sprites/square-orange.png"], + [876, 3772, 39, 43, "sprites/square-orange.png"], + [1029, 4667, 39, 43, "sprites/square-orange.png"], + [823, 5324, 39, 43, "sprites/square-orange.png"], + [3251, 5220, 39, 43, "sprites/square-orange.png"], + [4747, 5282, 39, 43, "sprites/square-orange.png"], + [9325, 5178, 39, 43, "sprites/square-orange.png"], + [9635, 4298, 39, 43, "sprites/square-orange.png"], + [7837, 4127, 39, 43, "sprites/square-orange.png"], + [8651, 1971, 39, 43, "sprites/square-orange.png"], + [6892, 2031, 39, 43, "sprites/square-orange.png"], + [4626, 3882, 39, 43, "sprites/square-orange.png"], + [4024, 4554, 39, 43, "sprites/square-orange.png"], + [3925, 3337, 39, 43, "sprites/square-orange.png"], + [5064, 1064, 39, 43, "sprites/square-orange.png"] +] diff --git a/samples/99_sample_game_clepto_frog/metadata/game_metadata.txt b/samples/99_sample_game_clepto_frog/metadata/game_metadata.txt new file mode 100644 index 0000000..7b3f61e --- /dev/null +++ b/samples/99_sample_game_clepto_frog/metadata/game_metadata.txt @@ -0,0 +1,6 @@ +devid=amirrajan +devtitle=Amir Rajan +gameid=clepto-frog +gametitle=Clepto Frog +version=1.0 +icon=sprites/square-green.png diff --git a/samples/99_sample_game_clepto_frog/sprites/level-map.png b/samples/99_sample_game_clepto_frog/sprites/level-map.png Binary files differnew file mode 100644 index 0000000..f590be4 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/level-map.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-black.png b/samples/99_sample_game_clepto_frog/sprites/square-black.png Binary files differnew file mode 100644 index 0000000..cea7bd7 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-black.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-blue.png b/samples/99_sample_game_clepto_frog/sprites/square-blue.png Binary files differnew file mode 100644 index 0000000..b840849 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-blue.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-gray.png b/samples/99_sample_game_clepto_frog/sprites/square-gray.png Binary files differnew file mode 100644 index 0000000..2142b30 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-gray.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-green.png b/samples/99_sample_game_clepto_frog/sprites/square-green.png Binary files differnew file mode 100644 index 0000000..5ef7f75 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-green.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-indigo.png b/samples/99_sample_game_clepto_frog/sprites/square-indigo.png Binary files differnew file mode 100644 index 0000000..2384108 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-indigo.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-orange.png b/samples/99_sample_game_clepto_frog/sprites/square-orange.png Binary files differnew file mode 100644 index 0000000..bb1eee7 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-orange.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-pink.png b/samples/99_sample_game_clepto_frog/sprites/square-pink.png Binary files differnew file mode 100644 index 0000000..3bbb63a --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-pink.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-red.png b/samples/99_sample_game_clepto_frog/sprites/square-red.png Binary files differnew file mode 100644 index 0000000..3ed5f13 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-red.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-violet.png b/samples/99_sample_game_clepto_frog/sprites/square-violet.png Binary files differnew file mode 100644 index 0000000..333540c --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-violet.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-white.png b/samples/99_sample_game_clepto_frog/sprites/square-white.png Binary files differnew file mode 100644 index 0000000..378c565 --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-white.png diff --git a/samples/99_sample_game_clepto_frog/sprites/square-yellow.png b/samples/99_sample_game_clepto_frog/sprites/square-yellow.png Binary files differnew file mode 100644 index 0000000..0edeeec --- /dev/null +++ b/samples/99_sample_game_clepto_frog/sprites/square-yellow.png diff --git a/samples/99_sample_game_dueling_starships/app/main.rb b/samples/99_sample_game_dueling_starships/app/main.rb new file mode 100644 index 0000000..8adcf3d --- /dev/null +++ b/samples/99_sample_game_dueling_starships/app/main.rb @@ -0,0 +1,365 @@ +class DuelingSpaceships + attr_accessor :state, :inputs, :outputs, :grid + + def tick + defaults + render + calc + input + end + + def defaults + outputs.background_color = [0, 0, 0] + state.ship_blue ||= new_blue_ship + state.ship_red ||= new_red_ship + state.flames ||= [] + state.bullets ||= [] + state.ship_blue_score ||= 0 + state.ship_red_score ||= 0 + state.stars ||= 100.map do + [rand.add(2).to_square(grid.w_half.randomize(:sign, :ratio), + grid.h_half.randomize(:sign, :ratio)), + 128 + 128.randomize(:ratio), 255, 255] + end + end + + def default_ship x, y, angle, sprite_path, bullet_sprite_path, color + state.new_entity(:ship, + { x: x, + y: y, + dy: 0, + dx: 0, + damage: 0, + dead: false, + angle: angle, + max_alpha: 255, + sprite_path: sprite_path, + bullet_sprite_path: bullet_sprite_path, + color: color }) + end + + def new_red_ship + default_ship(400, 250.randomize(:sign, :ratio), + 180, 'sprites/ship_red.png', 'sprites/red_bullet.png', + [255, 90, 90]) + end + + def new_blue_ship + default_ship(-400, 250.randomize(:sign, :ratio), + 0, 'sprites/ship_blue.png', 'sprites/blue_bullet.png', + [110, 140, 255]) + end + + def render + render_instructions + render_score + render_universe + render_flames + render_ships + render_bullets + end + + def render_ships + update_ship_outputs(state.ship_blue) + update_ship_outputs(state.ship_red) + outputs.sprites << [state.ship_blue.sprite, state.ship_red.sprite] + outputs.labels << [state.ship_blue.label, state.ship_red.label] + end + + def render_instructions + return if state.ship_blue.dx > 0 || state.ship_blue.dy > 0 || + state.ship_red.dx > 0 || state.ship_red.dy > 0 || + state.flames.length > 0 + + outputs.labels << [grid.left.shift_right(30), + grid.bottom.shift_up(30), + "Two gamepads needed to play. R1 to accelerate. Left and right on D-PAD to turn ship. Hold A to shoot. Press B to drop mines.", + 0, 0, 255, 255, 255] + end + + def calc + calc_thrusts + calc_ships + calc_bullets + calc_winner + end + + def input + input_accelerate + input_turn + input_bullets_and_mines + end + + def render_score + outputs.labels << [grid.left.shift_right(80), + grid.top.shift_down(40), + state.ship_blue_score, 30, 1, state.ship_blue.color] + + outputs.labels << [grid.right.shift_left(80), + grid.top.shift_down(40), + state.ship_red_score, 30, 1, state.ship_red.color] + end + + def render_universe + return if outputs.static_solids.any? + outputs.static_solids << grid.rect + outputs.static_solids << state.stars + end + + def apply_round_finished_alpha entity + return entity unless state.round_finished_debounce + entity.a *= state.round_finished_debounce.percentage_of(2.seconds) + return entity + end + + def update_ship_outputs ship, sprite_size = 66 + ship.sprite = + apply_round_finished_alpha [sprite_size.to_square(ship.x, ship.y), + ship.sprite_path, + ship.angle, + ship.dead ? 0 : 255 * ship.created_at.ease(2.seconds)].sprite + ship.label = + apply_round_finished_alpha [ship.x, + ship.y + 100, + "." * 5.minus(ship.damage).greater(0), 20, 1, ship.color, 255].label + end + + def render_flames sprite_size = 6 + outputs.sprites << state.flames.map do |p| + apply_round_finished_alpha [sprite_size.to_square(p.x, p.y), + 'sprites/flame.png', 0, + p.max_alpha * p.created_at.ease(p.lifetime, :flip)].sprite + end + end + + def render_bullets sprite_size = 10 + outputs.sprites << state.bullets.map do |b| + apply_round_finished_alpha [b.sprite_size.to_square(b.x, b.y), + b.owner.bullet_sprite_path, + 0, b.max_alpha].sprite + end + end + + def wrap_location! location + location.x = grid.left if location.x > grid.right + location.x = grid.right if location.x < grid.left + location.y = grid.top if location.y < grid.bottom + location.y = grid.bottom if location.y > grid.top + location + end + + def calc_thrusts + state.flames = + state.flames + .reject(&:old?) + .map do |p| + p.speed *= 0.9 + p.y += p.angle.vector_y(p.speed) + p.x += p.angle.vector_x(p.speed) + wrap_location! p + end + end + + def all_ships + [state.ship_blue, state.ship_red] + end + + def alive_ships + all_ships.reject { |s| s.dead } + end + + def calc_bullet bullet + bullet.y += bullet.angle.vector_y(bullet.speed) + bullet.x += bullet.angle.vector_x(bullet.speed) + wrap_location! bullet + explode_bullet! bullet if bullet.old? + return if bullet.exploded + return if state.round_finished + alive_ships.each do |s| + if s != bullet.owner && + s.sprite.intersect_rect?(bullet.sprite_size.to_square(bullet.x, bullet.y)) + explode_bullet! bullet, 10, 5, 30 + s.damage += 1 + end + end + end + + def calc_bullets + state.bullets.each { |b| calc_bullet b } + state.bullets.reject! { |b| b.exploded } + end + + def create_explosion! type, entity, flame_count, max_speed, lifetime, max_alpha = 255 + flame_count.times do + state.flames << state.new_entity(type, + { angle: 360.randomize(:ratio), + speed: max_speed.randomize(:ratio), + lifetime: lifetime, + x: entity.x, + y: entity.y, + max_alpha: max_alpha }) + end + end + + def explode_bullet! bullet, flame_override = 5, max_speed = 5, lifetime = 10 + bullet.exploded = true + create_explosion! :bullet_explosion, + bullet, + flame_override, + max_speed, + lifetime, + bullet.max_alpha + end + + def calc_ship ship + ship.x += ship.dx + ship.y += ship.dy + wrap_location! ship + end + + def calc_ships + all_ships.each { |s| calc_ship s } + return if all_ships.any? { |s| s.dead } + return if state.round_finished + return unless state.ship_blue.sprite.intersect_rect?(state.ship_red.sprite) + state.ship_blue.damage = 5 + state.ship_red.damage = 5 + end + + def create_thruster_flames! ship + state.flames << state.new_entity(:ship_thruster, + { angle: ship.angle + 180 + 60.randomize(:sign, :ratio), + speed: 5.randomize(:ratio), + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), + lifetime: 30, + x: ship.x - ship.angle.vector_x(40) + 5.randomize(:sign, :ratio), + y: ship.y - ship.angle.vector_y(40) + 5.randomize(:sign, :ratio) }) + end + + def input_accelerate_ship should_move_ship, ship + return if ship.dead + + should_move_ship &&= (ship.dx + ship.dy).abs < 5 + + if should_move_ship + create_thruster_flames! ship + ship.dx += ship.angle.vector_x 0.050 + ship.dy += ship.angle.vector_y 0.050 + else + ship.dx *= 0.99 + ship.dy *= 0.99 + end + end + + def input_accelerate + input_accelerate_ship inputs.controller_one.key_held.r1 || inputs.keyboard.up, state.ship_blue + input_accelerate_ship inputs.controller_two.key_held.r1, state.ship_red + end + + def input_turn_ship direction, ship + ship.angle -= 3 * direction + end + + def input_turn + input_turn_ship inputs.controller_one.left_right + inputs.keyboard.left_right, state.ship_blue + input_turn_ship inputs.controller_two.left_right, state.ship_red + end + + def input_bullet create_bullet, ship + return unless create_bullet + return if ship.dead + + state.bullets << state.new_entity(:ship_bullet, + { owner: ship, + angle: ship.angle, + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), + speed: 5 + ship.dx.mult(ship.angle.vector_x) + ship.dy.mult(ship.angle.vector_y), + lifetime: 120, + sprite_size: 10, + x: ship.x + ship.angle.vector_x * 32, + y: ship.y + ship.angle.vector_y * 32 }) + end + + def input_mine create_mine, ship + return unless create_mine + return if ship.dead + + state.bullets << state.new_entity(:ship_bullet, + { owner: ship, + angle: 360.randomize(:sign, :ratio), + max_alpha: 255 * ship.created_at_elapsed.percentage_of(2.seconds), + speed: 0.02, + sprite_size: 10, + lifetime: 600, + x: ship.x + ship.angle.vector_x * -50, + y: ship.y + ship.angle.vector_y * -50 }) + end + + def input_bullets_and_mines + return if state.bullets.length > 100 + + [ + [inputs.controller_one.key_held.a || inputs.keyboard.key_held.space, + inputs.controller_one.key_down.b || inputs.keyboard.key_down.down, + state.ship_blue], + [inputs.controller_two.key_held.a, inputs.controller_two.key_down.b, state.ship_red] + ].each do |a_held, b_down, ship| + input_bullet(a_held && state.tick_count.mod_zero?(10).or(a_held == 0), ship) + input_mine(b_down, ship) + end + end + + def calc_kill_ships + alive_ships.find_all { |s| s.damage >= 5 }.each do |s| + s.dead = true + create_explosion! :ship_explosion, s, 20, 20, 30, s.max_alpha + end + end + + def calc_score + return if state.round_finished + return if alive_ships.length > 1 + + if alive_ships.first == state.ship_red + state.ship_red_score += 1 + elsif alive_ships.first == state.ship_blue + state.ship_blue_score += 1 + end + + state.round_finished = true + end + + def calc_reset_ships + return unless state.round_finished + state.round_finished_debounce ||= 2.seconds + state.round_finished_debounce -= 1 + return if state.round_finished_debounce > 0 + start_new_round! + end + + def start_new_round! + state.ship_blue = new_blue_ship + state.ship_red = new_red_ship + state.round_finished = false + state.round_finished_debounce = nil + state.flames.clear + state.bullets.clear + end + + def calc_winner + calc_kill_ships + calc_score + calc_reset_ships + end +end + +$dueling_spaceship = DuelingSpaceships.new + +def tick args + args.grid.origin_center! + $dueling_spaceship.inputs = args.inputs + $dueling_spaceship.outputs = args.outputs + $dueling_spaceship.state = args.state + $dueling_spaceship.grid = args.grid + $dueling_spaceship.tick +end diff --git a/samples/99_sample_game_dueling_starships/license-for-sample.txt b/samples/99_sample_game_dueling_starships/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/99_sample_game_dueling_starships/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_game_dueling_starships/replay.txt b/samples/99_sample_game_dueling_starships/replay.txt new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/samples/99_sample_game_dueling_starships/replay.txt @@ -0,0 +1,2383 @@ +replay_version 2.0 +stopped_at 2733 +seed 100 +recorded_at Sun Sep 29 23:29:44 2019 +[:mouse_move, 10, 536, 2, 1, 76] +[:mouse_move, 26, 536, 2, 2, 77] +[:mouse_move, 41, 536, 2, 3, 78] +[:mouse_move, 49, 536, 2, 4, 79] +[:mouse_move, 56, 536, 2, 5, 80] +[:mouse_move, 60, 535, 2, 6, 81] +[:mouse_move, 62, 534, 2, 7, 82] +[:mouse_move, 66, 533, 2, 8, 83] +[:mouse_move, 67, 533, 2, 9, 84] +[:mouse_move, 69, 531, 2, 10, 85] +[:mouse_move, 70, 531, 2, 11, 86] +[:mouse_move, 71, 530, 2, 12, 87] +[:mouse_move, 72, 529, 2, 13, 88] +[:mouse_move, 73, 529, 2, 14, 89] +[:mouse_move, 71, 532, 2, 15, 107] +[:mouse_move, 68, 544, 2, 16, 108] +[:mouse_move, 65, 553, 2, 17, 109] +[:mouse_move, 59, 576, 2, 18, 110] +[:mouse_move, 56, 590, 2, 19, 111] +[:mouse_move, 50, 620, 2, 20, 112] +[:mouse_move, 48, 635, 2, 21, 113] +[:mouse_move, 47, 645, 2, 22, 114] +[:mouse_move, 45, 653, 2, 23, 115] +[:mouse_move, 44, 659, 2, 24, 116] +[:mouse_move, 42, 665, 2, 25, 117] +[:mouse_move, 41, 667, 2, 26, 118] +[:mouse_move, 40, 668, 2, 27, 119] +[:mouse_move, 39, 669, 2, 28, 120] +[:mouse_move, 38, 669, 2, 29, 124] +[:mouse_move, 38, 672, 2, 30, 127] +[:mouse_move, 38, 674, 2, 31, 128] +[:mouse_move, 36, 680, 2, 32, 129] +[:mouse_move, 35, 683, 2, 33, 130] +[:mouse_move, 32, 689, 2, 34, 131] +[:mouse_move, 31, 692, 2, 35, 132] +[:mouse_move, 28, 699, 2, 36, 133] +[:mouse_move, 28, 700, 2, 37, 134] +[:mouse_move, 27, 704, 2, 38, 135] +[:mouse_move, 27, 705, 2, 39, 136] +[:mouse_move, 27, 707, 2, 40, 137] +[:mouse_move, 29, 707, 2, 41, 139] +[:mouse_move, 30, 707, 2, 42, 140] +[:mouse_move, 35, 707, 2, 43, 141] +[:mouse_move, 37, 707, 2, 44, 142] +[:mouse_move, 42, 708, 2, 45, 143] +[:mouse_move, 45, 709, 2, 46, 144] +[:mouse_move, 46, 710, 2, 47, 145] +[:mouse_move, 48, 711, 2, 48, 146] +[:mouse_move, 49, 711, 2, 49, 158] +[:mouse_move, 50, 711, 2, 50, 159] +[:mouse_move, 56, 711, 2, 51, 160] +[:mouse_move, 60, 711, 2, 52, 161] +[:mouse_move, 77, 711, 2, 53, 162] +[:mouse_move, 90, 711, 2, 54, 163] +[:mouse_move, 118, 711, 2, 55, 164] +[:mouse_move, 124, 711, 2, 56, 165] +[:mouse_move, 148, 711, 2, 57, 166] +[:mouse_move, 160, 711, 2, 58, 167] +[:mouse_move, 181, 709, 2, 59, 168] +[:mouse_move, 190, 709, 2, 60, 169] +[:mouse_move, 201, 708, 2, 61, 170] +[:mouse_move, 206, 708, 2, 62, 171] +[:mouse_move, 211, 707, 2, 63, 172] +[:mouse_move, 218, 707, 2, 64, 173] +[:mouse_move, 221, 707, 2, 65, 174] +[:mouse_move, 225, 707, 2, 66, 175] +[:mouse_move, 227, 707, 2, 67, 176] +[:mouse_move, 232, 707, 2, 68, 177] +[:mouse_move, 234, 707, 2, 69, 178] +[:mouse_move, 240, 707, 2, 70, 179] +[:mouse_move, 244, 707, 2, 71, 180] +[:mouse_move, 252, 707, 2, 72, 181] +[:mouse_move, 258, 707, 2, 73, 182] +[:mouse_move, 269, 707, 2, 74, 183] +[:mouse_move, 274, 706, 2, 75, 184] +[:mouse_move, 285, 706, 2, 76, 185] +[:mouse_move, 291, 705, 2, 77, 186] +[:mouse_move, 304, 705, 2, 78, 187] +[:mouse_move, 310, 705, 2, 79, 188] +[:mouse_move, 323, 704, 2, 80, 189] +[:mouse_move, 329, 703, 2, 81, 190] +[:mouse_move, 343, 700, 2, 82, 191] +[:mouse_move, 355, 698, 2, 83, 192] +[:mouse_move, 366, 697, 2, 84, 193] +[:mouse_move, 373, 697, 2, 85, 194] +[:mouse_move, 384, 696, 2, 86, 195] +[:mouse_move, 390, 696, 2, 87, 196] +[:mouse_move, 391, 696, 2, 88, 197] +[:mouse_move, 392, 696, 2, 89, 217] +[:mouse_move, 400, 696, 2, 90, 218] +[:mouse_move, 404, 697, 2, 91, 219] +[:mouse_move, 413, 698, 2, 92, 220] +[:mouse_move, 417, 699, 2, 93, 221] +[:mouse_move, 438, 700, 2, 94, 222] +[:mouse_move, 449, 700, 2, 95, 223] +[:mouse_move, 473, 700, 2, 96, 224] +[:mouse_move, 485, 700, 2, 97, 225] +[:mouse_move, 497, 700, 2, 98, 226] +[:mouse_move, 514, 700, 2, 99, 227] +[:mouse_move, 524, 700, 2, 100, 228] +[:mouse_move, 539, 700, 2, 101, 229] +[:mouse_move, 545, 700, 2, 102, 230] +[:mouse_move, 555, 700, 2, 103, 231] +[:mouse_move, 557, 701, 2, 104, 232] +[:mouse_move, 568, 702, 2, 105, 233] +[:mouse_move, 572, 702, 2, 106, 234] +[:mouse_move, 581, 703, 2, 107, 235] +[:mouse_move, 586, 704, 2, 108, 236] +[:mouse_move, 598, 704, 2, 109, 237] +[:mouse_move, 604, 704, 2, 110, 238] +[:mouse_move, 620, 704, 2, 111, 239] +[:mouse_move, 634, 704, 2, 112, 240] +[:mouse_move, 654, 704, 2, 113, 241] +[:mouse_move, 665, 702, 2, 114, 242] +[:mouse_move, 681, 701, 2, 115, 243] +[:mouse_move, 701, 698, 2, 116, 244] +[:mouse_move, 726, 696, 2, 117, 245] +[:mouse_move, 740, 695, 2, 118, 246] +[:mouse_move, 772, 695, 2, 119, 247] +[:mouse_move, 788, 695, 2, 120, 248] +[:mouse_move, 806, 694, 2, 121, 249] +[:mouse_move, 808, 694, 2, 122, 270] +[:mouse_move, 810, 695, 2, 123, 271] +[:mouse_move, 815, 698, 2, 124, 272] +[:mouse_move, 820, 699, 2, 125, 273] +[:mouse_move, 833, 703, 2, 126, 274] +[:mouse_move, 840, 704, 2, 127, 275] +[:mouse_move, 851, 707, 2, 128, 276] +[:mouse_move, 856, 707, 2, 129, 277] +[:mouse_move, 864, 708, 2, 130, 278] +[:mouse_move, 867, 708, 2, 131, 279] +[:mouse_move, 869, 708, 2, 132, 280] +[:mouse_move, 875, 708, 2, 133, 281] +[:mouse_move, 876, 708, 2, 134, 282] +[:mouse_move, 880, 708, 2, 135, 283] +[:mouse_move, 881, 708, 2, 136, 284] +[:mouse_move, 883, 708, 2, 137, 285] +[:mouse_move, 884, 708, 2, 138, 286] +[:mouse_move, 885, 708, 2, 139, 287] +[:mouse_move, 886, 708, 2, 140, 288] +[:mouse_move, 887, 708, 2, 141, 290] +[:mouse_move, 889, 708, 2, 142, 291] +[:mouse_move, 890, 708, 2, 143, 292] +[:mouse_move, 893, 708, 2, 144, 293] +[:mouse_move, 894, 708, 2, 145, 294] +[:mouse_move, 896, 708, 2, 146, 295] +[:mouse_move, 897, 708, 2, 147, 296] +[:mouse_move, 899, 708, 2, 148, 297] +[:mouse_move, 900, 708, 2, 149, 299] +[:mouse_move, 901, 708, 2, 150, 301] +[:mouse_move, 902, 708, 2, 151, 305] +[:mouse_move, 903, 708, 2, 152, 309] +[:mouse_move, 905, 708, 2, 153, 310] +[:mouse_move, 906, 708, 2, 154, 311] +[:mouse_move, 911, 708, 2, 155, 312] +[:mouse_move, 914, 709, 2, 156, 313] +[:mouse_move, 922, 710, 2, 157, 314] +[:mouse_move, 925, 710, 2, 158, 315] +[:mouse_move, 933, 711, 2, 159, 316] +[:mouse_move, 937, 711, 2, 160, 317] +[:mouse_move, 944, 712, 2, 161, 318] +[:mouse_move, 947, 713, 2, 162, 319] +[:mouse_move, 954, 713, 2, 163, 320] +[:mouse_move, 956, 713, 2, 164, 321] +[:mouse_move, 962, 714, 2, 165, 322] +[:mouse_move, 967, 714, 2, 166, 323] +[:mouse_move, 973, 714, 2, 167, 324] +[:mouse_move, 976, 714, 2, 168, 325] +[:mouse_move, 981, 714, 2, 169, 326] +[:mouse_move, 983, 714, 2, 170, 327] +[:mouse_move, 989, 715, 2, 171, 328] +[:mouse_move, 992, 715, 2, 172, 329] +[:mouse_move, 996, 716, 2, 173, 330] +[:mouse_move, 1000, 716, 2, 174, 331] +[:mouse_move, 1004, 716, 2, 175, 332] +[:mouse_move, 1007, 717, 2, 176, 333] +[:mouse_move, 1010, 717, 2, 177, 334] +[:mouse_move, 1017, 719, 2, 178, 335] +[:mouse_move, 1021, 719, 2, 179, 336] +[:mouse_move, 1029, 719, 2, 180, 337] +[:mouse_move, 1169, 719, 2, 181, 365] +[:mouse_move, 1170, 719, 2, 182, 367] +[:mouse_move, 1171, 718, 2, 183, 368] +[:mouse_move, 1172, 718, 2, 184, 369] +[:mouse_move, 1172, 717, 2, 185, 371] +[:mouse_move, 1173, 717, 2, 186, 371] +[:mouse_move, 1173, 716, 2, 187, 373] +[:mouse_move, 1174, 716, 2, 188, 373] +[:mouse_move, 1175, 715, 2, 189, 375] +[:mouse_move, 1175, 714, 2, 190, 376] +[:mouse_move, 1175, 710, 2, 191, 377] +[:mouse_move, 1173, 691, 2, 192, 378] +[:mouse_move, 1167, 676, 2, 193, 379] +[:mouse_move, 1143, 633, 2, 194, 380] +[:mouse_move, 1112, 591, 2, 195, 381] +[:mouse_move, 1069, 547, 2, 196, 382] +[:mouse_move, 1057, 537, 2, 197, 383] +[:mouse_move, 1026, 510, 2, 198, 384] +[:mouse_move, 1021, 505, 2, 199, 385] +[:mouse_move, 1002, 490, 2, 200, 386] +[:mouse_move, 998, 487, 2, 201, 387] +[:mouse_move, 996, 484, 2, 202, 388] +[:mouse_move, 994, 483, 2, 203, 388] +[:mouse_move, 993, 482, 2, 204, 389] +[:mouse_move, 993, 481, 2, 205, 395] +[:mouse_move, 992, 481, 2, 206, 398] +[:mouse_move, 991, 480, 2, 207, 399] +[:mouse_move, 990, 480, 2, 208, 400] +[:mouse_move, 987, 478, 2, 209, 400] +[:mouse_move, 983, 475, 2, 210, 401] +[:mouse_move, 977, 472, 2, 211, 402] +[:mouse_move, 974, 471, 2, 212, 402] +[:mouse_move, 968, 467, 2, 213, 403] +[:mouse_move, 963, 465, 2, 214, 404] +[:mouse_move, 956, 463, 2, 215, 404] +[:mouse_move, 951, 461, 2, 216, 405] +[:mouse_move, 949, 460, 2, 217, 406] +[:mouse_move, 942, 459, 2, 218, 407] +[:mouse_move, 940, 458, 2, 219, 408] +[:mouse_move, 937, 458, 2, 220, 409] +[:mouse_move, 936, 458, 2, 221, 410] +[:mouse_move, 935, 458, 2, 222, 412] +[:mouse_button_pressed, 1, 0, 1, 223, 415] +[:mouse_button_up, 1, 0, 1, 224, 423] +[:key_down_player_two, 3, 0, 1, 225, 458] +[:key_down_player_two, 26, 0, 1, 226, 458] +[:key_held_player_two, 3, 0, 1, 227, 459] +[:key_held_player_two, 26, 0, 1, 228, 459] +[:key_held_player_two, 3, 0, 1, 229, 460] +[:key_held_player_two, 26, 0, 1, 230, 460] +[:key_held_player_two, 3, 0, 1, 231, 461] +[:key_held_player_two, 26, 0, 1, 232, 461] +[:key_held_player_two, 3, 0, 1, 233, 462] +[:key_held_player_two, 26, 0, 1, 234, 462] +[:key_held_player_two, 3, 0, 1, 235, 463] +[:key_held_player_two, 26, 0, 1, 236, 463] +[:key_held_player_two, 3, 0, 1, 237, 464] +[:key_held_player_two, 26, 0, 1, 238, 464] +[:key_held_player_two, 3, 0, 1, 239, 465] +[:key_held_player_two, 26, 0, 1, 240, 465] +[:key_held_player_two, 3, 0, 1, 241, 466] +[:key_held_player_two, 26, 0, 1, 242, 466] +[:key_held_player_two, 3, 0, 1, 243, 467] +[:key_held_player_two, 26, 0, 1, 244, 467] +[:key_held_player_two, 3, 0, 1, 245, 468] +[:key_held_player_two, 26, 0, 1, 246, 468] +[:key_held_player_two, 3, 0, 1, 247, 469] +[:key_held_player_two, 26, 0, 1, 248, 469] +[:key_held_player_two, 3, 0, 1, 249, 470] +[:key_held_player_two, 26, 0, 1, 250, 470] +[:key_held_player_two, 3, 0, 1, 251, 471] +[:key_held_player_two, 26, 0, 1, 252, 471] +[:key_held_player_two, 3, 0, 1, 253, 472] +[:key_held_player_two, 26, 0, 1, 254, 472] +[:key_held_player_two, 3, 0, 1, 255, 473] +[:key_held_player_two, 26, 0, 1, 256, 473] +[:key_held_player_two, 3, 0, 1, 257, 474] +[:key_held_player_two, 26, 0, 1, 258, 474] +[:key_held_player_two, 3, 0, 1, 259, 475] +[:key_held_player_two, 26, 0, 1, 260, 475] +[:key_held_player_two, 3, 0, 1, 261, 476] +[:key_held_player_two, 26, 0, 1, 262, 476] +[:key_held_player_two, 3, 0, 1, 263, 477] +[:key_held_player_two, 26, 0, 1, 264, 477] +[:key_up_player_two, 3, 0, 1, 265, 478] +[:key_up_player_two, 26, 0, 1, 266, 478] +[:mouse_button_pressed, 1, 0, 1, 267, 527] +[:mouse_button_up, 1, 0, 1, 268, 534] +[:key_down_player_two, 3, 0, 1, 269, 542] +[:key_down_player_two, 26, 0, 1, 270, 542] +[:key_held_player_two, 3, 0, 1, 271, 543] +[:key_held_player_two, 26, 0, 1, 272, 543] +[:key_held_player_two, 3, 0, 1, 273, 544] +[:key_held_player_two, 26, 0, 1, 274, 544] +[:key_held_player_two, 3, 0, 1, 275, 545] +[:key_held_player_two, 26, 0, 1, 276, 545] +[:key_held_player_two, 3, 0, 1, 277, 546] +[:key_held_player_two, 26, 0, 1, 278, 546] +[:key_held_player_two, 3, 0, 1, 279, 547] +[:key_held_player_two, 26, 0, 1, 280, 547] +[:key_held_player_two, 3, 0, 1, 281, 548] +[:key_held_player_two, 26, 0, 1, 282, 548] +[:key_held_player_two, 3, 0, 1, 283, 549] +[:key_held_player_two, 26, 0, 1, 284, 549] +[:key_held_player_two, 3, 0, 1, 285, 550] +[:key_held_player_two, 26, 0, 1, 286, 550] +[:key_held_player_two, 3, 0, 1, 287, 551] +[:key_held_player_two, 26, 0, 1, 288, 551] +[:key_held_player_two, 3, 0, 1, 289, 552] +[:key_held_player_two, 26, 0, 1, 290, 552] +[:key_held_player_two, 3, 0, 1, 291, 553] +[:key_held_player_two, 26, 0, 1, 292, 553] +[:key_held_player_two, 3, 0, 1, 293, 554] +[:key_held_player_two, 26, 0, 1, 294, 554] +[:key_held_player_two, 3, 0, 1, 295, 555] +[:key_held_player_two, 26, 0, 1, 296, 555] +[:key_held_player_two, 3, 0, 1, 297, 556] +[:key_held_player_two, 26, 0, 1, 298, 556] +[:key_held_player_two, 3, 0, 1, 299, 557] +[:key_held_player_two, 26, 0, 1, 300, 557] +[:key_up_player_two, 3, 0, 1, 301, 558] +[:key_up_player_two, 26, 0, 1, 302, 558] +[:key_down_player_two, 4, 0, 1, 303, 562] +[:key_down_player_two, 27, 0, 1, 304, 562] +[:key_held_player_two, 4, 0, 1, 305, 563] +[:key_held_player_two, 27, 0, 1, 306, 563] +[:key_held_player_two, 4, 0, 1, 307, 564] +[:key_held_player_two, 27, 0, 1, 308, 564] +[:key_held_player_two, 4, 0, 1, 309, 565] +[:key_held_player_two, 27, 0, 1, 310, 565] +[:key_held_player_two, 4, 0, 1, 311, 566] +[:key_held_player_two, 27, 0, 1, 312, 566] +[:key_held_player_two, 4, 0, 1, 313, 567] +[:key_held_player_two, 27, 0, 1, 314, 567] +[:key_held_player_two, 4, 0, 1, 315, 568] +[:key_held_player_two, 27, 0, 1, 316, 568] +[:key_held_player_two, 4, 0, 1, 317, 569] +[:key_held_player_two, 27, 0, 1, 318, 569] +[:key_held_player_two, 4, 0, 1, 319, 570] +[:key_held_player_two, 27, 0, 1, 320, 570] +[:key_held_player_two, 4, 0, 1, 321, 571] +[:key_held_player_two, 27, 0, 1, 322, 571] +[:key_held_player_two, 4, 0, 1, 323, 572] +[:key_held_player_two, 27, 0, 1, 324, 572] +[:key_down_player_two, 1, 0, 1, 325, 573] +[:key_held_player_two, 4, 0, 1, 326, 573] +[:key_down_player_two, 24, 0, 1, 327, 573] +[:key_held_player_two, 27, 0, 1, 328, 573] +[:key_held_player_two, 1, 0, 1, 329, 574] +[:key_held_player_two, 4, 0, 1, 330, 574] +[:key_held_player_two, 24, 0, 1, 331, 574] +[:key_held_player_two, 27, 0, 1, 332, 574] +[:key_held_player_two, 1, 0, 1, 333, 575] +[:key_held_player_two, 4, 0, 1, 334, 575] +[:key_held_player_two, 24, 0, 1, 335, 575] +[:key_held_player_two, 27, 0, 1, 336, 575] +[:key_held_player_two, 1, 0, 1, 337, 576] +[:key_held_player_two, 4, 0, 1, 338, 576] +[:key_held_player_two, 24, 0, 1, 339, 576] +[:key_held_player_two, 27, 0, 1, 340, 576] +[:key_held_player_two, 1, 0, 1, 341, 577] +[:key_held_player_two, 4, 0, 1, 342, 577] +[:key_held_player_two, 24, 0, 1, 343, 577] +[:key_held_player_two, 27, 0, 1, 344, 577] +[:key_up_player_two, 1, 0, 1, 345, 578] +[:key_held_player_two, 4, 0, 1, 346, 578] +[:key_up_player_two, 24, 0, 1, 347, 578] +[:key_held_player_two, 27, 0, 1, 348, 578] +[:key_held_player_two, 4, 0, 1, 349, 579] +[:key_held_player_two, 27, 0, 1, 350, 579] +[:key_held_player_two, 4, 0, 1, 351, 580] +[:key_held_player_two, 27, 0, 1, 352, 580] +[:key_held_player_two, 4, 0, 1, 353, 581] +[:key_held_player_two, 27, 0, 1, 354, 581] +[:key_held_player_two, 4, 0, 1, 355, 582] +[:key_held_player_two, 27, 0, 1, 356, 582] +[:key_held_player_two, 4, 0, 1, 357, 583] +[:key_held_player_two, 27, 0, 1, 358, 583] +[:key_held_player_two, 4, 0, 1, 359, 584] +[:key_held_player_two, 27, 0, 1, 360, 584] +[:key_held_player_two, 4, 0, 1, 361, 585] +[:key_held_player_two, 27, 0, 1, 362, 585] +[:key_held_player_two, 4, 0, 1, 363, 586] +[:key_held_player_two, 27, 0, 1, 364, 586] +[:key_held_player_two, 4, 0, 1, 365, 587] +[:key_held_player_two, 27, 0, 1, 366, 587] +[:key_held_player_two, 4, 0, 1, 367, 588] +[:key_held_player_two, 27, 0, 1, 368, 588] +[:key_held_player_two, 4, 0, 1, 369, 589] +[:key_held_player_two, 27, 0, 1, 370, 589] +[:key_held_player_two, 4, 0, 1, 371, 590] +[:key_held_player_two, 27, 0, 1, 372, 590] +[:key_held_player_two, 4, 0, 1, 373, 591] +[:key_held_player_two, 27, 0, 1, 374, 591] +[:key_held_player_two, 4, 0, 1, 375, 592] +[:key_held_player_two, 27, 0, 1, 376, 592] +[:key_held_player_two, 4, 0, 1, 377, 593] +[:key_held_player_two, 27, 0, 1, 378, 593] +[:key_held_player_two, 4, 0, 1, 379, 594] +[:key_held_player_two, 27, 0, 1, 380, 594] +[:key_held_player_two, 4, 0, 1, 381, 595] +[:key_held_player_two, 27, 0, 1, 382, 595] +[:key_held_player_two, 4, 0, 1, 383, 596] +[:key_held_player_two, 27, 0, 1, 384, 596] +[:key_up_player_two, 4, 0, 1, 385, 597] +[:key_up_player_two, 27, 0, 1, 386, 597] +[:key_down_player_two, 3, 0, 1, 387, 603] +[:key_down_player_two, 26, 0, 1, 388, 603] +[:key_held_player_two, 3, 0, 1, 389, 604] +[:key_held_player_two, 26, 0, 1, 390, 604] +[:key_held_player_two, 3, 0, 1, 391, 605] +[:key_held_player_two, 26, 0, 1, 392, 605] +[:key_held_player_two, 3, 0, 1, 393, 606] +[:key_held_player_two, 26, 0, 1, 394, 606] +[:key_held_player_two, 3, 0, 1, 395, 607] +[:key_held_player_two, 26, 0, 1, 396, 607] +[:key_held_player_two, 3, 0, 1, 397, 608] +[:key_held_player_two, 26, 0, 1, 398, 608] +[:key_held_player_two, 3, 0, 1, 399, 609] +[:key_held_player_two, 26, 0, 1, 400, 609] +[:key_held_player_two, 3, 0, 1, 401, 610] +[:key_held_player_two, 26, 0, 1, 402, 610] +[:key_held_player_two, 3, 0, 1, 403, 611] +[:key_held_player_two, 26, 0, 1, 404, 611] +[:key_held_player_two, 3, 0, 1, 405, 612] +[:key_held_player_two, 26, 0, 1, 406, 612] +[:key_held_player_two, 3, 0, 1, 407, 613] +[:key_held_player_two, 26, 0, 1, 408, 613] +[:key_held_player_two, 3, 0, 1, 409, 614] +[:key_held_player_two, 26, 0, 1, 410, 614] +[:key_held_player_two, 3, 0, 1, 411, 615] +[:key_held_player_two, 26, 0, 1, 412, 615] +[:key_held_player_two, 3, 0, 1, 413, 616] +[:key_held_player_two, 26, 0, 1, 414, 616] +[:key_held_player_two, 3, 0, 1, 415, 617] +[:key_down_player_two, 19, 0, 1, 416, 617] +[:key_held_player_two, 26, 0, 1, 417, 617] +[:key_held_player_two, 3, 0, 1, 418, 618] +[:key_held_player_two, 19, 0, 1, 419, 618] +[:key_held_player_two, 26, 0, 1, 420, 618] +[:key_held_player_two, 3, 0, 1, 421, 619] +[:key_held_player_two, 19, 0, 1, 422, 619] +[:key_held_player_two, 26, 0, 1, 423, 619] +[:key_held_player_two, 3, 0, 1, 424, 620] +[:key_held_player_two, 19, 0, 1, 425, 620] +[:key_held_player_two, 26, 0, 1, 426, 620] +[:key_held_player_two, 3, 0, 1, 427, 621] +[:key_held_player_two, 19, 0, 1, 428, 621] +[:key_held_player_two, 26, 0, 1, 429, 621] +[:key_up_player_two, 3, 0, 1, 430, 622] +[:key_held_player_two, 19, 0, 1, 431, 622] +[:key_up_player_two, 26, 0, 1, 432, 622] +[:key_held_player_two, 19, 0, 1, 433, 623] +[:key_held_player_two, 19, 0, 1, 434, 624] +[:key_held_player_two, 19, 0, 1, 435, 625] +[:key_held_player_two, 19, 0, 1, 436, 626] +[:key_held_player_two, 19, 0, 1, 437, 627] +[:key_held_player_two, 19, 0, 1, 438, 628] +[:key_held_player_two, 19, 0, 1, 439, 629] +[:key_held_player_two, 19, 0, 1, 440, 630] +[:key_down_player_two, 4, 0, 1, 441, 631] +[:key_held_player_two, 19, 0, 1, 442, 631] +[:key_down_player_two, 27, 0, 1, 443, 631] +[:key_held_player_two, 4, 0, 1, 444, 632] +[:key_held_player_two, 19, 0, 1, 445, 632] +[:key_held_player_two, 27, 0, 1, 446, 632] +[:key_held_player_two, 4, 0, 1, 447, 633] +[:key_held_player_two, 19, 0, 1, 448, 633] +[:key_held_player_two, 27, 0, 1, 449, 633] +[:key_held_player_two, 4, 0, 1, 450, 634] +[:key_held_player_two, 19, 0, 1, 451, 634] +[:key_held_player_two, 27, 0, 1, 452, 634] +[:key_held_player_two, 4, 0, 1, 453, 635] +[:key_held_player_two, 19, 0, 1, 454, 635] +[:key_held_player_two, 27, 0, 1, 455, 635] +[:key_held_player_two, 4, 0, 1, 456, 636] +[:key_held_player_two, 19, 0, 1, 457, 636] +[:key_held_player_two, 27, 0, 1, 458, 636] +[:key_held_player_two, 4, 0, 1, 459, 637] +[:key_held_player_two, 19, 0, 1, 460, 637] +[:key_held_player_two, 27, 0, 1, 461, 637] +[:key_held_player_two, 4, 0, 1, 462, 638] +[:key_held_player_two, 19, 0, 1, 463, 638] +[:key_held_player_two, 27, 0, 1, 464, 638] +[:key_held_player_two, 4, 0, 1, 465, 639] +[:key_held_player_two, 19, 0, 1, 466, 639] +[:key_held_player_two, 27, 0, 1, 467, 639] +[:key_held_player_two, 4, 0, 1, 468, 640] +[:key_held_player_two, 19, 0, 1, 469, 640] +[:key_held_player_two, 27, 0, 1, 470, 640] +[:key_held_player_two, 4, 0, 1, 471, 641] +[:key_held_player_two, 19, 0, 1, 472, 641] +[:key_held_player_two, 27, 0, 1, 473, 641] +[:key_held_player_two, 4, 0, 1, 474, 642] +[:key_held_player_two, 19, 0, 1, 475, 642] +[:key_held_player_two, 27, 0, 1, 476, 642] +[:key_held_player_two, 4, 0, 1, 477, 643] +[:key_held_player_two, 19, 0, 1, 478, 643] +[:key_held_player_two, 27, 0, 1, 479, 643] +[:key_held_player_two, 4, 0, 1, 480, 644] +[:key_held_player_two, 19, 0, 1, 481, 644] +[:key_held_player_two, 27, 0, 1, 482, 644] +[:key_held_player_two, 4, 0, 1, 483, 645] +[:key_held_player_two, 19, 0, 1, 484, 645] +[:key_held_player_two, 27, 0, 1, 485, 645] +[:key_held_player_two, 4, 0, 1, 486, 646] +[:key_held_player_two, 19, 0, 1, 487, 646] +[:key_held_player_two, 27, 0, 1, 488, 646] +[:key_held_player_two, 4, 0, 1, 489, 647] +[:key_held_player_two, 19, 0, 1, 490, 647] +[:key_held_player_two, 27, 0, 1, 491, 647] +[:key_held_player_two, 4, 0, 1, 492, 648] +[:key_held_player_two, 19, 0, 1, 493, 648] +[:key_held_player_two, 27, 0, 1, 494, 648] +[:key_held_player_two, 4, 0, 1, 495, 649] +[:key_held_player_two, 19, 0, 1, 496, 649] +[:key_held_player_two, 27, 0, 1, 497, 649] +[:key_held_player_two, 4, 0, 1, 498, 650] +[:key_held_player_two, 19, 0, 1, 499, 650] +[:key_held_player_two, 27, 0, 1, 500, 650] +[:key_held_player_two, 4, 0, 1, 501, 651] +[:key_held_player_two, 19, 0, 1, 502, 651] +[:key_held_player_two, 27, 0, 1, 503, 651] +[:key_held_player_two, 4, 0, 1, 504, 652] +[:key_held_player_two, 19, 0, 1, 505, 652] +[:key_held_player_two, 27, 0, 1, 506, 652] +[:key_down_player_two, 1, 0, 1, 507, 653] +[:key_held_player_two, 4, 0, 1, 508, 653] +[:key_held_player_two, 19, 0, 1, 509, 653] +[:key_down_player_two, 24, 0, 1, 510, 653] +[:key_held_player_two, 27, 0, 1, 511, 653] +[:key_held_player_two, 1, 0, 1, 512, 654] +[:key_held_player_two, 4, 0, 1, 513, 654] +[:key_held_player_two, 19, 0, 1, 514, 654] +[:key_held_player_two, 24, 0, 1, 515, 654] +[:key_held_player_two, 27, 0, 1, 516, 654] +[:key_held_player_two, 1, 0, 1, 517, 655] +[:key_held_player_two, 4, 0, 1, 518, 655] +[:key_held_player_two, 19, 0, 1, 519, 655] +[:key_held_player_two, 24, 0, 1, 520, 655] +[:key_held_player_two, 27, 0, 1, 521, 655] +[:key_up_player_two, 1, 0, 1, 522, 656] +[:key_up_player_two, 4, 0, 1, 523, 656] +[:key_held_player_two, 19, 0, 1, 524, 656] +[:key_up_player_two, 24, 0, 1, 525, 656] +[:key_up_player_two, 27, 0, 1, 526, 656] +[:key_held_player_two, 19, 0, 1, 527, 657] +[:key_held_player_two, 19, 0, 1, 528, 658] +[:key_held_player_two, 19, 0, 1, 529, 659] +[:key_held_player_two, 19, 0, 1, 530, 660] +[:key_held_player_two, 19, 0, 1, 531, 661] +[:key_held_player_two, 19, 0, 1, 532, 662] +[:key_held_player_two, 19, 0, 1, 533, 663] +[:key_held_player_two, 19, 0, 1, 534, 664] +[:key_down_player_two, 3, 0, 1, 535, 665] +[:key_held_player_two, 19, 0, 1, 536, 665] +[:key_down_player_two, 26, 0, 1, 537, 665] +[:key_held_player_two, 3, 0, 1, 538, 666] +[:key_held_player_two, 19, 0, 1, 539, 666] +[:key_held_player_two, 26, 0, 1, 540, 666] +[:key_held_player_two, 3, 0, 1, 541, 667] +[:key_held_player_two, 19, 0, 1, 542, 667] +[:key_held_player_two, 26, 0, 1, 543, 667] +[:key_held_player_two, 3, 0, 1, 544, 668] +[:key_held_player_two, 19, 0, 1, 545, 668] +[:key_held_player_two, 26, 0, 1, 546, 668] +[:key_held_player_two, 3, 0, 1, 547, 669] +[:key_held_player_two, 19, 0, 1, 548, 669] +[:key_held_player_two, 26, 0, 1, 549, 669] +[:key_held_player_two, 3, 0, 1, 550, 670] +[:key_held_player_two, 19, 0, 1, 551, 670] +[:key_held_player_two, 26, 0, 1, 552, 670] +[:key_held_player_two, 3, 0, 1, 553, 671] +[:key_down_player_two, 14, 0, 1, 554, 671] +[:key_held_player_two, 19, 0, 1, 555, 671] +[:key_held_player_two, 26, 0, 1, 556, 671] +[:key_held_player_two, 3, 0, 1, 557, 672] +[:key_held_player_two, 14, 0, 1, 558, 672] +[:key_held_player_two, 19, 0, 1, 559, 672] +[:key_held_player_two, 26, 0, 1, 560, 672] +[:key_held_player_two, 3, 0, 1, 561, 673] +[:key_held_player_two, 14, 0, 1, 562, 673] +[:key_held_player_two, 19, 0, 1, 563, 673] +[:key_held_player_two, 26, 0, 1, 564, 673] +[:key_held_player_two, 3, 0, 1, 565, 674] +[:key_held_player_two, 14, 0, 1, 566, 674] +[:key_held_player_two, 19, 0, 1, 567, 674] +[:key_held_player_two, 26, 0, 1, 568, 674] +[:key_held_player_two, 3, 0, 1, 569, 675] +[:key_held_player_two, 14, 0, 1, 570, 675] +[:key_held_player_two, 19, 0, 1, 571, 675] +[:key_held_player_two, 26, 0, 1, 572, 675] +[:key_held_player_two, 3, 0, 1, 573, 676] +[:key_held_player_two, 14, 0, 1, 574, 676] +[:key_held_player_two, 19, 0, 1, 575, 676] +[:key_held_player_two, 26, 0, 1, 576, 676] +[:key_held_player_two, 3, 0, 1, 577, 677] +[:key_held_player_two, 14, 0, 1, 578, 677] +[:key_held_player_two, 19, 0, 1, 579, 677] +[:key_held_player_two, 26, 0, 1, 580, 677] +[:key_held_player_two, 3, 0, 1, 581, 678] +[:key_held_player_two, 14, 0, 1, 582, 678] +[:key_held_player_two, 19, 0, 1, 583, 678] +[:key_held_player_two, 26, 0, 1, 584, 678] +[:key_held_player_two, 3, 0, 1, 585, 679] +[:key_held_player_two, 14, 0, 1, 586, 679] +[:key_held_player_two, 19, 0, 1, 587, 679] +[:key_held_player_two, 26, 0, 1, 588, 679] +[:key_held_player_two, 3, 0, 1, 589, 680] +[:key_held_player_two, 14, 0, 1, 590, 680] +[:key_held_player_two, 19, 0, 1, 591, 680] +[:key_held_player_two, 26, 0, 1, 592, 680] +[:key_held_player_two, 3, 0, 1, 593, 681] +[:key_held_player_two, 14, 0, 1, 594, 681] +[:key_held_player_two, 19, 0, 1, 595, 681] +[:key_held_player_two, 26, 0, 1, 596, 681] +[:key_held_player_two, 3, 0, 1, 597, 682] +[:key_held_player_two, 14, 0, 1, 598, 682] +[:key_held_player_two, 19, 0, 1, 599, 682] +[:key_held_player_two, 26, 0, 1, 600, 682] +[:key_held_player_two, 3, 0, 1, 601, 683] +[:key_held_player_two, 14, 0, 1, 602, 683] +[:key_held_player_two, 19, 0, 1, 603, 683] +[:key_held_player_two, 26, 0, 1, 604, 683] +[:key_held_player_two, 3, 0, 1, 605, 684] +[:key_held_player_two, 14, 0, 1, 606, 684] +[:key_held_player_two, 19, 0, 1, 607, 684] +[:key_held_player_two, 26, 0, 1, 608, 684] +[:key_held_player_two, 3, 0, 1, 609, 685] +[:key_held_player_two, 14, 0, 1, 610, 685] +[:key_held_player_two, 19, 0, 1, 611, 685] +[:key_held_player_two, 26, 0, 1, 612, 685] +[:key_held_player_two, 3, 0, 1, 613, 686] +[:key_held_player_two, 14, 0, 1, 614, 686] +[:key_held_player_two, 19, 0, 1, 615, 686] +[:key_held_player_two, 26, 0, 1, 616, 686] +[:key_up_player_two, 3, 0, 1, 617, 687] +[:key_held_player_two, 14, 0, 1, 618, 687] +[:key_held_player_two, 19, 0, 1, 619, 687] +[:key_up_player_two, 26, 0, 1, 620, 687] +[:key_held_player_two, 14, 0, 1, 621, 688] +[:key_held_player_two, 19, 0, 1, 622, 688] +[:key_held_player_two, 14, 0, 1, 623, 689] +[:key_held_player_two, 19, 0, 1, 624, 689] +[:key_held_player_two, 14, 0, 1, 625, 690] +[:key_held_player_two, 19, 0, 1, 626, 690] +[:key_held_player_two, 14, 0, 1, 627, 691] +[:key_held_player_two, 19, 0, 1, 628, 691] +[:key_up_player_two, 14, 0, 1, 629, 692] +[:key_held_player_two, 19, 0, 1, 630, 692] +[:key_held_player_two, 19, 0, 1, 631, 693] +[:key_held_player_two, 19, 0, 1, 632, 694] +[:key_held_player_two, 19, 0, 1, 633, 695] +[:key_held_player_two, 19, 0, 1, 634, 696] +[:key_held_player_two, 19, 0, 1, 635, 697] +[:key_held_player_two, 19, 0, 1, 636, 698] +[:key_down_player_two, 14, 0, 1, 637, 699] +[:key_held_player_two, 19, 0, 1, 638, 699] +[:key_held_player_two, 14, 0, 1, 639, 700] +[:key_held_player_two, 19, 0, 1, 640, 700] +[:key_held_player_two, 14, 0, 1, 641, 701] +[:key_held_player_two, 19, 0, 1, 642, 701] +[:key_held_player_two, 14, 0, 1, 643, 702] +[:key_held_player_two, 19, 0, 1, 644, 702] +[:key_held_player_two, 14, 0, 1, 645, 703] +[:key_held_player_two, 19, 0, 1, 646, 703] +[:key_held_player_two, 14, 0, 1, 647, 704] +[:key_held_player_two, 19, 0, 1, 648, 704] +[:key_held_player_two, 14, 0, 1, 649, 705] +[:key_held_player_two, 19, 0, 1, 650, 705] +[:key_up_player_two, 14, 0, 1, 651, 706] +[:key_held_player_two, 19, 0, 1, 652, 706] +[:key_held_player_two, 19, 0, 1, 653, 707] +[:key_held_player_two, 19, 0, 1, 654, 708] +[:key_held_player_two, 19, 0, 1, 655, 709] +[:key_down_player_two, 4, 0, 1, 656, 710] +[:key_down_player_two, 14, 0, 1, 657, 710] +[:key_held_player_two, 19, 0, 1, 658, 710] +[:key_down_player_two, 27, 0, 1, 659, 710] +[:key_held_player_two, 4, 0, 1, 660, 711] +[:key_held_player_two, 14, 0, 1, 661, 711] +[:key_held_player_two, 19, 0, 1, 662, 711] +[:key_held_player_two, 27, 0, 1, 663, 711] +[:key_held_player_two, 4, 0, 1, 664, 712] +[:key_held_player_two, 14, 0, 1, 665, 712] +[:key_held_player_two, 19, 0, 1, 666, 712] +[:key_held_player_two, 27, 0, 1, 667, 712] +[:key_held_player_two, 4, 0, 1, 668, 713] +[:key_held_player_two, 14, 0, 1, 669, 713] +[:key_held_player_two, 19, 0, 1, 670, 713] +[:key_held_player_two, 27, 0, 1, 671, 713] +[:key_held_player_two, 4, 0, 1, 672, 714] +[:key_held_player_two, 14, 0, 1, 673, 714] +[:key_held_player_two, 19, 0, 1, 674, 714] +[:key_held_player_two, 27, 0, 1, 675, 714] +[:key_held_player_two, 4, 0, 1, 676, 715] +[:key_held_player_two, 14, 0, 1, 677, 715] +[:key_held_player_two, 19, 0, 1, 678, 715] +[:key_held_player_two, 27, 0, 1, 679, 715] +[:key_held_player_two, 4, 0, 1, 680, 716] +[:key_held_player_two, 14, 0, 1, 681, 716] +[:key_held_player_two, 19, 0, 1, 682, 716] +[:key_held_player_two, 27, 0, 1, 683, 716] +[:key_up_player_two, 4, 0, 1, 684, 717] +[:key_up_player_two, 14, 0, 1, 685, 717] +[:key_held_player_two, 19, 0, 1, 686, 717] +[:key_up_player_two, 27, 0, 1, 687, 717] +[:key_held_player_two, 19, 0, 1, 688, 718] +[:key_held_player_two, 19, 0, 1, 689, 719] +[:key_held_player_two, 19, 0, 1, 690, 720] +[:key_held_player_two, 19, 0, 1, 691, 721] +[:key_down_player_two, 14, 0, 1, 692, 722] +[:key_held_player_two, 19, 0, 1, 693, 722] +[:key_held_player_two, 14, 0, 1, 694, 723] +[:key_held_player_two, 19, 0, 1, 695, 723] +[:key_held_player_two, 14, 0, 1, 696, 724] +[:key_held_player_two, 19, 0, 1, 697, 724] +[:key_held_player_two, 14, 0, 1, 698, 725] +[:key_held_player_two, 19, 0, 1, 699, 725] +[:key_held_player_two, 14, 0, 1, 700, 726] +[:key_held_player_two, 19, 0, 1, 701, 726] +[:key_up_player_two, 14, 0, 1, 702, 727] +[:key_held_player_two, 19, 0, 1, 703, 727] +[:key_held_player_two, 19, 0, 1, 704, 728] +[:key_held_player_two, 19, 0, 1, 705, 729] +[:key_held_player_two, 19, 0, 1, 706, 730] +[:key_down_player_two, 14, 0, 1, 707, 731] +[:key_held_player_two, 19, 0, 1, 708, 731] +[:key_held_player_two, 14, 0, 1, 709, 732] +[:key_held_player_two, 19, 0, 1, 710, 732] +[:key_held_player_two, 14, 0, 1, 711, 733] +[:key_held_player_two, 19, 0, 1, 712, 733] +[:key_held_player_two, 14, 0, 1, 713, 734] +[:key_held_player_two, 19, 0, 1, 714, 734] +[:key_held_player_two, 14, 0, 1, 715, 735] +[:key_held_player_two, 19, 0, 1, 716, 735] +[:key_held_player_two, 14, 0, 1, 717, 736] +[:key_held_player_two, 19, 0, 1, 718, 736] +[:key_held_player_two, 14, 0, 1, 719, 737] +[:key_held_player_two, 19, 0, 1, 720, 737] +[:key_up_player_two, 14, 0, 1, 721, 738] +[:key_held_player_two, 19, 0, 1, 722, 738] +[:key_held_player_two, 19, 0, 1, 723, 739] +[:key_held_player_two, 19, 0, 1, 724, 740] +[:key_down_player_two, 14, 0, 1, 725, 741] +[:key_held_player_two, 19, 0, 1, 726, 741] +[:key_held_player_two, 14, 0, 1, 727, 742] +[:key_held_player_two, 19, 0, 1, 728, 742] +[:key_held_player_two, 14, 0, 1, 729, 743] +[:key_held_player_two, 19, 0, 1, 730, 743] +[:key_held_player_two, 14, 0, 1, 731, 744] +[:key_held_player_two, 19, 0, 1, 732, 744] +[:key_held_player_two, 14, 0, 1, 733, 745] +[:key_held_player_two, 19, 0, 1, 734, 745] +[:key_held_player_two, 14, 0, 1, 735, 746] +[:key_held_player_two, 19, 0, 1, 736, 746] +[:key_held_player_two, 14, 0, 1, 737, 747] +[:key_held_player_two, 19, 0, 1, 738, 747] +[:key_held_player_two, 14, 0, 1, 739, 748] +[:key_held_player_two, 19, 0, 1, 740, 748] +[:key_up_player_two, 14, 0, 1, 741, 749] +[:key_held_player_two, 19, 0, 1, 742, 749] +[:key_held_player_two, 19, 0, 1, 743, 750] +[:key_held_player_two, 19, 0, 1, 744, 751] +[:key_held_player_two, 19, 0, 1, 745, 752] +[:key_held_player_two, 19, 0, 1, 746, 753] +[:key_down_player_two, 4, 0, 1, 747, 754] +[:key_down_player_two, 14, 0, 1, 748, 754] +[:key_held_player_two, 19, 0, 1, 749, 754] +[:key_down_player_two, 27, 0, 1, 750, 754] +[:key_held_player_two, 4, 0, 1, 751, 755] +[:key_held_player_two, 14, 0, 1, 752, 755] +[:key_held_player_two, 19, 0, 1, 753, 755] +[:key_held_player_two, 27, 0, 1, 754, 755] +[:key_held_player_two, 4, 0, 1, 755, 756] +[:key_held_player_two, 14, 0, 1, 756, 756] +[:key_held_player_two, 19, 0, 1, 757, 756] +[:key_held_player_two, 27, 0, 1, 758, 756] +[:key_held_player_two, 4, 0, 1, 759, 757] +[:key_held_player_two, 14, 0, 1, 760, 757] +[:key_held_player_two, 19, 0, 1, 761, 757] +[:key_held_player_two, 27, 0, 1, 762, 757] +[:key_held_player_two, 4, 0, 1, 763, 758] +[:key_held_player_two, 14, 0, 1, 764, 758] +[:key_held_player_two, 19, 0, 1, 765, 758] +[:key_held_player_two, 27, 0, 1, 766, 758] +[:key_held_player_two, 4, 0, 1, 767, 759] +[:key_held_player_two, 14, 0, 1, 768, 759] +[:key_held_player_two, 19, 0, 1, 769, 759] +[:key_held_player_two, 27, 0, 1, 770, 759] +[:key_held_player_two, 4, 0, 1, 771, 760] +[:key_held_player_two, 14, 0, 1, 772, 760] +[:key_held_player_two, 19, 0, 1, 773, 760] +[:key_held_player_two, 27, 0, 1, 774, 760] +[:key_held_player_two, 4, 0, 1, 775, 761] +[:key_up_player_two, 14, 0, 1, 776, 761] +[:key_held_player_two, 19, 0, 1, 777, 761] +[:key_held_player_two, 27, 0, 1, 778, 761] +[:key_held_player_two, 4, 0, 1, 779, 762] +[:key_held_player_two, 19, 0, 1, 780, 762] +[:key_held_player_two, 27, 0, 1, 781, 762] +[:key_held_player_two, 4, 0, 1, 782, 763] +[:key_held_player_two, 19, 0, 1, 783, 763] +[:key_held_player_two, 27, 0, 1, 784, 763] +[:key_held_player_two, 4, 0, 1, 785, 764] +[:key_held_player_two, 19, 0, 1, 786, 764] +[:key_held_player_two, 27, 0, 1, 787, 764] +[:key_held_player_two, 4, 0, 1, 788, 765] +[:key_held_player_two, 19, 0, 1, 789, 765] +[:key_held_player_two, 27, 0, 1, 790, 765] +[:key_held_player_two, 4, 0, 1, 791, 766] +[:key_down_player_two, 14, 0, 1, 792, 766] +[:key_held_player_two, 19, 0, 1, 793, 766] +[:key_held_player_two, 27, 0, 1, 794, 766] +[:key_held_player_two, 4, 0, 1, 795, 767] +[:key_held_player_two, 14, 0, 1, 796, 767] +[:key_held_player_two, 19, 0, 1, 797, 767] +[:key_held_player_two, 27, 0, 1, 798, 767] +[:key_held_player_two, 4, 0, 1, 799, 768] +[:key_held_player_two, 14, 0, 1, 800, 768] +[:key_held_player_two, 19, 0, 1, 801, 768] +[:key_held_player_two, 27, 0, 1, 802, 768] +[:key_held_player_two, 4, 0, 1, 803, 769] +[:key_held_player_two, 14, 0, 1, 804, 769] +[:key_held_player_two, 19, 0, 1, 805, 769] +[:key_held_player_two, 27, 0, 1, 806, 769] +[:key_held_player_two, 4, 0, 1, 807, 770] +[:key_held_player_two, 14, 0, 1, 808, 770] +[:key_held_player_two, 19, 0, 1, 809, 770] +[:key_held_player_two, 27, 0, 1, 810, 770] +[:key_held_player_two, 4, 0, 1, 811, 771] +[:key_held_player_two, 14, 0, 1, 812, 771] +[:key_held_player_two, 19, 0, 1, 813, 771] +[:key_held_player_two, 27, 0, 1, 814, 771] +[:key_held_player_two, 4, 0, 1, 815, 772] +[:key_held_player_two, 14, 0, 1, 816, 772] +[:key_held_player_two, 19, 0, 1, 817, 772] +[:key_held_player_two, 27, 0, 1, 818, 772] +[:key_held_player_two, 4, 0, 1, 819, 773] +[:key_held_player_two, 14, 0, 1, 820, 773] +[:key_held_player_two, 19, 0, 1, 821, 773] +[:key_held_player_two, 27, 0, 1, 822, 773] +[:key_held_player_two, 4, 0, 1, 823, 774] +[:key_up_player_two, 14, 0, 1, 824, 774] +[:key_held_player_two, 19, 0, 1, 825, 774] +[:key_held_player_two, 27, 0, 1, 826, 774] +[:key_held_player_two, 4, 0, 1, 827, 775] +[:key_held_player_two, 19, 0, 1, 828, 775] +[:key_held_player_two, 27, 0, 1, 829, 775] +[:key_up_player_two, 4, 0, 1, 830, 776] +[:key_held_player_two, 19, 0, 1, 831, 776] +[:key_up_player_two, 27, 0, 1, 832, 776] +[:key_held_player_two, 19, 0, 1, 833, 777] +[:key_held_player_two, 19, 0, 1, 834, 778] +[:key_down_player_two, 14, 0, 1, 835, 779] +[:key_held_player_two, 19, 0, 1, 836, 779] +[:key_held_player_two, 14, 0, 1, 837, 780] +[:key_held_player_two, 19, 0, 1, 838, 780] +[:key_held_player_two, 14, 0, 1, 839, 781] +[:key_held_player_two, 19, 0, 1, 840, 781] +[:key_held_player_two, 14, 0, 1, 841, 782] +[:key_held_player_two, 19, 0, 1, 842, 782] +[:key_held_player_two, 14, 0, 1, 843, 783] +[:key_held_player_two, 19, 0, 1, 844, 783] +[:key_held_player_two, 14, 0, 1, 845, 784] +[:key_held_player_two, 19, 0, 1, 846, 784] +[:key_up_player_two, 14, 0, 1, 847, 785] +[:key_held_player_two, 19, 0, 1, 848, 785] +[:key_held_player_two, 19, 0, 1, 849, 786] +[:key_held_player_two, 19, 0, 1, 850, 787] +[:key_held_player_two, 19, 0, 1, 851, 788] +[:key_held_player_two, 19, 0, 1, 852, 789] +[:key_held_player_two, 19, 0, 1, 853, 790] +[:key_held_player_two, 19, 0, 1, 854, 791] +[:key_held_player_two, 19, 0, 1, 855, 792] +[:key_held_player_two, 19, 0, 1, 856, 793] +[:key_held_player_two, 19, 0, 1, 857, 794] +[:key_held_player_two, 19, 0, 1, 858, 795] +[:key_held_player_two, 19, 0, 1, 859, 796] +[:key_held_player_two, 19, 0, 1, 860, 797] +[:key_held_player_two, 19, 0, 1, 861, 798] +[:key_held_player_two, 19, 0, 1, 862, 799] +[:key_held_player_two, 19, 0, 1, 863, 800] +[:key_held_player_two, 19, 0, 1, 864, 801] +[:key_held_player_two, 19, 0, 1, 865, 802] +[:key_held_player_two, 19, 0, 1, 866, 803] +[:key_down_player_two, 3, 0, 1, 867, 804] +[:key_held_player_two, 19, 0, 1, 868, 804] +[:key_down_player_two, 26, 0, 1, 869, 804] +[:key_held_player_two, 3, 0, 1, 870, 805] +[:key_held_player_two, 19, 0, 1, 871, 805] +[:key_held_player_two, 26, 0, 1, 872, 805] +[:key_held_player_two, 3, 0, 1, 873, 806] +[:key_held_player_two, 19, 0, 1, 874, 806] +[:key_held_player_two, 26, 0, 1, 875, 806] +[:key_held_player_two, 3, 0, 1, 876, 807] +[:key_held_player_two, 19, 0, 1, 877, 807] +[:key_held_player_two, 26, 0, 1, 878, 807] +[:key_held_player_two, 3, 0, 1, 879, 808] +[:key_held_player_two, 19, 0, 1, 880, 808] +[:key_held_player_two, 26, 0, 1, 881, 808] +[:key_held_player_two, 3, 0, 1, 882, 809] +[:key_held_player_two, 19, 0, 1, 883, 809] +[:key_held_player_two, 26, 0, 1, 884, 809] +[:key_held_player_two, 3, 0, 1, 885, 810] +[:key_held_player_two, 19, 0, 1, 886, 810] +[:key_held_player_two, 26, 0, 1, 887, 810] +[:key_held_player_two, 3, 0, 1, 888, 811] +[:key_held_player_two, 19, 0, 1, 889, 811] +[:key_held_player_two, 26, 0, 1, 890, 811] +[:key_held_player_two, 3, 0, 1, 891, 812] +[:key_held_player_two, 19, 0, 1, 892, 812] +[:key_held_player_two, 26, 0, 1, 893, 812] +[:key_held_player_two, 3, 0, 1, 894, 813] +[:key_held_player_two, 19, 0, 1, 895, 813] +[:key_held_player_two, 26, 0, 1, 896, 813] +[:key_up_player_two, 3, 0, 1, 897, 814] +[:key_held_player_two, 19, 0, 1, 898, 814] +[:key_up_player_two, 26, 0, 1, 899, 814] +[:key_held_player_two, 19, 0, 1, 900, 815] +[:key_held_player_two, 19, 0, 1, 901, 816] +[:key_held_player_two, 19, 0, 1, 902, 817] +[:key_held_player_two, 19, 0, 1, 903, 818] +[:key_held_player_two, 19, 0, 1, 904, 819] +[:key_held_player_two, 19, 0, 1, 905, 820] +[:key_held_player_two, 19, 0, 1, 906, 821] +[:key_held_player_two, 19, 0, 1, 907, 822] +[:key_held_player_two, 19, 0, 1, 908, 823] +[:key_held_player_two, 19, 0, 1, 909, 824] +[:key_held_player_two, 19, 0, 1, 910, 825] +[:key_held_player_two, 19, 0, 1, 911, 826] +[:key_held_player_two, 19, 0, 1, 912, 827] +[:key_held_player_two, 19, 0, 1, 913, 828] +[:key_held_player_two, 19, 0, 1, 914, 829] +[:key_held_player_two, 19, 0, 1, 915, 830] +[:key_held_player_two, 19, 0, 1, 916, 831] +[:key_held_player_two, 19, 0, 1, 917, 832] +[:key_held_player_two, 19, 0, 1, 918, 833] +[:key_held_player_two, 19, 0, 1, 919, 834] +[:key_held_player_two, 19, 0, 1, 920, 835] +[:key_down_player_two, 3, 0, 1, 921, 836] +[:key_held_player_two, 19, 0, 1, 922, 836] +[:key_down_player_two, 26, 0, 1, 923, 836] +[:key_held_player_two, 3, 0, 1, 924, 837] +[:key_held_player_two, 19, 0, 1, 925, 837] +[:key_held_player_two, 26, 0, 1, 926, 837] +[:key_held_player_two, 3, 0, 1, 927, 838] +[:key_held_player_two, 19, 0, 1, 928, 838] +[:key_held_player_two, 26, 0, 1, 929, 838] +[:key_held_player_two, 3, 0, 1, 930, 839] +[:key_held_player_two, 19, 0, 1, 931, 839] +[:key_held_player_two, 26, 0, 1, 932, 839] +[:key_held_player_two, 3, 0, 1, 933, 840] +[:key_held_player_two, 19, 0, 1, 934, 840] +[:key_held_player_two, 26, 0, 1, 935, 840] +[:key_held_player_two, 3, 0, 1, 936, 841] +[:key_held_player_two, 19, 0, 1, 937, 841] +[:key_held_player_two, 26, 0, 1, 938, 841] +[:key_held_player_two, 3, 0, 1, 939, 842] +[:key_held_player_two, 19, 0, 1, 940, 842] +[:key_held_player_two, 26, 0, 1, 941, 842] +[:key_held_player_two, 3, 0, 1, 942, 843] +[:key_held_player_two, 19, 0, 1, 943, 843] +[:key_held_player_two, 26, 0, 1, 944, 843] +[:key_held_player_two, 3, 0, 1, 945, 844] +[:key_held_player_two, 19, 0, 1, 946, 844] +[:key_held_player_two, 26, 0, 1, 947, 844] +[:key_up_player_two, 3, 0, 1, 948, 845] +[:key_held_player_two, 19, 0, 1, 949, 845] +[:key_up_player_two, 26, 0, 1, 950, 845] +[:key_held_player_two, 19, 0, 1, 951, 846] +[:key_held_player_two, 19, 0, 1, 952, 847] +[:key_held_player_two, 19, 0, 1, 953, 848] +[:key_held_player_two, 19, 0, 1, 954, 849] +[:key_held_player_two, 19, 0, 1, 955, 850] +[:key_held_player_two, 19, 0, 1, 956, 851] +[:key_held_player_two, 19, 0, 1, 957, 852] +[:key_held_player_two, 19, 0, 1, 958, 853] +[:key_held_player_two, 19, 0, 1, 959, 854] +[:key_held_player_two, 19, 0, 1, 960, 855] +[:key_held_player_two, 19, 0, 1, 961, 856] +[:key_held_player_two, 19, 0, 1, 962, 857] +[:key_held_player_two, 19, 0, 1, 963, 858] +[:key_down_player_two, 4, 0, 1, 964, 859] +[:key_held_player_two, 19, 0, 1, 965, 859] +[:key_down_player_two, 27, 0, 1, 966, 859] +[:key_held_player_two, 4, 0, 1, 967, 860] +[:key_held_player_two, 19, 0, 1, 968, 860] +[:key_held_player_two, 27, 0, 1, 969, 860] +[:key_held_player_two, 4, 0, 1, 970, 861] +[:key_held_player_two, 19, 0, 1, 971, 861] +[:key_held_player_two, 27, 0, 1, 972, 861] +[:key_held_player_two, 4, 0, 1, 973, 862] +[:key_held_player_two, 19, 0, 1, 974, 862] +[:key_held_player_two, 27, 0, 1, 975, 862] +[:key_held_player_two, 4, 0, 1, 976, 863] +[:key_held_player_two, 19, 0, 1, 977, 863] +[:key_held_player_two, 27, 0, 1, 978, 863] +[:key_held_player_two, 4, 0, 1, 979, 864] +[:key_held_player_two, 19, 0, 1, 980, 864] +[:key_held_player_two, 27, 0, 1, 981, 864] +[:key_held_player_two, 4, 0, 1, 982, 865] +[:key_held_player_two, 19, 0, 1, 983, 865] +[:key_held_player_two, 27, 0, 1, 984, 865] +[:key_held_player_two, 4, 0, 1, 985, 866] +[:key_held_player_two, 19, 0, 1, 986, 866] +[:key_held_player_two, 27, 0, 1, 987, 866] +[:key_up_player_two, 4, 0, 1, 988, 867] +[:key_held_player_two, 19, 0, 1, 989, 867] +[:key_up_player_two, 27, 0, 1, 990, 867] +[:key_held_player_two, 19, 0, 1, 991, 868] +[:key_held_player_two, 19, 0, 1, 992, 869] +[:key_held_player_two, 19, 0, 1, 993, 870] +[:key_held_player_two, 19, 0, 1, 994, 871] +[:key_held_player_two, 19, 0, 1, 995, 872] +[:key_held_player_two, 19, 0, 1, 996, 873] +[:key_held_player_two, 19, 0, 1, 997, 874] +[:key_held_player_two, 19, 0, 1, 998, 875] +[:key_held_player_two, 19, 0, 1, 999, 876] +[:key_held_player_two, 19, 0, 1, 1000, 877] +[:key_held_player_two, 19, 0, 1, 1001, 878] +[:key_held_player_two, 19, 0, 1, 1002, 879] +[:key_held_player_two, 19, 0, 1, 1003, 880] +[:key_held_player_two, 19, 0, 1, 1004, 881] +[:key_held_player_two, 19, 0, 1, 1005, 882] +[:key_held_player_two, 19, 0, 1, 1006, 883] +[:key_held_player_two, 19, 0, 1, 1007, 884] +[:key_held_player_two, 19, 0, 1, 1008, 885] +[:key_held_player_two, 19, 0, 1, 1009, 886] +[:key_held_player_two, 19, 0, 1, 1010, 887] +[:key_held_player_two, 19, 0, 1, 1011, 888] +[:key_held_player_two, 19, 0, 1, 1012, 889] +[:key_held_player_two, 19, 0, 1, 1013, 890] +[:key_held_player_two, 19, 0, 1, 1014, 891] +[:key_held_player_two, 19, 0, 1, 1015, 892] +[:key_held_player_two, 19, 0, 1, 1016, 893] +[:key_held_player_two, 19, 0, 1, 1017, 894] +[:key_held_player_two, 19, 0, 1, 1018, 895] +[:key_held_player_two, 19, 0, 1, 1019, 896] +[:key_held_player_two, 19, 0, 1, 1020, 897] +[:key_held_player_two, 19, 0, 1, 1021, 898] +[:key_held_player_two, 19, 0, 1, 1022, 899] +[:key_held_player_two, 19, 0, 1, 1023, 900] +[:key_up_player_two, 19, 0, 1, 1024, 901] +[:key_down_player_two, 19, 0, 1, 1025, 1003] +[:key_held_player_two, 19, 0, 1, 1026, 1004] +[:key_held_player_two, 19, 0, 1, 1027, 1005] +[:key_held_player_two, 19, 0, 1, 1028, 1006] +[:key_held_player_two, 19, 0, 1, 1029, 1007] +[:key_held_player_two, 19, 0, 1, 1030, 1008] +[:key_held_player_two, 19, 0, 1, 1031, 1009] +[:key_held_player_two, 19, 0, 1, 1032, 1010] +[:key_held_player_two, 19, 0, 1, 1033, 1011] +[:key_held_player_two, 19, 0, 1, 1034, 1012] +[:key_held_player_two, 19, 0, 1, 1035, 1013] +[:key_held_player_two, 19, 0, 1, 1036, 1014] +[:key_held_player_two, 19, 0, 1, 1037, 1015] +[:key_held_player_two, 19, 0, 1, 1038, 1016] +[:key_held_player_two, 19, 0, 1, 1039, 1017] +[:key_held_player_two, 19, 0, 1, 1040, 1018] +[:key_held_player_two, 19, 0, 1, 1041, 1019] +[:key_held_player_two, 19, 0, 1, 1042, 1020] +[:key_held_player_two, 19, 0, 1, 1043, 1021] +[:key_held_player_two, 19, 0, 1, 1044, 1022] +[:key_held_player_two, 19, 0, 1, 1045, 1023] +[:key_held_player_two, 19, 0, 1, 1046, 1024] +[:key_held_player_two, 19, 0, 1, 1047, 1025] +[:key_held_player_two, 19, 0, 1, 1048, 1026] +[:key_held_player_two, 19, 0, 1, 1049, 1027] +[:key_held_player_two, 19, 0, 1, 1050, 1028] +[:key_held_player_two, 19, 0, 1, 1051, 1029] +[:key_held_player_two, 19, 0, 1, 1052, 1030] +[:key_held_player_two, 19, 0, 1, 1053, 1031] +[:key_down_player_two, 3, 0, 1, 1054, 1032] +[:key_held_player_two, 19, 0, 1, 1055, 1032] +[:key_down_player_two, 26, 0, 1, 1056, 1032] +[:key_held_player_two, 3, 0, 1, 1057, 1033] +[:key_held_player_two, 19, 0, 1, 1058, 1033] +[:key_held_player_two, 26, 0, 1, 1059, 1033] +[:key_held_player_two, 3, 0, 1, 1060, 1034] +[:key_held_player_two, 19, 0, 1, 1061, 1034] +[:key_held_player_two, 26, 0, 1, 1062, 1034] +[:key_held_player_two, 3, 0, 1, 1063, 1035] +[:key_held_player_two, 19, 0, 1, 1064, 1035] +[:key_held_player_two, 26, 0, 1, 1065, 1035] +[:key_held_player_two, 3, 0, 1, 1066, 1036] +[:key_held_player_two, 19, 0, 1, 1067, 1036] +[:key_held_player_two, 26, 0, 1, 1068, 1036] +[:key_held_player_two, 3, 0, 1, 1069, 1037] +[:key_held_player_two, 19, 0, 1, 1070, 1037] +[:key_held_player_two, 26, 0, 1, 1071, 1037] +[:key_held_player_two, 3, 0, 1, 1072, 1038] +[:key_held_player_two, 19, 0, 1, 1073, 1038] +[:key_held_player_two, 26, 0, 1, 1074, 1038] +[:key_up_player_two, 3, 0, 1, 1075, 1039] +[:key_held_player_two, 19, 0, 1, 1076, 1039] +[:key_up_player_two, 26, 0, 1, 1077, 1039] +[:key_held_player_two, 19, 0, 1, 1078, 1040] +[:key_held_player_two, 19, 0, 1, 1079, 1041] +[:key_held_player_two, 19, 0, 1, 1080, 1042] +[:key_held_player_two, 19, 0, 1, 1081, 1043] +[:key_held_player_two, 19, 0, 1, 1082, 1044] +[:key_held_player_two, 19, 0, 1, 1083, 1045] +[:key_held_player_two, 19, 0, 1, 1084, 1046] +[:key_down_player_two, 15, 0, 1, 1085, 1047] +[:key_held_player_two, 19, 0, 1, 1086, 1047] +[:key_held_player_two, 15, 0, 1, 1087, 1048] +[:key_held_player_two, 19, 0, 1, 1088, 1048] +[:key_held_player_two, 15, 0, 1, 1089, 1049] +[:key_held_player_two, 19, 0, 1, 1090, 1049] +[:key_held_player_two, 15, 0, 1, 1091, 1050] +[:key_held_player_two, 19, 0, 1, 1092, 1050] +[:key_held_player_two, 15, 0, 1, 1093, 1051] +[:key_held_player_two, 19, 0, 1, 1094, 1051] +[:key_held_player_two, 15, 0, 1, 1095, 1052] +[:key_held_player_two, 19, 0, 1, 1096, 1052] +[:key_held_player_two, 15, 0, 1, 1097, 1053] +[:key_held_player_two, 19, 0, 1, 1098, 1053] +[:key_held_player_two, 15, 0, 1, 1099, 1054] +[:key_held_player_two, 19, 0, 1, 1100, 1054] +[:key_held_player_two, 15, 0, 1, 1101, 1055] +[:key_held_player_two, 19, 0, 1, 1102, 1055] +[:key_held_player_two, 15, 0, 1, 1103, 1056] +[:key_held_player_two, 19, 0, 1, 1104, 1056] +[:key_held_player_two, 15, 0, 1, 1105, 1057] +[:key_held_player_two, 19, 0, 1, 1106, 1057] +[:key_held_player_two, 15, 0, 1, 1107, 1058] +[:key_held_player_two, 19, 0, 1, 1108, 1058] +[:key_held_player_two, 15, 0, 1, 1109, 1059] +[:key_held_player_two, 19, 0, 1, 1110, 1059] +[:key_held_player_two, 15, 0, 1, 1111, 1060] +[:key_held_player_two, 19, 0, 1, 1112, 1060] +[:key_held_player_two, 15, 0, 1, 1113, 1061] +[:key_held_player_two, 19, 0, 1, 1114, 1061] +[:key_down_player_two, 4, 0, 1, 1115, 1062] +[:key_held_player_two, 15, 0, 1, 1116, 1062] +[:key_held_player_two, 19, 0, 1, 1117, 1062] +[:key_down_player_two, 27, 0, 1, 1118, 1062] +[:key_held_player_two, 4, 0, 1, 1119, 1063] +[:key_held_player_two, 15, 0, 1, 1120, 1063] +[:key_held_player_two, 19, 0, 1, 1121, 1063] +[:key_held_player_two, 27, 0, 1, 1122, 1063] +[:key_held_player_two, 4, 0, 1, 1123, 1064] +[:key_held_player_two, 15, 0, 1, 1124, 1064] +[:key_held_player_two, 19, 0, 1, 1125, 1064] +[:key_held_player_two, 27, 0, 1, 1126, 1064] +[:key_held_player_two, 4, 0, 1, 1127, 1065] +[:key_held_player_two, 15, 0, 1, 1128, 1065] +[:key_held_player_two, 19, 0, 1, 1129, 1065] +[:key_held_player_two, 27, 0, 1, 1130, 1065] +[:key_held_player_two, 4, 0, 1, 1131, 1066] +[:key_held_player_two, 15, 0, 1, 1132, 1066] +[:key_held_player_two, 19, 0, 1, 1133, 1066] +[:key_held_player_two, 27, 0, 1, 1134, 1066] +[:key_up_player_two, 4, 0, 1, 1135, 1067] +[:key_held_player_two, 15, 0, 1, 1136, 1067] +[:key_held_player_two, 19, 0, 1, 1137, 1067] +[:key_up_player_two, 27, 0, 1, 1138, 1067] +[:key_held_player_two, 15, 0, 1, 1139, 1068] +[:key_held_player_two, 19, 0, 1, 1140, 1068] +[:key_held_player_two, 15, 0, 1, 1141, 1069] +[:key_held_player_two, 19, 0, 1, 1142, 1069] +[:key_held_player_two, 15, 0, 1, 1143, 1070] +[:key_held_player_two, 19, 0, 1, 1144, 1070] +[:key_held_player_two, 15, 0, 1, 1145, 1071] +[:key_held_player_two, 19, 0, 1, 1146, 1071] +[:key_held_player_two, 15, 0, 1, 1147, 1072] +[:key_held_player_two, 19, 0, 1, 1148, 1072] +[:key_held_player_two, 15, 0, 1, 1149, 1073] +[:key_held_player_two, 19, 0, 1, 1150, 1073] +[:key_held_player_two, 15, 0, 1, 1151, 1074] +[:key_held_player_two, 19, 0, 1, 1152, 1074] +[:key_held_player_two, 15, 0, 1, 1153, 1075] +[:key_held_player_two, 19, 0, 1, 1154, 1075] +[:key_held_player_two, 15, 0, 1, 1155, 1076] +[:key_held_player_two, 19, 0, 1, 1156, 1076] +[:key_held_player_two, 15, 0, 1, 1157, 1077] +[:key_held_player_two, 19, 0, 1, 1158, 1077] +[:key_held_player_two, 15, 0, 1, 1159, 1078] +[:key_held_player_two, 19, 0, 1, 1160, 1078] +[:key_held_player_two, 15, 0, 1, 1161, 1079] +[:key_held_player_two, 19, 0, 1, 1162, 1079] +[:key_held_player_two, 15, 0, 1, 1163, 1080] +[:key_held_player_two, 19, 0, 1, 1164, 1080] +[:key_held_player_two, 15, 0, 1, 1165, 1081] +[:key_held_player_two, 19, 0, 1, 1166, 1081] +[:key_held_player_two, 15, 0, 1, 1167, 1082] +[:key_held_player_two, 19, 0, 1, 1168, 1082] +[:key_held_player_two, 15, 0, 1, 1169, 1083] +[:key_held_player_two, 19, 0, 1, 1170, 1083] +[:key_held_player_two, 15, 0, 1, 1171, 1084] +[:key_held_player_two, 19, 0, 1, 1172, 1084] +[:key_held_player_two, 15, 0, 1, 1173, 1085] +[:key_held_player_two, 19, 0, 1, 1174, 1085] +[:key_held_player_two, 15, 0, 1, 1175, 1086] +[:key_held_player_two, 19, 0, 1, 1176, 1086] +[:key_held_player_two, 15, 0, 1, 1177, 1087] +[:key_held_player_two, 19, 0, 1, 1178, 1087] +[:key_held_player_two, 15, 0, 1, 1179, 1088] +[:key_held_player_two, 19, 0, 1, 1180, 1088] +[:key_held_player_two, 15, 0, 1, 1181, 1089] +[:key_held_player_two, 19, 0, 1, 1182, 1089] +[:key_held_player_two, 15, 0, 1, 1183, 1090] +[:key_held_player_two, 19, 0, 1, 1184, 1090] +[:key_held_player_two, 15, 0, 1, 1185, 1091] +[:key_held_player_two, 19, 0, 1, 1186, 1091] +[:key_held_player_two, 15, 0, 1, 1187, 1092] +[:key_held_player_two, 19, 0, 1, 1188, 1092] +[:key_held_player_two, 15, 0, 1, 1189, 1093] +[:key_held_player_two, 19, 0, 1, 1190, 1093] +[:key_held_player_two, 15, 0, 1, 1191, 1094] +[:key_held_player_two, 19, 0, 1, 1192, 1094] +[:key_held_player_two, 15, 0, 1, 1193, 1095] +[:key_held_player_two, 19, 0, 1, 1194, 1095] +[:key_held_player_two, 15, 0, 1, 1195, 1096] +[:key_held_player_two, 19, 0, 1, 1196, 1096] +[:key_held_player_two, 15, 0, 1, 1197, 1097] +[:key_held_player_two, 19, 0, 1, 1198, 1097] +[:key_held_player_two, 15, 0, 1, 1199, 1098] +[:key_held_player_two, 19, 0, 1, 1200, 1098] +[:key_held_player_two, 15, 0, 1, 1201, 1099] +[:key_held_player_two, 19, 0, 1, 1202, 1099] +[:key_held_player_two, 15, 0, 1, 1203, 1100] +[:key_held_player_two, 19, 0, 1, 1204, 1100] +[:key_held_player_two, 15, 0, 1, 1205, 1101] +[:key_held_player_two, 19, 0, 1, 1206, 1101] +[:key_held_player_two, 15, 0, 1, 1207, 1102] +[:key_held_player_two, 19, 0, 1, 1208, 1102] +[:key_held_player_two, 15, 0, 1, 1209, 1103] +[:key_held_player_two, 19, 0, 1, 1210, 1103] +[:key_held_player_two, 15, 0, 1, 1211, 1104] +[:key_held_player_two, 19, 0, 1, 1212, 1104] +[:key_held_player_two, 15, 0, 1, 1213, 1105] +[:key_held_player_two, 19, 0, 1, 1214, 1105] +[:key_held_player_two, 15, 0, 1, 1215, 1106] +[:key_held_player_two, 19, 0, 1, 1216, 1106] +[:key_held_player_two, 15, 0, 1, 1217, 1107] +[:key_held_player_two, 19, 0, 1, 1218, 1107] +[:key_held_player_two, 15, 0, 1, 1219, 1108] +[:key_held_player_two, 19, 0, 1, 1220, 1108] +[:key_held_player_two, 15, 0, 1, 1221, 1109] +[:key_held_player_two, 19, 0, 1, 1222, 1109] +[:key_held_player_two, 15, 0, 1, 1223, 1110] +[:key_held_player_two, 19, 0, 1, 1224, 1110] +[:key_held_player_two, 15, 0, 1, 1225, 1111] +[:key_held_player_two, 19, 0, 1, 1226, 1111] +[:key_held_player_two, 15, 0, 1, 1227, 1112] +[:key_held_player_two, 19, 0, 1, 1228, 1112] +[:key_held_player_two, 15, 0, 1, 1229, 1113] +[:key_held_player_two, 19, 0, 1, 1230, 1113] +[:key_held_player_two, 15, 0, 1, 1231, 1114] +[:key_held_player_two, 19, 0, 1, 1232, 1114] +[:key_held_player_two, 15, 0, 1, 1233, 1115] +[:key_held_player_two, 19, 0, 1, 1234, 1115] +[:key_held_player_two, 15, 0, 1, 1235, 1116] +[:key_held_player_two, 19, 0, 1, 1236, 1116] +[:key_held_player_two, 15, 0, 1, 1237, 1117] +[:key_held_player_two, 19, 0, 1, 1238, 1117] +[:key_held_player_two, 15, 0, 1, 1239, 1118] +[:key_held_player_two, 19, 0, 1, 1240, 1118] +[:key_held_player_two, 15, 0, 1, 1241, 1119] +[:key_held_player_two, 19, 0, 1, 1242, 1119] +[:key_held_player_two, 15, 0, 1, 1243, 1120] +[:key_held_player_two, 19, 0, 1, 1244, 1120] +[:key_held_player_two, 15, 0, 1, 1245, 1121] +[:key_held_player_two, 19, 0, 1, 1246, 1121] +[:key_held_player_two, 15, 0, 1, 1247, 1122] +[:key_held_player_two, 19, 0, 1, 1248, 1122] +[:key_held_player_two, 15, 0, 1, 1249, 1123] +[:key_held_player_two, 19, 0, 1, 1250, 1123] +[:key_held_player_two, 15, 0, 1, 1251, 1124] +[:key_held_player_two, 19, 0, 1, 1252, 1124] +[:key_held_player_two, 15, 0, 1, 1253, 1125] +[:key_held_player_two, 19, 0, 1, 1254, 1125] +[:key_held_player_two, 15, 0, 1, 1255, 1126] +[:key_held_player_two, 19, 0, 1, 1256, 1126] +[:key_held_player_two, 15, 0, 1, 1257, 1127] +[:key_held_player_two, 19, 0, 1, 1258, 1127] +[:key_held_player_two, 15, 0, 1, 1259, 1128] +[:key_held_player_two, 19, 0, 1, 1260, 1128] +[:key_held_player_two, 15, 0, 1, 1261, 1129] +[:key_held_player_two, 19, 0, 1, 1262, 1129] +[:key_held_player_two, 15, 0, 1, 1263, 1130] +[:key_held_player_two, 19, 0, 1, 1264, 1130] +[:key_held_player_two, 15, 0, 1, 1265, 1131] +[:key_held_player_two, 19, 0, 1, 1266, 1131] +[:key_held_player_two, 15, 0, 1, 1267, 1132] +[:key_held_player_two, 19, 0, 1, 1268, 1132] +[:key_held_player_two, 15, 0, 1, 1269, 1133] +[:key_held_player_two, 19, 0, 1, 1270, 1133] +[:key_held_player_two, 15, 0, 1, 1271, 1134] +[:key_held_player_two, 19, 0, 1, 1272, 1134] +[:key_held_player_two, 15, 0, 1, 1273, 1135] +[:key_held_player_two, 19, 0, 1, 1274, 1135] +[:key_held_player_two, 15, 0, 1, 1275, 1136] +[:key_held_player_two, 19, 0, 1, 1276, 1136] +[:key_held_player_two, 15, 0, 1, 1277, 1137] +[:key_held_player_two, 19, 0, 1, 1278, 1137] +[:key_held_player_two, 15, 0, 1, 1279, 1138] +[:key_held_player_two, 19, 0, 1, 1280, 1138] +[:key_held_player_two, 15, 0, 1, 1281, 1139] +[:key_held_player_two, 19, 0, 1, 1282, 1139] +[:key_held_player_two, 15, 0, 1, 1283, 1140] +[:key_held_player_two, 19, 0, 1, 1284, 1140] +[:key_held_player_two, 15, 0, 1, 1285, 1141] +[:key_held_player_two, 19, 0, 1, 1286, 1141] +[:key_held_player_two, 15, 0, 1, 1287, 1142] +[:key_held_player_two, 19, 0, 1, 1288, 1142] +[:key_held_player_two, 15, 0, 1, 1289, 1143] +[:key_held_player_two, 19, 0, 1, 1290, 1143] +[:key_held_player_two, 15, 0, 1, 1291, 1144] +[:key_held_player_two, 19, 0, 1, 1292, 1144] +[:key_held_player_two, 15, 0, 1, 1293, 1145] +[:key_held_player_two, 19, 0, 1, 1294, 1145] +[:key_held_player_two, 15, 0, 1, 1295, 1146] +[:key_held_player_two, 19, 0, 1, 1296, 1146] +[:key_up_player_two, 15, 0, 1, 1297, 1147] +[:key_held_player_two, 19, 0, 1, 1298, 1147] +[:key_held_player_two, 19, 0, 1, 1299, 1148] +[:key_held_player_two, 19, 0, 1, 1300, 1149] +[:key_held_player_two, 19, 0, 1, 1301, 1150] +[:key_held_player_two, 19, 0, 1, 1302, 1151] +[:key_held_player_two, 19, 0, 1, 1303, 1152] +[:key_held_player_two, 19, 0, 1, 1304, 1153] +[:key_held_player_two, 19, 0, 1, 1305, 1154] +[:key_held_player_two, 19, 0, 1, 1306, 1155] +[:key_held_player_two, 19, 0, 1, 1307, 1156] +[:key_held_player_two, 19, 0, 1, 1308, 1157] +[:key_held_player_two, 19, 0, 1, 1309, 1158] +[:key_held_player_two, 19, 0, 1, 1310, 1159] +[:key_held_player_two, 19, 0, 1, 1311, 1160] +[:key_held_player_two, 19, 0, 1, 1312, 1161] +[:key_held_player_two, 19, 0, 1, 1313, 1162] +[:key_held_player_two, 19, 0, 1, 1314, 1163] +[:key_held_player_two, 19, 0, 1, 1315, 1164] +[:key_held_player_two, 19, 0, 1, 1316, 1165] +[:key_held_player_two, 19, 0, 1, 1317, 1166] +[:key_held_player_two, 19, 0, 1, 1318, 1167] +[:key_held_player_two, 19, 0, 1, 1319, 1168] +[:key_held_player_two, 19, 0, 1, 1320, 1169] +[:key_held_player_two, 19, 0, 1, 1321, 1170] +[:key_held_player_two, 19, 0, 1, 1322, 1171] +[:key_held_player_two, 19, 0, 1, 1323, 1172] +[:key_held_player_two, 19, 0, 1, 1324, 1173] +[:key_held_player_two, 19, 0, 1, 1325, 1174] +[:key_held_player_two, 19, 0, 1, 1326, 1175] +[:key_held_player_two, 19, 0, 1, 1327, 1176] +[:key_held_player_two, 19, 0, 1, 1328, 1177] +[:key_held_player_two, 19, 0, 1, 1329, 1178] +[:key_held_player_two, 19, 0, 1, 1330, 1179] +[:key_held_player_two, 19, 0, 1, 1331, 1180] +[:key_held_player_two, 19, 0, 1, 1332, 1181] +[:key_held_player_two, 19, 0, 1, 1333, 1182] +[:key_held_player_two, 19, 0, 1, 1334, 1183] +[:key_held_player_two, 19, 0, 1, 1335, 1184] +[:key_held_player_two, 19, 0, 1, 1336, 1185] +[:key_held_player_two, 19, 0, 1, 1337, 1186] +[:key_held_player_two, 19, 0, 1, 1338, 1187] +[:key_held_player_two, 19, 0, 1, 1339, 1188] +[:key_held_player_two, 19, 0, 1, 1340, 1189] +[:key_held_player_two, 19, 0, 1, 1341, 1190] +[:key_held_player_two, 19, 0, 1, 1342, 1191] +[:key_up_player_two, 19, 0, 1, 1343, 1192] +[:key_down_player_one, 3, 0, 1, 1344, 1320] +[:key_down_player_one, 26, 0, 1, 1345, 1320] +[:key_held_player_one, 3, 0, 1, 1346, 1321] +[:key_held_player_one, 26, 0, 1, 1347, 1321] +[:key_held_player_one, 3, 0, 1, 1348, 1322] +[:key_held_player_one, 26, 0, 1, 1349, 1322] +[:key_held_player_one, 3, 0, 1, 1350, 1323] +[:key_held_player_one, 26, 0, 1, 1351, 1323] +[:key_held_player_one, 3, 0, 1, 1352, 1324] +[:key_held_player_one, 26, 0, 1, 1353, 1324] +[:key_held_player_one, 3, 0, 1, 1354, 1325] +[:key_held_player_one, 26, 0, 1, 1355, 1325] +[:key_held_player_one, 3, 0, 1, 1356, 1326] +[:key_held_player_one, 26, 0, 1, 1357, 1326] +[:key_held_player_one, 3, 0, 1, 1358, 1327] +[:key_held_player_one, 26, 0, 1, 1359, 1327] +[:key_held_player_one, 3, 0, 1, 1360, 1328] +[:key_held_player_one, 26, 0, 1, 1361, 1328] +[:key_held_player_one, 3, 0, 1, 1362, 1329] +[:key_held_player_one, 26, 0, 1, 1363, 1329] +[:key_held_player_one, 3, 0, 1, 1364, 1330] +[:key_held_player_one, 26, 0, 1, 1365, 1330] +[:key_held_player_one, 3, 0, 1, 1366, 1331] +[:key_held_player_one, 26, 0, 1, 1367, 1331] +[:key_held_player_one, 3, 0, 1, 1368, 1332] +[:key_held_player_one, 26, 0, 1, 1369, 1332] +[:key_held_player_one, 3, 0, 1, 1370, 1333] +[:key_held_player_one, 26, 0, 1, 1371, 1333] +[:key_held_player_one, 3, 0, 1, 1372, 1334] +[:key_held_player_one, 26, 0, 1, 1373, 1334] +[:key_held_player_one, 3, 0, 1, 1374, 1335] +[:key_held_player_one, 26, 0, 1, 1375, 1335] +[:key_held_player_one, 3, 0, 1, 1376, 1336] +[:key_held_player_one, 26, 0, 1, 1377, 1336] +[:key_held_player_one, 3, 0, 1, 1378, 1337] +[:key_held_player_one, 26, 0, 1, 1379, 1337] +[:key_held_player_one, 3, 0, 1, 1380, 1338] +[:key_held_player_one, 26, 0, 1, 1381, 1338] +[:key_held_player_one, 3, 0, 1, 1382, 1339] +[:key_held_player_one, 26, 0, 1, 1383, 1339] +[:key_held_player_one, 3, 0, 1, 1384, 1340] +[:key_held_player_one, 26, 0, 1, 1385, 1340] +[:key_held_player_one, 3, 0, 1, 1386, 1341] +[:key_held_player_one, 26, 0, 1, 1387, 1341] +[:key_held_player_one, 3, 0, 1, 1388, 1342] +[:key_held_player_one, 26, 0, 1, 1389, 1342] +[:key_held_player_one, 3, 0, 1, 1390, 1343] +[:key_held_player_one, 26, 0, 1, 1391, 1343] +[:key_held_player_one, 3, 0, 1, 1392, 1344] +[:key_held_player_one, 26, 0, 1, 1393, 1344] +[:key_up_player_one, 3, 0, 1, 1394, 1345] +[:key_up_player_one, 26, 0, 1, 1395, 1345] +[:key_down_player_one, 4, 0, 1, 1396, 1351] +[:key_down_player_one, 27, 0, 1, 1397, 1351] +[:key_held_player_one, 4, 0, 1, 1398, 1352] +[:key_held_player_one, 27, 0, 1, 1399, 1352] +[:key_held_player_one, 4, 0, 1, 1400, 1353] +[:key_held_player_one, 27, 0, 1, 1401, 1353] +[:key_held_player_one, 4, 0, 1, 1402, 1354] +[:key_held_player_one, 27, 0, 1, 1403, 1354] +[:key_held_player_one, 4, 0, 1, 1404, 1355] +[:key_held_player_one, 27, 0, 1, 1405, 1355] +[:key_held_player_one, 4, 0, 1, 1406, 1356] +[:key_held_player_one, 27, 0, 1, 1407, 1356] +[:key_held_player_one, 4, 0, 1, 1408, 1357] +[:key_held_player_one, 27, 0, 1, 1409, 1357] +[:key_held_player_one, 4, 0, 1, 1410, 1358] +[:key_held_player_one, 27, 0, 1, 1411, 1358] +[:key_held_player_one, 4, 0, 1, 1412, 1359] +[:key_held_player_one, 27, 0, 1, 1413, 1359] +[:key_held_player_one, 4, 0, 1, 1414, 1360] +[:key_held_player_one, 27, 0, 1, 1415, 1360] +[:key_held_player_one, 4, 0, 1, 1416, 1361] +[:key_held_player_one, 27, 0, 1, 1417, 1361] +[:key_held_player_one, 4, 0, 1, 1418, 1362] +[:key_held_player_one, 27, 0, 1, 1419, 1362] +[:key_held_player_one, 4, 0, 1, 1420, 1363] +[:key_held_player_one, 27, 0, 1, 1421, 1363] +[:key_held_player_one, 4, 0, 1, 1422, 1364] +[:key_held_player_one, 27, 0, 1, 1423, 1364] +[:key_held_player_one, 4, 0, 1, 1424, 1365] +[:key_held_player_one, 27, 0, 1, 1425, 1365] +[:key_held_player_one, 4, 0, 1, 1426, 1366] +[:key_held_player_one, 27, 0, 1, 1427, 1366] +[:key_held_player_one, 4, 0, 1, 1428, 1367] +[:key_held_player_one, 27, 0, 1, 1429, 1367] +[:key_held_player_one, 4, 0, 1, 1430, 1368] +[:key_held_player_one, 27, 0, 1, 1431, 1368] +[:key_held_player_one, 4, 0, 1, 1432, 1369] +[:key_held_player_one, 27, 0, 1, 1433, 1369] +[:key_held_player_one, 4, 0, 1, 1434, 1370] +[:key_held_player_one, 27, 0, 1, 1435, 1370] +[:key_held_player_one, 4, 0, 1, 1436, 1371] +[:key_held_player_one, 27, 0, 1, 1437, 1371] +[:key_held_player_one, 4, 0, 1, 1438, 1372] +[:key_down_player_one, 19, 0, 1, 1439, 1372] +[:key_held_player_one, 27, 0, 1, 1440, 1372] +[:key_held_player_one, 4, 0, 1, 1441, 1373] +[:key_held_player_one, 19, 0, 1, 1442, 1373] +[:key_held_player_one, 27, 0, 1, 1443, 1373] +[:key_held_player_one, 4, 0, 1, 1444, 1374] +[:key_held_player_one, 19, 0, 1, 1445, 1374] +[:key_held_player_one, 27, 0, 1, 1446, 1374] +[:key_held_player_one, 4, 0, 1, 1447, 1375] +[:key_held_player_one, 19, 0, 1, 1448, 1375] +[:key_held_player_one, 27, 0, 1, 1449, 1375] +[:key_held_player_one, 4, 0, 1, 1450, 1376] +[:key_held_player_one, 19, 0, 1, 1451, 1376] +[:key_held_player_one, 27, 0, 1, 1452, 1376] +[:key_held_player_one, 4, 0, 1, 1453, 1377] +[:key_held_player_one, 19, 0, 1, 1454, 1377] +[:key_held_player_one, 27, 0, 1, 1455, 1377] +[:key_held_player_one, 4, 0, 1, 1456, 1378] +[:key_held_player_one, 19, 0, 1, 1457, 1378] +[:key_held_player_one, 27, 0, 1, 1458, 1378] +[:key_up_player_one, 4, 0, 1, 1459, 1379] +[:key_held_player_one, 19, 0, 1, 1460, 1379] +[:key_up_player_one, 27, 0, 1, 1461, 1379] +[:key_held_player_one, 19, 0, 1, 1462, 1380] +[:key_held_player_one, 19, 0, 1, 1463, 1381] +[:key_held_player_one, 19, 0, 1, 1464, 1382] +[:key_held_player_one, 19, 0, 1, 1465, 1383] +[:key_held_player_one, 19, 0, 1, 1466, 1384] +[:key_held_player_one, 19, 0, 1, 1467, 1385] +[:key_held_player_one, 19, 0, 1, 1468, 1386] +[:key_held_player_one, 19, 0, 1, 1469, 1387] +[:key_held_player_one, 19, 0, 1, 1470, 1388] +[:key_held_player_one, 19, 0, 1, 1471, 1389] +[:key_held_player_one, 19, 0, 1, 1472, 1390] +[:key_held_player_one, 19, 0, 1, 1473, 1391] +[:key_held_player_one, 19, 0, 1, 1474, 1392] +[:key_held_player_one, 19, 0, 1, 1475, 1393] +[:key_held_player_one, 19, 0, 1, 1476, 1394] +[:key_held_player_one, 19, 0, 1, 1477, 1395] +[:key_held_player_one, 19, 0, 1, 1478, 1396] +[:key_held_player_one, 19, 0, 1, 1479, 1397] +[:key_held_player_one, 19, 0, 1, 1480, 1398] +[:key_held_player_one, 19, 0, 1, 1481, 1399] +[:key_held_player_one, 19, 0, 1, 1482, 1400] +[:key_held_player_one, 19, 0, 1, 1483, 1401] +[:key_held_player_one, 19, 0, 1, 1484, 1402] +[:key_down_player_one, 3, 0, 1, 1485, 1403] +[:key_held_player_one, 19, 0, 1, 1486, 1403] +[:key_down_player_one, 26, 0, 1, 1487, 1403] +[:key_held_player_one, 3, 0, 1, 1488, 1404] +[:key_held_player_one, 19, 0, 1, 1489, 1404] +[:key_held_player_one, 26, 0, 1, 1490, 1404] +[:key_held_player_one, 3, 0, 1, 1491, 1405] +[:key_held_player_one, 19, 0, 1, 1492, 1405] +[:key_held_player_one, 26, 0, 1, 1493, 1405] +[:key_held_player_one, 3, 0, 1, 1494, 1406] +[:key_held_player_one, 19, 0, 1, 1495, 1406] +[:key_held_player_one, 26, 0, 1, 1496, 1406] +[:key_held_player_one, 3, 0, 1, 1497, 1407] +[:key_held_player_one, 19, 0, 1, 1498, 1407] +[:key_held_player_one, 26, 0, 1, 1499, 1407] +[:key_held_player_one, 3, 0, 1, 1500, 1408] +[:key_held_player_one, 19, 0, 1, 1501, 1408] +[:key_held_player_one, 26, 0, 1, 1502, 1408] +[:key_held_player_one, 3, 0, 1, 1503, 1409] +[:key_held_player_one, 19, 0, 1, 1504, 1409] +[:key_held_player_one, 26, 0, 1, 1505, 1409] +[:key_held_player_one, 3, 0, 1, 1506, 1410] +[:key_held_player_one, 19, 0, 1, 1507, 1410] +[:key_held_player_one, 26, 0, 1, 1508, 1410] +[:key_up_player_one, 3, 0, 1, 1509, 1411] +[:key_held_player_one, 19, 0, 1, 1510, 1411] +[:key_up_player_one, 26, 0, 1, 1511, 1411] +[:key_held_player_one, 19, 0, 1, 1512, 1412] +[:key_held_player_one, 19, 0, 1, 1513, 1413] +[:key_held_player_one, 19, 0, 1, 1514, 1414] +[:key_held_player_one, 19, 0, 1, 1515, 1415] +[:key_held_player_one, 19, 0, 1, 1516, 1416] +[:key_held_player_one, 19, 0, 1, 1517, 1417] +[:key_held_player_one, 19, 0, 1, 1518, 1418] +[:key_held_player_one, 19, 0, 1, 1519, 1419] +[:key_held_player_one, 19, 0, 1, 1520, 1420] +[:key_held_player_one, 19, 0, 1, 1521, 1421] +[:key_held_player_one, 19, 0, 1, 1522, 1422] +[:key_held_player_one, 19, 0, 1, 1523, 1423] +[:key_held_player_one, 19, 0, 1, 1524, 1424] +[:key_held_player_one, 19, 0, 1, 1525, 1425] +[:key_held_player_one, 19, 0, 1, 1526, 1426] +[:key_held_player_one, 19, 0, 1, 1527, 1427] +[:key_held_player_one, 19, 0, 1, 1528, 1428] +[:key_down_player_one, 15, 0, 1, 1529, 1429] +[:key_held_player_one, 19, 0, 1, 1530, 1429] +[:key_held_player_one, 15, 0, 1, 1531, 1430] +[:key_held_player_one, 19, 0, 1, 1532, 1430] +[:key_held_player_one, 15, 0, 1, 1533, 1431] +[:key_held_player_one, 19, 0, 1, 1534, 1431] +[:key_held_player_one, 15, 0, 1, 1535, 1432] +[:key_held_player_one, 19, 0, 1, 1536, 1432] +[:key_held_player_one, 15, 0, 1, 1537, 1433] +[:key_held_player_one, 19, 0, 1, 1538, 1433] +[:key_held_player_one, 15, 0, 1, 1539, 1434] +[:key_held_player_one, 19, 0, 1, 1540, 1434] +[:key_held_player_one, 15, 0, 1, 1541, 1435] +[:key_held_player_one, 19, 0, 1, 1542, 1435] +[:key_held_player_one, 15, 0, 1, 1543, 1436] +[:key_held_player_one, 19, 0, 1, 1544, 1436] +[:key_held_player_one, 15, 0, 1, 1545, 1437] +[:key_held_player_one, 19, 0, 1, 1546, 1437] +[:key_held_player_one, 15, 0, 1, 1547, 1438] +[:key_held_player_one, 19, 0, 1, 1548, 1438] +[:key_held_player_one, 15, 0, 1, 1549, 1439] +[:key_held_player_one, 19, 0, 1, 1550, 1439] +[:key_held_player_one, 15, 0, 1, 1551, 1440] +[:key_held_player_one, 19, 0, 1, 1552, 1440] +[:key_held_player_one, 15, 0, 1, 1553, 1441] +[:key_held_player_one, 19, 0, 1, 1554, 1441] +[:key_held_player_one, 15, 0, 1, 1555, 1442] +[:key_held_player_one, 19, 0, 1, 1556, 1442] +[:key_held_player_one, 15, 0, 1, 1557, 1443] +[:key_held_player_one, 19, 0, 1, 1558, 1443] +[:key_held_player_one, 15, 0, 1, 1559, 1444] +[:key_held_player_one, 19, 0, 1, 1560, 1444] +[:key_held_player_one, 15, 0, 1, 1561, 1445] +[:key_held_player_one, 19, 0, 1, 1562, 1445] +[:key_held_player_one, 15, 0, 1, 1563, 1446] +[:key_held_player_one, 19, 0, 1, 1564, 1446] +[:key_held_player_one, 15, 0, 1, 1565, 1447] +[:key_held_player_one, 19, 0, 1, 1566, 1447] +[:key_held_player_one, 15, 0, 1, 1567, 1448] +[:key_held_player_one, 19, 0, 1, 1568, 1448] +[:key_held_player_one, 15, 0, 1, 1569, 1449] +[:key_held_player_one, 19, 0, 1, 1570, 1449] +[:key_held_player_one, 15, 0, 1, 1571, 1450] +[:key_held_player_one, 19, 0, 1, 1572, 1450] +[:key_held_player_one, 15, 0, 1, 1573, 1451] +[:key_held_player_one, 19, 0, 1, 1574, 1451] +[:key_held_player_one, 15, 0, 1, 1575, 1452] +[:key_held_player_one, 19, 0, 1, 1576, 1452] +[:key_held_player_one, 15, 0, 1, 1577, 1453] +[:key_held_player_one, 19, 0, 1, 1578, 1453] +[:key_held_player_one, 15, 0, 1, 1579, 1454] +[:key_held_player_one, 19, 0, 1, 1580, 1454] +[:key_held_player_one, 15, 0, 1, 1581, 1455] +[:key_held_player_one, 19, 0, 1, 1582, 1455] +[:key_up_player_one, 15, 0, 1, 1583, 1456] +[:key_held_player_one, 19, 0, 1, 1584, 1456] +[:key_held_player_one, 19, 0, 1, 1585, 1457] +[:key_held_player_one, 19, 0, 1, 1586, 1458] +[:key_down_player_one, 4, 0, 1, 1587, 1459] +[:key_held_player_one, 19, 0, 1, 1588, 1459] +[:key_down_player_one, 27, 0, 1, 1589, 1459] +[:key_held_player_one, 4, 0, 1, 1590, 1460] +[:key_held_player_one, 19, 0, 1, 1591, 1460] +[:key_held_player_one, 27, 0, 1, 1592, 1460] +[:key_held_player_one, 4, 0, 1, 1593, 1461] +[:key_held_player_one, 19, 0, 1, 1594, 1461] +[:key_held_player_one, 27, 0, 1, 1595, 1461] +[:key_held_player_one, 4, 0, 1, 1596, 1462] +[:key_held_player_one, 19, 0, 1, 1597, 1462] +[:key_held_player_one, 27, 0, 1, 1598, 1462] +[:key_held_player_one, 4, 0, 1, 1599, 1463] +[:key_held_player_one, 19, 0, 1, 1600, 1463] +[:key_held_player_one, 27, 0, 1, 1601, 1463] +[:key_held_player_one, 4, 0, 1, 1602, 1464] +[:key_down_player_one, 15, 0, 1, 1603, 1464] +[:key_held_player_one, 19, 0, 1, 1604, 1464] +[:key_held_player_one, 27, 0, 1, 1605, 1464] +[:key_held_player_one, 4, 0, 1, 1606, 1465] +[:key_held_player_one, 15, 0, 1, 1607, 1465] +[:key_held_player_one, 19, 0, 1, 1608, 1465] +[:key_held_player_one, 27, 0, 1, 1609, 1465] +[:key_up_player_one, 4, 0, 1, 1610, 1466] +[:key_held_player_one, 15, 0, 1, 1611, 1466] +[:key_held_player_one, 19, 0, 1, 1612, 1466] +[:key_up_player_one, 27, 0, 1, 1613, 1466] +[:key_held_player_one, 15, 0, 1, 1614, 1467] +[:key_held_player_one, 19, 0, 1, 1615, 1467] +[:key_held_player_one, 15, 0, 1, 1616, 1468] +[:key_held_player_one, 19, 0, 1, 1617, 1468] +[:key_held_player_one, 15, 0, 1, 1618, 1469] +[:key_held_player_one, 19, 0, 1, 1619, 1469] +[:key_held_player_one, 15, 0, 1, 1620, 1470] +[:key_held_player_one, 19, 0, 1, 1621, 1470] +[:key_held_player_one, 15, 0, 1, 1622, 1471] +[:key_held_player_one, 19, 0, 1, 1623, 1471] +[:key_held_player_one, 15, 0, 1, 1624, 1472] +[:key_held_player_one, 19, 0, 1, 1625, 1472] +[:key_held_player_one, 15, 0, 1, 1626, 1473] +[:key_held_player_one, 19, 0, 1, 1627, 1473] +[:key_held_player_one, 15, 0, 1, 1628, 1474] +[:key_held_player_one, 19, 0, 1, 1629, 1474] +[:key_held_player_one, 15, 0, 1, 1630, 1475] +[:key_held_player_one, 19, 0, 1, 1631, 1475] +[:key_held_player_one, 15, 0, 1, 1632, 1476] +[:key_held_player_one, 19, 0, 1, 1633, 1476] +[:key_held_player_one, 15, 0, 1, 1634, 1477] +[:key_held_player_one, 19, 0, 1, 1635, 1477] +[:key_held_player_one, 15, 0, 1, 1636, 1478] +[:key_held_player_one, 19, 0, 1, 1637, 1478] +[:key_held_player_one, 15, 0, 1, 1638, 1479] +[:key_held_player_one, 19, 0, 1, 1639, 1479] +[:key_held_player_one, 15, 0, 1, 1640, 1480] +[:key_held_player_one, 19, 0, 1, 1641, 1480] +[:key_held_player_one, 15, 0, 1, 1642, 1481] +[:key_held_player_one, 19, 0, 1, 1643, 1481] +[:key_held_player_one, 15, 0, 1, 1644, 1482] +[:key_held_player_one, 19, 0, 1, 1645, 1482] +[:key_held_player_one, 15, 0, 1, 1646, 1483] +[:key_held_player_one, 19, 0, 1, 1647, 1483] +[:key_held_player_one, 15, 0, 1, 1648, 1484] +[:key_held_player_one, 19, 0, 1, 1649, 1484] +[:key_held_player_one, 15, 0, 1, 1650, 1485] +[:key_held_player_one, 19, 0, 1, 1651, 1485] +[:key_down_player_one, 3, 0, 1, 1652, 1486] +[:key_held_player_one, 15, 0, 1, 1653, 1486] +[:key_held_player_one, 19, 0, 1, 1654, 1486] +[:key_down_player_one, 26, 0, 1, 1655, 1486] +[:key_held_player_one, 3, 0, 1, 1656, 1487] +[:key_held_player_one, 15, 0, 1, 1657, 1487] +[:key_held_player_one, 19, 0, 1, 1658, 1487] +[:key_held_player_one, 26, 0, 1, 1659, 1487] +[:key_held_player_one, 3, 0, 1, 1660, 1488] +[:key_held_player_one, 15, 0, 1, 1661, 1488] +[:key_held_player_one, 19, 0, 1, 1662, 1488] +[:key_held_player_one, 26, 0, 1, 1663, 1488] +[:key_held_player_one, 3, 0, 1, 1664, 1489] +[:key_held_player_one, 15, 0, 1, 1665, 1489] +[:key_held_player_one, 19, 0, 1, 1666, 1489] +[:key_held_player_one, 26, 0, 1, 1667, 1489] +[:key_held_player_one, 3, 0, 1, 1668, 1490] +[:key_held_player_one, 15, 0, 1, 1669, 1490] +[:key_held_player_one, 19, 0, 1, 1670, 1490] +[:key_held_player_one, 26, 0, 1, 1671, 1490] +[:key_up_player_one, 3, 0, 1, 1672, 1491] +[:key_held_player_one, 15, 0, 1, 1673, 1491] +[:key_held_player_one, 19, 0, 1, 1674, 1491] +[:key_up_player_one, 26, 0, 1, 1675, 1491] +[:key_held_player_one, 15, 0, 1, 1676, 1492] +[:key_held_player_one, 19, 0, 1, 1677, 1492] +[:key_held_player_one, 15, 0, 1, 1678, 1493] +[:key_held_player_one, 19, 0, 1, 1679, 1493] +[:key_held_player_one, 15, 0, 1, 1680, 1494] +[:key_held_player_one, 19, 0, 1, 1681, 1494] +[:key_held_player_one, 15, 0, 1, 1682, 1495] +[:key_held_player_one, 19, 0, 1, 1683, 1495] +[:key_held_player_one, 15, 0, 1, 1684, 1496] +[:key_held_player_one, 19, 0, 1, 1685, 1496] +[:key_held_player_one, 15, 0, 1, 1686, 1497] +[:key_held_player_one, 19, 0, 1, 1687, 1497] +[:key_held_player_one, 15, 0, 1, 1688, 1498] +[:key_held_player_one, 19, 0, 1, 1689, 1498] +[:key_held_player_one, 15, 0, 1, 1690, 1499] +[:key_held_player_one, 19, 0, 1, 1691, 1499] +[:key_held_player_one, 15, 0, 1, 1692, 1500] +[:key_held_player_one, 19, 0, 1, 1693, 1500] +[:key_held_player_one, 15, 0, 1, 1694, 1501] +[:key_held_player_one, 19, 0, 1, 1695, 1501] +[:key_held_player_one, 15, 0, 1, 1696, 1502] +[:key_held_player_one, 19, 0, 1, 1697, 1502] +[:key_held_player_one, 15, 0, 1, 1698, 1503] +[:key_held_player_one, 19, 0, 1, 1699, 1503] +[:key_held_player_one, 15, 0, 1, 1700, 1504] +[:key_held_player_one, 19, 0, 1, 1701, 1504] +[:key_held_player_one, 15, 0, 1, 1702, 1505] +[:key_held_player_one, 19, 0, 1, 1703, 1505] +[:key_held_player_one, 15, 0, 1, 1704, 1506] +[:key_held_player_one, 19, 0, 1, 1705, 1506] +[:key_held_player_one, 15, 0, 1, 1706, 1507] +[:key_held_player_one, 19, 0, 1, 1707, 1507] +[:key_held_player_one, 15, 0, 1, 1708, 1508] +[:key_held_player_one, 19, 0, 1, 1709, 1508] +[:key_held_player_one, 15, 0, 1, 1710, 1509] +[:key_held_player_one, 19, 0, 1, 1711, 1509] +[:key_held_player_one, 15, 0, 1, 1712, 1510] +[:key_held_player_one, 19, 0, 1, 1713, 1510] +[:key_held_player_one, 15, 0, 1, 1714, 1511] +[:key_held_player_one, 19, 0, 1, 1715, 1511] +[:key_held_player_one, 15, 0, 1, 1716, 1512] +[:key_held_player_one, 19, 0, 1, 1717, 1512] +[:key_held_player_one, 15, 0, 1, 1718, 1513] +[:key_held_player_one, 19, 0, 1, 1719, 1513] +[:key_held_player_one, 15, 0, 1, 1720, 1514] +[:key_held_player_one, 19, 0, 1, 1721, 1514] +[:key_held_player_one, 15, 0, 1, 1722, 1515] +[:key_held_player_one, 19, 0, 1, 1723, 1515] +[:key_held_player_one, 15, 0, 1, 1724, 1516] +[:key_held_player_one, 19, 0, 1, 1725, 1516] +[:key_held_player_one, 15, 0, 1, 1726, 1517] +[:key_held_player_one, 19, 0, 1, 1727, 1517] +[:key_held_player_one, 15, 0, 1, 1728, 1518] +[:key_held_player_one, 19, 0, 1, 1729, 1518] +[:key_held_player_one, 15, 0, 1, 1730, 1519] +[:key_held_player_one, 19, 0, 1, 1731, 1519] +[:key_held_player_one, 15, 0, 1, 1732, 1520] +[:key_held_player_one, 19, 0, 1, 1733, 1520] +[:key_down_player_one, 4, 0, 1, 1734, 1521] +[:key_held_player_one, 15, 0, 1, 1735, 1521] +[:key_held_player_one, 19, 0, 1, 1736, 1521] +[:key_down_player_one, 27, 0, 1, 1737, 1521] +[:key_held_player_one, 4, 0, 1, 1738, 1522] +[:key_held_player_one, 15, 0, 1, 1739, 1522] +[:key_held_player_one, 19, 0, 1, 1740, 1522] +[:key_held_player_one, 27, 0, 1, 1741, 1522] +[:key_held_player_one, 4, 0, 1, 1742, 1523] +[:key_held_player_one, 15, 0, 1, 1743, 1523] +[:key_held_player_one, 19, 0, 1, 1744, 1523] +[:key_held_player_one, 27, 0, 1, 1745, 1523] +[:key_held_player_one, 4, 0, 1, 1746, 1524] +[:key_held_player_one, 15, 0, 1, 1747, 1524] +[:key_held_player_one, 19, 0, 1, 1748, 1524] +[:key_held_player_one, 27, 0, 1, 1749, 1524] +[:key_held_player_one, 4, 0, 1, 1750, 1525] +[:key_held_player_one, 15, 0, 1, 1751, 1525] +[:key_held_player_one, 19, 0, 1, 1752, 1525] +[:key_held_player_one, 27, 0, 1, 1753, 1525] +[:key_up_player_one, 4, 0, 1, 1754, 1526] +[:key_held_player_one, 15, 0, 1, 1755, 1526] +[:key_held_player_one, 19, 0, 1, 1756, 1526] +[:key_up_player_one, 27, 0, 1, 1757, 1526] +[:key_held_player_one, 15, 0, 1, 1758, 1527] +[:key_held_player_one, 19, 0, 1, 1759, 1527] +[:key_held_player_one, 15, 0, 1, 1760, 1528] +[:key_held_player_one, 19, 0, 1, 1761, 1528] +[:key_held_player_one, 15, 0, 1, 1762, 1529] +[:key_held_player_one, 19, 0, 1, 1763, 1529] +[:key_held_player_one, 15, 0, 1, 1764, 1530] +[:key_held_player_one, 19, 0, 1, 1765, 1530] +[:key_held_player_one, 15, 0, 1, 1766, 1531] +[:key_held_player_one, 19, 0, 1, 1767, 1531] +[:key_held_player_one, 15, 0, 1, 1768, 1532] +[:key_held_player_one, 19, 0, 1, 1769, 1532] +[:key_held_player_one, 15, 0, 1, 1770, 1533] +[:key_held_player_one, 19, 0, 1, 1771, 1533] +[:key_held_player_one, 15, 0, 1, 1772, 1534] +[:key_held_player_one, 19, 0, 1, 1773, 1534] +[:key_held_player_one, 15, 0, 1, 1774, 1535] +[:key_held_player_one, 19, 0, 1, 1775, 1535] +[:key_held_player_one, 15, 0, 1, 1776, 1536] +[:key_held_player_one, 19, 0, 1, 1777, 1536] +[:key_held_player_one, 15, 0, 1, 1778, 1537] +[:key_held_player_one, 19, 0, 1, 1779, 1537] +[:key_held_player_one, 15, 0, 1, 1780, 1538] +[:key_held_player_one, 19, 0, 1, 1781, 1538] +[:key_held_player_one, 15, 0, 1, 1782, 1539] +[:key_held_player_one, 19, 0, 1, 1783, 1539] +[:key_held_player_one, 15, 0, 1, 1784, 1540] +[:key_held_player_one, 19, 0, 1, 1785, 1540] +[:key_held_player_one, 15, 0, 1, 1786, 1541] +[:key_held_player_one, 19, 0, 1, 1787, 1541] +[:key_held_player_one, 15, 0, 1, 1788, 1542] +[:key_held_player_one, 19, 0, 1, 1789, 1542] +[:key_held_player_one, 15, 0, 1, 1790, 1543] +[:key_held_player_one, 19, 0, 1, 1791, 1543] +[:key_held_player_one, 15, 0, 1, 1792, 1544] +[:key_held_player_one, 19, 0, 1, 1793, 1544] +[:key_held_player_one, 15, 0, 1, 1794, 1545] +[:key_held_player_one, 19, 0, 1, 1795, 1545] +[:key_held_player_one, 15, 0, 1, 1796, 1546] +[:key_held_player_one, 19, 0, 1, 1797, 1546] +[:key_held_player_one, 15, 0, 1, 1798, 1547] +[:key_held_player_one, 19, 0, 1, 1799, 1547] +[:key_held_player_one, 15, 0, 1, 1800, 1548] +[:key_held_player_one, 19, 0, 1, 1801, 1548] +[:key_held_player_one, 15, 0, 1, 1802, 1549] +[:key_held_player_one, 19, 0, 1, 1803, 1549] +[:key_held_player_one, 15, 0, 1, 1804, 1550] +[:key_held_player_one, 19, 0, 1, 1805, 1550] +[:key_held_player_one, 15, 0, 1, 1806, 1551] +[:key_held_player_one, 19, 0, 1, 1807, 1551] +[:key_held_player_one, 15, 0, 1, 1808, 1552] +[:key_held_player_one, 19, 0, 1, 1809, 1552] +[:key_held_player_one, 15, 0, 1, 1810, 1553] +[:key_held_player_one, 19, 0, 1, 1811, 1553] +[:key_held_player_one, 15, 0, 1, 1812, 1554] +[:key_held_player_one, 19, 0, 1, 1813, 1554] +[:key_held_player_one, 15, 0, 1, 1814, 1555] +[:key_held_player_one, 19, 0, 1, 1815, 1555] +[:key_held_player_one, 15, 0, 1, 1816, 1556] +[:key_held_player_one, 19, 0, 1, 1817, 1556] +[:key_held_player_one, 15, 0, 1, 1818, 1557] +[:key_held_player_one, 19, 0, 1, 1819, 1557] +[:key_held_player_one, 15, 0, 1, 1820, 1558] +[:key_held_player_one, 19, 0, 1, 1821, 1558] +[:key_held_player_one, 15, 0, 1, 1822, 1559] +[:key_held_player_one, 19, 0, 1, 1823, 1559] +[:key_held_player_one, 15, 0, 1, 1824, 1560] +[:key_held_player_one, 19, 0, 1, 1825, 1560] +[:key_held_player_one, 15, 0, 1, 1826, 1561] +[:key_held_player_one, 19, 0, 1, 1827, 1561] +[:key_held_player_one, 15, 0, 1, 1828, 1562] +[:key_held_player_one, 19, 0, 1, 1829, 1562] +[:key_held_player_one, 15, 0, 1, 1830, 1563] +[:key_held_player_one, 19, 0, 1, 1831, 1563] +[:key_held_player_one, 15, 0, 1, 1832, 1564] +[:key_held_player_one, 19, 0, 1, 1833, 1564] +[:key_held_player_one, 15, 0, 1, 1834, 1565] +[:key_held_player_one, 19, 0, 1, 1835, 1565] +[:key_held_player_one, 15, 0, 1, 1836, 1566] +[:key_held_player_one, 19, 0, 1, 1837, 1566] +[:key_held_player_one, 15, 0, 1, 1838, 1567] +[:key_held_player_one, 19, 0, 1, 1839, 1567] +[:key_held_player_one, 15, 0, 1, 1840, 1568] +[:key_held_player_one, 19, 0, 1, 1841, 1568] +[:key_held_player_one, 15, 0, 1, 1842, 1569] +[:key_held_player_one, 19, 0, 1, 1843, 1569] +[:key_held_player_one, 15, 0, 1, 1844, 1570] +[:key_held_player_one, 19, 0, 1, 1845, 1570] +[:key_held_player_one, 15, 0, 1, 1846, 1571] +[:key_held_player_one, 19, 0, 1, 1847, 1571] +[:key_held_player_one, 15, 0, 1, 1848, 1572] +[:key_held_player_one, 19, 0, 1, 1849, 1572] +[:key_held_player_one, 15, 0, 1, 1850, 1573] +[:key_held_player_one, 19, 0, 1, 1851, 1573] +[:key_held_player_one, 15, 0, 1, 1852, 1574] +[:key_held_player_one, 19, 0, 1, 1853, 1574] +[:key_held_player_one, 15, 0, 1, 1854, 1575] +[:key_held_player_one, 19, 0, 1, 1855, 1575] +[:key_held_player_one, 15, 0, 1, 1856, 1576] +[:key_held_player_one, 19, 0, 1, 1857, 1576] +[:key_held_player_one, 15, 0, 1, 1858, 1577] +[:key_held_player_one, 19, 0, 1, 1859, 1577] +[:key_held_player_one, 15, 0, 1, 1860, 1578] +[:key_held_player_one, 19, 0, 1, 1861, 1578] +[:key_held_player_one, 15, 0, 1, 1862, 1579] +[:key_held_player_one, 19, 0, 1, 1863, 1579] +[:key_held_player_one, 15, 0, 1, 1864, 1580] +[:key_held_player_one, 19, 0, 1, 1865, 1580] +[:key_held_player_one, 15, 0, 1, 1866, 1581] +[:key_held_player_one, 19, 0, 1, 1867, 1581] +[:key_held_player_one, 15, 0, 1, 1868, 1582] +[:key_held_player_one, 19, 0, 1, 1869, 1582] +[:key_held_player_one, 15, 0, 1, 1870, 1583] +[:key_held_player_one, 19, 0, 1, 1871, 1583] +[:key_held_player_one, 15, 0, 1, 1872, 1584] +[:key_held_player_one, 19, 0, 1, 1873, 1584] +[:key_held_player_one, 15, 0, 1, 1874, 1585] +[:key_held_player_one, 19, 0, 1, 1875, 1585] +[:key_up_player_one, 15, 0, 1, 1876, 1586] +[:key_held_player_one, 19, 0, 1, 1877, 1586] +[:key_held_player_one, 19, 0, 1, 1878, 1587] +[:key_up_player_one, 19, 0, 1, 1879, 1588] +[:key_down_player_one, 19, 0, 1, 1880, 1713] +[:key_held_player_one, 19, 0, 1, 1881, 1714] +[:key_held_player_one, 19, 0, 1, 1882, 1715] +[:key_held_player_one, 19, 0, 1, 1883, 1716] +[:key_held_player_one, 19, 0, 1, 1884, 1717] +[:key_held_player_one, 19, 0, 1, 1885, 1718] +[:key_held_player_one, 19, 0, 1, 1886, 1719] +[:key_held_player_one, 19, 0, 1, 1887, 1720] +[:key_held_player_one, 19, 0, 1, 1888, 1721] +[:key_held_player_one, 19, 0, 1, 1889, 1722] +[:key_held_player_one, 19, 0, 1, 1890, 1723] +[:key_held_player_one, 19, 0, 1, 1891, 1724] +[:key_held_player_one, 19, 0, 1, 1892, 1725] +[:key_held_player_one, 19, 0, 1, 1893, 1726] +[:key_held_player_one, 19, 0, 1, 1894, 1727] +[:key_held_player_one, 19, 0, 1, 1895, 1728] +[:key_held_player_one, 19, 0, 1, 1896, 1729] +[:key_held_player_one, 19, 0, 1, 1897, 1730] +[:key_held_player_one, 19, 0, 1, 1898, 1731] +[:key_held_player_one, 19, 0, 1, 1899, 1732] +[:key_held_player_one, 19, 0, 1, 1900, 1733] +[:key_held_player_one, 19, 0, 1, 1901, 1734] +[:key_held_player_one, 19, 0, 1, 1902, 1735] +[:key_held_player_one, 19, 0, 1, 1903, 1736] +[:key_down_player_one, 4, 0, 1, 1904, 1737] +[:key_held_player_one, 19, 0, 1, 1905, 1737] +[:key_down_player_one, 27, 0, 1, 1906, 1737] +[:key_held_player_one, 4, 0, 1, 1907, 1738] +[:key_held_player_one, 19, 0, 1, 1908, 1738] +[:key_held_player_one, 27, 0, 1, 1909, 1738] +[:key_held_player_one, 4, 0, 1, 1910, 1739] +[:key_held_player_one, 19, 0, 1, 1911, 1739] +[:key_held_player_one, 27, 0, 1, 1912, 1739] +[:key_held_player_one, 4, 0, 1, 1913, 1740] +[:key_held_player_one, 19, 0, 1, 1914, 1740] +[:key_held_player_one, 27, 0, 1, 1915, 1740] +[:key_held_player_one, 4, 0, 1, 1916, 1741] +[:key_held_player_one, 19, 0, 1, 1917, 1741] +[:key_held_player_one, 27, 0, 1, 1918, 1741] +[:key_held_player_one, 4, 0, 1, 1919, 1742] +[:key_held_player_one, 19, 0, 1, 1920, 1742] +[:key_held_player_one, 27, 0, 1, 1921, 1742] +[:key_held_player_one, 4, 0, 1, 1922, 1743] +[:key_held_player_one, 19, 0, 1, 1923, 1743] +[:key_held_player_one, 27, 0, 1, 1924, 1743] +[:key_held_player_one, 4, 0, 1, 1925, 1744] +[:key_held_player_one, 19, 0, 1, 1926, 1744] +[:key_held_player_one, 27, 0, 1, 1927, 1744] +[:key_held_player_one, 4, 0, 1, 1928, 1745] +[:key_held_player_one, 19, 0, 1, 1929, 1745] +[:key_held_player_one, 27, 0, 1, 1930, 1745] +[:key_held_player_one, 4, 0, 1, 1931, 1746] +[:key_held_player_one, 19, 0, 1, 1932, 1746] +[:key_held_player_one, 27, 0, 1, 1933, 1746] +[:key_held_player_one, 4, 0, 1, 1934, 1747] +[:key_held_player_one, 19, 0, 1, 1935, 1747] +[:key_held_player_one, 27, 0, 1, 1936, 1747] +[:key_held_player_one, 4, 0, 1, 1937, 1748] +[:key_held_player_one, 19, 0, 1, 1938, 1748] +[:key_held_player_one, 27, 0, 1, 1939, 1748] +[:key_up_player_one, 4, 0, 1, 1940, 1749] +[:key_held_player_one, 19, 0, 1, 1941, 1749] +[:key_up_player_one, 27, 0, 1, 1942, 1749] +[:key_held_player_one, 19, 0, 1, 1943, 1750] +[:key_held_player_one, 19, 0, 1, 1944, 1751] +[:key_held_player_one, 19, 0, 1, 1945, 1752] +[:key_held_player_one, 19, 0, 1, 1946, 1753] +[:key_held_player_one, 19, 0, 1, 1947, 1754] +[:key_held_player_one, 19, 0, 1, 1948, 1755] +[:key_held_player_one, 19, 0, 1, 1949, 1756] +[:key_held_player_one, 19, 0, 1, 1950, 1757] +[:key_held_player_one, 19, 0, 1, 1951, 1758] +[:key_held_player_one, 19, 0, 1, 1952, 1759] +[:key_held_player_one, 19, 0, 1, 1953, 1760] +[:key_held_player_one, 19, 0, 1, 1954, 1761] +[:key_held_player_one, 19, 0, 1, 1955, 1762] +[:key_held_player_one, 19, 0, 1, 1956, 1763] +[:key_held_player_one, 19, 0, 1, 1957, 1764] +[:key_held_player_one, 19, 0, 1, 1958, 1765] +[:key_held_player_one, 19, 0, 1, 1959, 1766] +[:key_held_player_one, 19, 0, 1, 1960, 1767] +[:key_down_player_one, 14, 0, 1, 1961, 1768] +[:key_held_player_one, 19, 0, 1, 1962, 1768] +[:key_held_player_one, 14, 0, 1, 1963, 1769] +[:key_held_player_one, 19, 0, 1, 1964, 1769] +[:key_down_player_one, 3, 0, 1, 1965, 1770] +[:key_held_player_one, 14, 0, 1, 1966, 1770] +[:key_held_player_one, 19, 0, 1, 1967, 1770] +[:key_down_player_one, 26, 0, 1, 1968, 1770] +[:key_held_player_one, 3, 0, 1, 1969, 1771] +[:key_held_player_one, 14, 0, 1, 1970, 1771] +[:key_held_player_one, 19, 0, 1, 1971, 1771] +[:key_held_player_one, 26, 0, 1, 1972, 1771] +[:key_held_player_one, 3, 0, 1, 1973, 1772] +[:key_held_player_one, 14, 0, 1, 1974, 1772] +[:key_held_player_one, 19, 0, 1, 1975, 1772] +[:key_held_player_one, 26, 0, 1, 1976, 1772] +[:key_held_player_one, 3, 0, 1, 1977, 1773] +[:key_held_player_one, 14, 0, 1, 1978, 1773] +[:key_held_player_one, 19, 0, 1, 1979, 1773] +[:key_held_player_one, 26, 0, 1, 1980, 1773] +[:key_held_player_one, 3, 0, 1, 1981, 1774] +[:key_up_player_one, 14, 0, 1, 1982, 1774] +[:key_held_player_one, 19, 0, 1, 1983, 1774] +[:key_held_player_one, 26, 0, 1, 1984, 1774] +[:key_held_player_one, 3, 0, 1, 1985, 1775] +[:key_held_player_one, 19, 0, 1, 1986, 1775] +[:key_held_player_one, 26, 0, 1, 1987, 1775] +[:key_held_player_one, 3, 0, 1, 1988, 1776] +[:key_held_player_one, 19, 0, 1, 1989, 1776] +[:key_held_player_one, 26, 0, 1, 1990, 1776] +[:key_up_player_one, 3, 0, 1, 1991, 1777] +[:key_held_player_one, 19, 0, 1, 1992, 1777] +[:key_up_player_one, 26, 0, 1, 1993, 1777] +[:key_held_player_one, 19, 0, 1, 1994, 1778] +[:key_held_player_one, 19, 0, 1, 1995, 1779] +[:key_down_player_one, 14, 0, 1, 1996, 1780] +[:key_held_player_one, 19, 0, 1, 1997, 1780] +[:key_held_player_one, 14, 0, 1, 1998, 1781] +[:key_held_player_one, 19, 0, 1, 1999, 1781] +[:key_held_player_one, 14, 0, 1, 2000, 1782] +[:key_held_player_one, 19, 0, 1, 2001, 1782] +[:key_held_player_one, 14, 0, 1, 2002, 1783] +[:key_held_player_one, 19, 0, 1, 2003, 1783] +[:key_held_player_one, 14, 0, 1, 2004, 1784] +[:key_held_player_one, 19, 0, 1, 2005, 1784] +[:key_held_player_one, 14, 0, 1, 2006, 1785] +[:key_held_player_one, 19, 0, 1, 2007, 1785] +[:key_up_player_one, 14, 0, 1, 2008, 1786] +[:key_held_player_one, 19, 0, 1, 2009, 1786] +[:key_held_player_one, 19, 0, 1, 2010, 1787] +[:key_held_player_one, 19, 0, 1, 2011, 1788] +[:key_held_player_one, 19, 0, 1, 2012, 1789] +[:key_down_player_one, 14, 0, 1, 2013, 1790] +[:key_held_player_one, 19, 0, 1, 2014, 1790] +[:key_held_player_one, 14, 0, 1, 2015, 1791] +[:key_held_player_one, 19, 0, 1, 2016, 1791] +[:key_held_player_one, 14, 0, 1, 2017, 1792] +[:key_held_player_one, 19, 0, 1, 2018, 1792] +[:key_held_player_one, 14, 0, 1, 2019, 1793] +[:key_held_player_one, 19, 0, 1, 2020, 1793] +[:key_held_player_one, 14, 0, 1, 2021, 1794] +[:key_held_player_one, 19, 0, 1, 2022, 1794] +[:key_down_player_one, 4, 0, 1, 2023, 1795] +[:key_held_player_one, 14, 0, 1, 2024, 1795] +[:key_held_player_one, 19, 0, 1, 2025, 1795] +[:key_down_player_one, 27, 0, 1, 2026, 1795] +[:key_held_player_one, 4, 0, 1, 2027, 1796] +[:key_up_player_one, 14, 0, 1, 2028, 1796] +[:key_held_player_one, 19, 0, 1, 2029, 1796] +[:key_held_player_one, 27, 0, 1, 2030, 1796] +[:key_held_player_one, 4, 0, 1, 2031, 1797] +[:key_held_player_one, 19, 0, 1, 2032, 1797] +[:key_held_player_one, 27, 0, 1, 2033, 1797] +[:key_held_player_one, 4, 0, 1, 2034, 1798] +[:key_held_player_one, 19, 0, 1, 2035, 1798] +[:key_held_player_one, 27, 0, 1, 2036, 1798] +[:key_held_player_one, 4, 0, 1, 2037, 1799] +[:key_held_player_one, 19, 0, 1, 2038, 1799] +[:key_held_player_one, 27, 0, 1, 2039, 1799] +[:key_held_player_one, 4, 0, 1, 2040, 1800] +[:key_down_player_one, 14, 0, 1, 2041, 1800] +[:key_held_player_one, 19, 0, 1, 2042, 1800] +[:key_held_player_one, 27, 0, 1, 2043, 1800] +[:key_up_player_one, 4, 0, 1, 2044, 1801] +[:key_held_player_one, 14, 0, 1, 2045, 1801] +[:key_held_player_one, 19, 0, 1, 2046, 1801] +[:key_up_player_one, 27, 0, 1, 2047, 1801] +[:key_held_player_one, 14, 0, 1, 2048, 1802] +[:key_held_player_one, 19, 0, 1, 2049, 1802] +[:key_held_player_one, 14, 0, 1, 2050, 1803] +[:key_held_player_one, 19, 0, 1, 2051, 1803] +[:key_held_player_one, 14, 0, 1, 2052, 1804] +[:key_held_player_one, 19, 0, 1, 2053, 1804] +[:key_held_player_one, 14, 0, 1, 2054, 1805] +[:key_held_player_one, 19, 0, 1, 2055, 1805] +[:key_held_player_one, 14, 0, 1, 2056, 1806] +[:key_held_player_one, 19, 0, 1, 2057, 1806] +[:key_held_player_one, 14, 0, 1, 2058, 1807] +[:key_held_player_one, 19, 0, 1, 2059, 1807] +[:key_up_player_one, 14, 0, 1, 2060, 1808] +[:key_held_player_one, 19, 0, 1, 2061, 1808] +[:key_held_player_one, 19, 0, 1, 2062, 1809] +[:key_held_player_one, 19, 0, 1, 2063, 1810] +[:key_down_player_one, 3, 0, 1, 2064, 1811] +[:key_down_player_one, 14, 0, 1, 2065, 1811] +[:key_held_player_one, 19, 0, 1, 2066, 1811] +[:key_down_player_one, 26, 0, 1, 2067, 1811] +[:key_held_player_one, 3, 0, 1, 2068, 1812] +[:key_held_player_one, 14, 0, 1, 2069, 1812] +[:key_held_player_one, 19, 0, 1, 2070, 1812] +[:key_held_player_one, 26, 0, 1, 2071, 1812] +[:key_held_player_one, 3, 0, 1, 2072, 1813] +[:key_held_player_one, 14, 0, 1, 2073, 1813] +[:key_held_player_one, 19, 0, 1, 2074, 1813] +[:key_held_player_one, 26, 0, 1, 2075, 1813] +[:key_held_player_one, 3, 0, 1, 2076, 1814] +[:key_held_player_one, 14, 0, 1, 2077, 1814] +[:key_held_player_one, 19, 0, 1, 2078, 1814] +[:key_held_player_one, 26, 0, 1, 2079, 1814] +[:key_held_player_one, 3, 0, 1, 2080, 1815] +[:key_held_player_one, 14, 0, 1, 2081, 1815] +[:key_held_player_one, 19, 0, 1, 2082, 1815] +[:key_held_player_one, 26, 0, 1, 2083, 1815] +[:key_held_player_one, 3, 0, 1, 2084, 1816] +[:key_held_player_one, 14, 0, 1, 2085, 1816] +[:key_held_player_one, 19, 0, 1, 2086, 1816] +[:key_held_player_one, 26, 0, 1, 2087, 1816] +[:key_held_player_one, 3, 0, 1, 2088, 1817] +[:key_held_player_one, 14, 0, 1, 2089, 1817] +[:key_held_player_one, 19, 0, 1, 2090, 1817] +[:key_held_player_one, 26, 0, 1, 2091, 1817] +[:key_held_player_one, 3, 0, 1, 2092, 1818] +[:key_held_player_one, 14, 0, 1, 2093, 1818] +[:key_held_player_one, 19, 0, 1, 2094, 1818] +[:key_held_player_one, 26, 0, 1, 2095, 1818] +[:key_held_player_one, 3, 0, 1, 2096, 1819] +[:key_up_player_one, 14, 0, 1, 2097, 1819] +[:key_held_player_one, 19, 0, 1, 2098, 1819] +[:key_held_player_one, 26, 0, 1, 2099, 1819] +[:key_held_player_one, 3, 0, 1, 2100, 1820] +[:key_held_player_one, 19, 0, 1, 2101, 1820] +[:key_held_player_one, 26, 0, 1, 2102, 1820] +[:key_held_player_one, 3, 0, 1, 2103, 1821] +[:key_held_player_one, 19, 0, 1, 2104, 1821] +[:key_held_player_one, 26, 0, 1, 2105, 1821] +[:key_held_player_one, 3, 0, 1, 2106, 1822] +[:key_held_player_one, 19, 0, 1, 2107, 1822] +[:key_held_player_one, 26, 0, 1, 2108, 1822] +[:key_held_player_one, 3, 0, 1, 2109, 1823] +[:key_down_player_one, 14, 0, 1, 2110, 1823] +[:key_held_player_one, 19, 0, 1, 2111, 1823] +[:key_held_player_one, 26, 0, 1, 2112, 1823] +[:key_held_player_one, 3, 0, 1, 2113, 1824] +[:key_held_player_one, 14, 0, 1, 2114, 1824] +[:key_held_player_one, 19, 0, 1, 2115, 1824] +[:key_held_player_one, 26, 0, 1, 2116, 1824] +[:key_held_player_one, 3, 0, 1, 2117, 1825] +[:key_held_player_one, 14, 0, 1, 2118, 1825] +[:key_held_player_one, 19, 0, 1, 2119, 1825] +[:key_held_player_one, 26, 0, 1, 2120, 1825] +[:key_held_player_one, 3, 0, 1, 2121, 1826] +[:key_held_player_one, 14, 0, 1, 2122, 1826] +[:key_held_player_one, 19, 0, 1, 2123, 1826] +[:key_held_player_one, 26, 0, 1, 2124, 1826] +[:key_up_player_one, 3, 0, 1, 2125, 1827] +[:key_held_player_one, 14, 0, 1, 2126, 1827] +[:key_held_player_one, 19, 0, 1, 2127, 1827] +[:key_up_player_one, 26, 0, 1, 2128, 1827] +[:key_held_player_one, 14, 0, 1, 2129, 1828] +[:key_held_player_one, 19, 0, 1, 2130, 1828] +[:key_held_player_one, 14, 0, 1, 2131, 1829] +[:key_held_player_one, 19, 0, 1, 2132, 1829] +[:key_up_player_one, 14, 0, 1, 2133, 1830] +[:key_held_player_one, 19, 0, 1, 2134, 1830] +[:key_held_player_one, 19, 0, 1, 2135, 1831] +[:key_held_player_one, 19, 0, 1, 2136, 1832] +[:key_held_player_one, 19, 0, 1, 2137, 1833] +[:key_down_player_one, 14, 0, 1, 2138, 1834] +[:key_held_player_one, 19, 0, 1, 2139, 1834] +[:key_held_player_one, 14, 0, 1, 2140, 1835] +[:key_held_player_one, 19, 0, 1, 2141, 1835] +[:key_held_player_one, 14, 0, 1, 2142, 1836] +[:key_held_player_one, 19, 0, 1, 2143, 1836] +[:key_held_player_one, 14, 0, 1, 2144, 1837] +[:key_held_player_one, 19, 0, 1, 2145, 1837] +[:key_held_player_one, 14, 0, 1, 2146, 1838] +[:key_held_player_one, 19, 0, 1, 2147, 1838] +[:key_held_player_one, 14, 0, 1, 2148, 1839] +[:key_held_player_one, 19, 0, 1, 2149, 1839] +[:key_held_player_one, 14, 0, 1, 2150, 1840] +[:key_held_player_one, 19, 0, 1, 2151, 1840] +[:key_up_player_one, 14, 0, 1, 2152, 1841] +[:key_held_player_one, 19, 0, 1, 2153, 1841] +[:key_held_player_one, 19, 0, 1, 2154, 1842] +[:key_held_player_one, 19, 0, 1, 2155, 1843] +[:key_held_player_one, 19, 0, 1, 2156, 1844] +[:key_held_player_one, 19, 0, 1, 2157, 1845] +[:key_held_player_one, 19, 0, 1, 2158, 1846] +[:key_held_player_one, 19, 0, 1, 2159, 1847] +[:key_held_player_one, 19, 0, 1, 2160, 1848] +[:key_held_player_one, 19, 0, 1, 2161, 1849] +[:key_held_player_one, 19, 0, 1, 2162, 1850] +[:key_held_player_one, 19, 0, 1, 2163, 1851] +[:key_held_player_one, 19, 0, 1, 2164, 1852] +[:key_held_player_one, 19, 0, 1, 2165, 1853] +[:key_held_player_one, 19, 0, 1, 2166, 1854] +[:key_held_player_one, 19, 0, 1, 2167, 1855] +[:key_held_player_one, 19, 0, 1, 2168, 1856] +[:key_held_player_one, 19, 0, 1, 2169, 1857] +[:key_held_player_one, 19, 0, 1, 2170, 1858] +[:key_held_player_one, 19, 0, 1, 2171, 1859] +[:key_down_player_one, 14, 0, 1, 2172, 1860] +[:key_held_player_one, 19, 0, 1, 2173, 1860] +[:key_held_player_one, 14, 0, 1, 2174, 1861] +[:key_held_player_one, 19, 0, 1, 2175, 1861] +[:key_held_player_one, 14, 0, 1, 2176, 1862] +[:key_held_player_one, 19, 0, 1, 2177, 1862] +[:key_down_player_one, 3, 0, 1, 2178, 1863] +[:key_held_player_one, 14, 0, 1, 2179, 1863] +[:key_held_player_one, 19, 0, 1, 2180, 1863] +[:key_down_player_one, 26, 0, 1, 2181, 1863] +[:key_held_player_one, 3, 0, 1, 2182, 1864] +[:key_held_player_one, 14, 0, 1, 2183, 1864] +[:key_held_player_one, 19, 0, 1, 2184, 1864] +[:key_held_player_one, 26, 0, 1, 2185, 1864] +[:key_held_player_one, 3, 0, 1, 2186, 1865] +[:key_held_player_one, 14, 0, 1, 2187, 1865] +[:key_held_player_one, 19, 0, 1, 2188, 1865] +[:key_held_player_one, 26, 0, 1, 2189, 1865] +[:key_held_player_one, 3, 0, 1, 2190, 1866] +[:key_held_player_one, 14, 0, 1, 2191, 1866] +[:key_held_player_one, 19, 0, 1, 2192, 1866] +[:key_held_player_one, 26, 0, 1, 2193, 1866] +[:key_held_player_one, 3, 0, 1, 2194, 1867] +[:key_held_player_one, 14, 0, 1, 2195, 1867] +[:key_held_player_one, 19, 0, 1, 2196, 1867] +[:key_held_player_one, 26, 0, 1, 2197, 1867] +[:key_held_player_one, 3, 0, 1, 2198, 1868] +[:key_up_player_one, 14, 0, 1, 2199, 1868] +[:key_held_player_one, 19, 0, 1, 2200, 1868] +[:key_held_player_one, 26, 0, 1, 2201, 1868] +[:key_held_player_one, 3, 0, 1, 2202, 1869] +[:key_held_player_one, 19, 0, 1, 2203, 1869] +[:key_held_player_one, 26, 0, 1, 2204, 1869] +[:key_held_player_one, 3, 0, 1, 2205, 1870] +[:key_held_player_one, 19, 0, 1, 2206, 1870] +[:key_held_player_one, 26, 0, 1, 2207, 1870] +[:key_held_player_one, 3, 0, 1, 2208, 1871] +[:key_held_player_one, 19, 0, 1, 2209, 1871] +[:key_held_player_one, 26, 0, 1, 2210, 1871] +[:key_held_player_one, 3, 0, 1, 2211, 1872] +[:key_held_player_one, 19, 0, 1, 2212, 1872] +[:key_held_player_one, 26, 0, 1, 2213, 1872] +[:key_held_player_one, 3, 0, 1, 2214, 1873] +[:key_held_player_one, 19, 0, 1, 2215, 1873] +[:key_held_player_one, 26, 0, 1, 2216, 1873] +[:key_held_player_one, 3, 0, 1, 2217, 1874] +[:key_down_player_one, 14, 0, 1, 2218, 1874] +[:key_held_player_one, 19, 0, 1, 2219, 1874] +[:key_held_player_one, 26, 0, 1, 2220, 1874] +[:key_held_player_one, 3, 0, 1, 2221, 1875] +[:key_held_player_one, 14, 0, 1, 2222, 1875] +[:key_held_player_one, 19, 0, 1, 2223, 1875] +[:key_held_player_one, 26, 0, 1, 2224, 1875] +[:key_held_player_one, 3, 0, 1, 2225, 1876] +[:key_held_player_one, 14, 0, 1, 2226, 1876] +[:key_held_player_one, 19, 0, 1, 2227, 1876] +[:key_held_player_one, 26, 0, 1, 2228, 1876] +[:key_held_player_one, 3, 0, 1, 2229, 1877] +[:key_held_player_one, 14, 0, 1, 2230, 1877] +[:key_held_player_one, 19, 0, 1, 2231, 1877] +[:key_held_player_one, 26, 0, 1, 2232, 1877] +[:key_held_player_one, 3, 0, 1, 2233, 1878] +[:key_held_player_one, 14, 0, 1, 2234, 1878] +[:key_held_player_one, 19, 0, 1, 2235, 1878] +[:key_held_player_one, 26, 0, 1, 2236, 1878] +[:key_held_player_one, 3, 0, 1, 2237, 1879] +[:key_held_player_one, 14, 0, 1, 2238, 1879] +[:key_held_player_one, 19, 0, 1, 2239, 1879] +[:key_held_player_one, 26, 0, 1, 2240, 1879] +[:key_up_player_one, 3, 0, 1, 2241, 1880] +[:key_held_player_one, 14, 0, 1, 2242, 1880] +[:key_held_player_one, 19, 0, 1, 2243, 1880] +[:key_up_player_one, 26, 0, 1, 2244, 1880] +[:key_held_player_one, 14, 0, 1, 2245, 1881] +[:key_held_player_one, 19, 0, 1, 2246, 1881] +[:key_up_player_one, 14, 0, 1, 2247, 1882] +[:key_held_player_one, 19, 0, 1, 2248, 1882] +[:key_held_player_one, 19, 0, 1, 2249, 1883] +[:key_held_player_one, 19, 0, 1, 2250, 1884] +[:key_held_player_one, 19, 0, 1, 2251, 1885] +[:key_held_player_one, 19, 0, 1, 2252, 1886] +[:key_held_player_one, 19, 0, 1, 2253, 1887] +[:key_held_player_one, 19, 0, 1, 2254, 1888] +[:key_held_player_one, 19, 0, 1, 2255, 1889] +[:key_held_player_one, 19, 0, 1, 2256, 1890] +[:key_held_player_one, 19, 0, 1, 2257, 1891] +[:key_held_player_one, 19, 0, 1, 2258, 1892] +[:key_held_player_one, 19, 0, 1, 2259, 1893] +[:key_held_player_one, 19, 0, 1, 2260, 1894] +[:key_held_player_one, 19, 0, 1, 2261, 1895] +[:key_held_player_one, 19, 0, 1, 2262, 1896] +[:key_held_player_one, 19, 0, 1, 2263, 1897] +[:key_down_player_one, 4, 0, 1, 2264, 1898] +[:key_held_player_one, 19, 0, 1, 2265, 1898] +[:key_down_player_one, 27, 0, 1, 2266, 1898] +[:key_held_player_one, 4, 0, 1, 2267, 1899] +[:key_held_player_one, 19, 0, 1, 2268, 1899] +[:key_held_player_one, 27, 0, 1, 2269, 1899] +[:key_held_player_one, 4, 0, 1, 2270, 1900] +[:key_held_player_one, 19, 0, 1, 2271, 1900] +[:key_held_player_one, 27, 0, 1, 2272, 1900] +[:key_held_player_one, 4, 0, 1, 2273, 1901] +[:key_held_player_one, 19, 0, 1, 2274, 1901] +[:key_held_player_one, 27, 0, 1, 2275, 1901] +[:key_held_player_one, 4, 0, 1, 2276, 1902] +[:key_held_player_one, 19, 0, 1, 2277, 1902] +[:key_held_player_one, 27, 0, 1, 2278, 1902] +[:key_held_player_one, 4, 0, 1, 2279, 1903] +[:key_held_player_one, 19, 0, 1, 2280, 1903] +[:key_held_player_one, 27, 0, 1, 2281, 1903] +[:key_held_player_one, 4, 0, 1, 2282, 1904] +[:key_held_player_one, 19, 0, 1, 2283, 1904] +[:key_held_player_one, 27, 0, 1, 2284, 1904] +[:key_up_player_one, 4, 0, 1, 2285, 1905] +[:key_held_player_one, 19, 0, 1, 2286, 1905] +[:key_up_player_one, 27, 0, 1, 2287, 1905] +[:key_held_player_one, 19, 0, 1, 2288, 1906] +[:key_held_player_one, 19, 0, 1, 2289, 1907] +[:key_held_player_one, 19, 0, 1, 2290, 1908] +[:key_held_player_one, 19, 0, 1, 2291, 1909] +[:key_held_player_one, 19, 0, 1, 2292, 1910] +[:key_held_player_one, 19, 0, 1, 2293, 1911] +[:key_held_player_one, 19, 0, 1, 2294, 1912] +[:key_held_player_one, 19, 0, 1, 2295, 1913] +[:key_held_player_one, 19, 0, 1, 2296, 1914] +[:key_up_player_one, 19, 0, 1, 2297, 1915] +[:key_down_raw, 1073741906, 0, 2, 2298, 2063] +[:key_down_raw, 1073741906, 0, 2, 2299, 2063] +[:key_down_raw, 1073741906, 0, 2, 2300, 2066] +[:key_down_raw, 1073741906, 0, 2, 2301, 2070] +[:key_down_raw, 1073741906, 0, 2, 2302, 2072] +[:key_down_raw, 1073741906, 0, 2, 2303, 2074] +[:key_down_raw, 1073741906, 0, 2, 2304, 2076] +[:key_down_raw, 1073741906, 0, 2, 2305, 2078] +[:key_down_raw, 1073741906, 0, 2, 2306, 2080] +[:key_down_raw, 1073741906, 0, 2, 2307, 2082] +[:key_down_raw, 1073741906, 0, 2, 2308, 2084] +[:key_down_raw, 1073741906, 0, 2, 2309, 2086] +[:key_down_raw, 1073741906, 0, 2, 2310, 2088] +[:key_down_raw, 1073741906, 0, 2, 2311, 2090] +[:key_down_raw, 1073741906, 0, 2, 2312, 2092] +[:key_down_raw, 1073741906, 0, 2, 2313, 2094] +[:key_down_raw, 1073741906, 0, 2, 2314, 2096] +[:key_down_raw, 1073741906, 0, 2, 2315, 2098] +[:key_down_raw, 1073741906, 0, 2, 2316, 2100] +[:key_down_raw, 1073741906, 0, 2, 2317, 2102] +[:key_down_raw, 1073741906, 0, 2, 2318, 2104] +[:key_down_raw, 1073741906, 0, 2, 2319, 2106] +[:key_down_raw, 1073741906, 0, 2, 2320, 2108] +[:key_down_raw, 1073741906, 0, 2, 2321, 2110] +[:key_down_raw, 1073741906, 0, 2, 2322, 2113] +[:key_down_raw, 1073741906, 0, 2, 2323, 2115] +[:key_down_raw, 1073741906, 0, 2, 2324, 2117] +[:key_down_raw, 1073741906, 0, 2, 2325, 2119] +[:key_down_raw, 1073741906, 0, 2, 2326, 2121] +[:key_down_raw, 1073741906, 0, 2, 2327, 2123] +[:key_down_raw, 1073741906, 0, 2, 2328, 2125] +[:key_down_raw, 1073741906, 0, 2, 2329, 2127] +[:key_down_raw, 1073741906, 0, 2, 2330, 2129] +[:key_down_raw, 1073741906, 0, 2, 2331, 2131] +[:key_down_raw, 1073741906, 0, 2, 2332, 2133] +[:key_down_raw, 1073741906, 0, 2, 2333, 2135] +[:key_down_raw, 1073741906, 0, 2, 2334, 2137] +[:key_down_raw, 1073741906, 0, 2, 2335, 2139] +[:key_down_raw, 1073741906, 0, 2, 2336, 2141] +[:key_down_raw, 1073741904, 0, 2, 2337, 2141] +[:key_up_raw, 1073741904, 0, 2, 2338, 2145] +[:key_down_raw, 1073741904, 0, 2, 2339, 2151] +[:key_up_raw, 1073741904, 0, 2, 2340, 2156] +[:key_down_raw, 1073741904, 0, 2, 2341, 2160] +[:key_up_raw, 1073741904, 0, 2, 2342, 2163] +[:key_down_raw, 1073741904, 0, 2, 2343, 2177] +[:key_down_raw, 1073741904, 0, 2, 2344, 2202] +[:key_down_raw, 1073741904, 0, 2, 2345, 2204] +[:key_down_raw, 1073741904, 0, 2, 2346, 2206] +[:key_down_raw, 1073741904, 0, 2, 2347, 2208] +[:key_down_raw, 32, 0, 2, 2348, 2208] +[:key_down_raw, 32, 0, 2, 2349, 2233] +[:key_down_raw, 32, 0, 2, 2350, 2235] +[:key_down_raw, 32, 0, 2, 2351, 2237] +[:key_down_raw, 32, 0, 2, 2352, 2239] +[:key_down_raw, 32, 0, 2, 2353, 2241] +[:key_down_raw, 32, 0, 2, 2354, 2244] +[:key_down_raw, 32, 0, 2, 2355, 2246] +[:key_down_raw, 32, 0, 2, 2356, 2247] +[:key_down_raw, 32, 0, 2, 2357, 2249] +[:key_down_raw, 32, 0, 2, 2358, 2251] +[:key_down_raw, 32, 0, 2, 2359, 2254] +[:key_down_raw, 32, 0, 2, 2360, 2255] +[:key_down_raw, 32, 0, 2, 2361, 2257] +[:key_down_raw, 32, 0, 2, 2362, 2259] +[:key_up_raw, 1073741904, 0, 2, 2363, 2261] +[:key_up_raw, 32, 0, 2, 2364, 2261] +[:key_down_raw, 1073741904, 0, 2, 2365, 2299] +[:key_up_raw, 1073741904, 0, 2, 2366, 2320] +[:key_down_raw, 1073741905, 0, 2, 2367, 2338] +[:key_up_raw, 1073741905, 0, 2, 2368, 2342] +[:key_down_raw, 1073741905, 0, 2, 2369, 2348] +[:key_up_raw, 1073741905, 0, 2, 2370, 2354] +[:key_down_raw, 1073741905, 0, 2, 2371, 2360] +[:key_up_raw, 1073741905, 0, 2, 2372, 2363] +[:key_down_raw, 1073741905, 0, 2, 2373, 2367] +[:key_up_raw, 1073741905, 0, 2, 2374, 2371] +[:key_down_raw, 1073741905, 0, 2, 2375, 2376] +[:key_up_raw, 1073741905, 0, 2, 2376, 2380] +[:key_up_raw, 1073741906, 0, 2, 2377, 2384] +[:key_down_raw, 1073742051, 1024, 2, 2378, 2682] +[:key_down_raw, 113, 1024, 2, 2379, 2732] diff --git a/samples/99_sample_game_dueling_starships/sprites/blue_bullet.png b/samples/99_sample_game_dueling_starships/sprites/blue_bullet.png Binary files differnew file mode 100644 index 0000000..78ae7d0 --- /dev/null +++ b/samples/99_sample_game_dueling_starships/sprites/blue_bullet.png diff --git a/samples/99_sample_game_dueling_starships/sprites/flame.png b/samples/99_sample_game_dueling_starships/sprites/flame.png Binary files differnew file mode 100644 index 0000000..6143f2f --- /dev/null +++ b/samples/99_sample_game_dueling_starships/sprites/flame.png diff --git a/samples/99_sample_game_dueling_starships/sprites/red_bullet.png b/samples/99_sample_game_dueling_starships/sprites/red_bullet.png Binary files differnew file mode 100644 index 0000000..3bb6219 --- /dev/null +++ b/samples/99_sample_game_dueling_starships/sprites/red_bullet.png diff --git a/samples/99_sample_game_dueling_starships/sprites/ship_blue.png b/samples/99_sample_game_dueling_starships/sprites/ship_blue.png Binary files differnew file mode 100644 index 0000000..3ef5f0b --- /dev/null +++ b/samples/99_sample_game_dueling_starships/sprites/ship_blue.png diff --git a/samples/99_sample_game_dueling_starships/sprites/ship_red.png b/samples/99_sample_game_dueling_starships/sprites/ship_red.png Binary files differnew file mode 100644 index 0000000..af729b7 --- /dev/null +++ b/samples/99_sample_game_dueling_starships/sprites/ship_red.png diff --git a/samples/99_sample_game_flappy_dragon/CREDITS.txt b/samples/99_sample_game_flappy_dragon/CREDITS.txt new file mode 100644 index 0000000..e02ebbd --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/CREDITS.txt @@ -0,0 +1,3 @@ +code: Amir Rajan, https://twitter.com/amirrajan +graphics and audio: Nick Culbertson, https://twitter.com/MobyPixel + diff --git a/samples/99_sample_game_flappy_dragon/app/main.rb b/samples/99_sample_game_flappy_dragon/app/main.rb new file mode 100644 index 0000000..56ce3ec --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/app/main.rb @@ -0,0 +1,360 @@ +class FlappyDragon + attr_accessor :grid, :inputs, :state, :outputs + + def tick + defaults + render + calc + process_inputs + end + + def defaults + state.flap_power = 11 + state.gravity = 0.9 + state.ceiling = 600 + state.ceiling_flap_power = 6 + state.wall_countdown_length = 100 + state.wall_gap_size = 100 + state.wall_countdown ||= 0 + state.hi_score ||= 0 + state.score ||= 0 + state.walls ||= [] + state.x ||= 50 + state.y ||= 500 + state.dy ||= 0 + state.scene ||= :menu + state.scene_at ||= 0 + state.difficulty ||= :normal + state.new_difficulty ||= :normal + state.countdown ||= 4.seconds + state.flash_at ||= 0 + end + + def render + outputs.sounds << "sounds/flappy-song.ogg" if state.tick_count == 1 + render_score + render_menu + render_game + end + + def render_score + outputs.primitives << [10, 710, "HI SCORE: #{state.hi_score}", large_white_typeset].label + outputs.primitives << [10, 680, "SCORE: #{state.score}", large_white_typeset].label + outputs.primitives << [10, 650, "DIFFICULTY: #{state.difficulty.upcase}", large_white_typeset].label + end + + def render_menu + return unless state.scene == :menu + render_overlay + + outputs.labels << [640, 700, "Flappy Dragon", 50, 1, 255, 255, 255] + outputs.labels << [640, 500, "Instructions: Press Spacebar to flap. Don't die.", 4, 1, 255, 255, 255] + outputs.labels << [430, 430, "[Tab] Change difficulty", 4, 0, 255, 255, 255] + outputs.labels << [430, 400, "[Enter] Start at New Difficulty ", 4, 0, 255, 255, 255] + outputs.labels << [430, 370, "[Escape] Cancel/Resume ", 4, 0, 255, 255, 255] + outputs.labels << [640, 300, "(mouse, touch, and game controllers work, too!) ", 4, 1, 255, 255, 255] + outputs.labels << [640, 200, "Difficulty: #{state.new_difficulty.capitalize}", 4, 1, 255, 255, 255] + + outputs.labels << [10, 100, "Code: @amirrajan", 255, 255, 255] + outputs.labels << [10, 80, "Art: @mobypixel", 255, 255, 255] + outputs.labels << [10, 60, "Music: @mobypixel", 255, 255, 255] + outputs.labels << [10, 40, "Engine: DragonRuby GTK", 255, 255, 255] + end + + def render_overlay + outputs.primitives << [grid.rect.scale_rect(1.1, 0, 0), 0, 0, 0, 230].solid + end + + def render_game + render_game_over + render_background + render_walls + render_dragon + render_flash + end + + def render_game_over + return unless state.scene == :game + outputs.labels << [638, 358, score_text, 20, 1] + outputs.labels << [635, 360, score_text, 20, 1, 255, 255, 255] + outputs.labels << [638, 428, countdown_text, 20, 1] + outputs.labels << [635, 430, countdown_text, 20, 1, 255, 255, 255] + end + + def render_background + outputs.sprites << [0, 0, 1280, 720, 'sprites/background.png'] + + scroll_point_at = state.tick_count + scroll_point_at = state.scene_at if state.scene == :menu + scroll_point_at = state.death_at if state.countdown > 0 + scroll_point_at ||= 0 + + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_back.png', 0.25) + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_middle.png', 0.50) + outputs.sprites << scrolling_background(scroll_point_at, 'sprites/parallax_front.png', 1.00, -80) + end + + def render_walls + state.walls.each do |w| + w.sprites = [ + [w.x, w.bottom_height - 720, 100, 720, 'sprites/wall.png', 180], + [w.x, w.top_y, 100, 720, 'sprites/wallbottom.png', 0] + ] + end + outputs.sprites << state.walls.map(&:sprites) + end + + def render_dragon + state.show_death = true if state.countdown == 3.seconds + + render_debug_hitbox false + + if state.show_death == false || !state.death_at + animation_index = state.flapped_at.frame_index 6, 2, false if state.flapped_at + sprite_name = "sprites/dragon_fly#{animation_index.or(0) + 1}.png" + state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + else + sprite_name = "sprites/dragon_die.png" + state.dragon_sprite = [state.x, state.y, 100, 80, sprite_name, state.dy * 1.2] + sprite_changed_elapsed = state.death_at.elapsed_time - 1.seconds + state.dragon_sprite.angle += (sprite_changed_elapsed ** 1.3) * state.death_fall_direction * -1 + state.dragon_sprite.x += (sprite_changed_elapsed ** 1.2) * state.death_fall_direction + state.dragon_sprite.y += (sprite_changed_elapsed * 14 - sprite_changed_elapsed ** 1.6) + end + + outputs.sprites << state.dragon_sprite + end + + def render_debug_hitbox show + return unless show + outputs.borders << [dragon_collision_box.rect, 255, 0, 0] if state.dragon_sprite + outputs.borders << state.walls.flat_map do |w| + w.sprites.map { |s| [s.rect, 255, 0, 0] } + end + end + + def render_flash + return unless state.flash_at + + outputs.primitives << [grid.rect, + white, + 255 * state.flash_at.ease(20, :flip)].solid + + state.flash_at = 0 if state.flash_at.elapsed_time > 20 + end + + def calc + return unless state.scene == :game + reset_game if state.countdown == 1 + state.countdown -= 1 and return if state.countdown > 0 + calc_walls + calc_flap + calc_game_over + end + + def calc_walls + state.walls.each { |w| w.x -= 8 } + + walls_count_before_removal = state.walls.length + + state.walls.reject! { |w| w.x < -100 } + + state.score += 1 if state.walls.count < walls_count_before_removal + + state.wall_countdown -= 1 and return if state.wall_countdown > 0 + + state.walls << state.new_entity(:wall) do |w| + w.x = grid.right + w.opening = grid.top + .randomize(:ratio) + .greater(200) + .lesser(520) + w.bottom_height = w.opening - state.wall_gap_size + w.top_y = w.opening + state.wall_gap_size + end + + state.wall_countdown = state.wall_countdown_length + end + + def calc_flap + state.y += state.dy + state.dy = state.dy.lesser state.flap_power + state.dy -= state.gravity + return if state.y < state.ceiling + state.y = state.ceiling + state.dy = state.dy.lesser state.ceiling_flap_power + end + + def calc_game_over + return unless game_over? + + state.death_at = state.tick_count + state.death_from = state.walls.first + state.death_fall_direction = -1 + state.death_fall_direction = 1 if state.x > state.death_from.x + outputs.sounds << "sounds/hit-sound.wav" + begin_countdown + end + + def process_inputs + process_inputs_menu + process_inputs_game + end + + def process_inputs_menu + return unless state.scene == :menu + + changediff = inputs.keyboard.key_down.tab || inputs.controller_one.key_down.select + if inputs.mouse.click + p = inputs.mouse.click.point + if (p.y >= 165) && (p.y < 200) && (p.x >= 500) && (p.x < 800) + changediff = true + end + end + + if changediff + case state.new_difficulty + when :easy + state.new_difficulty = :normal + when :normal + state.new_difficulty = :hard + when :hard + state.new_difficulty = :flappy + when :flappy + state.new_difficulty = :easy + end + end + + if inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start || inputs.controller_one.key_down.a + state.difficulty = state.new_difficulty + change_to_scene :game + reset_game false + state.hi_score = 0 + begin_countdown + end + + if inputs.keyboard.key_down.escape || (inputs.mouse.click && !changediff) || inputs.controller_one.key_down.b + state.new_difficulty = state.difficulty + change_to_scene :game + end + end + + def process_inputs_game + return unless state.scene == :game + + clicked_menu = false + if inputs.mouse.click + p = inputs.mouse.click.point + clicked_menu = (p.y >= 620) && (p.x < 275) + end + + if clicked_menu || inputs.keyboard.key_down.escape || inputs.keyboard.key_down.enter || inputs.controller_one.key_down.start + change_to_scene :menu + elsif (inputs.mouse.down || inputs.mouse.click || inputs.keyboard.key_down.space || inputs.controller_one.key_down.a) && state.countdown == 0 + state.dy = 0 + state.dy += state.flap_power + state.flapped_at = state.tick_count + outputs.sounds << "sounds/fly-sound.wav" + end + end + + def scrolling_background at, path, rate, y = 0 + [ + [ 0 - at.*(rate) % 1440, y, 1440, 720, path], + [1440 - at.*(rate) % 1440, y, 1440, 720, path] + ] + end + + def white + [255, 255, 255] + end + + def large_white_typeset + [5, 0, 255, 255, 255] + end + + def at_beginning? + state.walls.count == 0 + end + + def dragon_collision_box + state.dragon_sprite + .scale_rect(1.0 - collision_forgiveness, 0.5, 0.5) + .rect_shift_right(10) + .rect_shift_up(state.dy * 2) + end + + def game_over? + return true if state.y <= 0.-(500 * collision_forgiveness) && !at_beginning? + + state.walls + .flat_map { |w| w.sprites } + .any? do |s| + s.intersect_rect?(dragon_collision_box) + end + end + + def collision_forgiveness + case state.difficulty + when :easy + 0.9 + when :normal + 0.7 + when :hard + 0.5 + when :flappy + 0.3 + else + 0.9 + end + end + + def countdown_text + state.countdown ||= -1 + return "" if state.countdown == 0 + return "GO!" if state.countdown.idiv(60) == 0 + return "GAME OVER" if state.death_at + return "READY?" + end + + def begin_countdown + state.countdown = 4.seconds + end + + def score_text + return "" unless state.countdown > 1.seconds + return "" unless state.death_at + return "SCORE: 0 (LOL)" if state.score == 0 + return "HI SCORE: #{state.score}" if state.score == state.hi_score + return "SCORE: #{state.score}" + end + + def reset_game set_flash = true + state.flash_at = state.tick_count if set_flash + state.walls = [] + state.y = 500 + state.dy = 0 + state.hi_score = state.hi_score.greater(state.score) + state.score = 0 + state.wall_countdown = state.wall_countdown_length.fdiv(2) + state.show_death = false + state.death_at = nil + end + + def change_to_scene scene + state.scene = scene + state.scene_at = state.tick_count + inputs.keyboard.clear + inputs.controller_one.clear + end +end + +$flappy_dragon = FlappyDragon.new + +def tick args + $flappy_dragon.grid = args.grid + $flappy_dragon.inputs = args.inputs + $flappy_dragon.state = args.state + $flappy_dragon.outputs = args.outputs + $flappy_dragon.tick +end diff --git a/samples/99_sample_game_flappy_dragon/license-for-sample.txt b/samples/99_sample_game_flappy_dragon/license-for-sample.txt new file mode 100644 index 0000000..c25563f --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC (code), Nick Culbertson @mobypixel (art/music) + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_game_flappy_dragon/metadata/game_metadata.txt b/samples/99_sample_game_flappy_dragon/metadata/game_metadata.txt new file mode 100644 index 0000000..022ab17 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/metadata/game_metadata.txt @@ -0,0 +1,6 @@ +devid=dragonruby +devtitle=DragonRuby LLC +gameid=flappydragon +gametitle=Flappy Dragon +version=1.3 +icon=sprites/dragon_fly1.png diff --git a/samples/99_sample_game_flappy_dragon/replay.txt b/samples/99_sample_game_flappy_dragon/replay.txt new file mode 100644 index 0000000..3640a47 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/replay.txt @@ -0,0 +1,957 @@ +replay_version 2.0 +stopped_at 2687 +seed 100 +recorded_at Wed Oct 30 01:03:33 2019 +[:mouse_move, 230, 226, 2, 1, 1] +[:mouse_move, 242, 232, 2, 2, 2] +[:mouse_move, 243, 232, 2, 3, 4] +[:mouse_move, 245, 233, 2, 4, 6] +[:mouse_move, 247, 233, 2, 5, 7] +[:mouse_move, 248, 234, 2, 6, 39] +[:mouse_move, 250, 236, 2, 7, 40] +[:mouse_move, 252, 240, 2, 8, 41] +[:mouse_move, 256, 244, 2, 9, 42] +[:mouse_move, 262, 248, 2, 10, 43] +[:mouse_move, 266, 250, 2, 11, 44] +[:mouse_move, 268, 252, 2, 12, 45] +[:mouse_move, 269, 252, 2, 13, 48] +[:mouse_move, 269, 253, 2, 14, 52] +[:mouse_move, 272, 257, 2, 15, 53] +[:mouse_move, 275, 262, 2, 16, 54] +[:mouse_move, 278, 268, 2, 17, 55] +[:mouse_move, 281, 274, 2, 18, 56] +[:mouse_move, 288, 280, 2, 19, 57] +[:mouse_move, 296, 286, 2, 20, 58] +[:mouse_move, 308, 294, 2, 21, 59] +[:mouse_move, 327, 302, 2, 22, 60] +[:mouse_move, 353, 310, 2, 23, 61] +[:mouse_move, 375, 315, 2, 24, 62] +[:mouse_move, 394, 317, 2, 25, 63] +[:mouse_move, 406, 317, 2, 26, 64] +[:mouse_move, 413, 317, 2, 27, 65] +[:mouse_move, 418, 315, 2, 28, 66] +[:mouse_move, 419, 314, 2, 29, 67] +[:mouse_move, 419, 313, 2, 30, 68] +[:mouse_move, 418, 311, 2, 31, 69] +[:mouse_move, 417, 308, 2, 32, 70] +[:mouse_move, 416, 306, 2, 33, 71] +[:mouse_move, 414, 306, 2, 34, 72] +[:mouse_move, 414, 305, 2, 35, 73] +[:mouse_move, 413, 305, 2, 36, 76] +[:mouse_move, 413, 306, 2, 37, 80] +[:mouse_move, 413, 307, 2, 38, 83] +[:mouse_move, 413, 308, 2, 39, 84] +[:mouse_move, 414, 309, 2, 40, 85] +[:mouse_move, 414, 310, 2, 41, 86] +[:mouse_move, 414, 311, 2, 42, 87] +[:mouse_move, 413, 312, 2, 43, 88] +[:mouse_move, 412, 313, 2, 44, 90] +[:mouse_move, 413, 312, 2, 45, 94] +[:mouse_move, 416, 310, 2, 46, 95] +[:mouse_move, 419, 307, 2, 47, 96] +[:mouse_move, 421, 305, 2, 48, 97] +[:mouse_move, 422, 305, 2, 49, 98] +[:mouse_move, 421, 305, 2, 50, 101] +[:mouse_move, 421, 306, 2, 51, 104] +[:mouse_move, 421, 307, 2, 52, 105] +[:mouse_move, 420, 307, 2, 53, 106] +[:mouse_move, 420, 308, 2, 54, 107] +[:mouse_move, 419, 309, 2, 55, 108] +[:mouse_move, 418, 309, 2, 56, 109] +[:mouse_move, 416, 311, 2, 57, 110] +[:mouse_move, 411, 312, 2, 58, 111] +[:mouse_move, 407, 314, 2, 59, 112] +[:mouse_move, 404, 315, 2, 60, 113] +[:mouse_move, 400, 317, 2, 61, 114] +[:mouse_move, 397, 318, 2, 62, 115] +[:mouse_move, 395, 320, 2, 63, 116] +[:mouse_move, 395, 321, 2, 64, 117] +[:mouse_move, 395, 322, 2, 65, 120] +[:mouse_move, 397, 323, 2, 66, 121] +[:mouse_move, 401, 325, 2, 67, 122] +[:mouse_move, 405, 326, 2, 68, 123] +[:mouse_move, 410, 326, 2, 69, 124] +[:mouse_move, 416, 327, 2, 70, 125] +[:mouse_move, 421, 327, 2, 71, 126] +[:mouse_move, 426, 328, 2, 72, 127] +[:mouse_move, 430, 328, 2, 73, 128] +[:mouse_move, 436, 328, 2, 74, 129] +[:mouse_move, 441, 327, 2, 75, 130] +[:mouse_move, 448, 327, 2, 76, 131] +[:mouse_move, 454, 326, 2, 77, 132] +[:mouse_move, 462, 326, 2, 78, 133] +[:mouse_move, 471, 326, 2, 79, 134] +[:mouse_move, 482, 327, 2, 80, 135] +[:mouse_move, 496, 328, 2, 81, 136] +[:mouse_move, 507, 329, 2, 82, 137] +[:mouse_move, 519, 329, 2, 83, 138] +[:mouse_move, 530, 329, 2, 84, 139] +[:mouse_move, 540, 329, 2, 85, 140] +[:mouse_move, 551, 330, 2, 86, 141] +[:mouse_move, 561, 330, 2, 87, 142] +[:mouse_move, 567, 330, 2, 88, 143] +[:mouse_move, 573, 330, 2, 89, 144] +[:mouse_move, 578, 329, 2, 90, 145] +[:mouse_move, 582, 329, 2, 91, 146] +[:mouse_move, 587, 329, 2, 92, 147] +[:mouse_move, 593, 328, 2, 93, 148] +[:mouse_move, 599, 328, 2, 94, 149] +[:mouse_move, 605, 327, 2, 95, 150] +[:mouse_move, 613, 327, 2, 96, 151] +[:mouse_move, 621, 327, 2, 97, 152] +[:mouse_move, 632, 327, 2, 98, 153] +[:mouse_move, 645, 328, 2, 99, 154] +[:mouse_move, 658, 328, 2, 100, 155] +[:mouse_move, 669, 328, 2, 101, 156] +[:mouse_move, 685, 328, 2, 102, 157] +[:mouse_move, 702, 328, 2, 103, 158] +[:mouse_move, 721, 328, 2, 104, 159] +[:mouse_move, 741, 328, 2, 105, 160] +[:mouse_move, 766, 327, 2, 106, 161] +[:mouse_move, 790, 326, 2, 107, 162] +[:mouse_move, 811, 325, 2, 108, 163] +[:mouse_move, 827, 323, 2, 109, 164] +[:mouse_move, 835, 321, 2, 110, 165] +[:mouse_move, 838, 318, 2, 111, 166] +[:mouse_move, 839, 317, 2, 112, 167] +[:mouse_move, 839, 316, 2, 113, 168] +[:mouse_move, 839, 315, 2, 114, 171] +[:mouse_move, 838, 316, 2, 115, 180] +[:mouse_move, 837, 316, 2, 116, 181] +[:mouse_move, 835, 317, 2, 117, 215] +[:mouse_move, 830, 318, 2, 118, 216] +[:mouse_move, 821, 321, 2, 119, 217] +[:mouse_move, 796, 324, 2, 120, 218] +[:mouse_move, 772, 328, 2, 121, 219] +[:mouse_move, 750, 331, 2, 122, 220] +[:mouse_move, 730, 332, 2, 123, 221] +[:mouse_move, 714, 333, 2, 124, 222] +[:mouse_move, 699, 333, 2, 125, 223] +[:mouse_move, 686, 331, 2, 126, 224] +[:mouse_move, 676, 330, 2, 127, 225] +[:mouse_move, 667, 330, 2, 128, 226] +[:mouse_move, 659, 330, 2, 129, 227] +[:mouse_move, 650, 330, 2, 130, 228] +[:mouse_move, 640, 330, 2, 131, 229] +[:mouse_move, 630, 329, 2, 132, 230] +[:mouse_move, 620, 329, 2, 133, 231] +[:mouse_move, 610, 330, 2, 134, 232] +[:mouse_move, 598, 330, 2, 135, 233] +[:mouse_move, 585, 330, 2, 136, 234] +[:mouse_move, 571, 330, 2, 137, 235] +[:mouse_move, 558, 331, 2, 138, 236] +[:mouse_move, 546, 333, 2, 139, 237] +[:mouse_move, 533, 334, 2, 140, 238] +[:mouse_move, 520, 336, 2, 141, 239] +[:mouse_move, 506, 338, 2, 142, 240] +[:mouse_move, 497, 340, 2, 143, 241] +[:mouse_move, 489, 342, 2, 144, 242] +[:mouse_move, 482, 343, 2, 145, 243] +[:mouse_move, 476, 344, 2, 146, 244] +[:mouse_move, 472, 345, 2, 147, 245] +[:mouse_move, 470, 345, 2, 148, 246] +[:mouse_move, 469, 346, 2, 149, 248] +[:mouse_move, 467, 346, 2, 150, 249] +[:mouse_move, 465, 347, 2, 151, 250] +[:mouse_move, 461, 347, 2, 152, 251] +[:mouse_move, 459, 348, 2, 153, 252] +[:mouse_move, 458, 348, 2, 154, 253] +[:mouse_move, 457, 348, 2, 155, 254] +[:mouse_move, 454, 347, 2, 156, 255] +[:mouse_move, 450, 347, 2, 157, 256] +[:mouse_move, 443, 347, 2, 158, 257] +[:mouse_move, 434, 347, 2, 159, 258] +[:mouse_move, 426, 347, 2, 160, 259] +[:mouse_move, 422, 347, 2, 161, 260] +[:mouse_move, 420, 348, 2, 162, 261] +[:mouse_move, 423, 348, 2, 163, 265] +[:mouse_move, 430, 349, 2, 164, 266] +[:mouse_move, 438, 349, 2, 165, 267] +[:mouse_move, 445, 350, 2, 166, 268] +[:mouse_move, 453, 350, 2, 167, 269] +[:mouse_move, 454, 350, 2, 168, 269] +[:mouse_move, 461, 352, 2, 169, 270] +[:mouse_move, 470, 352, 2, 170, 271] +[:mouse_move, 477, 353, 2, 171, 272] +[:mouse_move, 486, 354, 2, 172, 273] +[:mouse_move, 499, 354, 2, 173, 274] +[:mouse_move, 509, 354, 2, 174, 275] +[:mouse_move, 522, 355, 2, 175, 276] +[:mouse_move, 532, 355, 2, 176, 277] +[:mouse_move, 538, 355, 2, 177, 278] +[:mouse_move, 544, 355, 2, 178, 279] +[:mouse_move, 549, 356, 2, 179, 280] +[:mouse_move, 554, 356, 2, 180, 281] +[:mouse_move, 561, 356, 2, 181, 282] +[:mouse_move, 568, 356, 2, 182, 283] +[:mouse_move, 573, 356, 2, 183, 284] +[:mouse_move, 579, 356, 2, 184, 285] +[:mouse_move, 586, 357, 2, 185, 286] +[:mouse_move, 595, 357, 2, 186, 287] +[:mouse_move, 601, 358, 2, 187, 288] +[:mouse_move, 612, 358, 2, 188, 289] +[:mouse_move, 624, 358, 2, 189, 290] +[:mouse_move, 633, 359, 2, 190, 291] +[:mouse_move, 645, 359, 2, 191, 292] +[:mouse_move, 654, 359, 2, 192, 293] +[:mouse_move, 665, 360, 2, 193, 294] +[:mouse_move, 676, 360, 2, 194, 295] +[:mouse_move, 686, 361, 2, 195, 296] +[:mouse_move, 695, 361, 2, 196, 297] +[:mouse_move, 705, 362, 2, 197, 298] +[:mouse_move, 712, 362, 2, 198, 299] +[:mouse_move, 721, 362, 2, 199, 300] +[:mouse_move, 728, 362, 2, 200, 301] +[:mouse_move, 736, 362, 2, 201, 302] +[:mouse_move, 743, 362, 2, 202, 303] +[:mouse_move, 750, 362, 2, 203, 304] +[:mouse_move, 758, 362, 2, 204, 305] +[:mouse_move, 769, 362, 2, 205, 306] +[:mouse_move, 779, 362, 2, 206, 307] +[:mouse_move, 788, 361, 2, 207, 308] +[:mouse_move, 793, 360, 2, 208, 309] +[:mouse_move, 796, 360, 2, 209, 310] +[:mouse_move, 797, 359, 2, 210, 311] +[:mouse_move, 796, 360, 2, 211, 353] +[:mouse_move, 793, 362, 2, 212, 354] +[:mouse_move, 786, 366, 2, 213, 355] +[:mouse_move, 771, 375, 2, 214, 356] +[:mouse_move, 750, 389, 2, 215, 357] +[:mouse_move, 724, 407, 2, 216, 358] +[:mouse_move, 693, 427, 2, 217, 359] +[:mouse_move, 662, 445, 2, 218, 360] +[:mouse_move, 635, 460, 2, 219, 361] +[:mouse_move, 609, 473, 2, 220, 362] +[:mouse_move, 590, 483, 2, 221, 363] +[:mouse_move, 578, 489, 2, 222, 364] +[:mouse_move, 569, 494, 2, 223, 365] +[:mouse_move, 563, 497, 2, 224, 366] +[:mouse_move, 560, 498, 2, 225, 367] +[:mouse_move, 557, 500, 2, 226, 368] +[:mouse_move, 554, 501, 2, 227, 369] +[:mouse_move, 549, 504, 2, 228, 370] +[:mouse_move, 541, 506, 2, 229, 371] +[:mouse_move, 534, 509, 2, 230, 372] +[:mouse_move, 526, 513, 2, 231, 373] +[:mouse_move, 521, 516, 2, 232, 374] +[:mouse_move, 516, 519, 2, 233, 375] +[:mouse_move, 514, 522, 2, 234, 376] +[:mouse_move, 514, 525, 2, 235, 377] +[:mouse_move, 516, 531, 2, 236, 378] +[:mouse_move, 520, 538, 2, 237, 379] +[:mouse_move, 523, 546, 2, 238, 380] +[:mouse_move, 524, 553, 2, 239, 381] +[:mouse_move, 525, 561, 2, 240, 382] +[:mouse_move, 528, 567, 2, 241, 383] +[:mouse_move, 532, 573, 2, 242, 384] +[:mouse_move, 537, 578, 2, 243, 385] +[:mouse_move, 546, 582, 2, 244, 386] +[:mouse_move, 561, 585, 2, 245, 387] +[:mouse_move, 583, 588, 2, 246, 388] +[:mouse_move, 608, 592, 2, 247, 389] +[:mouse_move, 637, 594, 2, 248, 390] +[:mouse_move, 664, 594, 2, 249, 391] +[:mouse_move, 691, 593, 2, 250, 392] +[:mouse_move, 712, 589, 2, 251, 393] +[:mouse_move, 733, 585, 2, 252, 394] +[:mouse_move, 749, 580, 2, 253, 395] +[:mouse_move, 762, 574, 2, 254, 396] +[:mouse_move, 774, 567, 2, 255, 397] +[:mouse_move, 781, 562, 2, 256, 398] +[:mouse_move, 788, 555, 2, 257, 399] +[:mouse_move, 791, 551, 2, 258, 400] +[:mouse_move, 792, 546, 2, 259, 401] +[:mouse_move, 791, 539, 2, 260, 402] +[:mouse_move, 788, 531, 2, 261, 403] +[:mouse_move, 784, 524, 2, 262, 404] +[:mouse_move, 777, 519, 2, 263, 405] +[:mouse_move, 769, 513, 2, 264, 406] +[:mouse_move, 756, 505, 2, 265, 407] +[:mouse_move, 737, 497, 2, 266, 408] +[:mouse_move, 710, 486, 2, 267, 409] +[:mouse_move, 684, 481, 2, 268, 410] +[:mouse_move, 665, 480, 2, 269, 411] +[:mouse_move, 646, 477, 2, 270, 412] +[:mouse_move, 627, 476, 2, 271, 413] +[:mouse_move, 605, 474, 2, 272, 414] +[:mouse_move, 586, 473, 2, 273, 415] +[:mouse_move, 571, 475, 2, 274, 416] +[:mouse_move, 560, 478, 2, 275, 417] +[:mouse_move, 550, 484, 2, 276, 418] +[:mouse_move, 540, 489, 2, 277, 419] +[:mouse_move, 532, 496, 2, 278, 420] +[:mouse_move, 525, 504, 2, 279, 421] +[:mouse_move, 521, 512, 2, 280, 422] +[:mouse_move, 520, 521, 2, 281, 423] +[:mouse_move, 520, 532, 2, 282, 424] +[:mouse_move, 522, 541, 2, 283, 425] +[:mouse_move, 524, 549, 2, 284, 426] +[:mouse_move, 529, 555, 2, 285, 427] +[:mouse_move, 534, 561, 2, 286, 428] +[:mouse_move, 541, 568, 2, 287, 429] +[:mouse_move, 555, 576, 2, 288, 430] +[:mouse_move, 572, 583, 2, 289, 431] +[:mouse_move, 596, 588, 2, 290, 432] +[:mouse_move, 628, 595, 2, 291, 433] +[:mouse_move, 663, 598, 2, 292, 434] +[:mouse_move, 698, 600, 2, 293, 435] +[:mouse_move, 730, 599, 2, 294, 436] +[:mouse_move, 762, 598, 2, 295, 437] +[:mouse_move, 787, 596, 2, 296, 438] +[:mouse_move, 806, 592, 2, 297, 439] +[:mouse_move, 818, 588, 2, 298, 440] +[:mouse_move, 824, 584, 2, 299, 441] +[:mouse_move, 826, 581, 2, 300, 442] +[:mouse_move, 827, 578, 2, 301, 443] +[:mouse_move, 827, 576, 2, 302, 444] +[:mouse_move, 827, 573, 2, 303, 445] +[:mouse_move, 827, 572, 2, 304, 446] +[:mouse_move, 827, 571, 2, 305, 448] +[:mouse_move, 826, 570, 2, 306, 486] +[:mouse_move, 826, 569, 2, 307, 487] +[:key_down_raw, 9, 0, 2, 308, 487] +[:mouse_move, 826, 568, 2, 309, 488] +[:mouse_move, 825, 568, 2, 310, 489] +[:mouse_move, 825, 567, 2, 311, 490] +[:key_up_raw, 9, 0, 2, 312, 494] +[:key_down_raw, 9, 0, 2, 313, 515] +[:key_up_raw, 9, 0, 2, 314, 525] +[:mouse_move, 824, 567, 2, 315, 535] +[:mouse_move, 821, 567, 2, 316, 536] +[:mouse_move, 816, 567, 2, 317, 537] +[:mouse_move, 808, 568, 2, 318, 538] +[:mouse_move, 803, 568, 2, 319, 539] +[:mouse_move, 797, 568, 2, 320, 540] +[:mouse_move, 792, 567, 2, 321, 541] +[:mouse_move, 788, 567, 2, 322, 542] +[:mouse_move, 786, 566, 2, 323, 543] +[:mouse_move, 785, 565, 2, 324, 544] +[:mouse_move, 784, 564, 2, 325, 545] +[:mouse_move, 779, 563, 2, 326, 546] +[:mouse_move, 774, 562, 2, 327, 547] +[:mouse_move, 771, 562, 2, 328, 548] +[:mouse_move, 766, 562, 2, 329, 549] +[:mouse_move, 761, 562, 2, 330, 550] +[:mouse_move, 755, 561, 2, 331, 551] +[:mouse_move, 748, 561, 2, 332, 552] +[:mouse_move, 740, 560, 2, 333, 553] +[:mouse_move, 733, 561, 2, 334, 554] +[:mouse_move, 726, 562, 2, 335, 555] +[:mouse_move, 720, 562, 2, 336, 556] +[:mouse_move, 713, 563, 2, 337, 557] +[:mouse_move, 707, 565, 2, 338, 558] +[:mouse_move, 702, 566, 2, 339, 559] +[:mouse_move, 701, 566, 2, 340, 560] +[:mouse_move, 702, 566, 2, 341, 561] +[:mouse_move, 706, 566, 2, 342, 562] +[:mouse_move, 711, 565, 2, 343, 563] +[:mouse_move, 722, 564, 2, 344, 564] +[:mouse_move, 737, 562, 2, 345, 565] +[:mouse_move, 747, 560, 2, 346, 566] +[:mouse_move, 749, 560, 2, 347, 567] +[:mouse_move, 745, 560, 2, 348, 569] +[:mouse_move, 724, 557, 2, 349, 570] +[:mouse_move, 697, 557, 2, 350, 571] +[:mouse_move, 678, 558, 2, 351, 572] +[:mouse_move, 663, 561, 2, 352, 573] +[:mouse_move, 660, 561, 2, 353, 574] +[:mouse_move, 661, 560, 2, 354, 575] +[:mouse_move, 665, 556, 2, 355, 576] +[:mouse_move, 674, 554, 2, 356, 577] +[:mouse_move, 693, 551, 2, 357, 578] +[:mouse_move, 723, 548, 2, 358, 579] +[:mouse_move, 742, 546, 2, 359, 580] +[:mouse_move, 746, 546, 2, 360, 581] +[:mouse_move, 742, 547, 2, 361, 583] +[:mouse_move, 724, 548, 2, 362, 584] +[:mouse_move, 702, 552, 2, 363, 585] +[:mouse_move, 684, 556, 2, 364, 586] +[:mouse_move, 673, 558, 2, 365, 587] +[:mouse_move, 668, 560, 2, 366, 588] +[:mouse_move, 669, 560, 2, 367, 590] +[:mouse_move, 678, 560, 2, 368, 591] +[:mouse_move, 696, 560, 2, 369, 592] +[:mouse_move, 714, 560, 2, 370, 593] +[:mouse_move, 729, 558, 2, 371, 594] +[:mouse_move, 736, 558, 2, 372, 595] +[:mouse_move, 732, 558, 2, 373, 597] +[:mouse_move, 718, 560, 2, 374, 598] +[:mouse_move, 701, 563, 2, 375, 599] +[:mouse_move, 685, 566, 2, 376, 600] +[:mouse_move, 676, 569, 2, 377, 601] +[:mouse_move, 674, 569, 2, 378, 602] +[:mouse_move, 680, 569, 2, 379, 604] +[:mouse_move, 696, 567, 2, 380, 605] +[:mouse_move, 712, 564, 2, 381, 606] +[:mouse_move, 723, 562, 2, 382, 607] +[:mouse_move, 727, 561, 2, 383, 608] +[:mouse_move, 724, 561, 2, 384, 610] +[:mouse_move, 708, 563, 2, 385, 611] +[:mouse_move, 693, 565, 2, 386, 612] +[:mouse_move, 686, 567, 2, 387, 613] +[:mouse_move, 690, 565, 2, 388, 616] +[:mouse_move, 695, 563, 2, 389, 617] +[:mouse_move, 696, 563, 2, 390, 618] +[:mouse_move, 693, 564, 2, 391, 626] +[:mouse_move, 689, 565, 2, 392, 627] +[:mouse_move, 685, 566, 2, 393, 628] +[:mouse_move, 683, 567, 2, 394, 629] +[:mouse_move, 683, 566, 2, 395, 633] +[:mouse_move, 684, 566, 2, 396, 634] +[:key_down_raw, 13, 0, 2, 397, 730] +[:key_up_raw, 13, 0, 2, 398, 735] +[:mouse_move, 681, 567, 2, 399, 888] +[:mouse_move, 675, 566, 2, 400, 889] +[:mouse_move, 660, 562, 2, 401, 890] +[:mouse_move, 641, 554, 2, 402, 891] +[:mouse_move, 600, 541, 2, 403, 892] +[:mouse_move, 568, 532, 2, 404, 893] +[:mouse_move, 565, 532, 2, 405, 894] +[:mouse_move, 579, 533, 2, 406, 895] +[:mouse_move, 597, 531, 2, 407, 896] +[:mouse_move, 612, 530, 2, 408, 897] +[:mouse_move, 616, 529, 2, 409, 898] +[:mouse_move, 613, 529, 2, 410, 904] +[:mouse_move, 602, 531, 2, 411, 905] +[:mouse_move, 536, 530, 2, 412, 906] +[:mouse_move, 422, 494, 2, 413, 907] +[:mouse_move, 364, 443, 2, 414, 908] +[:mouse_move, 350, 420, 2, 415, 909] +[:mouse_move, 340, 404, 2, 416, 910] +[:mouse_move, 318, 384, 2, 417, 911] +[:mouse_move, 298, 366, 2, 418, 912] +[:mouse_move, 289, 357, 2, 419, 913] +[:mouse_move, 289, 356, 2, 420, 913] +[:mouse_move, 285, 352, 2, 421, 914] +[:mouse_move, 283, 345, 2, 422, 915] +[:mouse_move, 282, 339, 2, 423, 916] +[:mouse_move, 279, 328, 2, 424, 917] +[:mouse_move, 275, 311, 2, 425, 918] +[:mouse_move, 268, 294, 2, 426, 919] +[:mouse_move, 263, 285, 2, 427, 920] +[:mouse_move, 253, 277, 2, 428, 921] +[:mouse_move, 229, 258, 2, 429, 922] +[:mouse_move, 183, 222, 2, 430, 923] +[:mouse_move, 144, 196, 2, 431, 924] +[:mouse_move, 119, 178, 2, 432, 925] +[:mouse_move, 101, 165, 2, 433, 926] +[:mouse_move, 86, 154, 2, 434, 927] +[:mouse_move, 78, 147, 2, 435, 928] +[:mouse_move, 74, 142, 2, 436, 929] +[:mouse_move, 71, 138, 2, 437, 930] +[:mouse_move, 67, 133, 2, 438, 931] +[:mouse_move, 60, 130, 2, 439, 932] +[:mouse_move, 56, 125, 2, 440, 933] +[:mouse_move, 55, 124, 2, 441, 934] +[:mouse_move, 54, 124, 2, 442, 941] +[:mouse_move, 51, 122, 2, 443, 942] +[:mouse_move, 40, 117, 2, 444, 943] +[:mouse_move, 32, 112, 2, 445, 944] +[:mouse_move, 26, 108, 2, 446, 945] +[:mouse_move, 25, 108, 2, 447, 946] +[:mouse_move, 25, 107, 2, 448, 949] +[:mouse_move, 27, 108, 2, 449, 952] +[:mouse_move, 34, 110, 2, 450, 953] +[:mouse_move, 43, 112, 2, 451, 954] +[:mouse_move, 53, 113, 2, 452, 955] +[:mouse_move, 65, 114, 2, 453, 956] +[:mouse_move, 81, 114, 2, 454, 957] +[:mouse_move, 96, 115, 2, 455, 958] +[:mouse_move, 112, 116, 2, 456, 959] +[:mouse_move, 118, 117, 2, 457, 960] +[:mouse_move, 123, 117, 2, 458, 961] +[:mouse_move, 130, 117, 2, 459, 962] +[:mouse_move, 134, 117, 2, 460, 963] +[:mouse_move, 138, 117, 2, 461, 964] +[:mouse_move, 142, 117, 2, 462, 965] +[:mouse_move, 148, 117, 2, 463, 966] +[:mouse_move, 151, 117, 2, 464, 967] +[:mouse_move, 155, 116, 2, 465, 968] +[:mouse_move, 157, 115, 2, 466, 969] +[:mouse_move, 161, 115, 2, 467, 970] +[:mouse_move, 163, 114, 2, 468, 971] +[:mouse_move, 164, 114, 2, 469, 972] +[:mouse_move, 166, 114, 2, 470, 973] +[:mouse_move, 168, 114, 2, 471, 974] +[:mouse_move, 171, 115, 2, 472, 975] +[:mouse_move, 178, 116, 2, 473, 976] +[:mouse_move, 188, 117, 2, 474, 977] +[:mouse_move, 200, 117, 2, 475, 978] +[:mouse_move, 210, 117, 2, 476, 979] +[:mouse_move, 217, 117, 2, 477, 980] +[:mouse_move, 224, 117, 2, 478, 981] +[:mouse_move, 230, 117, 2, 479, 982] +[:mouse_move, 233, 116, 2, 480, 983] +[:mouse_move, 234, 116, 2, 481, 984] +[:mouse_move, 235, 116, 2, 482, 985] +[:mouse_move, 234, 116, 2, 483, 994] +[:key_down_raw, 32, 0, 2, 484, 998] +[:key_up_raw, 32, 0, 2, 485, 1004] +[:key_down_raw, 32, 0, 2, 486, 1008] +[:key_up_raw, 32, 0, 2, 487, 1013] +[:key_down_raw, 32, 0, 2, 488, 1017] +[:key_up_raw, 32, 0, 2, 489, 1021] +[:key_down_raw, 32, 0, 2, 490, 1025] +[:key_up_raw, 32, 0, 2, 491, 1029] +[:key_down_raw, 32, 0, 2, 492, 1034] +[:key_up_raw, 32, 0, 2, 493, 1037] +[:key_down_raw, 32, 0, 2, 494, 1042] +[:key_up_raw, 32, 0, 2, 495, 1046] +[:mouse_move, 244, 118, 2, 496, 1052] +[:mouse_move, 304, 142, 2, 497, 1053] +[:mouse_move, 425, 192, 2, 498, 1054] +[:mouse_move, 494, 240, 2, 499, 1055] +[:mouse_move, 513, 264, 2, 500, 1056] +[:mouse_move, 516, 272, 2, 501, 1057] +[:mouse_move, 520, 279, 2, 502, 1058] +[:mouse_move, 531, 290, 2, 503, 1059] +[:mouse_move, 548, 301, 2, 504, 1060] +[:mouse_move, 567, 311, 2, 505, 1061] +[:mouse_move, 584, 316, 2, 506, 1062] +[:mouse_move, 598, 318, 2, 507, 1063] +[:mouse_move, 605, 318, 2, 508, 1064] +[:mouse_move, 612, 317, 2, 509, 1065] +[:mouse_move, 618, 317, 2, 510, 1066] +[:mouse_move, 625, 317, 2, 511, 1067] +[:mouse_move, 629, 316, 2, 512, 1068] +[:mouse_move, 632, 315, 2, 513, 1069] +[:key_down_raw, 32, 0, 2, 514, 1083] +[:key_up_raw, 32, 0, 2, 515, 1089] +[:mouse_move, 633, 316, 2, 516, 1094] +[:mouse_move, 640, 325, 2, 517, 1095] +[:mouse_move, 653, 337, 2, 518, 1096] +[:mouse_move, 679, 349, 2, 519, 1097] +[:mouse_move, 708, 359, 2, 520, 1098] +[:mouse_move, 742, 368, 2, 521, 1099] +[:mouse_move, 771, 374, 2, 522, 1100] +[:mouse_move, 792, 380, 2, 523, 1101] +[:mouse_move, 807, 386, 2, 524, 1102] +[:mouse_move, 818, 389, 2, 525, 1103] +[:mouse_move, 825, 391, 2, 526, 1104] +[:mouse_move, 827, 392, 2, 527, 1105] +[:mouse_move, 828, 392, 2, 528, 1106] +[:mouse_move, 828, 393, 2, 529, 1108] +[:mouse_move, 834, 396, 2, 530, 1109] +[:mouse_move, 839, 402, 2, 531, 1110] +[:mouse_move, 841, 404, 2, 532, 1111] +[:key_down_raw, 32, 0, 2, 533, 1112] +[:key_up_raw, 32, 0, 2, 534, 1117] +[:key_down_raw, 32, 0, 2, 535, 1136] +[:key_up_raw, 32, 0, 2, 536, 1141] +[:key_down_raw, 32, 0, 2, 537, 1150] +[:key_up_raw, 32, 0, 2, 538, 1156] +[:key_down_raw, 32, 0, 2, 539, 1161] +[:key_up_raw, 32, 0, 2, 540, 1165] +[:key_down_raw, 32, 0, 2, 541, 1188] +[:key_up_raw, 32, 0, 2, 542, 1195] +[:key_down_raw, 32, 0, 2, 543, 1216] +[:key_up_raw, 32, 0, 2, 544, 1222] +[:key_down_raw, 32, 0, 2, 545, 1242] +[:key_up_raw, 32, 0, 2, 546, 1248] +[:key_down_raw, 32, 0, 2, 547, 1255] +[:key_up_raw, 32, 0, 2, 548, 1260] +[:key_down_raw, 32, 0, 2, 549, 1264] +[:key_up_raw, 32, 0, 2, 550, 1267] +[:key_down_raw, 32, 0, 2, 551, 1283] +[:key_up_raw, 32, 0, 2, 552, 1290] +[:key_down_raw, 32, 0, 2, 553, 1329] +[:key_up_raw, 32, 0, 2, 554, 1336] +[:key_down_raw, 32, 0, 2, 555, 1349] +[:key_up_raw, 32, 0, 2, 556, 1354] +[:key_down_raw, 32, 0, 2, 557, 1359] +[:key_up_raw, 32, 0, 2, 558, 1363] +[:key_down_raw, 32, 0, 2, 559, 1387] +[:key_up_raw, 32, 0, 2, 560, 1393] +[:key_down_raw, 32, 0, 2, 561, 1416] +[:key_up_raw, 32, 0, 2, 562, 1422] +[:key_down_raw, 32, 0, 2, 563, 1428] +[:key_up_raw, 32, 0, 2, 564, 1431] +[:key_down_raw, 32, 0, 2, 565, 1436] +[:key_up_raw, 32, 0, 2, 566, 1440] +[:key_down_raw, 32, 0, 2, 567, 1445] +[:key_up_raw, 32, 0, 2, 568, 1448] +[:key_down_raw, 32, 0, 2, 569, 1472] +[:key_up_raw, 32, 0, 2, 570, 1481] +[:key_down_raw, 32, 0, 2, 571, 1504] +[:key_up_raw, 32, 0, 2, 572, 1509] +[:key_down_raw, 32, 0, 2, 573, 1531] +[:key_up_raw, 32, 0, 2, 574, 1537] +[:key_down_raw, 32, 0, 2, 575, 1555] +[:key_up_raw, 32, 0, 2, 576, 1559] +[:key_down_raw, 32, 0, 2, 577, 1565] +[:key_up_raw, 32, 0, 2, 578, 1569] +[:key_down_raw, 32, 0, 2, 579, 1590] +[:key_up_raw, 32, 0, 2, 580, 1594] +[:key_down_raw, 32, 0, 2, 581, 1600] +[:key_up_raw, 32, 0, 2, 582, 1604] +[:key_down_raw, 32, 0, 2, 583, 1609] +[:key_up_raw, 32, 0, 2, 584, 1612] +[:key_down_raw, 32, 0, 2, 585, 1617] +[:key_up_raw, 32, 0, 2, 586, 1621] +[:key_down_raw, 32, 0, 2, 587, 1653] +[:key_up_raw, 32, 0, 2, 588, 1658] +[:key_down_raw, 32, 0, 2, 589, 1669] +[:key_up_raw, 32, 0, 2, 590, 1674] +[:key_down_raw, 32, 0, 2, 591, 1701] +[:key_up_raw, 32, 0, 2, 592, 1706] +[:key_down_raw, 32, 0, 2, 593, 1712] +[:key_up_raw, 32, 0, 2, 594, 1716] +[:key_down_raw, 32, 0, 2, 595, 1722] +[:key_up_raw, 32, 0, 2, 596, 1725] +[:key_down_raw, 32, 0, 2, 597, 1730] +[:key_up_raw, 32, 0, 2, 598, 1733] +[:key_down_raw, 32, 0, 2, 599, 1738] +[:key_up_raw, 32, 0, 2, 600, 1743] +[:key_down_raw, 32, 0, 2, 601, 1769] +[:key_up_raw, 32, 0, 2, 602, 1775] +[:key_down_raw, 32, 0, 2, 603, 1790] +[:key_up_raw, 32, 0, 2, 604, 1795] +[:key_down_raw, 32, 0, 2, 605, 1835] +[:key_up_raw, 32, 0, 2, 606, 1841] +[:key_down_raw, 32, 0, 2, 607, 1850] +[:key_up_raw, 32, 0, 2, 608, 1856] +[:key_down_raw, 32, 0, 2, 609, 1877] +[:key_up_raw, 32, 0, 2, 610, 1884] +[:key_down_raw, 32, 0, 2, 611, 1904] +[:key_up_raw, 32, 0, 2, 612, 1908] +[:key_down_raw, 32, 0, 2, 613, 1935] +[:key_up_raw, 32, 0, 2, 614, 1940] +[:key_down_raw, 32, 0, 2, 615, 1950] +[:key_up_raw, 32, 0, 2, 616, 1956] +[:key_down_raw, 32, 0, 2, 617, 1962] +[:key_up_raw, 32, 0, 2, 618, 1966] +[:key_down_raw, 32, 0, 2, 619, 1993] +[:key_up_raw, 32, 0, 2, 620, 1999] +[:mouse_move, 828, 408, 2, 621, 2035] +[:mouse_move, 797, 419, 2, 622, 2036] +[:mouse_move, 775, 427, 2, 623, 2037] +[:mouse_move, 766, 429, 2, 624, 2038] +[:mouse_move, 763, 430, 2, 625, 2039] +[:mouse_move, 759, 433, 2, 626, 2040] +[:mouse_move, 756, 433, 2, 627, 2041] +[:mouse_move, 752, 433, 2, 628, 2042] +[:mouse_move, 746, 432, 2, 629, 2043] +[:mouse_move, 740, 430, 2, 630, 2044] +[:mouse_move, 728, 429, 2, 631, 2045] +[:mouse_move, 713, 427, 2, 632, 2046] +[:mouse_move, 697, 427, 2, 633, 2047] +[:mouse_move, 685, 429, 2, 634, 2048] +[:mouse_move, 678, 432, 2, 635, 2049] +[:mouse_move, 675, 433, 2, 636, 2050] +[:mouse_move, 673, 433, 2, 637, 2051] +[:mouse_move, 670, 433, 2, 638, 2052] +[:mouse_move, 665, 433, 2, 639, 2053] +[:mouse_move, 659, 432, 2, 640, 2054] +[:mouse_move, 654, 433, 2, 641, 2055] +[:mouse_move, 654, 434, 2, 642, 2056] +[:mouse_move, 659, 440, 2, 643, 2057] +[:mouse_move, 670, 450, 2, 644, 2058] +[:mouse_move, 685, 458, 2, 645, 2059] +[:mouse_move, 708, 462, 2, 646, 2060] +[:mouse_move, 745, 461, 2, 647, 2061] +[:mouse_move, 792, 455, 2, 648, 2062] +[:mouse_move, 827, 443, 2, 649, 2063] +[:mouse_move, 848, 429, 2, 650, 2064] +[:mouse_move, 861, 412, 2, 651, 2065] +[:mouse_move, 868, 393, 2, 652, 2066] +[:mouse_move, 868, 373, 2, 653, 2067] +[:mouse_move, 859, 352, 2, 654, 2068] +[:mouse_move, 844, 334, 2, 655, 2069] +[:mouse_move, 830, 320, 2, 656, 2070] +[:mouse_move, 812, 305, 2, 657, 2071] +[:mouse_move, 787, 288, 2, 658, 2072] +[:mouse_move, 747, 266, 2, 659, 2073] +[:mouse_move, 696, 245, 2, 660, 2074] +[:mouse_move, 653, 236, 2, 661, 2075] +[:mouse_move, 622, 233, 2, 662, 2076] +[:mouse_move, 598, 232, 2, 663, 2077] +[:mouse_move, 576, 231, 2, 664, 2078] +[:mouse_move, 553, 230, 2, 665, 2079] +[:mouse_move, 535, 233, 2, 666, 2080] +[:mouse_move, 519, 238, 2, 667, 2081] +[:mouse_move, 503, 246, 2, 668, 2082] +[:mouse_move, 490, 256, 2, 669, 2083] +[:mouse_move, 482, 265, 2, 670, 2084] +[:mouse_move, 472, 276, 2, 671, 2085] +[:mouse_move, 464, 289, 2, 672, 2086] +[:mouse_move, 459, 302, 2, 673, 2087] +[:mouse_move, 457, 318, 2, 674, 2088] +[:mouse_move, 457, 337, 2, 675, 2089] +[:mouse_move, 461, 354, 2, 676, 2090] +[:mouse_move, 471, 368, 2, 677, 2091] +[:mouse_move, 484, 378, 2, 678, 2092] +[:mouse_move, 504, 389, 2, 679, 2093] +[:mouse_move, 536, 402, 2, 680, 2094] +[:mouse_move, 574, 413, 2, 681, 2095] +[:mouse_move, 613, 424, 2, 682, 2096] +[:mouse_move, 658, 430, 2, 683, 2097] +[:mouse_move, 695, 434, 2, 684, 2098] +[:mouse_move, 722, 435, 2, 685, 2099] +[:mouse_move, 748, 432, 2, 686, 2100] +[:mouse_move, 769, 425, 2, 687, 2101] +[:mouse_move, 784, 417, 2, 688, 2102] +[:mouse_move, 796, 408, 2, 689, 2103] +[:mouse_move, 804, 398, 2, 690, 2104] +[:mouse_move, 808, 385, 2, 691, 2105] +[:mouse_move, 809, 364, 2, 692, 2106] +[:mouse_move, 805, 342, 2, 693, 2107] +[:mouse_move, 798, 326, 2, 694, 2108] +[:mouse_move, 790, 313, 2, 695, 2109] +[:mouse_move, 777, 302, 2, 696, 2110] +[:mouse_move, 756, 288, 2, 697, 2111] +[:mouse_move, 724, 266, 2, 698, 2112] +[:mouse_move, 688, 245, 2, 699, 2113] +[:mouse_move, 656, 234, 2, 700, 2114] +[:mouse_move, 630, 229, 2, 701, 2115] +[:mouse_move, 610, 225, 2, 702, 2116] +[:mouse_move, 592, 221, 2, 703, 2117] +[:mouse_move, 569, 218, 2, 704, 2118] +[:mouse_move, 547, 218, 2, 705, 2119] +[:mouse_move, 532, 224, 2, 706, 2120] +[:mouse_move, 518, 233, 2, 707, 2121] +[:mouse_move, 506, 244, 2, 708, 2122] +[:mouse_move, 494, 257, 2, 709, 2123] +[:mouse_move, 481, 278, 2, 710, 2124] +[:mouse_move, 467, 304, 2, 711, 2125] +[:mouse_move, 462, 322, 2, 712, 2126] +[:mouse_move, 465, 338, 2, 713, 2127] +[:mouse_move, 471, 352, 2, 714, 2128] +[:mouse_move, 483, 365, 2, 715, 2129] +[:mouse_move, 498, 379, 2, 716, 2130] +[:mouse_move, 519, 392, 2, 717, 2131] +[:mouse_move, 550, 404, 2, 718, 2132] +[:mouse_move, 594, 413, 2, 719, 2133] +[:mouse_move, 643, 416, 2, 720, 2134] +[:mouse_move, 686, 410, 2, 721, 2135] +[:mouse_move, 727, 398, 2, 722, 2136] +[:mouse_move, 762, 380, 2, 723, 2137] +[:mouse_move, 786, 358, 2, 724, 2138] +[:mouse_move, 797, 327, 2, 725, 2139] +[:mouse_move, 798, 289, 2, 726, 2140] +[:mouse_move, 790, 258, 2, 727, 2141] +[:mouse_move, 777, 238, 2, 728, 2142] +[:mouse_move, 769, 231, 2, 729, 2143] +[:mouse_move, 762, 229, 2, 730, 2144] +[:mouse_move, 756, 227, 2, 731, 2145] +[:mouse_move, 747, 229, 2, 732, 2146] +[:mouse_move, 741, 233, 2, 733, 2147] +[:mouse_move, 734, 242, 2, 734, 2148] +[:mouse_move, 726, 256, 2, 735, 2149] +[:mouse_move, 716, 278, 2, 736, 2150] +[:mouse_move, 712, 304, 2, 737, 2151] +[:mouse_move, 711, 323, 2, 738, 2152] +[:mouse_move, 712, 336, 2, 739, 2153] +[:mouse_move, 712, 344, 2, 740, 2154] +[:mouse_move, 711, 352, 2, 741, 2155] +[:mouse_move, 708, 356, 2, 742, 2156] +[:mouse_move, 706, 359, 2, 743, 2157] +[:mouse_move, 705, 359, 2, 744, 2187] +[:mouse_move, 704, 360, 2, 745, 2188] +[:mouse_move, 702, 361, 2, 746, 2189] +[:mouse_move, 701, 362, 2, 747, 2196] +[:mouse_move, 698, 363, 2, 748, 2197] +[:mouse_move, 694, 364, 2, 749, 2198] +[:mouse_move, 690, 365, 2, 750, 2199] +[:mouse_move, 685, 368, 2, 751, 2200] +[:mouse_move, 682, 370, 2, 752, 2201] +[:mouse_move, 679, 371, 2, 753, 2202] +[:mouse_move, 679, 370, 2, 754, 2210] +[:mouse_move, 674, 368, 2, 755, 2211] +[:mouse_move, 664, 363, 2, 756, 2212] +[:mouse_move, 654, 361, 2, 757, 2213] +[:mouse_move, 644, 359, 2, 758, 2214] +[:mouse_move, 635, 357, 2, 759, 2215] +[:mouse_move, 629, 356, 2, 760, 2216] +[:mouse_move, 627, 355, 2, 761, 2217] +[:mouse_move, 628, 354, 2, 762, 2219] +[:mouse_move, 630, 354, 2, 763, 2220] +[:mouse_move, 631, 354, 2, 764, 2221] +[:mouse_move, 632, 354, 2, 765, 2222] +[:mouse_move, 633, 354, 2, 766, 2223] +[:mouse_move, 631, 354, 2, 767, 2234] +[:mouse_move, 627, 355, 2, 768, 2235] +[:mouse_move, 621, 356, 2, 769, 2236] +[:mouse_move, 612, 356, 2, 770, 2237] +[:mouse_move, 602, 356, 2, 771, 2238] +[:mouse_move, 598, 356, 2, 772, 2239] +[:mouse_move, 599, 356, 2, 773, 2244] +[:mouse_move, 599, 355, 2, 774, 2245] +[:mouse_move, 600, 355, 2, 775, 2246] +[:mouse_move, 599, 356, 2, 776, 2250] +[:key_down_raw, 32, 0, 2, 777, 2258] +[:key_up_raw, 32, 0, 2, 778, 2263] +[:key_down_raw, 32, 0, 2, 779, 2268] +[:mouse_move, 605, 359, 2, 780, 2271] +[:mouse_move, 622, 365, 2, 781, 2272] +[:key_up_raw, 32, 0, 2, 782, 2272] +[:mouse_move, 648, 377, 2, 783, 2273] +[:mouse_move, 673, 393, 2, 784, 2274] +[:mouse_move, 689, 406, 2, 785, 2275] +[:mouse_move, 700, 413, 2, 786, 2276] +[:mouse_move, 709, 418, 2, 787, 2277] +[:key_down_raw, 32, 0, 2, 788, 2277] +[:mouse_move, 711, 419, 2, 789, 2277] +[:mouse_move, 718, 421, 2, 790, 2278] +[:mouse_move, 724, 423, 2, 791, 2279] +[:mouse_move, 728, 425, 2, 792, 2280] +[:mouse_move, 730, 426, 2, 793, 2281] +[:key_up_raw, 32, 0, 2, 794, 2281] +[:key_down_raw, 32, 0, 2, 795, 2286] +[:mouse_move, 731, 425, 2, 796, 2286] +[:key_up_raw, 32, 0, 2, 797, 2290] +[:key_down_raw, 32, 0, 2, 798, 2294] +[:mouse_move, 732, 425, 2, 799, 2294] +[:key_up_raw, 32, 0, 2, 800, 2298] +[:mouse_move, 732, 424, 2, 801, 2298] +[:key_down_raw, 32, 0, 2, 802, 2302] +[:key_up_raw, 32, 0, 2, 803, 2306] +[:key_down_raw, 32, 0, 2, 804, 2311] +[:key_up_raw, 32, 0, 2, 805, 2315] +[:key_down_raw, 32, 0, 2, 806, 2347] +[:key_up_raw, 32, 0, 2, 807, 2352] +[:key_down_raw, 32, 0, 2, 808, 2374] +[:key_up_raw, 32, 0, 2, 809, 2379] +[:key_down_raw, 32, 0, 2, 810, 2386] +[:key_up_raw, 32, 0, 2, 811, 2389] +[:key_down_raw, 32, 0, 2, 812, 2395] +[:mouse_move, 721, 424, 2, 813, 2397] +[:mouse_move, 706, 425, 2, 814, 2398] +[:mouse_move, 695, 428, 2, 815, 2399] +[:key_up_raw, 32, 0, 2, 816, 2399] +[:mouse_move, 689, 430, 2, 817, 2400] +[:mouse_move, 684, 433, 2, 818, 2401] +[:mouse_move, 680, 433, 2, 819, 2402] +[:mouse_move, 676, 432, 2, 820, 2403] +[:mouse_move, 670, 429, 2, 821, 2404] +[:mouse_move, 668, 429, 2, 822, 2405] +[:key_down_raw, 32, 0, 2, 823, 2405] +[:mouse_move, 667, 429, 2, 824, 2405] +[:key_up_raw, 32, 0, 2, 825, 2410] +[:mouse_move, 668, 428, 2, 826, 2415] +[:mouse_move, 669, 426, 2, 827, 2416] +[:mouse_move, 669, 425, 2, 828, 2417] +[:mouse_move, 669, 424, 2, 829, 2418] +[:mouse_move, 668, 423, 2, 830, 2419] +[:mouse_move, 666, 421, 2, 831, 2436] +[:mouse_move, 664, 421, 2, 832, 2437] +[:mouse_move, 661, 420, 2, 833, 2438] +[:mouse_move, 659, 419, 2, 834, 2439] +[:mouse_move, 657, 418, 2, 835, 2440] +[:mouse_move, 656, 418, 2, 836, 2441] +[:mouse_move, 653, 418, 2, 837, 2442] +[:mouse_move, 652, 418, 2, 838, 2443] +[:mouse_move, 651, 417, 2, 839, 2444] +[:mouse_move, 650, 417, 2, 840, 2464] +[:mouse_move, 646, 418, 2, 841, 2465] +[:mouse_move, 636, 417, 2, 842, 2466] +[:mouse_move, 624, 413, 2, 843, 2467] +[:mouse_move, 612, 411, 2, 844, 2468] +[:mouse_move, 605, 410, 2, 845, 2469] +[:mouse_move, 601, 409, 2, 846, 2470] +[:mouse_move, 597, 408, 2, 847, 2471] +[:mouse_move, 592, 407, 2, 848, 2472] +[:mouse_move, 586, 406, 2, 849, 2473] +[:mouse_move, 579, 406, 2, 850, 2474] +[:mouse_move, 570, 407, 2, 851, 2475] +[:mouse_move, 564, 409, 2, 852, 2476] +[:mouse_move, 561, 413, 2, 853, 2477] +[:mouse_move, 558, 418, 2, 854, 2478] +[:mouse_move, 561, 424, 2, 855, 2479] +[:mouse_move, 573, 437, 2, 856, 2480] +[:mouse_move, 600, 454, 2, 857, 2481] +[:mouse_move, 643, 473, 2, 858, 2482] +[:mouse_move, 698, 487, 2, 859, 2483] +[:mouse_move, 763, 494, 2, 860, 2484] +[:mouse_move, 839, 496, 2, 861, 2485] +[:mouse_move, 900, 489, 2, 862, 2486] +[:mouse_move, 935, 483, 2, 863, 2487] +[:mouse_move, 951, 475, 2, 864, 2488] +[:mouse_move, 955, 469, 2, 865, 2489] +[:mouse_move, 956, 459, 2, 866, 2490] +[:mouse_move, 953, 444, 2, 867, 2491] +[:mouse_move, 947, 427, 2, 868, 2492] +[:mouse_move, 934, 409, 2, 869, 2493] +[:mouse_move, 909, 386, 2, 870, 2494] +[:mouse_move, 876, 362, 2, 871, 2495] +[:mouse_move, 851, 346, 2, 872, 2496] +[:mouse_move, 834, 336, 2, 873, 2497] +[:mouse_move, 820, 325, 2, 874, 2498] +[:mouse_move, 797, 313, 2, 875, 2499] +[:mouse_move, 766, 299, 2, 876, 2500] +[:mouse_move, 724, 280, 2, 877, 2501] +[:mouse_move, 685, 269, 2, 878, 2502] +[:mouse_move, 664, 266, 2, 879, 2503] +[:mouse_move, 650, 266, 2, 880, 2504] +[:mouse_move, 640, 266, 2, 881, 2505] +[:mouse_move, 625, 266, 2, 882, 2506] +[:mouse_move, 603, 268, 2, 883, 2507] +[:mouse_move, 580, 273, 2, 884, 2508] +[:mouse_move, 564, 278, 2, 885, 2509] +[:mouse_move, 553, 283, 2, 886, 2510] +[:mouse_move, 541, 291, 2, 887, 2511] +[:mouse_move, 531, 297, 2, 888, 2512] +[:mouse_move, 520, 305, 2, 889, 2513] +[:mouse_move, 510, 315, 2, 890, 2514] +[:mouse_move, 503, 328, 2, 891, 2515] +[:mouse_move, 499, 339, 2, 892, 2516] +[:mouse_move, 497, 348, 2, 893, 2517] +[:mouse_move, 497, 358, 2, 894, 2518] +[:mouse_move, 504, 372, 2, 895, 2519] +[:mouse_move, 516, 387, 2, 896, 2520] +[:mouse_move, 532, 398, 2, 897, 2521] +[:mouse_move, 552, 409, 2, 898, 2522] +[:mouse_move, 573, 419, 2, 899, 2523] +[:mouse_move, 595, 428, 2, 900, 2524] +[:mouse_move, 620, 440, 2, 901, 2525] +[:mouse_move, 650, 449, 2, 902, 2526] +[:mouse_move, 685, 456, 2, 903, 2527] +[:mouse_move, 722, 459, 2, 904, 2528] +[:mouse_move, 760, 460, 2, 905, 2529] +[:mouse_move, 787, 458, 2, 906, 2530] +[:mouse_move, 813, 455, 2, 907, 2531] +[:mouse_move, 832, 451, 2, 908, 2532] +[:mouse_move, 842, 444, 2, 909, 2533] +[:mouse_move, 848, 439, 2, 910, 2534] +[:mouse_move, 851, 429, 2, 911, 2535] +[:mouse_move, 851, 417, 2, 912, 2536] +[:mouse_move, 848, 404, 2, 913, 2537] +[:mouse_move, 844, 396, 2, 914, 2538] +[:mouse_move, 842, 392, 2, 915, 2539] +[:mouse_move, 837, 387, 2, 916, 2540] +[:mouse_move, 828, 381, 2, 917, 2541] +[:mouse_move, 822, 377, 2, 918, 2542] +[:mouse_move, 820, 375, 2, 919, 2543] +[:mouse_move, 818, 375, 2, 920, 2544] +[:mouse_move, 817, 374, 2, 921, 2545] +[:mouse_move, 816, 374, 2, 922, 2550] +[:mouse_move, 813, 374, 2, 923, 2551] +[:mouse_move, 804, 373, 2, 924, 2552] +[:mouse_move, 785, 366, 2, 925, 2553] +[:mouse_move, 741, 348, 2, 926, 2554] +[:mouse_move, 669, 313, 2, 927, 2555] +[:mouse_move, 561, 261, 2, 928, 2556] +[:mouse_move, 432, 200, 2, 929, 2557] +[:mouse_move, 324, 152, 2, 930, 2558] +[:mouse_move, 237, 115, 2, 931, 2559] +[:mouse_move, 169, 82, 2, 932, 2560] +[:mouse_move, 116, 55, 2, 933, 2561] +[:mouse_move, 71, 38, 2, 934, 2562] +[:mouse_move, 42, 29, 2, 935, 2563] +[:mouse_move, 32, 27, 2, 936, 2564] +[:mouse_move, 24, 24, 2, 937, 2565] +[:mouse_move, 16, 22, 2, 938, 2566] +[:mouse_move, 10, 20, 2, 939, 2567] +[:mouse_move, 7, 18, 2, 940, 2568] +[:mouse_move, 4, 17, 2, 941, 2569] +[:mouse_move, 2, 14, 2, 942, 2570] +[:mouse_move, 0, 12, 2, 943, 2572] +[:mouse_move, -3, 11, 2, 944, 2573] +[:mouse_move, -4, 10, 2, 945, 2574] +[:mouse_move, -5, 9, 2, 946, 2578] +[:mouse_move, -8, 8, 2, 947, 2579] +[:mouse_move, -11, 6, 2, 948, 2580] +[:mouse_move, -14, 4, 2, 949, 2581] +[:mouse_move, -17, 3, 2, 950, 2582] +[:mouse_move, -18, 2, 2, 951, 2583] +[:mouse_move, -20, 0, 2, 952, 2584] +[:mouse_move, -22, 0, 2, 953, 2585] diff --git a/samples/99_sample_game_flappy_dragon/sounds/flappy-song.ogg b/samples/99_sample_game_flappy_dragon/sounds/flappy-song.ogg Binary files differnew file mode 100644 index 0000000..aa02e8b --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sounds/flappy-song.ogg diff --git a/samples/99_sample_game_flappy_dragon/sounds/fly-sound.wav b/samples/99_sample_game_flappy_dragon/sounds/fly-sound.wav Binary files differnew file mode 100644 index 0000000..d621920 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sounds/fly-sound.wav diff --git a/samples/99_sample_game_flappy_dragon/sounds/hit-sound.wav b/samples/99_sample_game_flappy_dragon/sounds/hit-sound.wav Binary files differnew file mode 100644 index 0000000..a701537 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sounds/hit-sound.wav diff --git a/samples/99_sample_game_flappy_dragon/sprites/background.png b/samples/99_sample_game_flappy_dragon/sprites/background.png Binary files differnew file mode 100644 index 0000000..6a0a42b --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/background.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/dragon_die.png b/samples/99_sample_game_flappy_dragon/sprites/dragon_die.png Binary files differnew file mode 100644 index 0000000..bb312e9 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/dragon_die.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/dragon_fly1.png b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly1.png Binary files differnew file mode 100644 index 0000000..fb179af --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly1.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/dragon_fly2.png b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly2.png Binary files differnew file mode 100644 index 0000000..8cfe531 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly2.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/dragon_fly3.png b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly3.png Binary files differnew file mode 100644 index 0000000..cb462e1 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly3.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/dragon_fly4.png b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly4.png Binary files differnew file mode 100644 index 0000000..04c4977 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly4.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/dragon_fly5.png b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly5.png Binary files differnew file mode 100644 index 0000000..b29fa3d --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly5.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/dragon_fly6.png b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly6.png Binary files differnew file mode 100644 index 0000000..99f4e74 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/dragon_fly6.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/parallax_back.png b/samples/99_sample_game_flappy_dragon/sprites/parallax_back.png Binary files differnew file mode 100644 index 0000000..15c7e2f --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/parallax_back.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/parallax_front.png b/samples/99_sample_game_flappy_dragon/sprites/parallax_front.png Binary files differnew file mode 100644 index 0000000..44d6a8a --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/parallax_front.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/parallax_middle.png b/samples/99_sample_game_flappy_dragon/sprites/parallax_middle.png Binary files differnew file mode 100644 index 0000000..a3c16b1 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/parallax_middle.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/wall.png b/samples/99_sample_game_flappy_dragon/sprites/wall.png Binary files differnew file mode 100644 index 0000000..fe94955 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/wall.png diff --git a/samples/99_sample_game_flappy_dragon/sprites/wallbottom.png b/samples/99_sample_game_flappy_dragon/sprites/wallbottom.png Binary files differnew file mode 100644 index 0000000..1668be8 --- /dev/null +++ b/samples/99_sample_game_flappy_dragon/sprites/wallbottom.png diff --git a/samples/99_sample_game_pong/app/main.rb b/samples/99_sample_game_pong/app/main.rb new file mode 100644 index 0000000..bd4eb45 --- /dev/null +++ b/samples/99_sample_game_pong/app/main.rb @@ -0,0 +1,159 @@ +def tick args + defaults args + render args + calc args + input args +end + +def defaults args + args.state.ball.debounce ||= 3 * 60 + args.state.ball.size ||= 10 + args.state.ball.size_half ||= args.state.ball.size / 2 + args.state.ball.x ||= 640 + args.state.ball.y ||= 360 + args.state.ball.dx ||= 5.randomize(:sign) + args.state.ball.dy ||= 5.randomize(:sign) + args.state.left_paddle.y ||= 360 + args.state.right_paddle.y ||= 360 + args.state.paddle.h ||= 120 + args.state.paddle.w ||= 10 + args.state.left_paddle.score ||= 0 + args.state.right_paddle.score ||= 0 +end + +def render args + render_center_line args + render_scores args + render_countdown args + render_ball args + render_paddles args + render_instructions args +end + +begin :render_methods + def render_center_line args + args.outputs.lines << [640, 0, 640, 720] + end + + def render_scores args + args.outputs.labels << [ + [320, 650, args.state.left_paddle.score, 10, 1], + [960, 650, args.state.right_paddle.score, 10, 1] + ] + end + + def render_countdown args + return unless args.state.ball.debounce > 0 + args.outputs.labels << [640, 360, "%.2f" % args.state.ball.debounce.fdiv(60), 10, 1] + end + + def render_ball args + args.outputs.solids << solid_ball(args) + end + + def render_paddles args + args.outputs.solids << solid_left_paddle(args) + args.outputs.solids << solid_right_paddle(args) + end + + def render_instructions args + args.outputs.labels << [320, 30, "W and S keys to move left paddle.", 0, 1] + args.outputs.labels << [920, 30, "O and L keys to move right paddle.", 0, 1] + end +end + +def calc args + args.state.ball.debounce -= 1 and return if args.state.ball.debounce > 0 + calc_move_ball args + calc_collision_with_left_paddle args + calc_collision_with_right_paddle args + calc_collision_with_walls args +end + +begin :calc_methods + def calc_move_ball args + args.state.ball.x += args.state.ball.dx + args.state.ball.y += args.state.ball.dy + end + + def calc_collision_with_left_paddle args + if solid_left_paddle(args).intersect_rect? solid_ball(args) + args.state.ball.dx *= -1 + elsif args.state.ball.x < 0 + args.state.right_paddle.score += 1 + calc_reset_round args + end + end + + def calc_collision_with_right_paddle args + if solid_right_paddle(args).intersect_rect? solid_ball(args) + args.state.ball.dx *= -1 + elsif args.state.ball.x > 1280 + args.state.left_paddle.score += 1 + calc_reset_round args + end + end + + def calc_collision_with_walls args + if args.state.ball.y + args.state.ball.size_half > 720 + args.state.ball.y = 720 - args.state.ball.size_half + args.state.ball.dy *= -1 + elsif args.state.ball.y - args.state.ball.size_half < 0 + args.state.ball.y = args.state.ball.size_half + args.state.ball.dy *= -1 + end + end + + def calc_reset_round args + args.state.ball.x = 640 + args.state.ball.y = 360 + args.state.ball.dx = 5.randomize(:sign) + args.state.ball.dy = 5.randomize(:sign) + args.state.ball.debounce = 3 * 60 + end +end + +def input args + input_left_paddle args + input_right_paddle args +end + +begin :input_methods + def input_left_paddle args + if args.inputs.controller_one.key_down.down || args.inputs.keyboard.key_down.s + args.state.left_paddle.y -= 40 + elsif args.inputs.controller_one.key_down.up || args.inputs.keyboard.key_down.w + args.state.left_paddle.y += 40 + end + end + + def input_right_paddle args + if args.inputs.controller_two.key_down.down || args.inputs.keyboard.key_down.l + args.state.right_paddle.y -= 40 + elsif args.inputs.controller_two.key_down.up || args.inputs.keyboard.key_down.o + args.state.right_paddle.y += 40 + end + end +end + +begin :assets + def solid_ball args + centered_rect args.state.ball.x, args.state.ball.y, args.state.ball.size, args.state.ball.size + end + + def solid_left_paddle args + centered_rect_vertically 0, args.state.left_paddle.y, args.state.paddle.w, args.state.paddle.h + end + + def solid_right_paddle args + centered_rect_vertically 1280 - args.state.paddle.w, args.state.right_paddle.y, args.state.paddle.w, args.state.paddle.h + end + + def centered_rect x, y, w, h + [x - w / 2, y - h / 2, w, h] + end + + def centered_rect_vertically x, y, w, h + [x, y - h / 2, w, h] + end +end diff --git a/samples/99_sample_game_pong/license-for-sample.txt b/samples/99_sample_game_pong/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/99_sample_game_pong/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_game_pong/replay.txt b/samples/99_sample_game_pong/replay.txt new file mode 100644 index 0000000..c7cc8ed --- /dev/null +++ b/samples/99_sample_game_pong/replay.txt @@ -0,0 +1,292 @@ +replay_version 2.0 +stopped_at 1167 +seed 100 +recorded_at Sun Sep 29 23:31:58 2019 +[:mouse_move, 846, 461, 2, 1, 84] +[:mouse_move, 819, 466, 2, 2, 85] +[:mouse_move, 773, 482, 2, 3, 86] +[:mouse_move, 755, 489, 2, 4, 87] +[:mouse_move, 729, 506, 2, 5, 88] +[:mouse_move, 706, 522, 2, 6, 89] +[:mouse_move, 686, 544, 2, 7, 90] +[:mouse_move, 677, 557, 2, 8, 91] +[:mouse_move, 672, 569, 2, 9, 92] +[:mouse_move, 670, 575, 2, 10, 93] +[:mouse_move, 669, 583, 2, 11, 94] +[:mouse_move, 668, 585, 2, 12, 95] +[:mouse_move, 667, 590, 2, 13, 96] +[:mouse_move, 663, 593, 2, 14, 97] +[:mouse_move, 653, 600, 2, 15, 98] +[:mouse_move, 645, 602, 2, 16, 99] +[:mouse_move, 604, 608, 2, 17, 100] +[:mouse_move, 557, 611, 2, 18, 101] +[:mouse_move, 467, 615, 2, 19, 102] +[:mouse_move, 410, 619, 2, 20, 103] +[:mouse_move, 291, 631, 2, 21, 104] +[:mouse_move, 268, 635, 2, 22, 105] +[:mouse_move, 221, 643, 2, 23, 106] +[:mouse_move, 195, 649, 2, 24, 107] +[:mouse_move, 175, 654, 2, 25, 108] +[:mouse_move, 159, 659, 2, 26, 109] +[:mouse_move, 152, 662, 2, 27, 110] +[:mouse_move, 145, 668, 2, 28, 111] +[:mouse_move, 145, 670, 2, 29, 112] +[:mouse_move, 144, 676, 2, 30, 123] +[:mouse_move, 143, 680, 2, 31, 124] +[:mouse_move, 138, 687, 2, 32, 125] +[:mouse_move, 136, 691, 2, 33, 126] +[:mouse_move, 132, 698, 2, 34, 127] +[:mouse_move, 129, 701, 2, 35, 128] +[:mouse_move, 128, 704, 2, 36, 129] +[:mouse_move, 126, 706, 2, 37, 130] +[:mouse_move, 126, 707, 2, 38, 131] +[:mouse_move, 130, 707, 2, 39, 133] +[:mouse_move, 132, 707, 2, 40, 134] +[:mouse_move, 135, 707, 2, 41, 135] +[:mouse_move, 141, 706, 2, 42, 136] +[:mouse_move, 145, 705, 2, 43, 137] +[:mouse_move, 155, 703, 2, 44, 138] +[:mouse_move, 160, 701, 2, 45, 139] +[:mouse_move, 170, 699, 2, 46, 140] +[:mouse_move, 174, 698, 2, 47, 141] +[:mouse_move, 182, 696, 2, 48, 142] +[:mouse_move, 187, 696, 2, 49, 143] +[:mouse_move, 192, 695, 2, 50, 144] +[:mouse_move, 197, 695, 2, 51, 145] +[:mouse_move, 203, 695, 2, 52, 146] +[:mouse_move, 205, 695, 2, 53, 147] +[:mouse_move, 211, 695, 2, 54, 148] +[:mouse_move, 214, 695, 2, 55, 149] +[:mouse_move, 219, 695, 2, 56, 150] +[:mouse_move, 222, 695, 2, 57, 151] +[:mouse_move, 228, 695, 2, 58, 152] +[:mouse_move, 231, 695, 2, 59, 153] +[:mouse_move, 237, 695, 2, 60, 154] +[:mouse_move, 241, 695, 2, 61, 155] +[:mouse_move, 246, 695, 2, 62, 156] +[:mouse_move, 250, 695, 2, 63, 157] +[:mouse_move, 257, 695, 2, 64, 158] +[:mouse_move, 260, 695, 2, 65, 159] +[:mouse_move, 267, 696, 2, 66, 160] +[:mouse_move, 271, 696, 2, 67, 161] +[:mouse_move, 275, 697, 2, 68, 162] +[:mouse_move, 283, 698, 2, 69, 163] +[:mouse_move, 288, 698, 2, 70, 164] +[:mouse_move, 297, 699, 2, 71, 165] +[:mouse_move, 303, 700, 2, 72, 166] +[:mouse_move, 313, 701, 2, 73, 167] +[:mouse_move, 318, 702, 2, 74, 168] +[:mouse_move, 330, 703, 2, 75, 169] +[:mouse_move, 337, 704, 2, 76, 170] +[:mouse_move, 350, 705, 2, 77, 171] +[:mouse_move, 356, 706, 2, 78, 172] +[:mouse_move, 371, 707, 2, 79, 173] +[:mouse_move, 377, 708, 2, 80, 174] +[:mouse_move, 393, 709, 2, 81, 175] +[:mouse_move, 401, 709, 2, 82, 176] +[:mouse_move, 410, 709, 2, 83, 177] +[:mouse_move, 415, 709, 2, 84, 178] +[:mouse_move, 422, 709, 2, 85, 179] +[:mouse_move, 424, 709, 2, 86, 180] +[:mouse_move, 429, 709, 2, 87, 181] +[:mouse_move, 430, 709, 2, 88, 182] +[:mouse_move, 432, 709, 2, 89, 183] +[:mouse_move, 433, 709, 2, 90, 185] +[:mouse_move, 434, 709, 2, 91, 190] +[:mouse_move, 435, 708, 2, 92, 192] +[:mouse_move, 437, 708, 2, 93, 193] +[:mouse_move, 440, 707, 2, 94, 194] +[:mouse_move, 442, 706, 2, 95, 195] +[:mouse_move, 446, 705, 2, 96, 196] +[:mouse_move, 448, 704, 2, 97, 197] +[:mouse_move, 451, 704, 2, 98, 198] +[:mouse_move, 451, 703, 2, 99, 199] +[:mouse_move, 452, 703, 2, 100, 200] +[:mouse_move, 453, 703, 2, 101, 201] +[:mouse_move, 454, 703, 2, 102, 210] +[:mouse_move, 462, 703, 2, 103, 225] +[:mouse_move, 475, 703, 2, 104, 226] +[:mouse_move, 511, 703, 2, 105, 227] +[:mouse_move, 535, 703, 2, 106, 228] +[:mouse_move, 603, 709, 2, 107, 229] +[:mouse_move, 645, 711, 2, 108, 230] +[:mouse_move, 692, 714, 2, 109, 231] +[:mouse_move, 703, 715, 2, 110, 232] +[:mouse_move, 725, 715, 2, 111, 233] +[:mouse_move, 735, 715, 2, 112, 234] +[:mouse_move, 745, 715, 2, 113, 235] +[:mouse_move, 747, 715, 2, 114, 236] +[:mouse_move, 744, 716, 2, 115, 238] +[:mouse_move, 735, 716, 2, 116, 239] +[:mouse_move, 732, 716, 2, 117, 240] +[:mouse_move, 726, 716, 2, 118, 241] +[:mouse_move, 723, 716, 2, 119, 242] +[:mouse_move, 721, 717, 2, 120, 243] +[:mouse_move, 720, 717, 2, 121, 244] +[:mouse_move, 721, 717, 2, 122, 246] +[:mouse_move, 722, 717, 2, 123, 247] +[:mouse_move, 726, 716, 2, 124, 248] +[:mouse_move, 728, 715, 2, 125, 249] +[:mouse_move, 732, 713, 2, 126, 250] +[:mouse_move, 733, 713, 2, 127, 251] +[:mouse_move, 736, 711, 2, 128, 252] +[:mouse_move, 738, 711, 2, 129, 253] +[:mouse_move, 739, 709, 2, 130, 254] +[:mouse_move, 740, 708, 2, 131, 255] +[:mouse_move, 743, 708, 2, 132, 273] +[:mouse_move, 745, 708, 2, 133, 274] +[:mouse_move, 751, 708, 2, 134, 275] +[:mouse_move, 755, 708, 2, 135, 276] +[:mouse_move, 764, 708, 2, 136, 277] +[:mouse_move, 769, 708, 2, 137, 278] +[:mouse_move, 778, 709, 2, 138, 279] +[:mouse_move, 782, 709, 2, 139, 280] +[:mouse_move, 790, 709, 2, 140, 281] +[:mouse_move, 794, 709, 2, 141, 282] +[:mouse_move, 801, 710, 2, 142, 283] +[:mouse_move, 804, 710, 2, 143, 284] +[:mouse_move, 812, 710, 2, 144, 285] +[:mouse_move, 815, 710, 2, 145, 286] +[:mouse_move, 823, 710, 2, 146, 287] +[:mouse_move, 827, 710, 2, 147, 288] +[:mouse_move, 835, 710, 2, 148, 289] +[:mouse_move, 838, 710, 2, 149, 290] +[:mouse_move, 846, 710, 2, 150, 291] +[:mouse_move, 851, 710, 2, 151, 292] +[:mouse_move, 859, 710, 2, 152, 293] +[:mouse_move, 862, 710, 2, 153, 294] +[:mouse_move, 872, 710, 2, 154, 295] +[:mouse_move, 876, 710, 2, 155, 296] +[:mouse_move, 880, 710, 2, 156, 297] +[:mouse_move, 891, 710, 2, 157, 298] +[:mouse_move, 895, 710, 2, 158, 299] +[:mouse_move, 904, 710, 2, 159, 300] +[:mouse_move, 909, 710, 2, 160, 301] +[:mouse_move, 918, 710, 2, 161, 302] +[:mouse_move, 922, 709, 2, 162, 303] +[:mouse_move, 928, 709, 2, 163, 304] +[:mouse_move, 931, 709, 2, 164, 305] +[:mouse_move, 939, 708, 2, 165, 306] +[:mouse_move, 942, 707, 2, 166, 307] +[:mouse_move, 948, 707, 2, 167, 308] +[:mouse_move, 952, 707, 2, 168, 309] +[:mouse_move, 958, 706, 2, 169, 310] +[:mouse_move, 960, 706, 2, 170, 311] +[:mouse_move, 965, 706, 2, 171, 312] +[:mouse_move, 967, 706, 2, 172, 313] +[:mouse_move, 973, 706, 2, 173, 314] +[:mouse_move, 975, 706, 2, 174, 315] +[:mouse_move, 981, 706, 2, 175, 316] +[:mouse_move, 983, 706, 2, 176, 317] +[:mouse_move, 989, 706, 2, 177, 318] +[:mouse_move, 992, 707, 2, 178, 319] +[:mouse_move, 998, 708, 2, 179, 320] +[:mouse_move, 1001, 709, 2, 180, 321] +[:mouse_move, 1008, 710, 2, 181, 322] +[:mouse_move, 1011, 710, 2, 182, 323] +[:mouse_move, 1019, 711, 2, 183, 324] +[:mouse_move, 1023, 711, 2, 184, 325] +[:mouse_move, 1028, 711, 2, 185, 326] +[:mouse_move, 1039, 711, 2, 186, 327] +[:mouse_move, 1044, 711, 2, 187, 328] +[:mouse_move, 1054, 709, 2, 188, 329] +[:mouse_move, 1059, 708, 2, 189, 330] +[:mouse_move, 1067, 707, 2, 190, 331] +[:mouse_move, 1068, 706, 2, 191, 332] +[:mouse_move, 1074, 705, 2, 192, 333] +[:mouse_move, 1076, 705, 2, 193, 334] +[:mouse_move, 1078, 704, 2, 194, 335] +[:mouse_move, 1079, 704, 2, 195, 336] +[:mouse_move, 1080, 703, 2, 196, 338] +[:mouse_move, 1079, 703, 2, 197, 353] +[:mouse_move, 1067, 698, 2, 198, 354] +[:mouse_move, 1050, 690, 2, 199, 355] +[:mouse_move, 1007, 673, 2, 200, 356] +[:mouse_move, 980, 663, 2, 201, 357] +[:mouse_move, 920, 639, 2, 202, 358] +[:mouse_move, 888, 626, 2, 203, 359] +[:mouse_move, 854, 611, 2, 204, 360] +[:mouse_move, 847, 607, 2, 205, 361] +[:mouse_move, 821, 593, 2, 206, 362] +[:key_down_raw, 111, 0, 2, 207, 524] +[:key_up_raw, 111, 0, 2, 208, 529] +[:key_down_raw, 111, 0, 2, 209, 533] +[:key_up_raw, 111, 0, 2, 210, 536] +[:key_down_raw, 111, 0, 2, 211, 541] +[:key_up_raw, 111, 0, 2, 212, 544] +[:key_down_raw, 111, 0, 2, 213, 549] +[:key_up_raw, 111, 0, 2, 214, 551] +[:key_down_raw, 111, 0, 2, 215, 556] +[:key_up_raw, 111, 0, 2, 216, 560] +[:key_down_raw, 108, 0, 2, 217, 591] +[:key_up_raw, 108, 0, 2, 218, 595] +[:key_down_raw, 108, 0, 2, 219, 601] +[:key_up_raw, 108, 0, 2, 220, 606] +[:key_down_raw, 108, 0, 2, 221, 612] +[:key_up_raw, 108, 0, 2, 222, 614] +[:key_down_raw, 119, 0, 2, 223, 651] +[:key_up_raw, 119, 0, 2, 224, 658] +[:key_down_raw, 119, 0, 2, 225, 662] +[:key_up_raw, 119, 0, 2, 226, 666] +[:key_down_raw, 115, 0, 2, 227, 678] +[:key_up_raw, 115, 0, 2, 228, 684] +[:key_down_raw, 115, 0, 2, 229, 689] +[:key_up_raw, 115, 0, 2, 230, 693] +[:key_down_raw, 115, 0, 2, 231, 698] +[:key_up_raw, 115, 0, 2, 232, 700] +[:key_down_raw, 115, 0, 2, 233, 704] +[:key_up_raw, 115, 0, 2, 234, 709] +[:key_down_raw, 115, 0, 2, 235, 713] +[:key_up_raw, 115, 0, 2, 236, 717] +[:key_down_raw, 119, 0, 2, 237, 727] +[:key_up_raw, 119, 0, 2, 238, 732] +[:key_down_raw, 119, 0, 2, 239, 738] +[:key_up_raw, 119, 0, 2, 240, 741] +[:key_down_raw, 119, 0, 2, 241, 745] +[:key_up_raw, 119, 0, 2, 242, 749] +[:key_down_raw, 119, 0, 2, 243, 754] +[:key_up_raw, 119, 0, 2, 244, 758] +[:key_down_raw, 119, 0, 2, 245, 762] +[:key_up_raw, 119, 0, 2, 246, 766] +[:key_down_raw, 119, 0, 2, 247, 770] +[:key_up_raw, 119, 0, 2, 248, 773] +[:key_down_raw, 119, 0, 2, 249, 777] +[:key_up_raw, 119, 0, 2, 250, 781] +[:key_down_raw, 119, 0, 2, 251, 786] +[:key_up_raw, 119, 0, 2, 252, 790] +[:key_down_raw, 119, 0, 2, 253, 793] +[:key_up_raw, 119, 0, 2, 254, 798] +[:key_down_raw, 119, 0, 2, 255, 804] +[:key_up_raw, 119, 0, 2, 256, 809] +[:key_down_raw, 115, 0, 2, 257, 849] +[:key_up_raw, 115, 0, 2, 258, 854] +[:key_down_raw, 108, 0, 2, 259, 980] +[:key_up_raw, 108, 0, 2, 260, 987] +[:key_down_raw, 108, 0, 2, 261, 992] +[:key_up_raw, 108, 0, 2, 262, 995] +[:key_down_raw, 108, 0, 2, 263, 1000] +[:key_up_raw, 108, 0, 2, 264, 1004] +[:key_down_raw, 108, 0, 2, 265, 1009] +[:key_up_raw, 108, 0, 2, 266, 1012] +[:key_down_raw, 108, 0, 2, 267, 1017] +[:key_up_raw, 108, 0, 2, 268, 1020] +[:key_down_raw, 108, 0, 2, 269, 1024] +[:key_up_raw, 108, 0, 2, 270, 1030] +[:key_down_raw, 111, 0, 2, 271, 1040] +[:key_up_raw, 111, 0, 2, 272, 1045] +[:key_down_raw, 111, 0, 2, 273, 1051] +[:key_up_raw, 111, 0, 2, 274, 1054] +[:key_down_raw, 108, 0, 2, 275, 1059] +[:key_up_raw, 108, 0, 2, 276, 1064] +[:key_down_raw, 108, 0, 2, 277, 1068] +[:key_up_raw, 108, 0, 2, 278, 1072] +[:key_down_raw, 111, 0, 2, 279, 1078] +[:key_up_raw, 111, 0, 2, 280, 1081] +[:key_down_raw, 111, 0, 2, 281, 1086] +[:key_up_raw, 111, 0, 2, 282, 1090] +[:key_down_raw, 111, 0, 2, 283, 1095] +[:key_up_raw, 111, 0, 2, 284, 1098] +[:key_down_raw, 111, 0, 2, 285, 1103] +[:key_up_raw, 111, 0, 2, 286, 1107] +[:key_down_raw, 1073742051, 1024, 2, 287, 1165] +[:key_down_raw, 113, 1024, 2, 288, 1166] diff --git a/samples/99_sample_game_return_of_serenity/app/lowrez_simulator.rb b/samples/99_sample_game_return_of_serenity/app/lowrez_simulator.rb new file mode 100644 index 0000000..cc1e021 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/lowrez_simulator.rb @@ -0,0 +1,91 @@ +################################################################################### +# YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES +# THE 64x64 CANVAS. +################################################################################### + +TINY_RESOLUTION = 64 +TINY_SCALE = 720.fdiv(TINY_RESOLUTION + 5) +CENTER_OFFSET = 10 +EMULATED_FONT_SIZE = 20 +EMULATED_FONT_X_ZERO = 0 +EMULATED_FONT_Y_ZERO = 46 + +def tick args + sprites = [] + labels = [] + borders = [] + solids = [] + mouse = emulate_lowrez_mouse args + args.state.show_gridlines = false + lowrez_tick args, sprites, labels, borders, solids, mouse + render_gridlines_if_needed args + render_mouse_crosshairs args, mouse + emulate_lowrez_scene args, sprites, labels, borders, solids, mouse +end + +def emulate_lowrez_mouse args + args.state.new_entity_strict(:lowrez_mouse) do |m| + m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1 + m.y = args.mouse.y.idiv(TINY_SCALE) + if args.mouse.click + m.click = [ + args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1, + args.mouse.click.point.y.idiv(TINY_SCALE) + ] + m.down = m.click + else + m.click = nil + m.down = nil + end + + if args.mouse.up + m.up = [ + args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1, + args.mouse.up.point.y.idiv(TINY_SCALE) + ] + else + m.up = nil + end + end +end + +def render_mouse_crosshairs args, mouse + return unless args.state.show_gridlines + args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] +end + +def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse + args.render_target(:lowrez).solids << [0, 0, 1280, 720] + args.render_target(:lowrez).sprites << sprites + args.render_target(:lowrez).borders << borders + args.render_target(:lowrez).solids << solids + args.outputs.primitives << labels.map do |l| + as_label = l.label + l.text.each_char.each_with_index.map do |char, i| + [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE, + EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char, + EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'fonts/dragonruby-gtk-4x4.ttf'].label + end + end + + args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez] +end + +def render_gridlines_if_needed args + if args.state.show_gridlines && args.static_lines.length == 0 + args.static_lines << 65.times.map do |i| + [ + [CENTER_OFFSET + i * TINY_SCALE + 1, 0, + CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], + [CENTER_OFFSET + i * TINY_SCALE, 0, + CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], + [CENTER_OFFSET, 0 + i * TINY_SCALE, + CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], + [CENTER_OFFSET, 1 + i * TINY_SCALE, + CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] + ] + end + elsif !args.state.show_gridlines + args.static_lines.clear + end +end diff --git a/samples/99_sample_game_return_of_serenity/app/main.rb b/samples/99_sample_game_return_of_serenity/app/main.rb new file mode 100644 index 0000000..b6573a3 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/main.rb @@ -0,0 +1,423 @@ +require 'app/require.rb' + +def defaults args + args.outputs.background_color = [0, 0, 0] + args.state.last_story_line_text ||= "" + args.state.scene_history ||= [] + args.state.storyline_history ||= [] + args.state.word_delay ||= 8 + if args.state.tick_count == 0 + args.gtk.stop_music + args.outputs.sounds << 'sounds/static-loop.ogg' + end + + if args.state.storyline_history[-1] && args.state.storyline_queue_empty_at + lines = args.state + .storyline_history[-1] + .gsub("-", "") + .gsub("~", "") + .wrapped_lines(55) + + args.outputs.labels << multiple_lines(args, 690, 10 + lines.length * 25, lines, 0, 0) + elsif !args.state.is_storyline_dialog_active + args.outputs.labels << multiple_lines(args, 690, 55, "Use the arrow keys on your keyboard to move around. The GREEN boxes are important.".wrapped_lines(50)) + end + + return if args.state.current_scene + set_scene(args, day_one_beginning(args)) +end + +def inputs_move_player args + if args.state.scene_changed_at.elapsed_time > 5 + if args.keyboard.down || args.keyboard.s || args.keyboard.j + args.state.player.y -= 0.25 + elsif args.keyboard.up || args.keyboard.w || args.keyboard.k + args.state.player.y += 0.25 + end + + if args.keyboard.left || args.keyboard.a || args.keyboard.h + args.state.player.x -= 0.25 + elsif args.keyboard.right || args.keyboard.d || args.keyboard.l + args.state.player.x += 0.25 + end + + args.state.player.y = 60 if args.state.player.y > 63 + args.state.player.y = 0 if args.state.player.y < -3 + args.state.player.x = 60 if args.state.player.x > 63 + args.state.player.x = 0 if args.state.player.x < -3 + end +end + +def null_or_empty? ary + return true unless ary + return true if ary.length == 0 + return false +end + +def calc_storyline_hotspot args + hotspots = args.state.storylines.find_all do |hs| + args.state.player.inside_rect?(hs.shift_rect(-2, 0)) + end + + if !null_or_empty?(hotspots) && !args.state.inside_storyline_hotspot + _, _, _, _, storyline = hotspots.first + queue_storyline_text(args, storyline) + args.state.inside_storyline_hotspot = true + elsif null_or_empty?(hotspots) + args.state.inside_storyline_hotspot = false + end +end + +def calc_scenes args + hotspots = args.state.scenes.find_all do |hs| + args.state.player.inside_rect?(hs.shift_rect(-2, 0)) + end + + if !null_or_empty?(hotspots) && !args.state.inside_scene_hotspot + _, _, _, _, scene_method_or_hash = hotspots.first + if scene_method_or_hash.is_a? Symbol + set_scene(args, send(scene_method_or_hash, args)) + args.state.last_hotspot_scene = scene_method_or_hash + args.state.scene_history << scene_method_or_hash + else + set_scene(args, scene_method_or_hash) + end + args.state.inside_scene_hotspot = true + elsif null_or_empty?(hotspots) + args.state.inside_scene_hotspot = false + end +end + +def null_or_whitespace? word + return true if !word + return true if word.strip.length == 0 + return false +end + +def calc_storyline_presentation args + return unless args.state.tick_count > args.state.next_storyline + return unless args.state.scene_storyline_queue + next_storyline = args.state.scene_storyline_queue.shift + if null_or_whitespace? next_storyline + args.state.storyline_queue_empty_at ||= args.state.tick_count + args.state.is_storyline_dialog_active = false + return + end + args.state.storyline_to_show = next_storyline + args.state.is_storyline_dialog_active = true + args.state.storyline_queue_empty_at = nil + if next_storyline.end_with?(".") || next_storyline.end_with?("!") || next_storyline.end_with?("?") || next_storyline.end_with?("\"") + args.state.next_storyline += 60 + elsif next_storyline.end_with?(",") + args.state.next_storyline += 50 + elsif next_storyline.end_with?(":") + args.state.next_storyline += 60 + else + default_word_delay = 13 + args.state.word_delay - 8 + if next_storyline.gsub("-", "").gsub("~", "").length <= 4 + default_word_delay = 11 + args.state.word_delay - 8 + end + number_of_syllabals = next_storyline.length - next_storyline.gsub("-", "").length + args.state.next_storyline += default_word_delay + number_of_syllabals * (args.state.word_delay + 1) + end +end + +def inputs_reload_current_scene args + return + if args.inputs.keyboard.key_down.r! + reload_current_scene + end +end + +def inputs_dismiss_current_storyline args + if args.inputs.keyboard.key_down.x! + args.state.scene_storyline_queue.clear + end +end + +def inputs_restart_game args + if args.inputs.keyboard.exclamation_point + args.gtk.reset_state + end +end + +def inputs_change_word_delay args + if args.inputs.keyboard.key_down.plus || args.inputs.keyboard.key_down.equal_sign + args.state.word_delay -= 2 + if args.state.word_delay < 0 + args.state.word_delay = 0 + # queue_storyline_text args, "Text speed at MAXIMUM. Geez, how fast do you read?" + else + # queue_storyline_text args, "Text speed INCREASED." + end + end + + if args.inputs.keyboard.key_down.hyphen || args.inputs.keyboard.key_down.underscore + args.state.word_delay += 2 + # queue_storyline_text args, "Text speed DECREASED." + end +end + +def multiple_lines args, x, y, texts, size = 0, minimum_alpha = nil + texts.each_with_index.map do |t, i| + [x, y - i * (25 + size * 2), t, size, 0, 255, 255, 255, adornments_alpha(args, 255, minimum_alpha)] + end +end + +def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse + # args.state.show_gridlines = true + defaults args + render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_solids << [0, 0, 64, 64, 0, 0, 0] + calc_storyline_presentation args + calc_scenes args + calc_storyline_hotspot args + inputs_move_player args + inputs_print_mouse_rect args, lowrez_mouse + inputs_reload_current_scene args + inputs_dismiss_current_storyline args + inputs_change_word_delay args + inputs_restart_game args + if !args.state.storyline_queue_empty_at + args.outputs.labels << multiple_lines(args, 690, 80, + ["Press \"X\" on the keyboard to dismiss dialog.", + "Press \"+\" on the keyboard to INCREASE text speed.", + "Press \"-\" on the keyboard to DECREASE text speed."], 0, 255) + end +end + +def inputs_print_mouse_rect args, lowrez_mouse + if lowrez_mouse.click + if args.state.previous_mouse_click + dx = lowrez_mouse.click.x - args.state.previous_mouse_click.x + dy = lowrez_mouse.click.y - args.state.previous_mouse_click.y + x, y, w, h = args.state.previous_mouse_click.x, args.state.previous_mouse_click.y, dx, dy + + if dx < 0 && dx < 0 + x = x + w + w = w.abs + y = y + h + h = h.abs + end + + w += 1 + h += 1 + + puts [x, y, w, h] + args.state.previous_mouse_click = nil + else + args.state.previous_mouse_click = lowrez_mouse.click + square_x, square_y = lowrez_mouse.click + puts [square_x, square_y] + 8.map_with_index do |i| + puts [square_x - i + 1, square_y - i + 1, i + 1, i + 1] + end + end + + end +end + +def try_centering! word + word ||= "" + just_word = word.gsub("-", "").gsub(",", "").gsub(".", "").gsub("'", "").gsub('""', "\"-\"") + return word if just_word.strip.length == 0 + return word if just_word.include? "~" + return "~#{word}" if just_word.length <= 2 + if just_word.length.mod_zero? 2 + center_index = just_word.length.idiv(2) - 1 + else + center_index = (just_word.length - 1).idiv(2) + end + return "#{word[0..center_index - 1]}~#{word[center_index]}#{word[center_index + 1..-1]}" +end + +def queue_storyline args, scene + queue_storyline_text args, scene[:storyline] +end + +def queue_storyline_text args, text + args.state.last_story_line_text = text + args.state.storyline_history << text if text + words = (text || "").split(" ") + words = words.map { |w| try_centering! w } + args.state.scene_storyline_queue = words + if args.state.scene_storyline_queue.length != 0 + args.state.scene_storyline_queue.unshift "~$--" + args.state.storyline_to_show = "~." + else + args.state.storyline_to_show = "" + end + args.state.scene_storyline_queue << "" + args.state.next_storyline = args.state.tick_count +end + +def set_scene args, scene + args.state.current_scene = scene + args.state.background = scene[:background] || 'sprites/todo.png' + args.state.scene_fade = scene[:fade] || 0 + args.state.scenes = (scene[:scenes] || []).reject { |s| !s } + args.state.scene_render_override = scene[:render_override] + args.state.storylines = (scene[:storylines] || []).reject { |s| !s } + args.state.scene_changed_at = args.state.tick_count + if scene[:player] + args.state.player = scene[:player] + end + args.state.inside_scene_hotspot = false + args.state.inside_storyline_hotspot = false + queue_storyline args, scene +end + +def replay_storyline_rect + [26, -1, 7, 4] +end + +def labels_for_word word + left_side_of_word = "" + center_letter = "" + right_side_of_word = "" + + if word[0] == "~" + left_side_of_word = "" + center_letter = word[1] + right_side_of_word = word[2..-1] + elsif word.length > 0 + left_side_of_word, right_side_of_word = word.split("~") + center_letter = right_side_of_word[0] + right_side_of_word = right_side_of_word[1..-1] + end + + right_side_of_word = right_side_of_word.gsub("-", "") + + { + left: [29 - left_side_of_word.length * 4 - 1 * left_side_of_word.length, 2, left_side_of_word], + center: [29, 2, center_letter, 255, 0, 0], + right: [34, 2, right_side_of_word] + } +end + +def render_scenes args, lowrez_sprites + lowrez_sprites << args.state.scenes.flat_map do |hs| + hotspot_square args, hs.x, hs.y, hs.w, hs.h + end +end + +def render_storylines args, lowrez_sprites + lowrez_sprites << args.state.storylines.flat_map do |hs| + hotspot_square args, hs.x, hs.y, hs.w, hs.h + end +end + +def adornments_alpha args, target_alpha = nil, minimum_alpha = nil + return (minimum_alpha || 80) unless args.state.storyline_queue_empty_at + target_alpha ||= 255 + target_alpha * args.state.storyline_queue_empty_at.ease(60) +end + +def hotspot_square args, x, y, w, h + if w >= 3 && h >= 3 + [ + [x + w.idiv(2) + 1, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 50), 23, 23, 23], + [x, y, w.idiv(2), h, 'sprites/label-background.png', 0, adornments_alpha(args, 100), 223, 223, 223], + [x + 1, y + 1, w - 2, h - 2, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 40, 140, 40], + ] + else + [ + [x, y, w, h, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 140, 0], + ] + end +end + +def render_storyline_dialog args, lowrez_labels, lowrez_sprites + return unless args.state.is_storyline_dialog_active + return unless args.state.storyline_to_show + labels = labels_for_word args.state.storyline_to_show + if true # high rez version + scale = 8.88 + offset = 45 + size = 25 + args.outputs.labels << [offset + labels[:left].x.-(1) * scale, + labels[:left].y * TINY_SCALE + 55, + labels[:left].text, size, 0, 0, 0, 0, 255, + 'fonts/manaspc.ttf'] + center_text = labels[:center].text + center_text = "|" if center_text == "$" + args.outputs.labels << [offset + labels[:center].x * scale, + labels[:center].y * TINY_SCALE + 55, + center_text, size, 0, 255, 0, 0, 255, + 'fonts/manaspc.ttf'] + args.outputs.labels << [offset + labels[:right].x * scale, + labels[:right].y * TINY_SCALE + 55, + labels[:right].text, size, 0, 0, 0, 0, 255, + 'fonts/manaspc.ttf'] + else + lowrez_labels << labels[:left] + lowrez_labels << labels[:center] + lowrez_labels << labels[:right] + end + args.state.is_storyline_dialog_active = true + render_player args, lowrez_sprites + lowrez_sprites << [0, 0, 64, 8, 'sprites/label-background.png'] +end + +def render_player args, lowrez_sprites + lowrez_sprites << player_md_down(args, *args.state.player) +end + +def render_adornments args, lowrez_sprites + render_scenes args, lowrez_sprites + render_storylines args, lowrez_sprites + return if args.state.is_storyline_dialog_active + lowrez_sprites << player_md_down(args, *args.state.player) +end + +def global_alpha_percentage args, max_alpha = 255 + return 255 unless args.state.scene_changed_at + return 255 unless args.state.scene_fade + return 255 unless args.state.scene_fade > 0 + return max_alpha * args.state.scene_changed_at.ease(args.state.scene_fade) +end + +def render_current_scene args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [0, 0, 64, 64, args.state.background, 0, (global_alpha_percentage args)] + if args.state.scene_render_override + send args.state.scene_render_override, args, lowrez_sprites, lowrez_labels, lowrez_solids + end + storyline_to_show = args.state.storyline_to_show || "" + render_adornments args, lowrez_sprites + render_storyline_dialog args, lowrez_labels, lowrez_sprites + + if args.state.background == 'sprites/tribute-game-over.png' + lowrez_sprites << [0, 0, 64, 11, 'sprites/label-background.png', 0, adornments_alpha(args, 200), 0, 0, 0] + lowrez_labels << [9, 6, 'Return of', 255, 255, 255] + lowrez_labels << [9, 1, ' Serenity', 255, 255, 255] + if !args.state.ended + args.gtk.stop_music + args.outputs.sounds << 'sounds/music-loop.ogg' + args.state.ended = true + end + end +end + +def player_md_right args, x, y + [x, y, 4, 11, 'sprites/player-right.png', 0, (global_alpha_percentage args)] +end + +def player_md_left args, x, y + [x, y, 4, 11, 'sprites/player-left.png', 0, (global_alpha_percentage args)] +end + +def player_md_up args, x, y + [x, y, 4, 11, 'sprites/player-up.png', 0, (global_alpha_percentage args)] +end + +def player_md_down args, x, y + [x, y, 4, 11, 'sprites/player-down.png', 0, (global_alpha_percentage args)] +end + +def player_sm args, x, y + [x, y, 3, 7, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] +end + +def player_xs args, x, y + [x, y, 1, 4, 'sprites/player-zoomed-out.png', 0, (global_alpha_percentage args)] +end diff --git a/samples/99_sample_game_return_of_serenity/app/repl.rb b/samples/99_sample_game_return_of_serenity/app/repl.rb new file mode 100644 index 0000000..a59baf5 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/repl.rb @@ -0,0 +1 @@ +puts $gtk.args.state.current_scene diff --git a/samples/99_sample_game_return_of_serenity/app/require.rb b/samples/99_sample_game_return_of_serenity/app/require.rb new file mode 100644 index 0000000..35d0ff0 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/require.rb @@ -0,0 +1,11 @@ +require 'app/lowrez_simulator.rb' +require 'app/storyline_day_one.rb' +require 'app/storyline_blinking_light.rb' +require 'app/storyline_serenity_introduction.rb' +require 'app/storyline_speed_of_light.rb' +require 'app/storyline_serenity_alive.rb' +require 'app/storyline_serenity_bio.rb' +require 'app/storyline_anka.rb' +require 'app/storyline_final_message.rb' +require 'app/storyline_final_decision.rb' +require 'app/storyline.rb' diff --git a/samples/99_sample_game_return_of_serenity/app/storyline.rb b/samples/99_sample_game_return_of_serenity/app/storyline.rb new file mode 100644 index 0000000..e881861 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline.rb @@ -0,0 +1,146 @@ +def hotspot_top + [4, 61, 56, 3] +end + +def hotspot_bottom + [4, 0, 56, 3] +end + +def hotspot_top_right + [62, 35, 3, 25] +end + +def hotspot_bottom_right + [62, 0, 3, 25] +end + +def storyline_history_include? args, text + args.state.storyline_history.any? { |s| s.gsub("-", "").gsub(" ", "").include? text.gsub("-", "").gsub(" ", "") } +end + +def blinking_light_side_of_home_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [48, 44, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [49, 45, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [50, 46, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def blinking_light_mountain_pass_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [18, 47, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [19, 48, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [20, 49, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def blinking_light_path_to_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [0, 26, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [1, 27, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [2, 28, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def blinking_light_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [23, 59, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [24, 60, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [25, 61, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def blinking_light_inside_observatory_render args, lowrez_sprites, lowrez_labels, lowrez_solids + lowrez_sprites << [30, 30, 5, 5, 'sprites/square.png', 0, 50 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [31, 31, 3, 3, 'sprites/square.png', 0, 100 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] + lowrez_sprites << [32, 32, 1, 1, 'sprites/square.png', 0, 255 * (args.state.tick_count % 50).fdiv(50), 0, 255, 0] +end + +def decision_graph context_message, context_action, context_result_one, context_result_two, context_result_three = [], context_result_four = [] + result_one_scene, result_one_label, result_one_text = context_result_one + result_two_scene, result_two_label, result_two_text = context_result_two + result_three_scene, result_three_label, result_three_text = context_result_three + result_four_scene, result_four_label, result_four_text = context_result_four + + top_level_hash = { + background: 'sprites/decision.png', + fade: 60, + player: [20, 36], + storylines: [ ], + scenes: [ ] + } + + confirmation_result_one_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_two_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_three_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + confirmation_result_four_hash = { + background: 'sprites/decision.png', + scenes: [ ], + storylines: [ ] + } + + top_level_hash[:storylines] << [ 5, 35, 4, 4, context_message] + top_level_hash[:storylines] << [20, 35, 4, 4, context_action] + + confirmation_result_one_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_one_hash[:scenes] << [60, 50, 4, 4, result_one_scene] + confirmation_result_one_hash[:storylines] << [40, 50, 4, 4, "#{result_one_label}: \"#{result_one_text}\""] + confirmation_result_one_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + confirmation_result_one_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + confirmation_result_one_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + confirmation_result_two_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_two_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_two_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + confirmation_result_two_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + confirmation_result_two_hash[:scenes] << [60, 20, 4, 4, result_two_scene] + confirmation_result_two_hash[:storylines] << [40, 20, 4, 4, "#{result_two_label}: \"#{result_two_text}\""] + + confirmation_result_three_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_three_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_three_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] + confirmation_result_three_hash[:scenes] << [60, 30, 4, 4, result_three_scene] + confirmation_result_three_hash[:storylines] << [40, 30, 4, 4, "#{result_three_label}: \"#{result_three_text}\""] + confirmation_result_three_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + confirmation_result_four_hash[:scenes] << [20, 35, 4, 4, top_level_hash] + confirmation_result_four_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + confirmation_result_four_hash[:scenes] << [60, 40, 4, 4, result_four_scene] + confirmation_result_four_hash[:storylines] << [40, 40, 4, 4, "#{result_four_label}: \"#{result_four_text}\""] + confirmation_result_four_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] + confirmation_result_four_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + top_level_hash[:scenes] << [40, 50, 4, 4, confirmation_result_one_hash] + top_level_hash[:scenes] << [40, 40, 4, 4, confirmation_result_four_hash] if result_four_scene + top_level_hash[:scenes] << [40, 30, 4, 4, confirmation_result_three_hash] if result_three_scene + top_level_hash[:scenes] << [40, 20, 4, 4, confirmation_result_two_hash] + + top_level_hash +end + +def ship_control_hotspot offset_x, offset_y, a, b, c, d + results = [] + results << [ 6 + offset_x, 0 + offset_y, 4, 4, a] if a + results << [ 1 + offset_x, 5 + offset_y, 4, 4, b] if b + results << [ 6 + offset_x, 5 + offset_y, 4, 4, c] if c + results << [ 11 + offset_x, 5 + offset_y, 4, 4, d] if d + results +end + +def reload_current_scene + if $gtk.args.state.last_hotspot_scene + set_scene $gtk.args, send($gtk.args.state.last_hotspot_scene, $gtk.args) + tick $gtk.args + elsif respond_to? :set_scene + set_scene $gtk.args, (replied_to_serenity_alive_firmly $gtk.args) + tick $gtk.args + end + $gtk.console.close +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_anka.rb b/samples/99_sample_game_return_of_serenity/app/storyline_anka.rb new file mode 100644 index 0000000..bad7795 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_anka.rb @@ -0,0 +1,127 @@ +def anka_inside_room args + { + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Ahhhh!!! Oh god, it was just- a nightmare."], + ], + scenes: [ + [32, -1, 8, 3, :anka_observatory] + ] + } +end + +def anka_observatory args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] + ], + scenes: [ + [30, 18, 5, 12, :anka_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def anka_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 60, + storylines: [ + [22, 45, 17, 4, (anka_last_reply args)], + [45, 45, 4, 4, (anka_current_reply args)], + ], + scenes: [ + [*hotspot_top_right, :reply_to_anka] + ] + } +end + +def reply_to_anka args + decision_graph anka_current_reply(args), + "Matthew's-- wife is doing-- well. What's-- even-- better-- is that he's-- a dad, and he didn't-- even-- know it. Should- I- leave- out the part about-- the crew- being-- in hibernation-- for 20-- years? They- should- enter-- statis-- on a high- note... Right?", + [:replied_with_whole_truth, "Whole-- Truth--", anka_reply_whole_truth], + [:replied_with_half_truth, "Half-- Truth--", anka_reply_half_truth] +end + +def anka_last_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Buffer--: #{serenity_alive_firm_reply.quote}" + else + return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" + end +end + +def anka_reply_whole_truth + "Matthew's wife is doing-- very-- well. In fact, she was pregnant. Matthew-- is a dad. He has a son. But, I need- all-- of-- you-- to brace-- yourselves. You've-- been in statis-- for 20 years. A lot has changed. Most of Earth's-- population--- didn't-- survive. Tell- Matthew-- that I'm-- sorry he didn't-- get to see- his- son grow- up." +end + +def anka_reply_half_truth + "Matthew's--- wife- is doing-- very-- well. In fact, she was pregnant. Matthew is a dad! It's a boy! Tell- Matthew-- congrats-- for me. Hope-- to see- all of you- soon." +end + +def replied_with_whole_truth args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_whole_truth.quote}"], + [30, 10, 5, 4, "I- hope- I- did the right- thing- by laying-- it all- out- there."], + ] + } +end + +def replied_with_half_truth args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [[60, 0, 4, 32, :replied_to_anka_back_home]], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{anka_reply_half_truth.quote}"], + [30, 10, 5, 4, "I- hope- I- did the right- thing- by not giving-- them- the whole- truth."], + ] + } +end + +def anka_current_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Hello. This is, Aanka. Sasha-- is still- trying-- to gather-- her wits about-- her, given- the gravity--- of your- last- reply. Thank- you- for being-- honest, and thank- you- for the help- with the ship- diagnostics. I was able-- to retrieve-- all of the navigation--- information---- after-- the battery--- swap. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." + else + return "Hello. This is, Aanka. Thank- you for the help- with the ship's-- diagnostics. I was able-- to retrieve-- all of the navigation--- information--- after-- the battery-- swap. I- know-- that- you didn't-- tell- the whole truth- about-- how far we are from- Earth. Don't-- worry. I understand-- why you did it. We- are ready-- to head back to Earth. Before-- we go- back- into-- statis, Matthew--- wanted-- to know- how his- wife- is doing. Please- reply-- as soon- as you can. He's-- not going-- to get- into-- the statis-- chamber-- until-- he knows- his wife is okay." + end +end + +def replied_to_anka_back_home args + if args.state.scene_history.include? :replied_with_whole_truth + return { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I- hope-- this pit in my stomach-- is gone-- by tomorrow---."], + ], + scenes: [ + [30, 38, 12, 13, :final_message_sad], + ] + } + else + return { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I- get the feeling-- I'm going-- to sleep real well tonight--."], + ], + scenes: [ + [30, 38, 12, 13, :final_message_happy], + ] + } + end +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_blinking_light.rb b/samples/99_sample_game_return_of_serenity/app/storyline_blinking_light.rb new file mode 100644 index 0000000..ba9e8a2 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_blinking_light.rb @@ -0,0 +1,75 @@ +def the_blinking_light args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :blinking_light_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } +end + +def blinking_light_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :blinking_light_path_to_observatory] + ], + render_override: :blinking_light_mountain_pass_render + } +end + +def blinking_light_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :blinking_light_observatory] + ], + render_override: :blinking_light_path_to_observatory_render + } +end + +def blinking_light_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :blinking_light_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } +end + +def blinking_light_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [ + [50, 2, 4, 8, "That's weird. I thought- this- mainframe-- was broken--."] + ], + scenes: [ + [30, 18, 5, 12, :blinking_light_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def blinking_light_inside_mainframe args + { + background: 'sprites/mainframe.png', + fade: 60, + player: [30, 4], + scenes: [ + [62, 32, 4, 32, :reply_to_introduction] + ], + storylines: [ + [43, 43, 8, 8, "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--."], + [30, 30, 4, 4, "There's-- a low- level-- message-- here... NANI.T.F?"], + [14, 10, 24, 4, "Oh interesting---. This transistor--- needed-- to be activated--- for the- mainframe-- to work."], + [14, 20, 24, 4, "What the heck activated--- this thing- though?"] + ] + } +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_day_one.rb b/samples/99_sample_game_return_of_serenity/app/storyline_day_one.rb new file mode 100644 index 0000000..24b2b45 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_day_one.rb @@ -0,0 +1,206 @@ +def day_one_beginning args + { + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [0, 0, 64, 2, :day_one_infront_of_home], + ], + storylines: [ + [35, 10, 6, 6, "Man. Hard to believe- that today- is the 20th--- anniversary-- of The Impact."] + ] + } +end + +def day_one_infront_of_home args + { + background: 'sprites/front-of-home.png', + player: [56, 23], + scenes: [ + [43, 34, 10, 16, :day_one_home], + [62, 0, 3, 40, :day_one_beginning], + [0, 4, 3, 20, :day_one_ceremony] + ], + storylines: [ + [40, 20, 4, 4, "It looks like everyone- is already- at the rememberance-- ceremony."], + ] + } +end + +def day_one_home args + { + background: 'sprites/inside-home.png', + player: [34, 3], + scenes: [ + [28, 0, 12, 2, :day_one_infront_of_home] + ], + storylines: [ + [ + 38, 4, 4, 4, "My mansion- in all its glory! Okay yea, it's just a shipping- container-. Apparently-, it's nothing- like the luxuries- of the 2040's. But it's- all we have- in- this day and age. And it'll suffice." + ], + [ + 28, 7, 4, 7, + "Ahhh. My reading- couch. It's so comfortable--." + ], + [ + 38, 21, 4, 4, + "I'm- lucky- to have a computer--. I'm- one of the few people- with- the skills to put this- thing to good use." + ], + [ + 45, 37, 4, 8, + "This corner- of my home- is always- warmer-. It's cause of the ref~lected-- light- from the solar-- panels--, just on the other- side- of this wall. It's hard- to believe- there was o~nce-- an unlimited- amount- of electricity--." + ], + [ + 32, 40, 8, 10, + "This isn't- a good time- to sleep. I- should probably- head to the ceremony-." + ], + [ + 25, 21, 5, 12, + "Fifteen-- years- of computer-- science-- notes, neatly-- organized. Compiler--- Theory--, Linear--- Algebra---, Game-- Development---... Every-- subject-- imaginable--." + ] + ] + } +end + +def day_one_ceremony args + { + background: 'sprites/tribute.png', + player: [57, 21], + scenes: [ + [62, 0, 2, 40, :day_one_infront_of_home], + [0, 24, 2, 40, :day_one_infront_of_library] + ], + storylines: [ + [53, 12, 3, 8, "It's- been twenty- years since The Impact. Twenty- years, since Halley's-- Comet-- set Earth's- blue- sky on fire."], + [45, 12, 3, 8, "The space mission- sent to prevent- Earth's- total- destruction--, was a success. Only- 99.9%------ of the world's- population-- died-- that day. Hey, it's- better-- than 100%---- of humanity-- dying."], + [20, 12, 23, 4, "The monument--- reads:---- Here- stands- the tribute-- to Space- Mission-- Serenity--- and- its- crew. You- have- given-- humanity--- a second-- chance."], + [15, 12, 3, 8, "Rest- in- peace--- Matthew----, Sasha----, Aanka----"], + ] + } +end + +def day_one_infront_of_library args + { + background: 'sprites/outside-library.png', + player: [57, 21], + scenes: [ + [62, 0, 2, 40, :day_one_ceremony], + [49, 39, 6, 9, :day_one_library] + ], + storylines: [ + [50, 20, 4, 8, "Shipping- containers-- as far- as the eye- can see. It's- rather- beautiful-- if you ask me. Even- though-- this- view- represents-- all- that's-- left- of humanity-."] + ] + } +end + +def day_one_library args + { + background: 'sprites/library.png', + player: [27, 4], + scenes: [ + [0, 0, 64, 2, :end_day_one_infront_of_library] + ], + storylines: [ + [28, 22, 8, 4, "I grew- up- in this library. I've- read every- book- here. My favorites-- were- of course-- anything- computer-- related."], + [6, 32, 10, 6, "My favorite-- area--- of the library. The Science-- Section."] + ] + } +end + +def end_day_one_infront_of_library args + { + background: 'sprites/outside-library.png', + player: [51, 33], + scenes: [ + [49, 39, 6, 9, :day_one_library], + [62, 0, 2, 40, :end_day_one_monument], + ], + storylines: [ + [50, 27, 4, 4, "It's getting late. Better get some sleep."] + ] + } +end + +def end_day_one_monument args + { + background: 'sprites/tribute.png', + player: [2, 36], + scenes: [ + [62, 0, 2, 40, :end_day_one_infront_of_home], + ], + storylines: [ + [50, 27, 4, 4, "It's getting late. Better get some sleep."], + ] + } +end + +def end_day_one_infront_of_home args + { + background: 'sprites/front-of-home.png', + player: [1, 17], + scenes: [ + [43, 34, 10, 16, :end_day_one_home], + ], + storylines: [ + [20, 10, 4, 4, "It's getting late. Better get some sleep."], + ] + } +end + +def end_day_one_home args + { + background: 'sprites/inside-home.png', + player: [34, 3], + scenes: [ + [32, 40, 8, 10, :end_day_one_dream], + ], + storylines: [ + [38, 4, 4, 4, "It's getting late. Better get some sleep."], + ] + } +end + +def end_day_one_dream args + { + background: 'sprites/dream.png', + fade: 60, + player: [4, 4], + scenes: [ + [62, 0, 2, 64, :explaining_the_special_power] + ], + storylines: [ + [10, 10, 4, 4, "Why- does this- moment-- always- haunt- my dreams?"], + [20, 10, 4, 4, "This kid- reads these computer--- science--- books- nonstop-. What's- wrong with him?"], + [30, 10, 4, 4, "There- is nothing-- wrong- with him. This behavior-- should be encouraged---! In fact-, I think- he's- special---. Have- you seen- him use- a computer---? It's-- almost-- as if he can- speak-- to it."] + ] + } +end + +def explaining_the_special_power args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [32, 30], + scenes: [ + [ + 38, 21, 4, 4, :explaining_the_special_power_inside_computer + ], + ] + } +end + +def explaining_the_special_power_inside_computer args + { + background: 'sprites/pc.png', + fade: 60, + player: [34, 4], + scenes: [ + [0, 62, 64, 3, :the_blinking_light] + ], + storylines: [ + [14, 20, 24, 4, "So... I have a special-- power--. I don't-- need a mouse-, keyboard--, or even-- a monitor--- to control-- a computer--."], + [14, 25, 24, 4, "I only-- pretend-- to use peripherals---, so as not- to freak- anyone--- out."], + [14, 30, 24, 4, "Inside-- this silicon--- Universe---, is the only-- place I- feel- at peace."], + [14, 35, 24, 4, "It's-- the only-- place where I don't-- feel alone."] + ] + } +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_final_decision.rb b/samples/99_sample_game_return_of_serenity/app/storyline_final_decision.rb new file mode 100644 index 0000000..0ea190f --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_final_decision.rb @@ -0,0 +1,136 @@ +def final_decision_side_of_home args + { + fade: 120, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :final_decision_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render, + storylines: [ + [28, 13, 8, 4, "Man. Hard to believe- that today- is the 21st--- anniversary-- of The Impact. Serenity--- will- be- home- soon."] + ] + } +end + +def final_decision_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :final_decision_path_to_observatory] + ], + render_override: :blinking_light_mountain_pass_render + } +end + +def final_decision_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :final_decision_observatory] + ], + render_override: :blinking_light_path_to_observatory_render + } +end + +def final_decision_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :final_decision_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } +end + +def final_decision_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [], + scenes: [ + [30, 18, 5, 12, :final_decision_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def final_decision_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + storylines: [], + scenes: [ + [*hotspot_top, :final_decision_ship_status], + ] + } +end + +def final_decision_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [*hotspot_top_right, :final_decision] + ], + storylines: [ + [30, 8, 4, 4, "????"], + *final_decision_ship_status_shared(args) + ] + } +end + +def final_decision args + decision_graph "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached.", + "I CAN'T DO THIS... But... If-- I-- don't--- bring-- the- chambers--- to- equilibrium-----, they all die...", + [:final_decision_game_over_noone, "Kill--- Everyone---", "DO--- NOTHING?"], + [:final_decision_game_over_matthew, "Kill--- Sasha---", "KILL--- SASHA?"], + [:final_decision_game_over_anka, "Kill--- Aanka---", "KILL--- AANKA?"], + [:final_decision_game_over_sasha, "Kill--- Matthew---", "KILL--- MATTHEW?"] +end + +def final_decision_game_over_noone args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } +end + +def final_decision_game_over_matthew args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } +end + +def final_decision_game_over_anka args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } +end + +def final_decision_game_over_sasha args + { + background: 'sprites/tribute-game-over.png', + player: [53, 14], + fade: 600 + } +end + +def final_decision_ship_status_shared args + [ + *ship_control_hotspot(24, 22, + "Stasis-- Chambers--: UNDERPOWERED, Life- forms-- will be terminated---- unless-- equilibrium----- is reached. WHAT?! NO!", + "Matthew's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", + "Aanka's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!", + "Sasha's--- Chamber--: UNDER-- THREAT-- OF-- TERMINATION. WHAT?! NO!"), + ] +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_final_message.rb b/samples/99_sample_game_return_of_serenity/app/storyline_final_message.rb new file mode 100644 index 0000000..c7737e2 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_final_message.rb @@ -0,0 +1,216 @@ +def final_message_sad args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Another-- sleepless-- night..."], + ], + scenes: [ + [32, -1, 8, 3, :final_message_observatory] + ] + } +end + +def final_message_happy args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Oh man, I slept like rock!"], + ], + scenes: [ + [32, -1, 8, 3, :final_message_observatory] + ] + } +end + +def final_message_side_of_home args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :final_message_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } +end + +def final_message_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :final_message_path_to_observatory], + ], + storylines: [ + [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] + ], + render_override: :blinking_light_mountain_pass_render + } +end + +def final_message_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :final_message_observatory] + ], + storylines: [ + [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] + ], + render_override: :blinking_light_path_to_observatory_render + } +end + +def final_message_observatory args + if args.state.scene_history.include? :replied_with_whole_truth + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Here-- we- go..."] + ], + scenes: [ + [30, 18, 5, 12, :final_message_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + else + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "I feel like I'm-- walking-- on sunshine!"] + ], + scenes: [ + [30, 18, 5, 12, :final_message_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } + end +end + +def final_message_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 60, + scenes: [[45, 45, 4, 4, :final_message_check_ship_status]] + } +end + +def final_message_check_ship_status args + { + background: 'sprites/mainframe.png', + storylines: [ + [45, 45, 4, 4, (final_message_current args)], + ], + scenes: [ + [*hotspot_top, :final_message_ship_status], + ] + } +end + +def final_message_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [30, 50, 4, 4, :final_message_ship_status_reviewed] + ], + storylines: [ + [30, 8, 4, 4, "Let me make- sure- everything--- looks good. It'll-- give me peace- of mind."], + *final_message_ship_status_shared(args) + ] + } +end + +def final_message_ship_status_reviewed args + { + background: 'sprites/serenity.png', + fade: 60, + scenes: [ + [*hotspot_bottom, :final_message_summary] + ], + storylines: [ + [0, 62, 62, 3, "Whew. Everyone-- is in their- chambers. The engines-- are roaring-- and Serenity-- is coming-- home."], + ] + } +end + +def final_message_ship_status_shared args + [ + *ship_control_hotspot( 0, 50, + "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--.", + "Matthew's--- Chamber--: OCCUPIED----", + "Aanka's--- Chamber--: OCCUPIED----", + "Sasha's--- Chamber--: OCCUPIED----"), + *ship_control_hotspot(12, 35, + "Life- Support--: Not-- Needed---", + "O2--- Production---: OFF---", + "CO2--- Scrubbers---: OFF---", + "H2O--- Production---: OFF---"), + *ship_control_hotspot(24, 20, + "Navigation: Offline---", + "Sensor: OFF---", + "Heads- Up- Display: DAMAGED---", + "Arithmetic--- Unit: DAMAGED----"), + *ship_control_hotspot(36, 35, + "COMM: Underpowered----", + "Text: ON---", + "Audio: SEGFAULT---", + "Video: DAMAGED---"), + *ship_control_hotspot(48, 50, + "Engine: Online, Coordinates--- Set- for Earth. Battery--- Allocation---: 3--- of-- 3---", + "Engine I: ON---", + "Engine II: ON---", + "Engine III: ON---") + ] +end + +def final_message_last_reply args + if args.state.scene_history.include? :replied_with_whole_truth + return "Buffer--: #{anka_reply_whole_truth.quote}" + else + return "Buffer--: #{anka_reply_half_truth.quote}" + end +end + +def final_message_current args + if args.state.scene_history.include? :replied_with_whole_truth + return "Hey... It's-- me Sasha. Aanka-- is trying-- her best to comfort-- Matthew. This- is the first- time- I've-- ever-- seen-- Matthew-- cry. We'll-- probably-- be in stasis-- by the time you get this message--. Thank- you- again-- for all your help. I look forward-- to meeting-- you in person." + else + return "Hey! It's-- me Sasha! LOL! Aanka-- and Matthew-- are dancing-- around-- like- goofballs--! They- are both- so adorable! Only-- this- tiny-- little-- genius-- can make-- a battle-- hardened-- general--- put- on a tiara-- and dance- around-- like a fairy-- princess-- XD------ Anyways, we are heading-- back into-- the chambers--. I hope our welcome-- home- parade-- has fireworks!" + end +end + +def final_message_summary args + if args.state.scene_history.include? :replied_with_whole_truth + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [31, 11], + scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], + storylines: [ + [30, 10, 5, 4, "I can't-- imagine-- what they are feeling-- right now. But at least- they- know everything---, and we can- concentrate-- on rebuilding--- this world-- right- off the bat. I can't-- wait to see the future-- they'll-- help- build."], + ] + } + else + return { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [31, 11], + scenes: [[60, 0, 4, 32, :final_decision_side_of_home]], + storylines: [ + [30, 10, 5, 4, "They all sounded-- so happy. I know- they'll-- be in for a tough- dose- of reality--- when they- arrive. But- at least- they'll-- be around-- all- of us. We'll-- help them- cope."], + ] + } + end +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_serenity_alive.rb b/samples/99_sample_game_return_of_serenity/app/storyline_serenity_alive.rb new file mode 100644 index 0000000..4407699 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_serenity_alive.rb @@ -0,0 +1,219 @@ +def serenity_alive_side_of_home args + { + fade: 60, + background: 'sprites/side-of-home.png', + player: [16, 13], + scenes: [ + [52, 24, 11, 5, :serenity_alive_mountain_pass], + ], + render_override: :blinking_light_side_of_home_render + } +end + +def serenity_alive_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [4, 4], + scenes: [ + [18, 47, 5, 5, :serenity_alive_path_to_observatory], + ], + storylines: [ + [18, 13, 5, 5, "Hnnnnnnnggg. My legs-- are still sore- from yesterday."] + ], + render_override: :blinking_light_mountain_pass_render + } +end + +def serenity_alive_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [60, 4], + scenes: [ + [0, 26, 5, 5, :serenity_alive_observatory] + ], + storylines: [ + [22, 20, 10, 10, "This spot--, on the mountain, right here, it's-- perfect. This- is where- I'll-- yeet-- the person-- who is playing-- this- prank- on me."] + ], + render_override: :blinking_light_path_to_observatory_render + } +end + +def serenity_alive_observatory args + { + background: 'sprites/observatory.png', + player: [60, 2], + scenes: [ + [28, 39, 4, 10, :serenity_alive_inside_observatory] + ], + render_override: :blinking_light_observatory_render + } +end + +def serenity_alive_inside_observatory args + { + background: 'sprites/inside-observatory.png', + player: [60, 2], + storylines: [], + scenes: [ + [30, 18, 5, 12, :serenity_alive_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def serenity_alive_inside_mainframe args + { + background: 'sprites/mainframe.png', + fade: 60, + player: [30, 4], + scenes: [ + [*hotspot_top, :serenity_alive_ship_status], + ], + storylines: [ + [22, 45, 17, 4, (serenity_alive_last_reply args)], + [45, 45, 4, 4, (serenity_alive_current_message args)], + ] + } +end + +def serenity_alive_ship_status args + { + background: 'sprites/serenity.png', + fade: 60, + player: [30, 10], + scenes: [ + [30, 50, 4, 4, :serenity_alive_ship_status_reviewed] + ], + storylines: [ + [30, 8, 4, 4, "Serenity? THE--- Mission-- Serenity?! How is that possible? They- are supposed-- to be dead."], + [30, 10, 4, 4, "I... can't-- believe-- it. I- can access-- Serenity's-- computer? I- guess my \"superpower----\" isn't limited-- by proximity-- to- a machine--."], + *serenity_alive_shared_ship_status(args) + ] + } +end + +def serenity_alive_ship_status_reviewed args + { + background: 'sprites/serenity.png', + fade: 60, + scenes: [ + [*hotspot_bottom, :serenity_alive_time_to_reply] + ], + storylines: [ + [0, 62, 62, 3, "Okay. Reviewing-- everything--, it looks- like- I- can- take- the batteries--- from the Stasis--- Chambers--- and- Engine--- to keep- the crew-- alive-- and-- their-- location--- pinpointed---."], + ] + } +end + +def serenity_alive_time_to_reply args + decision_graph serenity_alive_current_message(args), + "Okay... time to deliver the bad news...", + [:replied_to_serenity_alive_firmly, "Firm-- Reply", serenity_alive_firm_reply], + [:replied_to_serenity_alive_kindly, "Sugar-- Coated---- Reply", serenity_alive_sugarcoated_reply] +end + +def serenity_alive_shared_ship_status args + [ + *ship_control_hotspot( 0, 50, + "Stasis-- Chambers--: Online, All chambers-- are powered. Battery--- Allocation---: 3--- of-- 3--, Hmmm. They don't-- need this to be powered-- right- now. Everyone-- is awake.", + nil, + nil, + nil), + *ship_control_hotspot(12, 35, + "Life- Support--: Offline, Unable--- to- Sustain-- Life. Battery--- Allocation---: 0--- of-- 3---, Okay. That is definitely---- not a good thing.", + nil, + nil, + nil), + *ship_control_hotspot(24, 20, + "Navigation: Offline, Unable--- to- Calculate--- Location. Battery--- Allocation---: 0--- of-- 3---, Whelp. No wonder-- Sasha-- can't-- get- any-- readings. Their- Navigation--- is completely--- offline.", + nil, + nil, + nil), + *ship_control_hotspot(36, 35, + "COMM: Underpowered----, Limited--- to- Text-- Based-- COMM. Battery--- Allocation---: 1--- of-- 3---, It's-- lucky- that- their- COMM---- system was able to survive-- twenty-- years--. Just- barely-- it seems.", + nil, + nil, + nil), + *ship_control_hotspot(48, 50, + "Engine: Online, Full- Control-- Available. Battery--- Allocation---: 3--- of-- 3---, Hmmm. No point of having an engine-- online--, if you don't- know- where you're-- going.", + nil, + nil, + nil) + ] +end + +def serenity_alive_firm_reply + "Serenity, you are at a distance-- farther-- than- Neptune. All- of the ship's-- systems-- are failing. Please- move the batteries---- from- the Stasis-- Chambers-- over- to- Life-- Support--. I also-- need- you to move-- the batteries---- from- the Engines--- to your Navigation---- System." +end + +def serenity_alive_sugarcoated_reply + "So... you- are- a teeny--- tiny--- bit--- farther-- from Earth- than you think. And you have a teeny--- tiny--- problem-- with your ship. Please-- move the batteries--- from the Stasis--- Chambers--- over to Life--- Support---. I also need you to move the batteries--- from the Engines--- to your- Navigation--- System. Don't-- worry-- Sasha. I'll-- get y'all-- home." +end + +def replied_to_serenity_alive_firmly args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_alive_path_from_observatory] + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_firm_reply.quote}"], + *serenity_alive_reply_completed_shared_hotspots(args), + ] + } +end + +def replied_to_serenity_alive_kindly args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_alive_path_from_observatory] + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: #{serenity_alive_sugarcoated_reply.quote}"], + *serenity_alive_reply_completed_shared_hotspots(args), + ] + } +end + +def serenity_alive_path_from_observatory args + { + fade: 60, + background: 'sprites/path-to-observatory.png', + player: [4, 21], + scenes: [ + [*hotspot_bottom_right, :serenity_bio_infront_of_home] + ], + storylines: [ + [22, 20, 10, 10, "I'm not sure what's-- worse. Waiting-- for Sasha's-- reply. Or jumping-- off- from- right- here."] + ] + } +end + +def serenity_alive_reply_completed_shared_hotspots args + [ + [30, 10, 5, 4, "I guess it wasn't-- a joke- after-- all."], + [40, 10, 5, 4, "I barely-- remember--- the- history----- of the crew."], + [50, 10, 5, 4, "It probably--- wouldn't-- hurt- to- refresh-- my memory--."] + ] +end + +def serenity_alive_last_reply args + if args.state.scene_history.include? :replied_to_introduction_seriously + return "Buffer--: \"Hello, Who- is sending-- this message--?\"" + else + return "Buffer--: \"New- phone. Who dis?\"" + end +end + +def serenity_alive_current_message args + if args.state.scene_history.include? :replied_to_introduction_seriously + "This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Please advise.".quote + else + "LOL! Thanks for the laugh. I needed that. This- is Sasha. The Serenity--- crew-- is out of hibernation---- and ready-- for Earth reentry--. But, it seems like we are having-- trouble-- with our Navigation---- systems. Can you help me out- babe?".quote + end +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_serenity_bio.rb b/samples/99_sample_game_return_of_serenity/app/storyline_serenity_bio.rb new file mode 100644 index 0000000..587f5f4 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_serenity_bio.rb @@ -0,0 +1,151 @@ +def serenity_bio_infront_of_home args + { + fade: 60, + background: 'sprites/front-of-home.png', + player: [54, 23], + scenes: [ + [44, 34, 8, 14, :serenity_bio_inside_home], + [0, 3, 3, 22, :serenity_bio_library] + ] + } +end + +def serenity_bio_inside_home args + { + background: 'sprites/inside-home.png', + player: [34, 4], + storylines: [ + [34, 4, 4, 4, "I'm--- completely--- exhausted."], + ], + scenes: [ + [30, 38, 12, 13, :serenity_bio_restless_sleep], + [32, 0, 8, 3, :serenity_bio_infront_of_home], + ] + } +end + +def serenity_bio_restless_sleep args + { + fade: 60, + background: 'sprites/inside-home.png', + storylines: [ + [32, 38, 10, 13, "I can't-- seem to sleep. I know nothing-- about the- crew-. Maybe- I- should- go read- up- on- them."], + ], + scenes: [ + [32, 0, 8, 3, :serenity_bio_infront_of_home], + ] + } +end + +def serenity_bio_library args + { + background: 'sprites/library.png', + fade: 60, + player: [30, 7], + scenes: [ + [21, 35, 3, 18, :serenity_bio_book] + ] + } +end + +def serenity_bio_book args + { + background: 'sprites/book.png', + fade: 60, + player: [6, 52], + storylines: [ + [ 4, 50, 56, 4, "The Title-- Reads: Never-- Forget-- Mission-- Serenity---"], + + [ 4, 38, 8, 8, "Name: Matthew--- R. Sex: Male--- Age-- at-- Departure: 36-----"], + [14, 38, 46, 8, "Tribute-- Text: Matthew graduated-- Magna-- Cum-- Laude-- from MIT--- with-- a- PHD---- in Aero-- Nautical--- Engineering. He was immensely--- competitive, and had an insatiable---- thirst- for aerial-- battle. From the age of twenty, he remained-- undefeated--- in the Israeli-- Air- Force- \"Blue Flag\" combat-- exercises. By the age of 29--- he had already-- risen through- the ranks, and became-- the Lieutenant--- General--- of Lufwaffe. Matthew-- volenteered-- to- pilot-- Mission-- Serenity. To- this day, his wife- and son- are pillars-- of strength- for us. Rest- in Peace- Matthew, we are sorry-- that- news of the pregancy-- never-- reached- you. Please forgive us."], + + [4, 26, 8, 8, "Name: Aanka--- P. Sex: Female--- Age-- at-- Departure: 9-----"], + [14, 26, 46, 8, "Tribute-- Text: Aanka--- gratuated--- Magna-- Cum- Laude-- from MIT, at- the- age- of eight, with a- PHD---- in Astro-- Physics. Her-- IQ--- was over 390, the highest-- ever- recorded--- IQ-- in- human-- history. She changed- the landscape-- of Physics-- with her efforts- in- unravelling--- the mysteries--- of- Dark- Matter--. Anka discovered-- the threat- of Halley's-- Comet-- collision--- with Earth. She spear headed-- the global-- effort-- for Misson-- Serenity. Her- multilingual--- address-- to- the world-- brought- us all hope."], + + [4, 14, 8, 8, "Name: Sasha--- N. Sex: Female--- Age-- at-- Departure: 29-----"], + [14, 14, 46, 8, "Tribute-- Text: Sasha gratuated-- Magna-- Cum- Laude-- from MIT--- with-- a- PHD---- in Computer---- Science----. She-- was-- brilliant--, strong- willed--, and-- a-- stunningly--- beautiful--- woman---. Sasha---- is- the- creator--- of the world's--- first- Ruby--- Quantum-- Machine---. After-- much- critical--- acclaim--, the Quantum-- Computer-- was placed in MIT's---- Museam-- next- to- Richard--- G. and Thomas--- K.'s---- Lisp-- Machine---. Her- engineering--- skills-- were-- paramount--- for Mission--- Serenity's--- success. Humanity-- misses-- you-- dearly,-- Sasha--. Life-- shines-- a dimmer-- light-- now- that- your- angelic- voice-- can never- be heard- again."], + ], + scenes: [ + [*hotspot_bottom, :serenity_bio_finally_to_bed] + ] + } +end + +def serenity_bio_finally_to_bed args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [35, 3], + storylines: [ + [34, 4, 4, 4, "Maybe-- I'll-- be able-- to sleep- now..."], + ], + scenes: [ + [32, 38, 10, 13, :bad_dream], + ] + } +end + +def bad_dream args + { + fade: 120, + background: 'sprites/inside-home.png', + player: [34, 35], + storylines: [ + [34, 34, 4, 4, "Man. I did not- sleep- well- at all..."], + ], + scenes: [ + [32, -1, 8, 3, :bad_dream_observatory] + ] + } +end + +def bad_dream_observatory args + { + background: 'sprites/inside-observatory.png', + fade: 120, + player: [51, 12], + storylines: [ + [50, 10, 4, 4, "Breathe, Hiro. Just see what's there... everything--- will- be okay."] + ], + scenes: [ + [30, 18, 5, 12, :bad_dream_inside_mainframe] + ], + render_override: :blinking_light_inside_observatory_render + } +end + +def bad_dream_inside_mainframe args + { + player: [32, 4], + background: 'sprites/mainframe.png', + fade: 120, + storylines: [ + [22, 45, 17, 4, (bad_dream_last_reply args)], + ], + scenes: [ + [45, 45, 4, 4, :bad_dream_everyone_dead], + ] + } +end + +def bad_dream_everyone_dead args + { + background: 'sprites/mainframe.png', + storylines: [ + [22, 45, 17, 4, (bad_dream_last_reply args)], + [45, 45, 4, 4, "Hi-- Hiro. This is Sasha. By the time- you get this- message, chances-- are we will- already-- be- dead. The batteries--- got- damaged-- during-- removal. And- we don't-- have enough-- power-- for Life-- Support. The air-- is- already--- starting-- to taste- bad. It... would- have been- nice... to go- on a date--- with- you-- when-- I- got- back- to Earth. Anyways, good-- bye-- Hiro-- XOXOXO----"], + [22, 5, 17, 4, "Meh. Whatever, I didn't-- want to save them anyways. What- a pain- in my ass."], + ], + scenes: [ + [*hotspot_bottom, :anka_inside_room] + ] + } +end + +def bad_dream_last_reply args + if args.state.scene_history.include? :replied_to_serenity_alive_firmly + return "Buffer--: #{serenity_alive_firm_reply.quote}" + else + return "Buffer--: #{serenity_alive_sugarcoated_reply.quote}" + end +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_serenity_introduction.rb b/samples/99_sample_game_return_of_serenity/app/storyline_serenity_introduction.rb new file mode 100644 index 0000000..d1a5a50 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_serenity_introduction.rb @@ -0,0 +1,95 @@ +# decision_graph "Message from Sasha", +# "I should reply.", +# [:replied_to_introduction_seriously, "Reply Seriously", "Who is this?"], +# [:replied_to_introduction_humorously, "Reply Humorously", "New phone who dis?"] +def reply_to_introduction args + decision_graph "\"Mission-- control--, your- main- comm-- channels-- seem-- to be down. My apologies-- for- using-- this low- level-- exploit--. What's-- going-- on down there? We are ready-- for reentry--.\" Message--- Timestamp---: 4- hours-- 23--- minutes-- ago--.", + "Whoever-- pulled- off this exploit-- knows their stuff. I should reply--.", + [:replied_to_introduction_seriously, "Serious Reply", "Hello, Who- is sending-- this message--?"], + [:replied_to_introduction_humorously, "Humorous Reply", "New phone, who dis?"] +end + +def replied_to_introduction_seriously args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + *replied_to_introduction_shared_scenes(args) + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: \"Hello, Who- is sending-- this message--?\""], + *replied_to_introduction_shared_storylines(args) + ] + } +end + +def replied_to_introduction_humorously args + { + background: 'sprites/inside-observatory.png', + fade: 60, + player: [32, 21], + scenes: [ + *replied_to_introduction_shared_scenes(args) + ], + storylines: [ + [30, 18, 5, 12, "Buffer-- has been set to: \"New- phone. Who dis?\""], + *replied_to_introduction_shared_storylines(args) + ] + } +end + +def replied_to_introduction_shared_storylines args + [ + [30, 10, 5, 4, "It's-- going-- to take a while-- for this reply-- to make it's-- way back."], + [40, 10, 5, 4, "4- hours-- to send a message-- at light speed?! How far away-- is the sender--?"], + [50, 10, 5, 4, "I know- I've-- read about-- light- speed- travel-- before--. Maybe-- the library--- still has that- poster."] + ] +end + +def replied_to_introduction_shared_scenes args + [[60, 0, 4, 32, :replied_to_introduction_observatory]] +end + +def replied_to_introduction_observatory args + { + background: 'sprites/observatory.png', + player: [28, 39], + scenes: [ + [60, 0, 4, 32, :replied_to_introduction_path_to_observatory] + ] + } +end + +def replied_to_introduction_path_to_observatory args + { + background: 'sprites/path-to-observatory.png', + player: [0, 26], + scenes: [ + [60, 0, 4, 20, :replied_to_introduction_mountain_pass] + ], + } +end + +def replied_to_introduction_mountain_pass args + { + background: 'sprites/mountain-pass-zoomed-out.png', + player: [21, 48], + scenes: [ + [0, 0, 15, 4, :replied_to_introduction_side_of_home] + ], + storylines: [ + [15, 28, 5, 3, "At least I'm-- getting-- my- exercise-- in- for- today--."] + ] + } +end + +def replied_to_introduction_side_of_home args + { + background: 'sprites/side-of-home.png', + player: [58, 29], + scenes: [ + [2, 0, 61, 2, :speed_of_light_front_of_home] + ], + } +end diff --git a/samples/99_sample_game_return_of_serenity/app/storyline_speed_of_light.rb b/samples/99_sample_game_return_of_serenity/app/storyline_speed_of_light.rb new file mode 100644 index 0000000..fdd6b47 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/app/storyline_speed_of_light.rb @@ -0,0 +1,104 @@ +def speed_of_light_front_of_home args + { + background: 'sprites/front-of-home.png', + player: [54, 23], + scenes: [ + [44, 34, 8, 14, :speed_of_light_inside_home], + [0, 3, 3, 22, :speed_of_light_outside_library] + ] + } +end + +def speed_of_light_inside_home args + { + background: 'sprites/inside-home.png', + player: [35, 4], + storylines: [ + [30, 38, 12, 13, "Can't- sleep right now. I have to- find- out- why- it took- over-- 4- hours-- to receive-- that message."] + ], + scenes: [ + [32, 0, 8, 3, :speed_of_light_front_of_home], + ] + } +end + +def speed_of_light_outside_library args + { + background: 'sprites/outside-library.png', + player: [55, 19], + scenes: [ + [49, 39, 6, 10, :speed_of_light_library], + [61, 11, 3, 20, :speed_of_light_front_of_home] + ] + } +end + +def speed_of_light_library args + { + background: 'sprites/library.png', + player: [30, 7], + scenes: [ + [3, 50, 10, 3, :speed_of_light_celestial_bodies_diagram] + ] + } +end + +def speed_of_light_celestial_bodies_diagram args + { + background: 'sprites/planets.png', + fade: 60, + player: [30, 3], + scenes: [ + [56 - 2, 10, 5, 5, :speed_of_light_distance_discovered] + ], + storylines: [ + [30, 2, 4, 4, "Here- it is! This is a diagram--- of the solar-- system--. It was printed-- over-- fifty-- years- ago. Geez-- that's-- old."], + + [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], + [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], + [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], + [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], + [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], + [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], + [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], + [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], + # [56 - 2, 15, 4, 4, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--."], + [63 - 2, 10, 5, 5, "The label- reads: Pluto. Wait. WTF? Pluto-- isn't-- a planet."], + ] + } +end + +def speed_of_light_distance_discovered args + { + background: 'sprites/planets.png', + scenes: [ + [13, 0, 44, 3, :speed_of_light_end_of_day] + ], + storylines: [ + [ 0 - 2, 10, 5, 5, "The label- reads: Sun. The length- of the Astronomical-------- Unit-- (AU), is the distance-- from the Sun- to the Earth. Which is about 150--- million--- kilometers----."], + [ 7 - 2, 10, 5, 5, "The label- reads: Mercury. Distance from Sun: 0.39AU------------ or- 3----- light-- minutes--."], + [14 - 2, 10, 5, 5, "The label- reads: Venus. Distance from Sun: 0.72AU------------ or- 6----- light-- minutes--."], + [21 - 2, 10, 5, 5, "The label- reads: Earth. Distance from Sun: 1.00AU------------ or- 8----- light-- minutes--."], + [28 - 2, 10, 5, 5, "The label- reads: Mars. Distance from Sun: 1.52AU------------ or- 12----- light-- minutes--."], + [35 - 2, 10, 5, 5, "The label- reads: Jupiter. Distance from Sun: 5.20AU------------ or- 45----- light-- minutes--."], + [42 - 2, 10, 5, 5, "The label- reads: Saturn. Distance from Sun: 9.53AU------------ or- 79----- light-- minutes--."], + [49 - 2, 10, 5, 5, "The label- reads: Uranus. Distance from Sun: 19.81AU------------ or- 159----- light-- minutes--."], + [56 - 2, 10, 5, 5, "The label- reads: Neptune. Distance from Sun: 30.05AU------------ or- 4.1----- light-- hours--. What?! The message--- I received-- was from a source-- farther-- than-- Neptune?!"], + [63 - 2, 10, 5, 5, "The label- reads: Pluto. Dista- Wait... Pluto-- isn't-- a planet. People-- thought- Pluto-- was a planet-- back- then?--"], + ] + } +end + +def speed_of_light_end_of_day args + { + fade: 60, + background: 'sprites/inside-home.png', + player: [35, 0], + storylines: [ + [35, 10, 4, 4, "Wonder-- what the reply-- will be. Who- the hell is contacting--- me from beyond-- Neptune? This- has to be some- kind- of- joke."] + ], + scenes: [ + [31, 38, 10, 12, :serenity_alive_side_of_home] + ] + } +end diff --git a/samples/99_sample_game_return_of_serenity/fonts/dragonruby-gtk-4x4.ttf b/samples/99_sample_game_return_of_serenity/fonts/dragonruby-gtk-4x4.ttf Binary files differnew file mode 100644 index 0000000..24cc711 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/fonts/dragonruby-gtk-4x4.ttf diff --git a/samples/99_sample_game_return_of_serenity/fonts/manaspc.ttf b/samples/99_sample_game_return_of_serenity/fonts/manaspc.ttf Binary files differnew file mode 100644 index 0000000..0c56733 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/fonts/manaspc.ttf diff --git a/samples/99_sample_game_return_of_serenity/license-for-sample.txt b/samples/99_sample_game_return_of_serenity/license-for-sample.txt new file mode 100644 index 0000000..b1005ed --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC, Amir Rajan + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_game_return_of_serenity/replay.txt b/samples/99_sample_game_return_of_serenity/replay.txt new file mode 100644 index 0000000..428883e --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/replay.txt @@ -0,0 +1,793 @@ +replay_version 2.0 +stopped_at 2284 +seed 100 +recorded_at Sun Sep 29 23:33:07 2019 +[:mouse_move, 758, 597, 2, 1, 353] +[:mouse_move, 556, 669, 2, 2, 353] +[:mouse_move, 550, 669, 2, 3, 353] +[:mouse_move, 543, 670, 2, 4, 357] +[:mouse_move, 540, 670, 2, 5, 358] +[:mouse_move, 536, 670, 2, 6, 359] +[:mouse_move, 535, 670, 2, 7, 360] +[:mouse_move, 534, 669, 2, 8, 361] +[:mouse_move, 533, 668, 2, 9, 362] +[:mouse_move, 534, 667, 2, 10, 364] +[:mouse_move, 539, 666, 2, 11, 365] +[:mouse_move, 564, 665, 2, 12, 366] +[:mouse_move, 580, 665, 2, 13, 367] +[:mouse_move, 598, 665, 2, 14, 368] +[:mouse_move, 611, 666, 2, 15, 369] +[:mouse_move, 623, 668, 2, 16, 370] +[:mouse_move, 629, 669, 2, 17, 371] +[:mouse_move, 637, 672, 2, 18, 372] +[:mouse_move, 638, 673, 2, 19, 373] +[:mouse_move, 642, 677, 2, 20, 374] +[:mouse_move, 645, 680, 2, 21, 375] +[:mouse_move, 655, 686, 2, 22, 376] +[:mouse_move, 664, 690, 2, 23, 377] +[:mouse_move, 686, 694, 2, 24, 378] +[:mouse_move, 699, 696, 2, 25, 379] +[:mouse_move, 717, 697, 2, 26, 380] +[:mouse_move, 728, 698, 2, 27, 381] +[:mouse_move, 745, 698, 2, 28, 382] +[:mouse_move, 748, 698, 2, 29, 383] +[:mouse_move, 757, 698, 2, 30, 384] +[:mouse_move, 761, 698, 2, 31, 385] +[:mouse_move, 766, 698, 2, 32, 386] +[:mouse_move, 769, 698, 2, 33, 387] +[:mouse_move, 771, 699, 2, 34, 388] +[:mouse_move, 773, 699, 2, 35, 389] +[:mouse_move, 774, 699, 2, 36, 390] +[:mouse_move, 775, 699, 2, 37, 391] +[:mouse_move, 768, 699, 2, 38, 393] +[:mouse_move, 762, 698, 2, 39, 394] +[:mouse_move, 748, 695, 2, 40, 395] +[:mouse_move, 733, 693, 2, 41, 396] +[:mouse_move, 712, 689, 2, 42, 397] +[:mouse_move, 700, 688, 2, 43, 398] +[:mouse_move, 675, 685, 2, 44, 399] +[:mouse_move, 661, 684, 2, 45, 400] +[:mouse_move, 631, 684, 2, 46, 401] +[:mouse_move, 615, 684, 2, 47, 402] +[:mouse_move, 595, 685, 2, 48, 403] +[:mouse_move, 582, 685, 2, 49, 404] +[:mouse_move, 564, 687, 2, 50, 405] +[:mouse_move, 558, 688, 2, 51, 406] +[:mouse_move, 551, 689, 2, 52, 407] +[:mouse_move, 547, 689, 2, 53, 408] +[:mouse_move, 543, 690, 2, 54, 409] +[:mouse_move, 541, 690, 2, 55, 410] +[:mouse_move, 540, 690, 2, 56, 411] +[:mouse_move, 539, 690, 2, 57, 412] +[:mouse_move, 547, 691, 2, 58, 416] +[:mouse_move, 559, 692, 2, 59, 417] +[:mouse_move, 592, 697, 2, 60, 418] +[:mouse_move, 613, 698, 2, 61, 419] +[:mouse_move, 645, 701, 2, 62, 420] +[:mouse_move, 664, 701, 2, 63, 421] +[:mouse_move, 687, 702, 2, 64, 422] +[:mouse_move, 700, 702, 2, 65, 423] +[:mouse_move, 717, 702, 2, 66, 424] +[:mouse_move, 720, 702, 2, 67, 425] +[:mouse_move, 728, 702, 2, 68, 426] +[:mouse_move, 731, 702, 2, 69, 427] +[:mouse_move, 735, 702, 2, 70, 428] +[:mouse_move, 736, 702, 2, 71, 429] +[:mouse_move, 737, 702, 2, 72, 430] +[:mouse_move, 735, 702, 2, 73, 432] +[:mouse_move, 730, 702, 2, 74, 433] +[:mouse_move, 716, 702, 2, 75, 434] +[:mouse_move, 707, 701, 2, 76, 435] +[:mouse_move, 684, 700, 2, 77, 436] +[:mouse_move, 672, 699, 2, 78, 437] +[:mouse_move, 645, 698, 2, 79, 438] +[:mouse_move, 640, 698, 2, 80, 439] +[:mouse_move, 619, 698, 2, 81, 440] +[:mouse_move, 609, 698, 2, 82, 441] +[:mouse_move, 603, 698, 2, 83, 442] +[:mouse_move, 595, 698, 2, 84, 443] +[:mouse_move, 591, 698, 2, 85, 444] +[:mouse_move, 586, 699, 2, 86, 445] +[:mouse_move, 585, 699, 2, 87, 446] +[:mouse_move, 583, 699, 2, 88, 447] +[:mouse_move, 587, 699, 2, 89, 451] +[:mouse_move, 593, 699, 2, 90, 452] +[:mouse_move, 608, 700, 2, 91, 453] +[:mouse_move, 618, 700, 2, 92, 454] +[:mouse_move, 643, 700, 2, 93, 455] +[:mouse_move, 655, 700, 2, 94, 456] +[:mouse_move, 671, 700, 2, 95, 457] +[:mouse_move, 681, 700, 2, 96, 458] +[:mouse_move, 692, 700, 2, 97, 459] +[:mouse_move, 698, 700, 2, 98, 460] +[:mouse_move, 705, 700, 2, 99, 461] +[:mouse_move, 706, 700, 2, 100, 462] +[:mouse_move, 708, 700, 2, 101, 463] +[:mouse_move, 709, 700, 2, 102, 464] +[:mouse_move, 708, 700, 2, 103, 465] +[:mouse_move, 703, 700, 2, 104, 466] +[:mouse_move, 689, 700, 2, 105, 467] +[:mouse_move, 680, 700, 2, 106, 468] +[:mouse_move, 670, 700, 2, 107, 469] +[:mouse_move, 644, 700, 2, 108, 470] +[:mouse_move, 631, 700, 2, 109, 471] +[:mouse_move, 612, 700, 2, 110, 472] +[:mouse_move, 600, 700, 2, 111, 473] +[:mouse_move, 582, 700, 2, 112, 474] +[:mouse_move, 579, 700, 2, 113, 475] +[:mouse_move, 570, 700, 2, 114, 476] +[:mouse_move, 567, 700, 2, 115, 477] +[:mouse_move, 564, 700, 2, 116, 478] +[:mouse_move, 563, 700, 2, 117, 479] +[:mouse_move, 562, 700, 2, 118, 480] +[:mouse_move, 563, 700, 2, 119, 482] +[:mouse_move, 568, 701, 2, 120, 483] +[:mouse_move, 584, 702, 2, 121, 484] +[:mouse_move, 606, 703, 2, 122, 485] +[:mouse_move, 632, 704, 2, 123, 486] +[:mouse_move, 649, 705, 2, 124, 487] +[:mouse_move, 669, 706, 2, 125, 488] +[:mouse_move, 673, 706, 2, 126, 489] +[:mouse_move, 689, 706, 2, 127, 490] +[:mouse_move, 694, 706, 2, 128, 491] +[:mouse_move, 698, 706, 2, 129, 492] +[:mouse_move, 693, 706, 2, 130, 495] +[:mouse_move, 685, 706, 2, 131, 496] +[:mouse_move, 663, 705, 2, 132, 497] +[:mouse_move, 649, 704, 2, 133, 498] +[:mouse_move, 620, 703, 2, 134, 499] +[:mouse_move, 614, 703, 2, 135, 500] +[:mouse_move, 601, 703, 2, 136, 501] +[:mouse_move, 595, 703, 2, 137, 502] +[:mouse_move, 589, 703, 2, 138, 503] +[:mouse_move, 587, 703, 2, 139, 504] +[:mouse_move, 586, 704, 2, 140, 505] +[:mouse_move, 591, 704, 2, 141, 507] +[:mouse_move, 597, 704, 2, 142, 508] +[:mouse_move, 613, 705, 2, 143, 509] +[:mouse_move, 618, 705, 2, 144, 510] +[:mouse_move, 633, 705, 2, 145, 511] +[:mouse_move, 641, 705, 2, 146, 512] +[:mouse_move, 648, 705, 2, 147, 513] +[:mouse_move, 651, 705, 2, 148, 514] +[:mouse_move, 654, 705, 2, 149, 515] +[:mouse_move, 655, 705, 2, 150, 516] +[:mouse_move, 657, 705, 2, 151, 517] +[:mouse_move, 658, 705, 2, 152, 565] +[:mouse_move, 651, 701, 2, 153, 611] +[:mouse_move, 645, 699, 2, 154, 612] +[:mouse_move, 625, 692, 2, 155, 613] +[:mouse_move, 611, 689, 2, 156, 614] +[:mouse_move, 590, 687, 2, 157, 615] +[:mouse_move, 578, 687, 2, 158, 616] +[:mouse_move, 564, 687, 2, 159, 617] +[:mouse_move, 559, 687, 2, 160, 618] +[:mouse_move, 553, 687, 2, 161, 619] +[:mouse_move, 551, 687, 2, 162, 620] +[:mouse_move, 550, 687, 2, 163, 621] +[:mouse_move, 553, 688, 2, 164, 623] +[:mouse_move, 558, 690, 2, 165, 624] +[:mouse_move, 578, 694, 2, 166, 625] +[:mouse_move, 591, 696, 2, 167, 626] +[:mouse_move, 634, 703, 2, 168, 627] +[:mouse_move, 645, 704, 2, 169, 628] +[:mouse_move, 682, 708, 2, 170, 629] +[:mouse_move, 698, 709, 2, 171, 630] +[:mouse_move, 704, 710, 2, 172, 631] +[:mouse_move, 720, 710, 2, 173, 632] +[:mouse_move, 726, 710, 2, 174, 633] +[:mouse_move, 732, 710, 2, 175, 634] +[:mouse_move, 733, 710, 2, 176, 635] +[:mouse_move, 729, 710, 2, 177, 637] +[:mouse_move, 716, 710, 2, 178, 638] +[:mouse_move, 711, 710, 2, 179, 639] +[:mouse_move, 693, 710, 2, 180, 640] +[:mouse_move, 684, 710, 2, 181, 641] +[:mouse_move, 669, 710, 2, 182, 642] +[:mouse_move, 663, 709, 2, 183, 643] +[:mouse_move, 652, 708, 2, 184, 644] +[:mouse_move, 650, 707, 2, 185, 645] +[:mouse_move, 644, 705, 2, 186, 646] +[:mouse_move, 641, 705, 2, 187, 647] +[:mouse_move, 638, 703, 2, 188, 648] +[:mouse_move, 636, 702, 2, 189, 649] +[:mouse_move, 631, 699, 2, 190, 650] +[:mouse_move, 628, 696, 2, 191, 651] +[:mouse_move, 622, 690, 2, 192, 652] +[:mouse_move, 619, 686, 2, 193, 653] +[:mouse_move, 613, 675, 2, 194, 654] +[:mouse_move, 610, 669, 2, 195, 655] +[:mouse_move, 601, 656, 2, 196, 656] +[:mouse_move, 597, 650, 2, 197, 657] +[:mouse_move, 592, 644, 2, 198, 658] +[:mouse_move, 583, 634, 2, 199, 659] +[:mouse_move, 582, 632, 2, 200, 660] +[:mouse_move, 575, 626, 2, 201, 661] +[:mouse_move, 573, 624, 2, 202, 662] +[:mouse_move, 566, 619, 2, 203, 663] +[:mouse_move, 564, 617, 2, 204, 664] +[:mouse_move, 558, 612, 2, 205, 665] +[:mouse_move, 554, 609, 2, 206, 666] +[:mouse_move, 545, 601, 2, 207, 667] +[:mouse_move, 540, 596, 2, 208, 668] +[:mouse_move, 532, 588, 2, 209, 669] +[:mouse_move, 527, 584, 2, 210, 670] +[:mouse_move, 522, 579, 2, 211, 671] +[:mouse_move, 518, 576, 2, 212, 672] +[:mouse_move, 514, 571, 2, 213, 673] +[:mouse_move, 512, 570, 2, 214, 674] +[:mouse_move, 508, 568, 2, 215, 675] +[:mouse_move, 507, 567, 2, 216, 677] +[:mouse_move, 506, 567, 2, 217, 678] +[:mouse_move, 506, 568, 2, 218, 679] +[:mouse_move, 506, 570, 2, 219, 680] +[:mouse_move, 510, 580, 2, 220, 681] +[:mouse_move, 514, 586, 2, 221, 682] +[:mouse_move, 523, 596, 2, 222, 683] +[:mouse_move, 526, 597, 2, 223, 684] +[:mouse_move, 533, 602, 2, 224, 685] +[:mouse_move, 536, 603, 2, 225, 686] +[:mouse_move, 537, 604, 2, 226, 687] +[:mouse_move, 541, 603, 2, 227, 688] +[:mouse_move, 542, 601, 2, 228, 689] +[:mouse_move, 546, 594, 2, 229, 690] +[:mouse_move, 548, 590, 2, 230, 691] +[:mouse_move, 551, 580, 2, 231, 692] +[:mouse_move, 552, 575, 2, 232, 693] +[:mouse_move, 554, 568, 2, 233, 694] +[:mouse_move, 555, 563, 2, 234, 695] +[:mouse_move, 556, 556, 2, 235, 696] +[:mouse_move, 556, 552, 2, 236, 697] +[:mouse_move, 556, 548, 2, 237, 698] +[:mouse_move, 555, 545, 2, 238, 699] +[:mouse_move, 550, 541, 2, 239, 700] +[:mouse_move, 547, 539, 2, 240, 701] +[:mouse_move, 539, 536, 2, 241, 702] +[:mouse_move, 536, 535, 2, 242, 703] +[:mouse_move, 527, 534, 2, 243, 704] +[:mouse_move, 525, 534, 2, 244, 705] +[:mouse_move, 518, 534, 2, 245, 706] +[:mouse_move, 516, 534, 2, 246, 707] +[:mouse_move, 511, 536, 2, 247, 708] +[:mouse_move, 509, 537, 2, 248, 709] +[:mouse_move, 506, 540, 2, 249, 710] +[:mouse_move, 505, 542, 2, 250, 711] +[:mouse_move, 503, 545, 2, 251, 712] +[:mouse_move, 503, 551, 2, 252, 713] +[:mouse_move, 503, 554, 2, 253, 714] +[:mouse_move, 503, 565, 2, 254, 715] +[:mouse_move, 504, 570, 2, 255, 716] +[:mouse_move, 511, 582, 2, 256, 717] +[:mouse_move, 515, 586, 2, 257, 718] +[:mouse_move, 521, 591, 2, 258, 719] +[:mouse_move, 524, 593, 2, 259, 720] +[:mouse_move, 530, 594, 2, 260, 721] +[:mouse_move, 535, 594, 2, 261, 722] +[:mouse_move, 538, 592, 2, 262, 723] +[:mouse_move, 540, 589, 2, 263, 724] +[:mouse_move, 542, 583, 2, 264, 725] +[:mouse_move, 543, 579, 2, 265, 726] +[:mouse_move, 543, 574, 2, 266, 727] +[:mouse_move, 543, 571, 2, 267, 728] +[:mouse_move, 543, 568, 2, 268, 729] +[:mouse_move, 543, 567, 2, 269, 730] +[:mouse_move, 543, 566, 2, 270, 731] +[:mouse_move, 544, 566, 2, 271, 749] +[:mouse_move, 547, 565, 2, 272, 750] +[:mouse_move, 548, 565, 2, 273, 751] +[:mouse_move, 550, 564, 2, 274, 752] +[:mouse_move, 551, 564, 2, 275, 753] +[:mouse_move, 552, 563, 2, 276, 754] +[:mouse_move, 553, 562, 2, 277, 755] +[:mouse_move, 552, 562, 2, 278, 761] +[:mouse_move, 552, 564, 2, 279, 762] +[:mouse_move, 552, 565, 2, 280, 763] +[:mouse_move, 552, 569, 2, 281, 764] +[:mouse_move, 552, 572, 2, 282, 765] +[:mouse_move, 556, 581, 2, 283, 766] +[:mouse_move, 559, 586, 2, 284, 767] +[:mouse_move, 563, 592, 2, 285, 768] +[:mouse_move, 574, 601, 2, 286, 769] +[:mouse_move, 580, 605, 2, 287, 770] +[:mouse_move, 591, 610, 2, 288, 771] +[:mouse_move, 597, 611, 2, 289, 772] +[:mouse_move, 607, 611, 2, 290, 773] +[:mouse_move, 611, 609, 2, 291, 774] +[:mouse_move, 617, 599, 2, 292, 775] +[:mouse_move, 619, 593, 2, 293, 776] +[:mouse_move, 619, 579, 2, 294, 777] +[:mouse_move, 619, 572, 2, 295, 778] +[:mouse_move, 615, 560, 2, 296, 779] +[:mouse_move, 612, 556, 2, 297, 780] +[:mouse_move, 604, 548, 2, 298, 781] +[:mouse_move, 602, 547, 2, 299, 782] +[:mouse_move, 597, 543, 2, 300, 783] +[:mouse_move, 592, 541, 2, 301, 784] +[:mouse_move, 586, 539, 2, 302, 785] +[:mouse_move, 583, 539, 2, 303, 786] +[:mouse_move, 576, 539, 2, 304, 787] +[:mouse_move, 574, 539, 2, 305, 788] +[:mouse_move, 569, 539, 2, 306, 789] +[:mouse_move, 567, 539, 2, 307, 790] +[:mouse_move, 564, 540, 2, 308, 791] +[:mouse_move, 563, 540, 2, 309, 792] +[:mouse_move, 560, 543, 2, 310, 793] +[:mouse_move, 559, 546, 2, 311, 794] +[:mouse_move, 559, 549, 2, 312, 795] +[:mouse_move, 559, 557, 2, 313, 796] +[:mouse_move, 559, 562, 2, 314, 797] +[:mouse_move, 563, 571, 2, 315, 798] +[:mouse_move, 566, 576, 2, 316, 799] +[:mouse_move, 572, 582, 2, 317, 800] +[:mouse_move, 575, 584, 2, 318, 801] +[:mouse_move, 586, 587, 2, 319, 802] +[:mouse_move, 590, 587, 2, 320, 803] +[:mouse_move, 601, 587, 2, 321, 804] +[:mouse_move, 606, 585, 2, 322, 805] +[:mouse_move, 612, 583, 2, 323, 806] +[:mouse_move, 615, 580, 2, 324, 807] +[:mouse_move, 620, 575, 2, 325, 808] +[:mouse_move, 621, 570, 2, 326, 809] +[:mouse_move, 620, 563, 2, 327, 810] +[:mouse_move, 617, 557, 2, 328, 811] +[:mouse_move, 613, 552, 2, 329, 812] +[:mouse_move, 610, 549, 2, 330, 813] +[:mouse_move, 607, 546, 2, 331, 814] +[:mouse_move, 606, 545, 2, 332, 815] +[:mouse_move, 605, 545, 2, 333, 816] +[:mouse_move, 605, 549, 2, 334, 831] +[:mouse_move, 605, 552, 2, 335, 832] +[:mouse_move, 605, 559, 2, 336, 833] +[:mouse_move, 605, 565, 2, 337, 834] +[:mouse_move, 609, 583, 2, 338, 835] +[:mouse_move, 613, 592, 2, 339, 836] +[:mouse_move, 622, 605, 2, 340, 837] +[:mouse_move, 628, 611, 2, 341, 838] +[:mouse_move, 635, 616, 2, 342, 839] +[:mouse_move, 638, 619, 2, 343, 840] +[:mouse_move, 642, 620, 2, 344, 841] +[:mouse_move, 644, 621, 2, 345, 842] +[:mouse_move, 646, 621, 2, 346, 843] +[:mouse_move, 647, 621, 2, 347, 845] +[:mouse_move, 651, 622, 2, 348, 847] +[:mouse_move, 654, 624, 2, 349, 848] +[:mouse_move, 660, 627, 2, 350, 849] +[:mouse_move, 676, 632, 2, 351, 850] +[:mouse_move, 687, 635, 2, 352, 851] +[:mouse_move, 713, 637, 2, 353, 852] +[:mouse_move, 728, 637, 2, 354, 853] +[:mouse_move, 755, 635, 2, 355, 854] +[:mouse_move, 769, 630, 2, 356, 855] +[:mouse_move, 784, 621, 2, 357, 856] +[:mouse_move, 792, 614, 2, 358, 857] +[:mouse_move, 809, 593, 2, 359, 858] +[:mouse_move, 811, 584, 2, 360, 859] +[:mouse_move, 812, 571, 2, 361, 860] +[:mouse_move, 812, 556, 2, 362, 861] +[:mouse_move, 805, 540, 2, 363, 862] +[:mouse_move, 796, 531, 2, 364, 863] +[:mouse_move, 782, 518, 2, 365, 864] +[:mouse_move, 773, 511, 2, 366, 865] +[:mouse_move, 757, 502, 2, 367, 866] +[:mouse_move, 749, 499, 2, 368, 867] +[:mouse_move, 735, 496, 2, 369, 868] +[:mouse_move, 722, 496, 2, 370, 869] +[:mouse_move, 710, 496, 2, 371, 870] +[:mouse_move, 702, 498, 2, 372, 871] +[:mouse_move, 687, 506, 2, 373, 872] +[:mouse_move, 680, 511, 2, 374, 873] +[:mouse_move, 665, 528, 2, 375, 874] +[:mouse_move, 661, 535, 2, 376, 875] +[:mouse_move, 657, 544, 2, 377, 876] +[:mouse_move, 653, 557, 2, 378, 877] +[:mouse_move, 652, 567, 2, 379, 878] +[:mouse_move, 652, 590, 2, 380, 879] +[:mouse_move, 652, 599, 2, 381, 880] +[:mouse_move, 666, 616, 2, 382, 881] +[:mouse_move, 677, 625, 2, 383, 882] +[:mouse_move, 702, 638, 2, 384, 883] +[:mouse_move, 717, 643, 2, 385, 884] +[:mouse_move, 747, 649, 2, 386, 885] +[:mouse_move, 761, 650, 2, 387, 886] +[:mouse_move, 780, 650, 2, 388, 887] +[:mouse_move, 790, 647, 2, 389, 888] +[:mouse_move, 810, 634, 2, 390, 889] +[:mouse_move, 814, 625, 2, 391, 890] +[:mouse_move, 817, 606, 2, 392, 891] +[:mouse_move, 817, 595, 2, 393, 892] +[:mouse_move, 809, 570, 2, 394, 893] +[:mouse_move, 801, 559, 2, 395, 894] +[:mouse_move, 784, 540, 2, 396, 895] +[:mouse_move, 780, 537, 2, 397, 896] +[:mouse_move, 765, 526, 2, 398, 897] +[:mouse_move, 758, 522, 2, 399, 898] +[:mouse_move, 747, 518, 2, 400, 899] +[:mouse_move, 742, 517, 2, 401, 900] +[:key_down_raw, 1073741905, 0, 2, 402, 940] +[:key_up_raw, 1073741905, 0, 2, 403, 944] +[:key_down_raw, 1073741905, 0, 2, 404, 949] +[:key_up_raw, 1073741905, 0, 2, 405, 954] +[:key_down_raw, 1073741905, 0, 2, 406, 968] +[:key_up_raw, 1073741905, 0, 2, 407, 972] +[:key_down_raw, 1073741903, 0, 2, 408, 974] +[:key_down_raw, 1073741903, 0, 2, 409, 999] +[:key_down_raw, 1073741903, 0, 2, 410, 1001] +[:key_down_raw, 1073741903, 0, 2, 411, 1003] +[:key_down_raw, 1073741903, 0, 2, 412, 1005] +[:key_down_raw, 1073741903, 0, 2, 413, 1007] +[:key_down_raw, 1073741903, 0, 2, 414, 1009] +[:key_down_raw, 1073741903, 0, 2, 415, 1011] +[:key_down_raw, 1073741903, 0, 2, 416, 1013] +[:key_down_raw, 1073741903, 0, 2, 417, 1015] +[:key_down_raw, 1073741903, 0, 2, 418, 1017] +[:key_down_raw, 1073741903, 0, 2, 419, 1019] +[:key_down_raw, 1073741903, 0, 2, 420, 1021] +[:key_down_raw, 1073741903, 0, 2, 421, 1023] +[:key_down_raw, 1073741903, 0, 2, 422, 1025] +[:key_down_raw, 1073741903, 0, 2, 423, 1027] +[:key_down_raw, 1073741903, 0, 2, 424, 1029] +[:key_down_raw, 1073741903, 0, 2, 425, 1031] +[:key_down_raw, 1073741903, 0, 2, 426, 1033] +[:key_down_raw, 1073741903, 0, 2, 427, 1035] +[:key_down_raw, 1073741903, 0, 2, 428, 1037] +[:key_down_raw, 1073741903, 0, 2, 429, 1039] +[:key_down_raw, 1073741903, 0, 2, 430, 1041] +[:key_down_raw, 1073741903, 0, 2, 431, 1043] +[:key_down_raw, 1073741903, 0, 2, 432, 1045] +[:key_down_raw, 1073741903, 0, 2, 433, 1047] +[:key_up_raw, 1073741903, 0, 2, 434, 1049] +[:key_down_raw, 1073741903, 0, 2, 435, 1069] +[:key_up_raw, 1073741903, 0, 2, 436, 1077] +[:key_down_raw, 1073741903, 0, 2, 437, 1085] +[:key_up_raw, 1073741903, 0, 2, 438, 1089] +[:key_down_raw, 1073741906, 0, 2, 439, 1101] +[:key_up_raw, 1073741906, 0, 2, 440, 1106] +[:mouse_move, 735, 526, 2, 441, 1232] +[:mouse_move, 730, 531, 2, 442, 1233] +[:mouse_move, 721, 540, 2, 443, 1234] +[:mouse_move, 716, 543, 2, 444, 1235] +[:mouse_move, 709, 549, 2, 445, 1236] +[:mouse_move, 705, 551, 2, 446, 1237] +[:mouse_move, 697, 557, 2, 447, 1238] +[:mouse_move, 693, 559, 2, 448, 1239] +[:mouse_move, 677, 571, 2, 449, 1240] +[:mouse_move, 655, 583, 2, 450, 1241] +[:mouse_move, 588, 608, 2, 451, 1242] +[:mouse_move, 577, 612, 2, 452, 1243] +[:mouse_move, 560, 616, 2, 453, 1244] +[:mouse_move, 525, 626, 2, 454, 1245] +[:mouse_move, 495, 634, 2, 455, 1246] +[:mouse_move, 481, 640, 2, 456, 1247] +[:mouse_move, 455, 652, 2, 457, 1248] +[:mouse_move, 433, 664, 2, 458, 1249] +[:mouse_move, 412, 681, 2, 459, 1250] +[:mouse_move, 399, 692, 2, 460, 1251] +[:mouse_move, 372, 713, 2, 461, 1252] +[:mouse_move, 367, 717, 2, 462, 1253] +[:mouse_move, 354, 719, 2, 463, 1254] +[:mouse_move, 440, 719, 2, 464, 1271] +[:mouse_move, 446, 717, 2, 465, 1272] +[:mouse_move, 452, 715, 2, 466, 1272] +[:mouse_move, 457, 713, 2, 467, 1273] +[:mouse_move, 462, 710, 2, 468, 1274] +[:mouse_move, 470, 707, 2, 469, 1275] +[:mouse_move, 473, 705, 2, 470, 1276] +[:mouse_move, 478, 704, 2, 471, 1277] +[:mouse_move, 483, 703, 2, 472, 1278] +[:mouse_move, 489, 702, 2, 473, 1279] +[:mouse_move, 492, 702, 2, 474, 1280] +[:mouse_move, 499, 701, 2, 475, 1281] +[:mouse_move, 503, 701, 2, 476, 1282] +[:mouse_move, 512, 701, 2, 477, 1283] +[:mouse_move, 518, 701, 2, 478, 1284] +[:mouse_move, 523, 701, 2, 479, 1285] +[:mouse_move, 529, 701, 2, 480, 1285] +[:mouse_move, 534, 701, 2, 481, 1286] +[:mouse_move, 539, 701, 2, 482, 1287] +[:mouse_move, 544, 702, 2, 483, 1287] +[:mouse_move, 549, 702, 2, 484, 1288] +[:mouse_move, 554, 702, 2, 485, 1289] +[:mouse_move, 558, 702, 2, 486, 1289] +[:mouse_move, 563, 702, 2, 487, 1290] +[:mouse_move, 568, 702, 2, 488, 1291] +[:mouse_move, 572, 702, 2, 489, 1291] +[:mouse_move, 576, 702, 2, 490, 1292] +[:mouse_move, 581, 702, 2, 491, 1293] +[:mouse_move, 586, 702, 2, 492, 1293] +[:mouse_move, 590, 701, 2, 493, 1294] +[:mouse_move, 595, 701, 2, 494, 1295] +[:mouse_move, 601, 700, 2, 495, 1295] +[:mouse_move, 606, 700, 2, 496, 1296] +[:mouse_move, 612, 699, 2, 497, 1297] +[:mouse_move, 617, 699, 2, 498, 1297] +[:mouse_move, 623, 698, 2, 499, 1298] +[:mouse_move, 629, 698, 2, 500, 1299] +[:mouse_move, 641, 697, 2, 501, 1300] +[:mouse_move, 647, 697, 2, 502, 1301] +[:mouse_move, 658, 696, 2, 503, 1302] +[:mouse_move, 664, 696, 2, 504, 1303] +[:mouse_move, 677, 695, 2, 505, 1304] +[:mouse_move, 690, 694, 2, 506, 1306] +[:mouse_move, 696, 693, 2, 507, 1307] +[:mouse_move, 701, 693, 2, 508, 1308] +[:mouse_move, 712, 692, 2, 509, 1309] +[:mouse_move, 717, 692, 2, 510, 1310] +[:mouse_move, 722, 692, 2, 511, 1310] +[:mouse_move, 727, 692, 2, 512, 1312] +[:mouse_move, 731, 692, 2, 513, 1313] +[:mouse_move, 736, 692, 2, 514, 1315] +[:mouse_move, 741, 692, 2, 515, 1316] +[:mouse_move, 749, 691, 2, 516, 1316] +[:mouse_move, 751, 691, 2, 517, 1317] +[:mouse_move, 757, 691, 2, 518, 1319] +[:mouse_move, 773, 690, 2, 519, 1321] +[:mouse_move, 797, 690, 2, 520, 1323] +[:mouse_move, 801, 690, 2, 521, 1324] +[:mouse_move, 805, 690, 2, 522, 1324] +[:mouse_move, 809, 690, 2, 523, 1325] +[:mouse_move, 818, 690, 2, 524, 1327] +[:mouse_move, 827, 691, 2, 525, 1328] +[:mouse_move, 835, 691, 2, 526, 1329] +[:mouse_move, 840, 691, 2, 527, 1330] +[:mouse_move, 853, 691, 2, 528, 1331] +[:mouse_move, 861, 691, 2, 529, 1332] +[:mouse_move, 870, 691, 2, 530, 1333] +[:mouse_move, 875, 691, 2, 531, 1335] +[:mouse_move, 881, 691, 2, 532, 1336] +[:mouse_move, 885, 691, 2, 533, 1337] +[:mouse_move, 887, 691, 2, 534, 1337] +[:mouse_move, 889, 691, 2, 535, 1338] +[:mouse_move, 891, 691, 2, 536, 1339] +[:mouse_move, 893, 691, 2, 537, 1339] +[:mouse_move, 895, 691, 2, 538, 1340] +[:mouse_move, 896, 692, 2, 539, 1341] +[:mouse_move, 898, 692, 2, 540, 1341] +[:mouse_move, 899, 692, 2, 541, 1343] +[:mouse_move, 900, 692, 2, 542, 1343] +[:mouse_move, 901, 692, 2, 543, 1344] +[:mouse_move, 902, 692, 2, 544, 1347] +[:mouse_move, 903, 692, 2, 545, 1349] +[:mouse_move, 904, 691, 2, 546, 1351] +[:mouse_move, 905, 688, 2, 547, 1351] +[:mouse_move, 906, 684, 2, 548, 1352] +[:mouse_move, 909, 674, 2, 549, 1353] +[:mouse_move, 912, 661, 2, 550, 1353] +[:mouse_move, 915, 640, 2, 551, 1354] +[:mouse_move, 924, 593, 2, 552, 1355] +[:mouse_move, 934, 552, 2, 553, 1355] +[:mouse_move, 939, 532, 2, 554, 1356] +[:mouse_move, 950, 491, 2, 555, 1357] +[:mouse_move, 955, 466, 2, 556, 1358] +[:mouse_move, 959, 442, 2, 557, 1359] +[:mouse_move, 963, 409, 2, 558, 1360] +[:mouse_move, 964, 388, 2, 559, 1361] +[:mouse_move, 965, 351, 2, 560, 1362] +[:key_down_raw, 1073741905, 0, 2, 561, 1480] +[:key_down_raw, 1073741905, 0, 2, 562, 1505] +[:key_down_raw, 1073741905, 0, 2, 563, 1507] +[:key_down_raw, 1073741905, 0, 2, 564, 1509] +[:key_up_raw, 1073741905, 0, 2, 565, 1511] +[:key_down_raw, 1073741905, 0, 2, 566, 1532] +[:key_up_raw, 1073741905, 0, 2, 567, 1537] +[:key_down_raw, 1073741905, 0, 2, 568, 1550] +[:key_up_raw, 1073741905, 0, 2, 569, 1555] +[:key_down_raw, 1073741904, 0, 2, 570, 1622] +[:key_down_raw, 1073741904, 0, 2, 571, 1647] +[:key_down_raw, 1073741904, 0, 2, 572, 1649] +[:key_down_raw, 1073741904, 0, 2, 573, 1651] +[:key_down_raw, 1073741904, 0, 2, 574, 1653] +[:key_up_raw, 1073741904, 0, 2, 575, 1654] +[:key_down_raw, 1073741906, 0, 2, 576, 1670] +[:key_up_raw, 1073741906, 0, 2, 577, 1691] +[:key_down_raw, 1073741904, 0, 2, 578, 1692] +[:key_up_raw, 1073741904, 0, 2, 579, 1699] +[:key_down_raw, 1073741906, 0, 2, 580, 1708] +[:key_down_raw, 1073741906, 0, 2, 581, 1733] +[:key_down_raw, 1073741906, 0, 2, 582, 1735] +[:key_down_raw, 1073741906, 0, 2, 583, 1737] +[:key_down_raw, 1073741906, 0, 2, 584, 1739] +[:key_down_raw, 1073741906, 0, 2, 585, 1741] +[:key_up_raw, 1073741906, 0, 2, 586, 1741] +[:key_down_raw, 1073741906, 0, 2, 587, 1808] +[:key_up_raw, 1073741906, 0, 2, 588, 1817] +[:key_down_raw, 1073741903, 0, 2, 589, 1821] +[:key_up_raw, 1073741903, 0, 2, 590, 1836] +[:mouse_move, 962, 350, 2, 591, 1924] +[:mouse_move, 957, 348, 2, 592, 1924] +[:mouse_move, 949, 345, 2, 593, 1925] +[:mouse_move, 940, 341, 2, 594, 1926] +[:mouse_move, 916, 331, 2, 595, 1927] +[:mouse_move, 902, 326, 2, 596, 1928] +[:mouse_move, 862, 312, 2, 597, 1929] +[:mouse_move, 853, 309, 2, 598, 1930] +[:mouse_move, 818, 298, 2, 599, 1931] +[:mouse_move, 812, 297, 2, 600, 1932] +[:mouse_move, 798, 293, 2, 601, 1933] +[:mouse_move, 791, 292, 2, 602, 1934] +[:mouse_move, 777, 290, 2, 603, 1935] +[:mouse_move, 773, 290, 2, 604, 1936] +[:mouse_move, 765, 290, 2, 605, 1937] +[:mouse_move, 761, 292, 2, 606, 1938] +[:mouse_move, 760, 292, 2, 607, 1939] +[:mouse_move, 757, 293, 2, 608, 1939] +[:mouse_move, 755, 295, 2, 609, 1940] +[:mouse_move, 754, 295, 2, 610, 1941] +[:mouse_move, 753, 296, 2, 611, 1941] +[:mouse_move, 753, 297, 2, 612, 1942] +[:mouse_move, 753, 298, 2, 613, 1944] +[:mouse_move, 753, 299, 2, 614, 1957] +[:mouse_move, 754, 299, 2, 615, 1969] +[:mouse_move, 755, 299, 2, 616, 1997] +[:mouse_move, 755, 300, 2, 617, 1997] +[:mouse_move, 756, 305, 2, 618, 1998] +[:mouse_move, 760, 316, 2, 619, 1999] +[:mouse_move, 763, 332, 2, 620, 1999] +[:mouse_move, 767, 353, 2, 621, 2000] +[:mouse_move, 771, 380, 2, 622, 2001] +[:mouse_move, 772, 393, 2, 623, 2001] +[:mouse_move, 774, 417, 2, 624, 2002] +[:mouse_move, 775, 425, 2, 625, 2003] +[:mouse_move, 775, 444, 2, 626, 2003] +[:mouse_move, 775, 472, 2, 627, 2004] +[:mouse_move, 775, 487, 2, 628, 2005] +[:mouse_move, 775, 492, 2, 629, 2005] +[:mouse_move, 774, 501, 2, 630, 2006] +[:mouse_move, 771, 508, 2, 631, 2007] +[:mouse_move, 769, 514, 2, 632, 2007] +[:mouse_move, 766, 520, 2, 633, 2008] +[:mouse_move, 761, 529, 2, 634, 2009] +[:mouse_move, 755, 534, 2, 635, 2009] +[:mouse_move, 749, 539, 2, 636, 2010] +[:mouse_move, 741, 545, 2, 637, 2011] +[:mouse_move, 720, 558, 2, 638, 2012] +[:mouse_move, 707, 565, 2, 639, 2013] +[:mouse_move, 678, 582, 2, 640, 2014] +[:mouse_move, 664, 590, 2, 641, 2015] +[:mouse_move, 634, 608, 2, 642, 2016] +[:mouse_move, 621, 616, 2, 643, 2017] +[:mouse_move, 607, 624, 2, 644, 2018] +[:mouse_move, 596, 631, 2, 645, 2018] +[:mouse_move, 584, 638, 2, 646, 2019] +[:mouse_move, 573, 644, 2, 647, 2020] +[:mouse_move, 569, 646, 2, 648, 2020] +[:mouse_move, 552, 654, 2, 649, 2021] +[:mouse_move, 542, 657, 2, 650, 2022] +[:mouse_move, 537, 659, 2, 651, 2022] +[:mouse_move, 529, 662, 2, 652, 2023] +[:mouse_move, 521, 665, 2, 653, 2024] +[:mouse_move, 513, 669, 2, 654, 2024] +[:mouse_move, 507, 671, 2, 655, 2025] +[:mouse_move, 501, 674, 2, 656, 2026] +[:mouse_move, 496, 676, 2, 657, 2026] +[:mouse_move, 494, 677, 2, 658, 2027] +[:mouse_move, 491, 679, 2, 659, 2028] +[:mouse_move, 488, 680, 2, 660, 2028] +[:mouse_move, 486, 682, 2, 661, 2029] +[:mouse_move, 484, 683, 2, 662, 2030] +[:mouse_move, 483, 683, 2, 663, 2030] +[:mouse_move, 482, 684, 2, 664, 2031] +[:mouse_move, 481, 684, 2, 665, 2032] +[:mouse_move, 481, 685, 2, 666, 2032] +[:mouse_move, 480, 685, 2, 667, 2033] +[:mouse_move, 480, 686, 2, 668, 2035] +[:mouse_move, 481, 687, 2, 669, 2037] +[:mouse_move, 483, 688, 2, 670, 2038] +[:mouse_move, 485, 689, 2, 671, 2038] +[:mouse_move, 487, 689, 2, 672, 2039] +[:mouse_move, 490, 690, 2, 673, 2040] +[:mouse_move, 498, 690, 2, 674, 2041] +[:mouse_move, 503, 690, 2, 675, 2042] +[:mouse_move, 513, 690, 2, 676, 2043] +[:mouse_move, 517, 689, 2, 677, 2044] +[:mouse_move, 522, 687, 2, 678, 2045] +[:mouse_move, 527, 686, 2, 679, 2045] +[:mouse_move, 531, 685, 2, 680, 2046] +[:mouse_move, 537, 684, 2, 681, 2047] +[:mouse_move, 540, 683, 2, 682, 2047] +[:mouse_move, 545, 682, 2, 683, 2048] +[:mouse_move, 549, 681, 2, 684, 2049] +[:mouse_move, 553, 680, 2, 685, 2049] +[:mouse_move, 557, 680, 2, 686, 2050] +[:mouse_move, 562, 679, 2, 687, 2051] +[:mouse_move, 566, 679, 2, 688, 2051] +[:mouse_move, 571, 678, 2, 689, 2052] +[:mouse_move, 576, 677, 2, 690, 2053] +[:mouse_move, 581, 677, 2, 691, 2053] +[:mouse_move, 584, 676, 2, 692, 2054] +[:mouse_move, 588, 676, 2, 693, 2055] +[:mouse_move, 592, 675, 2, 694, 2055] +[:mouse_move, 595, 675, 2, 695, 2056] +[:mouse_move, 597, 675, 2, 696, 2057] +[:mouse_move, 599, 675, 2, 697, 2057] +[:mouse_move, 602, 675, 2, 698, 2058] +[:mouse_move, 604, 674, 2, 699, 2059] +[:mouse_move, 607, 674, 2, 700, 2059] +[:mouse_move, 609, 674, 2, 701, 2060] +[:mouse_move, 610, 674, 2, 702, 2061] +[:mouse_move, 614, 674, 2, 703, 2061] +[:mouse_move, 615, 674, 2, 704, 2062] +[:mouse_move, 619, 674, 2, 705, 2063] +[:mouse_move, 624, 673, 2, 706, 2064] +[:mouse_move, 626, 673, 2, 707, 2065] +[:mouse_move, 631, 672, 2, 708, 2066] +[:mouse_move, 634, 672, 2, 709, 2067] +[:mouse_move, 640, 672, 2, 710, 2068] +[:mouse_move, 643, 672, 2, 711, 2069] +[:mouse_move, 649, 671, 2, 712, 2070] +[:mouse_move, 653, 671, 2, 713, 2071] +[:mouse_move, 661, 670, 2, 714, 2072] +[:mouse_move, 666, 670, 2, 715, 2073] +[:mouse_move, 670, 670, 2, 716, 2074] +[:mouse_move, 672, 670, 2, 717, 2074] +[:mouse_move, 676, 669, 2, 718, 2075] +[:mouse_move, 679, 669, 2, 719, 2076] +[:mouse_move, 684, 669, 2, 720, 2076] +[:mouse_move, 686, 669, 2, 721, 2077] +[:mouse_move, 690, 669, 2, 722, 2078] +[:mouse_move, 694, 669, 2, 723, 2078] +[:mouse_move, 697, 669, 2, 724, 2079] +[:mouse_move, 701, 669, 2, 725, 2080] +[:mouse_move, 704, 668, 2, 726, 2080] +[:mouse_move, 707, 668, 2, 727, 2081] +[:mouse_move, 713, 668, 2, 728, 2082] +[:mouse_move, 715, 668, 2, 729, 2082] +[:mouse_move, 720, 668, 2, 730, 2083] +[:mouse_move, 721, 668, 2, 731, 2084] +[:mouse_move, 727, 668, 2, 732, 2084] +[:mouse_move, 730, 668, 2, 733, 2085] +[:mouse_move, 733, 668, 2, 734, 2086] +[:mouse_move, 737, 668, 2, 735, 2086] +[:mouse_move, 740, 668, 2, 736, 2087] +[:mouse_move, 744, 668, 2, 737, 2088] +[:mouse_move, 748, 667, 2, 738, 2088] +[:mouse_move, 752, 667, 2, 739, 2089] +[:mouse_move, 754, 667, 2, 740, 2090] +[:mouse_move, 761, 666, 2, 741, 2091] +[:mouse_move, 764, 666, 2, 742, 2092] +[:mouse_move, 769, 666, 2, 743, 2093] +[:mouse_move, 771, 666, 2, 744, 2094] +[:mouse_move, 775, 666, 2, 745, 2095] +[:mouse_move, 776, 666, 2, 746, 2096] +[:mouse_move, 780, 666, 2, 747, 2097] +[:mouse_move, 781, 667, 2, 748, 2098] +[:mouse_move, 784, 667, 2, 749, 2099] +[:mouse_move, 785, 667, 2, 750, 2100] +[:mouse_move, 786, 667, 2, 751, 2101] +[:mouse_move, 787, 667, 2, 752, 2103] +[:mouse_move, 789, 667, 2, 753, 2121] +[:mouse_move, 798, 667, 2, 754, 2122] +[:mouse_move, 804, 667, 2, 755, 2123] +[:mouse_move, 837, 664, 2, 756, 2124] +[:mouse_move, 860, 660, 2, 757, 2125] +[:mouse_move, 913, 648, 2, 758, 2126] +[:mouse_move, 941, 639, 2, 759, 2127] +[:mouse_move, 972, 629, 2, 760, 2128] +[:mouse_move, 998, 616, 2, 761, 2128] +[:mouse_move, 1024, 603, 2, 762, 2129] +[:mouse_move, 1035, 598, 2, 763, 2130] +[:mouse_move, 1055, 586, 2, 764, 2130] +[:mouse_move, 1071, 576, 2, 765, 2131] +[:mouse_move, 1077, 572, 2, 766, 2132] +[:mouse_move, 1088, 563, 2, 767, 2132] +[:mouse_move, 1096, 557, 2, 768, 2133] +[:mouse_move, 1102, 551, 2, 769, 2134] +[:mouse_move, 1104, 549, 2, 770, 2134] +[:mouse_move, 1111, 542, 2, 771, 2135] +[:mouse_move, 1114, 538, 2, 772, 2136] +[:mouse_move, 1117, 534, 2, 773, 2136] +[:mouse_move, 1121, 531, 2, 774, 2137] +[:mouse_move, 1125, 527, 2, 775, 2138] +[:mouse_move, 1130, 523, 2, 776, 2138] +[:mouse_move, 1135, 519, 2, 777, 2139] +[:mouse_move, 1140, 515, 2, 778, 2140] +[:mouse_move, 1145, 511, 2, 779, 2140] +[:mouse_move, 1148, 509, 2, 780, 2141] +[:mouse_move, 1151, 506, 2, 781, 2142] +[:mouse_move, 1154, 504, 2, 782, 2142] +[:mouse_move, 1156, 503, 2, 783, 2143] +[:mouse_move, 1157, 502, 2, 784, 2144] +[:mouse_move, 1159, 501, 2, 785, 2145] +[:mouse_move, 1159, 500, 2, 786, 2147] +[:key_down_raw, 1073742051, 1024, 2, 787, 2282] +[:key_down_raw, 113, 1024, 2, 788, 2283] +[:key_up_raw, 113, 1024, 2, 789, 2283] diff --git a/samples/99_sample_game_return_of_serenity/sounds/music-loop.ogg b/samples/99_sample_game_return_of_serenity/sounds/music-loop.ogg Binary files differnew file mode 100644 index 0000000..bec1275 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sounds/music-loop.ogg diff --git a/samples/99_sample_game_return_of_serenity/sounds/static-loop.ogg b/samples/99_sample_game_return_of_serenity/sounds/static-loop.ogg Binary files differnew file mode 100644 index 0000000..bb4ac6b --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sounds/static-loop.ogg diff --git a/samples/99_sample_game_return_of_serenity/sprites/book.png b/samples/99_sample_game_return_of_serenity/sprites/book.png Binary files differnew file mode 100644 index 0000000..97859c0 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/book.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/decision.png b/samples/99_sample_game_return_of_serenity/sprites/decision.png Binary files differnew file mode 100644 index 0000000..e323cea --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/decision.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/dream.png b/samples/99_sample_game_return_of_serenity/sprites/dream.png Binary files differnew file mode 100644 index 0000000..0b6f982 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/dream.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/front-of-home.png b/samples/99_sample_game_return_of_serenity/sprites/front-of-home.png Binary files differnew file mode 100644 index 0000000..ca865fe --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/front-of-home.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/inside-home.png b/samples/99_sample_game_return_of_serenity/sprites/inside-home.png Binary files differnew file mode 100644 index 0000000..3bc4804 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/inside-home.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/inside-observatory.png b/samples/99_sample_game_return_of_serenity/sprites/inside-observatory.png Binary files differnew file mode 100644 index 0000000..af1d25d --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/inside-observatory.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/label-background.png b/samples/99_sample_game_return_of_serenity/sprites/label-background.png Binary files differnew file mode 100644 index 0000000..80a682f --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/label-background.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/library.png b/samples/99_sample_game_return_of_serenity/sprites/library.png Binary files differnew file mode 100644 index 0000000..60f8908 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/library.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/mainframe.png b/samples/99_sample_game_return_of_serenity/sprites/mainframe.png Binary files differnew file mode 100644 index 0000000..aed8813 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/mainframe.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/mountain-pass-zoomed-out.png b/samples/99_sample_game_return_of_serenity/sprites/mountain-pass-zoomed-out.png Binary files differnew file mode 100644 index 0000000..b39ab78 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/mountain-pass-zoomed-out.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/observatory.png b/samples/99_sample_game_return_of_serenity/sprites/observatory.png Binary files differnew file mode 100644 index 0000000..925886b --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/observatory.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/outside-library.png b/samples/99_sample_game_return_of_serenity/sprites/outside-library.png Binary files differnew file mode 100644 index 0000000..df42ccf --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/outside-library.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/path-to-observatory.png b/samples/99_sample_game_return_of_serenity/sprites/path-to-observatory.png Binary files differnew file mode 100644 index 0000000..7e740ac --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/path-to-observatory.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/pc.png b/samples/99_sample_game_return_of_serenity/sprites/pc.png Binary files differnew file mode 100644 index 0000000..e5f4218 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/pc.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/planets.png b/samples/99_sample_game_return_of_serenity/sprites/planets.png Binary files differnew file mode 100644 index 0000000..537dd8f --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/planets.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/player-down.png b/samples/99_sample_game_return_of_serenity/sprites/player-down.png Binary files differnew file mode 100644 index 0000000..161ea69 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/player-down.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/player-left.png b/samples/99_sample_game_return_of_serenity/sprites/player-left.png Binary files differnew file mode 100644 index 0000000..5f682fd --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/player-left.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/player-right.png b/samples/99_sample_game_return_of_serenity/sprites/player-right.png Binary files differnew file mode 100644 index 0000000..798f97e --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/player-right.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/player-up.png b/samples/99_sample_game_return_of_serenity/sprites/player-up.png Binary files differnew file mode 100644 index 0000000..161ea69 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/player-up.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/player-zoomed-out.png b/samples/99_sample_game_return_of_serenity/sprites/player-zoomed-out.png Binary files differnew file mode 100644 index 0000000..804cd72 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/player-zoomed-out.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/serenity.png b/samples/99_sample_game_return_of_serenity/sprites/serenity.png Binary files differnew file mode 100644 index 0000000..def5bea --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/serenity.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/side-of-home.png b/samples/99_sample_game_return_of_serenity/sprites/side-of-home.png Binary files differnew file mode 100644 index 0000000..6a17e93 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/side-of-home.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/square.png b/samples/99_sample_game_return_of_serenity/sprites/square.png Binary files differnew file mode 100644 index 0000000..80a682f --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/square.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/todo.png b/samples/99_sample_game_return_of_serenity/sprites/todo.png Binary files differnew file mode 100644 index 0000000..5cd3b13 --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/todo.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/tribute-game-over.png b/samples/99_sample_game_return_of_serenity/sprites/tribute-game-over.png Binary files differnew file mode 100644 index 0000000..99991fb --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/tribute-game-over.png diff --git a/samples/99_sample_game_return_of_serenity/sprites/tribute.png b/samples/99_sample_game_return_of_serenity/sprites/tribute.png Binary files differnew file mode 100644 index 0000000..8686cca --- /dev/null +++ b/samples/99_sample_game_return_of_serenity/sprites/tribute.png diff --git a/samples/99_sample_game_the_little_probe/app/main.rb b/samples/99_sample_game_the_little_probe/app/main.rb new file mode 100644 index 0000000..1c90218 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/app/main.rb @@ -0,0 +1,887 @@ +class FallingCircle + attr_gtk + + def tick + fiddle + defaults + render + input + calc + end + + def fiddle + state.gravity = -0.02 + circle.radius = 15 + circle.elasticity = 0.4 + camera.follow_speed = 0.4 * 0.4 + end + + def render + render_stage_editor + render_debug + render_game + end + + def defaults + if state.tick_count == 0 + outputs.sounds << "sounds/bg.ogg" + end + + state.storyline ||= [ + { text: "<- -> to aim, hold space to charge", distance_gate: 0 }, + { text: "the little probe - by @amirrajan, made with DragonRuby Game Toolkit", distance_gate: 0 }, + { text: "mission control, this is sasha. landing on europa successful.", distance_gate: 0 }, + { text: "operation \"find earth 2.0\", initiated at 8-29-2036 14:00.", distance_gate: 0 }, + { text: "jupiter's sure is beautiful...", distance_gate: 4000 }, + { text: "hmm, it seems there's some kind of anomoly in the sky", distance_gate: 7000 }, + { text: "dancing lights, i'll call them whisps.", distance_gate: 8000 }, + { text: "#todo... look i ran out of time -_-", distance_gate: 9000 }, + { text: "there's never enough time", distance_gate: 9000 }, + { text: "the game jam was fun though ^_^", distance_gate: 10000 }, + ] + + load_level force: args.state.tick_count == 0 + state.line_mode ||= :terrain + + state.sound_index ||= 1 + circle.potential_lift ||= 0 + circle.angle ||= 90 + circle.check_point_at ||= -1000 + circle.game_over_at ||= -1000 + circle.x ||= -485 + circle.y ||= 12226 + circle.check_point_x ||= circle.x + circle.check_point_y ||= circle.y + circle.dy ||= 0 + circle.dx ||= 0 + circle.previous_dy ||= 0 + circle.previous_dx ||= 0 + circle.angle ||= 0 + circle.after_images ||= [] + circle.terrains_to_monitor ||= {} + circle.impact_history ||= [] + + camera.x ||= 0 + camera.y ||= 0 + camera.target_x ||= 0 + camera.target_y ||= 0 + state.snaps ||= { } + state.snap_number = 10 + + args.state.storyline_x ||= -1000 + args.state.storyline_y ||= -1000 + end + + def render_game + outputs.background_color = [0, 0, 0] + outputs.sprites << [-circle.x + 1100, + -circle.y - 100, + 2416 * 4, + 3574 * 4, + 'sprites/jupiter.png'] + outputs.sprites << [-circle.x, + -circle.y, + 2416 * 4, + 3574 * 4, + 'sprites/level.png'] + outputs.sprites << state.whisp_queue + render_aiming_retical + render_circle + render_notification + end + + def render_notification + toast_length = 500 + if circle.game_over_at.elapsed_time < toast_length + label_text = "..." + elsif circle.check_point_at.elapsed_time > toast_length + args.state.current_storyline = nil + return + end + if circle.check_point_at && + circle.check_point_at.elapsed_time == 1 && + !args.state.current_storyline + if args.state.storyline.length > 0 && args.state.distance_traveled > args.state.storyline[0][:distance_gate] + args.state.current_storyline = args.state.storyline.shift[:text] + args.state.distance_traveled ||= 0 + args.state.storyline_x = circle.x + args.state.storyline_y = circle.y + end + return unless args.state.current_storyline + end + label_text = args.state.current_storyline + return unless label_text + x = circle.x + camera.x + y = circle.y + camera.y - 40 + w = 900 + h = 30 + outputs.primitives << [x - w.idiv(2), y - h, w, h, 255, 255, 255, 255].solid + outputs.primitives << [x - w.idiv(2), y - h, w, h, 0, 0, 0, 255].border + outputs.labels << [x, y - 4, label_text, 1, 1, 0, 0, 0, 255] + end + + def render_aiming_retical + outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.potential_lift * 10) - 5, + state.camera.y + circle.y + circle.angle.vector_y(circle.potential_lift * 10) - 5, + 10, 10, 'sprites/circle-orange.png'] + outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5, + state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5, + 10, 10, 'sprites/circle-orange.png', 0, 128] + if rand > 0.9 + outputs.sprites << [state.camera.x + circle.x + circle.angle.vector_x(circle.radius * 3) - 5, + state.camera.y + circle.y + circle.angle.vector_y(circle.radius * 3) - 5, + 10, 10, 'sprites/circle-white.png', 0, 128] + end + end + + def render_circle + outputs.sprites << circle.after_images.map do |ai| + ai.merge(x: ai.x + state.camera.x - circle.radius, + y: ai.y + state.camera.y - circle.radius, + w: circle.radius * 2, + h: circle.radius * 2, + path: 'sprites/circle-white.png') + end + + outputs.sprites << [(circle.x - circle.radius) + state.camera.x, + (circle.y - circle.radius) + state.camera.y, + circle.radius * 2, + circle.radius * 2, + 'sprites/probe.png'] + end + + def render_debug + return unless state.debug_mode + + outputs.labels << [10, 30, state.line_mode, 0, 0, 0, 0, 0] + outputs.labels << [12, 32, state.line_mode, 0, 0, 255, 255, 255] + + args.outputs.lines << trajectory(circle).line.to_hash.tap do |h| + h[:x] += state.camera.x + h[:y] += state.camera.y + h[:x2] += state.camera.x + h[:y2] += state.camera.y + end + + outputs.primitives << state.terrain.find_all do |t| + circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360) + end.map do |t| + [ + t.line.associate(r: 0, g: 255, b: 0) do |h| + h.x += state.camera.x + h.y += state.camera.y + h.x2 += state.camera.x + h.y2 += state.camera.y + if circle.rect.intersect_rect? t[:rect] + h[:r] = 255 + h[:g] = 0 + end + h + end, + t[:rect].border.associate(r: 255, g: 0, b: 0) do |h| + h.x += state.camera.x + h.y += state.camera.y + h.b = 255 if line_near_rect? circle.rect, t + h + end + ] + end + + outputs.primitives << state.lava.find_all do |t| + circle.x.between?(t.x - 640, t.x2 + 640) || circle.y.between?(t.y - 360, t.y2 + 360) + end.map do |t| + [ + t.line.associate(r: 0, g: 0, b: 255) do |h| + h.x += state.camera.x + h.y += state.camera.y + h.x2 += state.camera.x + h.y2 += state.camera.y + if circle.rect.intersect_rect? t[:rect] + h[:r] = 255 + h[:b] = 0 + end + h + end, + t[:rect].border.associate(r: 255, g: 0, b: 0) do |h| + h.x += state.camera.x + h.y += state.camera.y + h.b = 255 if line_near_rect? circle.rect, t + h + end + ] + end + + if state.god_mode + border = circle.rect.merge(x: circle.rect.x + state.camera.x, + y: circle.rect.y + state.camera.y, + g: 255) + else + border = circle.rect.merge(x: circle.rect.x + state.camera.x, + y: circle.rect.y + state.camera.y, + b: 255) + end + + outputs.borders << border + + overlapping ||= {} + + circle.impact_history.each do |h| + label_mod = 300 + x = (h[:body][:x].-(150).idiv(label_mod)) * label_mod + camera.x + y = (h[:body][:y].+(150).idiv(label_mod)) * label_mod + camera.y + 10.times do + if overlapping[x] && overlapping[x][y] + y -= 52 + else + break + end + end + + overlapping[x] ||= {} + overlapping[x][y] ||= true + outputs.primitives << [x, y - 25, 300, 50, 0, 0, 0, 128].solid + outputs.labels << [x + 10, y + 24, "dy: %.2f" % h[:body][:new_dy], -2, 0, 255, 255, 255] + outputs.labels << [x + 10, y + 9, "dx: %.2f" % h[:body][:new_dx], -2, 0, 255, 255, 255] + outputs.labels << [x + 10, y - 5, " ?: #{h[:body][:new_reason]}", -2, 0, 255, 255, 255] + + outputs.labels << [x + 100, y + 24, "angle: %.2f" % h[:impact][:angle], -2, 0, 255, 255, 255] + outputs.labels << [x + 100, y + 9, "m(l): %.2f" % h[:terrain][:slope], -2, 0, 255, 255, 255] + outputs.labels << [x + 100, y - 5, "m(c): %.2f" % h[:body][:slope], -2, 0, 255, 255, 255] + + outputs.labels << [x + 200, y + 24, "ray: #{h[:impact][:ray]}", -2, 0, 255, 255, 255] + outputs.labels << [x + 200, y + 9, "nxt: #{h[:impact][:ray_next]}", -2, 0, 255, 255, 255] + outputs.labels << [x + 200, y - 5, "typ: #{h[:impact][:type]}", -2, 0, 255, 255, 255] + end + + if circle.floor + outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 100, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0] + outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 101, "point: #{circle.floor_point.slice(:x, :y).values}", -2, 0, 255, 255, 255] + outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 85, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0] + outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 86, "circle: #{circle.hash.slice(:x, :y).values}", -2, 0, 255, 255, 255] + outputs.labels << [circle.x + camera.x + 30, circle.y + camera.y + 70, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0] + outputs.labels << [circle.x + camera.x + 31, circle.y + camera.y + 71, "rel: #{circle.floor_relative_x} #{circle.floor_relative_y}", -2, 0, 255, 255, 255] + end + end + + def render_stage_editor + return unless state.god_mode + return unless state.point_one + args.lines << [state.point_one, inputs.mouse.point, 0, 255, 255] + end + + def trajectory body + [body.x + body.dx, + body.y + body.dy, + body.x + body.dx * 1000, + body.y + body.dy * 1000, + 0, 255, 255] + end + + def lengthen_line line, num + line = normalize_line(line) + slope = geometry.line_slope(line, replace_infinity: 10).abs + if slope < 2 + [line.x - num, line.y, line.x2 + num, line.y2].line.to_hash + else + [line.x, line.y, line.x2, line.y2].line.to_hash + end + end + + def normalize_line line + if line.x > line.x2 + x = line.x2 + y = line.y2 + x2 = line.x + y2 = line.y + else + x = line.x + y = line.y + x2 = line.x2 + y2 = line.y2 + end + [x, y, x2, y2] + end + + def rect_for_line line + if line.x > line.x2 + x = line.x2 + y = line.y2 + x2 = line.x + y2 = line.y + else + x = line.x + y = line.y + x2 = line.x2 + y2 = line.y2 + end + + w = x2 - x + h = y2 - y + + if h < 0 + y += h + h = h.abs + end + + if w < circle.radius + x -= circle.radius + w = circle.radius * 2 + end + + if h < circle.radius + y -= circle.radius + h = circle.radius * 2 + end + + { x: x, y: y, w: w, h: h } + end + + def snap_to_grid x, y, snaps + snap_number = 10 + x = x.to_i + y = y.to_i + + x_floor = x.idiv(snap_number) * snap_number + x_mod = x % snap_number + x_ceil = (x.idiv(snap_number) + 1) * snap_number + + y_floor = y.idiv(snap_number) * snap_number + y_mod = y % snap_number + y_ceil = (y.idiv(snap_number) + 1) * snap_number + + if snaps[x_floor] + x_result = x_floor + elsif snaps[x_ceil] + x_result = x_ceil + elsif x_mod < snap_number.idiv(2) + x_result = x_floor + else + x_result = x_ceil + end + + snaps[x_result] ||= {} + + if snaps[x_result][y_floor] + y_result = y_floor + elsif snaps[x_result][y_ceil] + y_result = y_ceil + elsif y_mod < snap_number.idiv(2) + y_result = y_floor + else + y_result = y_ceil + end + + snaps[x_result][y_result] = true + return [x_result, y_result] + + end + + def snap_line line + x, y, x2, y2 = line + end + + def string_to_line s + x, y, x2, y2 = s.split(',').map(&:to_f) + + if x > x2 + x2, x = x, x2 + y2, y = y, y2 + end + + x, y = snap_to_grid x, y, state.snaps + x2, y2 = snap_to_grid x2, y2, state.snaps + [x, y, x2, y2].line.to_hash + end + + def load_lines file + data = gtk.read_file(file) || "" + data.each_line + .reject { |l| l.strip.length == 0 } + .map { |l| string_to_line l } + .map { |h| h.merge(rect: rect_for_line(h)) } + end + + def load_terrain + load_lines 'level.txt' + end + + def load_lava + load_lines 'level_lava.txt' + end + + def load_level force: false + if force + state.snaps = {} + state.terrain = load_terrain + state.lava = load_lava + else + state.terrain ||= load_terrain + state.lava ||= load_lava + end + end + + def save_lines lines, file + s = lines.map do |l| + "#{l.x1},#{l.y1},#{l.x2},#{l.y2}" + end.join("\n") + gtk.write_file(file, s) + end + + def save_level + save_lines(state.terrain, 'level.txt') + save_lines(state.lava, 'level_lava.txt') + load_level force: true + end + + def line_near_rect? rect, terrain + geometry.intersect_rect?(rect, terrain[:rect]) + end + + def point_within_line? point, line + return false if !point + return false if !line + return true + end + + def calc_impacts x, dx, y, dy, radius + results = { } + results[:x] = x + results[:y] = y + results[:dx] = x + results[:dy] = y + results[:point] = { x: x, y: y } + results[:rect] = { x: x - radius, y: y - radius, w: radius * 2, h: radius * 2 } + results[:trajectory] = trajectory(results) + results[:impacts] = terrain.find_all { |t| line_near_rect? results[:rect], t }.map do |t| + { + terrain: t, + point: geometry.line_intersect(results[:trajectory], t), + type: :terrain + } + end.reject { |t| !point_within_line? t[:point], t[:terrain] } + + results[:impacts] += lava.find_all { |t| line_near_rect? results[:rect], t }.map do |t| + { + terrain: t, + point: geometry.line_intersect(results[:trajectory], t), + type: :lava + } + end.reject { |t| !point_within_line? t[:point], t[:terrain] } + + results + end + + def calc_potential_impacts + impact_results = calc_impacts circle.x, circle.dx, circle.y, circle.dy, circle.radius + circle.rect = impact_results[:rect] + circle.trajectory = impact_results[:trajectory] + circle.impacts = impact_results[:impacts] + end + + def calc_terrains_to_monitor + circle.impact = nil + circle.impacts.each do |i| + circle.terrains_to_monitor[i[:terrain]] ||= { + ray_start: geometry.ray_test(circle, i[:terrain]), + } + + circle.terrains_to_monitor[i[:terrain]][:ray_current] = geometry.ray_test(circle, i[:terrain]) + if circle.terrains_to_monitor[i[:terrain]][:ray_start] != circle.terrains_to_monitor[i[:terrain]][:ray_current] + if circle.x.between?(i[:terrain].x, i[:terrain].x2) || circle.y.between?(i[:terrain].y, i[:terrain].y2) + circle.impact = i + circle.ray_current = circle.terrains_to_monitor[i[:terrain]][:ray_current] + end + end + end + end + + def impact_result body, impact + infinity_alias = 1000 + r = { + body: {}, + terrain: {}, + impact: {} + } + + r[:body][:line] = body.trajectory.dup + r[:body][:slope] = geometry.line_slope(body.trajectory, replace_infinity: infinity_alias) + r[:body][:slope_sign] = r[:body][:slope].sign + r[:body][:x] = body.x + r[:body][:y] = body.y + r[:body][:dy] = body.dy + r[:body][:dx] = body.dx + + r[:terrain][:line] = impact[:terrain].dup + r[:terrain][:slope] = geometry.line_slope(impact[:terrain], replace_infinity: infinity_alias) + r[:terrain][:slope_sign] = r[:terrain][:slope].sign + + r[:impact][:angle] = geometry.angle_between_lines(body.trajectory, impact[:terrain], replace_infinity: infinity_alias) + r[:impact][:point] = { x: impact[:point].x, y: impact[:point].y } + r[:impact][:same_slope_sign] = r[:body][:slope_sign] == r[:terrain][:slope_sign] + r[:impact][:ray] = body.ray_current + r[:body][:new_on_floor] = body.on_floor + r[:body][:new_floor] = r[:terrain][:line] + + if r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs < 3 + play_sound + r[:body][:new_dy] = r[:body][:dy] * circle.elasticity * -1 + r[:body][:new_dx] = r[:body][:dx] * circle.elasticity + r[:impact][:type] = :horizontal + r[:body][:new_reason] = "-" + elsif r[:impact][:angle].abs < 90 && r[:terrain][:slope].abs > 3 + play_sound + r[:body][:new_dy] = r[:body][:dy] * 1.1 + r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity + r[:impact][:type] = :vertical + r[:body][:new_reason] = "|" + else + play_sound + r[:body][:new_dx] = r[:body][:dx] * -circle.elasticity + r[:body][:new_dy] = r[:body][:dy] * -circle.elasticity + r[:impact][:type] = :slanted + r[:body][:new_reason] = "/" + end + + r[:impact][:energy] = r[:body][:new_dx].abs + r[:body][:new_dy].abs + + if r[:impact][:energy] <= 0.3 && r[:terrain][:slope].abs < 4 + r[:body][:new_dx] = 0 + r[:body][:new_dy] = 0 + r[:impact][:energy] = 0 + r[:body][:new_on_floor] = true + r[:body][:new_floor] = r[:terrain][:line] + r[:body][:new_reason] = "0" + end + + r[:impact][:ray_next] = geometry.ray_test({ x: r[:body][:x] - (r[:body][:dx] * 1.1) + r[:body][:new_dx], + y: r[:body][:y] - (r[:body][:dy] * 1.1) + r[:body][:new_dy] + state.gravity }, + r[:terrain][:line]) + + if r[:impact][:ray_next] == r[:impact][:ray] + r[:body][:new_dx] *= -1 + r[:body][:new_dy] *= -1 + r[:body][:new_reason] = "clip" + end + + r + end + + def game_over! + circle.x = circle.check_point_x + circle.y = circle.check_point_y + circle.dx = 0 + circle.dy = 0 + circle.game_over_at = state.tick_count + end + + def not_game_over! + impact_history_entry = impact_result circle, circle.impact + circle.impact_history << impact_history_entry + circle.x -= circle.dx * 1.1 + circle.y -= circle.dy * 1.1 + circle.dx = impact_history_entry[:body][:new_dx] + circle.dy = impact_history_entry[:body][:new_dy] + circle.on_floor = impact_history_entry[:body][:new_on_floor] + + if circle.on_floor + circle.check_point_at = state.tick_count + circle.check_point_x = circle.x + circle.check_point_y = circle.y + end + + circle.previous_floor = circle.floor || {} + circle.floor = impact_history_entry[:body][:new_floor] || {} + circle.floor_point = impact_history_entry[:impact][:point] + if circle.floor.slice(:x, :y, :x2, :y2) != circle.previous_floor.slice(:x, :y, :x2, :y2) + new_relative_x = if circle.dx > 0 + :right + elsif circle.dx < 0 + :left + else + nil + end + + new_relative_y = if circle.dy > 0 + :above + elsif circle.dy < 0 + :below + else + nil + end + + circle.floor_relative_x = new_relative_x + circle.floor_relative_y = new_relative_y + end + + circle.impact = nil + circle.terrains_to_monitor.clear + end + + def calc_physics + if args.state.god_mode + calc_potential_impacts + calc_terrains_to_monitor + return + end + + if circle.y < -700 + game_over + return + end + + return if state.game_over + return if circle.on_floor + circle.previous_dy = circle.dy + circle.previous_dx = circle.dx + circle.x += circle.dx + circle.y += circle.dy + args.state.distance_traveled ||= 0 + args.state.distance_traveled += circle.dx.abs + circle.dy.abs + circle.dy += state.gravity + calc_potential_impacts + calc_terrains_to_monitor + return unless circle.impact + if circle.impact && circle.impact[:type] == :lava + game_over! + else + not_game_over! + end + end + + def input_god_mode + state.debug_mode = !state.debug_mode if inputs.keyboard.key_down.forward_slash + + # toggle god mode + if inputs.keyboard.key_down.g + state.god_mode = !state.god_mode + state.potential_lift = 0 + circle.floor = nil + circle.floor_point = nil + circle.floor_relative_x = nil + circle.floor_relative_y = nil + circle.impact = nil + circle.terrains_to_monitor.clear + return + end + + return unless state.god_mode + + circle.x = circle.x.to_i + circle.y = circle.y.to_i + + # move god circle + if inputs.keyboard.left || inputs.keyboard.a + circle.x -= 20 + elsif inputs.keyboard.right || inputs.keyboard.d || inputs.keyboard.f + circle.x += 20 + end + + if inputs.keyboard.up || inputs.keyboard.w + circle.y += 20 + elsif inputs.keyboard.down || inputs.keyboard.s + circle.y -= 20 + end + + # delete terrain + if inputs.keyboard.key_down.x + calc_terrains_to_monitor + state.terrain = state.terrain.reject do |t| + t[:rect].intersect_rect? circle.rect + end + + state.lava = state.lava.reject do |t| + t[:rect].intersect_rect? circle.rect + end + + calc_potential_impacts + save_level + end + + # change terrain type + if inputs.keyboard.key_down.l + if state.line_mode == :terrain + state.line_mode = :lava + else + state.line_mode = :terrain + end + end + + if inputs.mouse.click && !state.point_one + state.point_one = inputs.mouse.click.point + elsif inputs.mouse.click && state.point_one + l = [*state.point_one, *inputs.mouse.click.point] + l = [l.x - state.camera.x, + l.y - state.camera.y, + l.x2 - state.camera.x, + l.y2 - state.camera.y].line.to_hash + l[:rect] = rect_for_line l + if state.line_mode == :terrain + state.terrain << l + else + state.lava << l + end + save_level + next_x = inputs.mouse.click.point.x - 640 + next_y = inputs.mouse.click.point.y - 360 + circle.x += next_x + circle.y += next_y + state.point_one = nil + elsif inputs.keyboard.one + state.point_one = [circle.x + camera.x, circle.y+ camera.y] + end + + # cancel chain lines + if inputs.keyboard.key_down.nine || inputs.keyboard.key_down.escape || inputs.keyboard.key_up.six || inputs.keyboard.key_up.one + state.point_one = nil + end + end + + def play_sound + return if state.sound_debounce > 0 + state.sound_debounce = 5 + outputs.sounds << "sounds/03#{"%02d" % state.sound_index}.wav" + state.sound_index += 1 + if state.sound_index > 21 + state.sound_index = 1 + end + end + + def input_game + if inputs.keyboard.down || inputs.keyboard.space + circle.potential_lift += 0.03 + circle.potential_lift = circle.potential_lift.lesser(10) + elsif inputs.keyboard.key_up.down || inputs.keyboard.key_up.space + play_sound + circle.dy += circle.angle.vector_y circle.potential_lift + circle.dx += circle.angle.vector_x circle.potential_lift + + if circle.on_floor + if circle.floor_relative_y == :above + circle.y += circle.potential_lift.abs * 2 + elsif circle.floor_relative_y == :below + circle.y -= circle.potential_lift.abs * 2 + end + end + + circle.on_floor = false + circle.potential_lift = 0 + circle.terrains_to_monitor.clear + circle.impact_history.clear + circle.impact = nil + calc_physics + end + + # aim probe + if inputs.keyboard.right || inputs.keyboard.a + circle.angle -= 2 + elsif inputs.keyboard.left || inputs.keyboard.d + circle.angle += 2 + end + end + + def input + input_god_mode + input_game + end + + def calc_camera + state.camera.target_x = 640 - circle.x + state.camera.target_y = 360 - circle.y + xdiff = state.camera.target_x - state.camera.x + ydiff = state.camera.target_y - state.camera.y + state.camera.x += xdiff * camera.follow_speed + state.camera.y += ydiff * camera.follow_speed + end + + def calc + state.sound_debounce ||= 0 + state.sound_debounce -= 1 + state.sound_debounce = 0 if state.sound_debounce < 0 + if state.god_mode + circle.dy *= 0.1 + circle.dx *= 0.1 + end + calc_camera + state.whisp_queue ||= [] + if state.tick_count.mod_zero?(4) + state.whisp_queue << { + x: -300, + y: 1400 * rand, + speed: 2.randomize(:ratio) + 3, + w: 20, + h: 20, path: 'sprites/whisp.png', + a: 0, + created_at: state.tick_count, + angle: 0, + r: 100, + g: 128 + 128 * rand, + b: 128 + 128 * rand + } + end + + state.whisp_queue.each do |w| + w.x += w[:speed] * 2 + w.x -= circle.dx * 0.3 + w.y -= w[:speed] + w.y -= circle.dy * 0.3 + w.angle += w[:speed] + w.a = w[:created_at].ease(30) * 255 + end + + state.whisp_queue = state.whisp_queue.reject { |w| w[:x] > 1280 } + + if state.tick_count.mod_zero?(2) && (circle.dx != 0 || circle.dy != 0) + circle.after_images << { + x: circle.x, + y: circle.y, + w: circle.radius, + h: circle.radius, + a: 255, + created_at: state.tick_count + } + end + + circle.after_images.each do |ai| + ai.a = ai[:created_at].ease(10, :flip) * 255 + end + + circle.after_images = circle.after_images.reject { |ai| ai[:created_at].elapsed_time > 10 } + calc_physics + end + + def circle + state.circle + end + + def camera + state.camera + end + + def terrain + state.terrain + end + + def lava + state.lava + end +end + +# $gtk.reset + +def tick args + args.outputs.background_color = [0, 0, 0] + if args.inputs.keyboard.r + args.gtk.reset + return + end + # uncomment the line below to slow down the game so you + # can see each tick as it passes + # args.gtk.slowmo! 30 + $game ||= FallingCircle.new + $game.args = args + $game.tick +end + +def reset + $game = nil +end diff --git a/samples/99_sample_game_the_little_probe/level.txt b/samples/99_sample_game_the_little_probe/level.txt new file mode 100644 index 0000000..62caf2d --- /dev/null +++ b/samples/99_sample_game_the_little_probe/level.txt @@ -0,0 +1,1481 @@ +640,8840,1180,8840 +-60,10220,0,9960 +-60,10220,0,10500 +0,10500,0,10780 +0,10780,40,10900 +500,10920,760,10960 +300,10560,820,10600 +420,10320,700,10300 +820,10600,1500,10600 +1500,10600,1940,10600 +1940,10600,2380,10580 +2380,10580,2800,10620 +2240,11080,2480,11020 +2000,11120,2240,11080 +1760,11180,2000,11120 +1620,11180,1760,11180 +1500,11220,1620,11180 +1180,11280,1340,11220 +1040,11240,1180,11280 +840,11280,1040,11240 +640,11280,840,11280 +500,11220,640,11280 +420,11140,500,11220 +240,11100,420,11140 +100,11120,240,11100 +0,11180,100,11120 +-160,11220,0,11180 +-260,11240,-160,11220 +1340,11220,1500,11220 +960,13300,1280,13060 +1280,13060,1540,12860 +1540,12860,1820,12700 +1820,12700,2080,12520 +2080,12520,2240,12400 +2240,12400,2240,12240 +2240,12240,2400,12080 +2400,12080,2560,11920 +2560,11920,2640,11740 +2640,11740,2740,11580 +2740,11580,2800,11400 +2800,11400,2800,11240 +2740,11140,2800,11240 +2700,11040,2740,11140 +2700,11040,2740,10960 +2740,10960,2740,10920 +2700,10900,2740,10920 +2380,10900,2700,10900 +2040,10920,2380,10900 +1720,10940,2040,10920 +1380,11000,1720,10940 +1180,10980,1380,11000 +900,10980,1180,10980 +760,10960,900,10980 +240,10960,500,10920 +40,10900,240,10960 +0,9700,0,9960 +-60,9500,0,9700 +-60,9420,-60,9500 +-60,9420,-60,9340 +-60,9340,-60,9280 +-60,9120,-60,9280 +-60,8940,-60,9120 +-60,8940,-60,8780 +-60,8780,0,8700 +0,8700,40,8680 +40,8680,240,8700 +240,8700,360,8780 +360,8780,640,8840 +1420,8400,1540,8480 +1540,8480,1680,8500 +1680,8500,1940,8460 +1180,8840,1280,8880 +1280,8880,1340,8860 +1340,8860,1720,8860 +1720,8860,1820,8920 +1820,8920,1820,9140 +1820,9140,1820,9280 +1820,9460,1820,9280 +1760,9480,1820,9460 +1640,9480,1760,9480 +1540,9500,1640,9480 +1340,9500,1540,9500 +1100,9500,1340,9500 +1040,9540,1100,9500 +960,9540,1040,9540 +300,9420,360,9460 +240,9440,300,9420 +180,9600,240,9440 +120,9660,180,9600 +100,9820,120,9660 +100,9820,120,9860 +120,9860,140,9900 +140,9900,140,10000 +140,10440,180,10540 +100,10080,140,10000 +100,10080,140,10100 +140,10100,140,10440 +180,10540,300,10560 +2140,9560,2140,9640 +2140,9720,2140,9640 +1880,9780,2140,9720 +1720,9780,1880,9780 +1620,9740,1720,9780 +1500,9780,1620,9740 +1380,9780,1500,9780 +1340,9820,1380,9780 +1200,9820,1340,9820 +1100,9780,1200,9820 +900,9780,1100,9780 +820,9720,900,9780 +540,9720,820,9720 +360,9840,540,9720 +360,9840,360,9960 +360,9960,360,10080 +360,10140,360,10080 +360,10140,360,10240 +360,10240,420,10320 +700,10300,820,10280 +820,10280,820,10280 +820,10280,900,10320 +900,10320,1040,10300 +1040,10300,1200,10320 +1200,10320,1380,10280 +1380,10280,1500,10300 +1500,10300,1760,10300 +2800,10620,2840,10600 +2840,10600,2900,10600 +2900,10600,3000,10620 +3000,10620,3080,10620 +3080,10620,3140,10600 +3140,10540,3140,10600 +3140,10540,3140,10460 +3140,10460,3140,10360 +3140,10360,3140,10260 +3140,10260,3140,10140 +3140,10140,3140,10000 +3140,10000,3140,9860 +3140,9860,3160,9720 +3160,9720,3160,9580 +3160,9580,3160,9440 +3160,9300,3160,9440 +3160,9300,3160,9140 +3160,9140,3160,8980 +3160,8980,3160,8820 +3160,8820,3160,8680 +3160,8680,3160,8520 +1760,10300,1880,10300 +660,9500,960,9540 +640,9460,660,9500 +360,9460,640,9460 +-480,10760,-440,10880 +-480,11020,-440,10880 +-480,11160,-260,11240 +-480,11020,-480,11160 +-600,11420,-380,11320 +-380,11320,-200,11340 +-200,11340,0,11340 +0,11340,180,11340 +960,13420,960,13300 +960,13420,960,13520 +960,13520,1000,13560 +1000,13560,1040,13540 +1040,13540,1200,13440 +1200,13440,1380,13380 +1380,13380,1620,13300 +1620,13300,1820,13220 +1820,13220,2000,13200 +2000,13200,2240,13200 +2240,13200,2440,13160 +2440,13160,2640,13040 +-480,10760,-440,10620 +-440,10620,-360,10560 +-380,10460,-360,10560 +-380,10460,-360,10300 +-380,10140,-360,10300 +-380,10140,-380,10040 +-380,9880,-380,10040 +-380,9720,-380,9880 +-380,9720,-380,9540 +-380,9360,-380,9540 +-380,9180,-380,9360 +-380,9180,-380,9000 +-380,8840,-380,9000 +-380,8840,-380,8760 +-380,8760,-380,8620 +-380,8620,-380,8520 +-380,8520,-360,8400 +-360,8400,-100,8400 +-100,8400,-60,8420 +-60,8420,240,8440 +240,8440,240,8380 +240,8380,500,8440 +500,8440,760,8460 +760,8460,1000,8400 +1000,8400,1180,8420 +1180,8420,1420,8400 +1940,8460,2140,8420 +2140,8420,2200,8520 +2200,8680,2200,8520 +2140,8840,2200,8680 +2140,8840,2140,9020 +2140,9100,2140,9020 +2140,9200,2140,9100 +2140,9200,2200,9320 +2200,9320,2200,9440 +2140,9560,2200,9440 +1880,10300,2200,10280 +2200,10280,2480,10260 +2480,10260,2700,10240 +2700,10240,2840,10180 +2840,10180,2900,10060 +2900,9860,2900,10060 +2900,9640,2900,9860 +2900,9640,2900,9500 +2900,9460,2900,9500 +2740,9460,2900,9460 +2700,9460,2740,9460 +2700,9360,2700,9460 +2700,9320,2700,9360 +2600,9320,2700,9320 +2600,9260,2600,9320 +2600,9200,2600,9260 +2480,9120,2600,9200 +2440,9080,2480,9120 +2380,9080,2440,9080 +2320,9060,2380,9080 +2320,8860,2320,9060 +2320,8860,2380,8840 +2380,8840,2480,8860 +2480,8860,2600,8840 +2600,8840,2740,8840 +2740,8840,2840,8800 +2840,8800,2900,8700 +2900,8600,2900,8700 +2900,8480,2900,8600 +2900,8380,2900,8480 +2900,8380,2900,8260 +2900,8260,2900,8140 +2900,8140,2900,8020 +2900,8020,2900,7900 +2900,7820,2900,7900 +2900,7820,2900,7740 +2900,7660,2900,7740 +2900,7560,2900,7660 +2900,7460,2900,7560 +2900,7460,2900,7360 +2900,7260,2900,7360 +2840,7160,2900,7260 +2800,7080,2840,7160 +2700,7100,2800,7080 +2560,7120,2700,7100 +2400,7100,2560,7120 +2320,7100,2400,7100 +2140,7100,2320,7100 +2040,7080,2140,7100 +1940,7080,2040,7080 +1820,7140,1940,7080 +1680,7140,1820,7140 +1540,7140,1680,7140 +1420,7220,1540,7140 +1280,7220,1380,7220 +1140,7200,1280,7220 +1000,7220,1140,7200 +760,7280,900,7320 +540,7220,760,7280 +300,7180,540,7220 +180,7120,180,7160 +40,7140,180,7120 +-60,7160,40,7140 +-200,7120,-60,7160 +180,7160,300,7180 +-260,7060,-200,7120 +-260,6980,-260,7060 +-260,6880,-260,6980 +-260,6880,-260,6820 +-260,6820,-200,6760 +-200,6760,-100,6740 +-100,6740,-60,6740 +-60,6740,40,6740 +40,6740,300,6800 +300,6800,420,6760 +420,6760,500,6740 +500,6740,540,6760 +540,6760,540,6760 +540,6760,640,6780 +640,6660,640,6780 +580,6580,640,6660 +580,6440,580,6580 +580,6440,640,6320 +640,6320,640,6180 +580,6080,640,6180 +580,6080,640,5960 +640,5960,640,5840 +640,5840,640,5700 +640,5700,660,5560 +660,5560,660,5440 +660,5440,660,5300 +660,5140,660,5300 +660,5140,660,5000 +660,5000,660,4880 +660,4880,820,4860 +820,4860,1000,4840 +1000,4840,1100,4860 +1100,4860,1280,4860 +1280,4860,1420,4840 +1420,4840,1580,4860 +1580,4860,1720,4820 +1720,4820,1880,4860 +1880,4860,2000,4840 +2000,4840,2140,4840 +2140,4840,2320,4860 +2320,4860,2440,4880 +2440,4880,2600,4880 +2600,4880,2800,4880 +2800,4880,2900,4880 +2900,4880,2900,4820 +2900,4740,2900,4820 +2800,4700,2900,4740 +2520,4680,2800,4700 +2240,4660,2520,4680 +1940,4620,2240,4660 +1820,4580,1940,4620 +1820,4500,1820,4580 +1820,4500,1880,4420 +1880,4420,2000,4420 +2000,4420,2200,4420 +2200,4420,2400,4440 +2400,4440,2600,4440 +2600,4440,2840,4440 +2840,4440,2900,4400 +2740,4260,2900,4280 +2600,4240,2740,4260 +2480,4280,2600,4240 +2320,4240,2480,4280 +2140,4220,2320,4240 +1940,4220,2140,4220 +1880,4160,1940,4220 +1880,4160,1880,4080 +1880,4080,2040,4040 +2040,4040,2240,4060 +2240,4060,2400,4040 +2400,4040,2600,4060 +2600,4060,2740,4020 +2740,4020,2840,3940 +2840,3780,2840,3940 +2740,3660,2840,3780 +2700,3680,2740,3660 +2520,3700,2700,3680 +2380,3700,2520,3700 +2200,3720,2380,3700 +2040,3720,2200,3720 +1880,3700,2040,3720 +1820,3680,1880,3700 +1760,3600,1820,3680 +1760,3600,1820,3480 +1820,3480,1880,3440 +1880,3440,1960,3460 +1960,3460,2140,3460 +2140,3460,2380,3460 +2380,3460,2640,3440 +2640,3440,2900,3380 +2840,3280,2900,3380 +2840,3280,2900,3200 +2900,3200,2900,3140 +2840,3020,2900,3140 +2800,2960,2840,3020 +2700,3000,2800,2960 +2600,2980,2700,3000 +2380,3000,2600,2980 +2140,3000,2380,3000 +1880,3000,2140,3000 +1720,3040,1880,3000 +1640,2960,1720,3040 +1500,2940,1640,2960 +1340,3000,1500,2940 +1240,3000,1340,3000 +1140,3020,1240,3000 +1040,3000,1140,3020 +960,2960,1040,3000 +900,2960,960,2960 +840,2840,900,2960 +700,2820,840,2840 +540,2820,700,2820 +420,2820,540,2820 +180,2800,420,2820 +60,2780,180,2800 +-60,2800,60,2780 +-160,2760,-60,2800 +-260,2740,-160,2760 +-300,2640,-260,2740 +-360,2560,-300,2640 +-380,2460,-360,2560 +-380,2460,-300,2380 +-300,2300,-300,2380 +-300,2300,-300,2220 +-300,2100,-300,2220 +-300,2100,-300,2040 +-300,2040,-160,2040 +-160,2040,-60,2040 +-60,2040,60,2040 +60,2040,180,2040 +180,2040,360,2040 +360,2040,540,2040 +540,2040,700,2080 +660,2160,700,2080 +660,2160,700,2260 +660,2380,700,2260 +500,2340,660,2380 +360,2340,500,2340 +240,2340,360,2340 +40,2320,240,2340 +-60,2320,40,2320 +-100,2380,-60,2320 +-100,2380,-100,2460 +-100,2460,-100,2540 +-100,2540,0,2560 +0,2560,140,2600 +140,2600,300,2600 +300,2600,460,2600 +460,2600,640,2600 +640,2600,760,2580 +760,2580,820,2560 +820,2560,820,2500 +820,2500,820,2400 +820,2400,840,2320 +840,2320,840,2240 +820,2120,840,2240 +820,2020,820,2120 +820,1900,820,2020 +760,1840,820,1900 +640,1840,760,1840 +500,1840,640,1840 +300,1860,420,1880 +180,1840,300,1860 +420,1880,500,1840 +0,1840,180,1840 +-60,1860,0,1840 +-160,1840,-60,1860 +-200,1800,-160,1840 +-260,1760,-200,1800 +-260,1680,-260,1760 +-260,1620,-260,1680 +-260,1540,-260,1620 +-260,1540,-260,1460 +-300,1420,-260,1460 +-300,1420,-300,1340 +-300,1340,-260,1260 +-260,1260,-260,1160 +-260,1060,-260,1160 +-260,1060,-260,960 +-260,880,-260,960 +-260,880,-260,780 +-260,780,-260,680 +-300,580,-260,680 +-300,580,-300,480 +-300,480,-260,400 +-300,320,-260,400 +-300,320,-300,240 +-300,240,-200,220 +-200,220,-200,160 +-200,160,-100,140 +-100,140,0,120 +0,120,60,120 +60,120,180,120 +180,120,300,120 +300,120,420,140 +420,140,580,180 +580,180,760,180 +760,180,900,180 +960,180,1100,180 +1100,180,1340,200 +1340,200,1580,200 +1580,200,1720,180 +1720,180,2000,140 +2000,140,2240,140 +2240,140,2480,140 +2520,140,2800,160 +2800,160,3000,160 +3000,160,3140,160 +3140,260,3140,160 +3140,260,3140,380 +3080,500,3140,380 +3080,620,3080,500 +3080,620,3080,740 +3080,740,3080,840 +3080,960,3080,840 +3080,1080,3080,960 +3080,1080,3080,1200 +3080,1200,3080,1340 +3080,1340,3080,1460 +3080,1580,3080,1460 +3080,1700,3080,1580 +3080,1700,3080,1760 +3080,1760,3200,1760 +3200,1760,3320,1760 +3320,1760,3520,1760 +3520,1760,3680,1740 +3680,1740,3780,1700 +3780,1700,3840,1620 +3840,1620,3840,1520 +3840,1520,3840,1420 +3840,1320,3840,1420 +3840,1120,3840,1320 +3840,1120,3840,940 +3840,940,3840,760 +3780,600,3840,760 +3780,600,3780,440 +3780,320,3780,440 +3780,320,3780,160 +3780,60,3780,160 +3780,60,4020,60 +4020,60,4260,40 +4260,40,4500,40 +4500,40,4740,40 +4740,40,4840,20 +4840,20,4880,80 +4880,80,5080,40 +5080,40,5280,20 +5280,20,5500,0 +5500,0,5720,0 +5720,0,5940,60 +5940,60,6240,60 +6240,60,6540,20 +6540,20,6840,20 +6840,20,7040,0 +7040,0,7140,0 +7140,0,7400,20 +7400,20,7680,0 +7680,0,7940,0 +7940,0,8200,-20 +8200,-20,8360,20 +8360,20,8560,-40 +8560,-40,8760,0 +8760,0,8880,40 +8880,120,8880,40 +8840,220,8840,120 +8620,240,8840,220 +8420,260,8620,240 +8200,280,8420,260 +7940,280,8200,280 +7760,240,7940,280 +7560,220,7760,240 +7360,280,7560,220 +7140,260,7360,280 +6940,240,7140,260 +6720,220,6940,240 +6480,220,6720,220 +6360,300,6480,220 +6240,300,6360,300 +6200,500,6240,300 +6200,500,6360,540 +6360,540,6540,520 +6540,520,6720,480 +6720,480,6880,460 +6880,460,7080,500 +7080,500,7320,500 +7320,500,7680,500 +7680,620,7680,500 +7520,640,7680,620 +7360,640,7520,640 +7200,640,7360,640 +7040,660,7200,640 +6880,720,7040,660 +6720,700,6880,720 +6540,700,6720,700 +6420,760,6540,700 +6280,740,6420,760 +6240,760,6280,740 +6200,920,6240,760 +6200,920,6360,960 +6360,960,6540,960 +6540,960,6720,960 +6720,960,6760,980 +6760,980,6880,940 +6880,940,7080,940 +7080,940,7280,940 +7280,940,7520,920 +7520,920,7760,900 +7760,900,7980,860 +7980,860,8100,880 +8100,880,8280,900 +8280,900,8500,820 +8500,820,8700,820 +8700,820,8760,840 +8760,960,8760,840 +8700,1040,8760,960 +8560,1060,8700,1040 +8460,1080,8560,1060 +8360,1040,8460,1080 +8280,1080,8360,1040 +8160,1120,8280,1080 +8040,1120,8160,1120 +7940,1100,8040,1120 +7800,1120,7940,1100 +7680,1120,7800,1120 +7520,1100,7680,1120 +7360,1100,7520,1100 +7200,1120,7360,1100 +7040,1180,7200,1120 +6880,1160,7040,1180 +6720,1160,6880,1160 +6540,1160,6720,1160 +6360,1160,6540,1160 +6200,1160,6360,1160 +6040,1220,6200,1160 +6040,1220,6040,1400 +6040,1400,6200,1440 +6200,1440,6320,1440 +6320,1440,6440,1440 +6600,1440,6760,1440 +6760,1440,6940,1420 +6440,1440,6600,1440 +6940,1420,7280,1400 +7280,1400,7560,1400 +7560,1400,7760,1400 +7760,1400,7940,1360 +7940,1360,8100,1380 +8100,1380,8280,1340 +8280,1340,8460,1320 +8660,1300,8760,1360 +8460,1320,8660,1300 +8760,1360,8800,1500 +8800,1660,8800,1500 +8800,1660,8800,1820 +8700,1840,8800,1820 +8620,1860,8700,1840 +8560,1800,8620,1860 +8560,1800,8620,1680 +8500,1640,8620,1680 +8420,1680,8500,1640 +8280,1680,8420,1680 +8160,1680,8280,1680 +7900,1680,8160,1680 +7680,1680,7900,1680 +7400,1660,7680,1680 +7140,1680,7400,1660 +6880,1640,7140,1680 +6040,1820,6320,1780 +5900,1840,6040,1820 +6640,1700,6880,1640 +6320,1780,6640,1700 +5840,2040,5900,1840 +5840,2040,5840,2220 +5840,2220,5840,2320 +5840,2460,5840,2320 +5840,2560,5840,2460 +5840,2560,5960,2620 +5960,2620,6200,2620 +6200,2620,6380,2600 +6380,2600,6600,2580 +6600,2580,6800,2600 +6800,2600,7040,2580 +7040,2580,7280,2580 +7280,2580,7480,2560 +7760,2540,7980,2520 +7980,2520,8160,2500 +7480,2560,7760,2540 +8160,2500,8160,2420 +8160,2420,8160,2320 +8160,2180,8160,2320 +7980,2160,8160,2180 +7800,2180,7980,2160 +7600,2200,7800,2180 +7400,2200,7600,2200 +6960,2200,7200,2200 +7200,2200,7400,2200 +6720,2200,6960,2200 +6540,2180,6720,2200 +6320,2200,6540,2180 +6240,2160,6320,2200 +6240,2160,6240,2040 +6240,2040,6240,1940 +6240,1940,6440,1940 +6440,1940,6720,1940 +6720,1940,6940,1920 +7520,1920,7760,1920 +6940,1920,7280,1920 +7280,1920,7520,1920 +7760,1920,8100,1900 +8100,1900,8420,1900 +8420,1900,8460,1940 +8460,2120,8460,1940 +8460,2280,8460,2120 +8460,2280,8560,2420 +8560,2420,8660,2380 +8660,2380,8800,2340 +8800,2340,8840,2400 +8840,2520,8840,2400 +8800,2620,8840,2520 +8800,2740,8800,2620 +8800,2860,8800,2740 +8800,2940,8800,2860 +8760,2980,8800,2940 +8660,2980,8760,2980 +8620,2960,8660,2980 +8560,2880,8620,2960 +8560,2880,8560,2780 +8500,2740,8560,2780 +8420,2760,8500,2740 +8420,2840,8420,2760 +8420,2840,8420,2940 +8420,3040,8420,2940 +8420,3160,8420,3040 +8420,3280,8420,3380 +8420,3280,8420,3160 +8420,3380,8620,3460 +8620,3460,8760,3460 +8760,3460,8840,3400 +8840,3400,8960,3400 +8960,3400,9000,3500 +9000,3700,9000,3500 +9000,3900,9000,3700 +9000,4080,9000,3900 +9000,4280,9000,4080 +9000,4500,9000,4280 +9000,4620,9000,4500 +9000,4780,9000,4620 +9000,4780,9000,4960 +9000,5120,9000,4960 +9000,5120,9000,5300 +8960,5460,9000,5300 +8920,5620,8960,5460 +8920,5620,8920,5800 +8920,5800,8920,5960 +8920,5960,8920,6120 +8920,6120,8960,6300 +8960,6300,8960,6480 +8960,6660,8960,6480 +8960,6860,8960,6660 +8960,7040,8960,6860 +8920,7420,8920,7220 +8920,7420,8960,7620 +8960,7620,8960,7800 +8960,7800,8960,8000 +8960,8000,8960,8180 +8960,8180,8960,8380 +8960,8580,8960,8380 +8920,8800,8960,8580 +8880,9000,8920,8800 +8840,9180,8880,9000 +8800,9220,8840,9180 +8800,9220,8840,9340 +8760,9380,8840,9340 +8560,9340,8760,9380 +8360,9360,8560,9340 +8160,9360,8360,9360 +8040,9340,8160,9360 +7860,9360,8040,9340 +7680,9360,7860,9360 +7520,9360,7680,9360 +7420,9260,7520,9360 +7400,9080,7420,9260 +7400,9080,7420,8860 +7420,8860,7440,8720 +7440,8720,7480,8660 +7480,8660,7520,8540 +7520,8540,7600,8460 +7600,8460,7800,8480 +7800,8480,8040,8480 +8040,8480,8280,8480 +8280,8480,8500,8460 +8500,8460,8620,8440 +8620,8440,8660,8340 +8660,8340,8660,8220 +8660,8220,8700,8080 +8700,8080,8700,7920 +8700,7920,8700,7760 +8700,7760,8700,7620 +8700,7480,8700,7620 +8700,7480,8700,7320 +8700,7160,8700,7320 +8920,7220,8960,7040 +8660,7040,8700,7160 +8660,7040,8700,6880 +8660,6700,8700,6880 +8660,6700,8700,6580 +8700,6460,8700,6580 +8700,6460,8700,6320 +8700,6160,8700,6320 +8700,6160,8760,6020 +8760,6020,8760,5860 +8760,5860,8760,5700 +8760,5700,8760,5540 +8760,5540,8760,5360 +8760,5360,8760,5180 +8760,5000,8760,5180 +8700,4820,8760,5000 +8560,4740,8700,4820 +8420,4700,8560,4740 +8280,4700,8420,4700 +8100,4700,8280,4700 +7980,4700,8100,4700 +7820,4740,7980,4700 +7800,4920,7820,4740 +7800,4920,7900,4960 +7900,4960,8060,4980 +8060,4980,8220,5000 +8220,5000,8420,5040 +8420,5040,8460,5120 +8460,5180,8460,5120 +8360,5200,8460,5180 +8360,5280,8360,5200 +8160,5300,8360,5280 +8040,5260,8160,5300 +7860,5220,8040,5260 +7720,5160,7860,5220 +7640,5120,7720,5160 +7480,5120,7640,5120 +7240,5120,7480,5120 +7000,5120,7240,5120 +6800,5160,7000,5120 +6640,5220,6800,5160 +6600,5360,6640,5220 +6600,5460,6600,5360 +6480,5520,6600,5460 +6240,5540,6480,5520 +5980,5540,6240,5540 +5740,5540,5980,5540 +5500,5520,5740,5540 +5400,5520,5500,5520 +5280,5540,5400,5520 +5080,5540,5280,5540 +4940,5540,5080,5540 +4760,5540,4940,5540 +4600,5540,4760,5540 +4440,5560,4600,5540 +4040,5580,4120,5520 +4260,5540,4440,5560 +4120,5520,4260,5540 +4020,5720,4040,5580 +4020,5840,4020,5720 +4020,5840,4080,5940 +4080,5940,4120,6040 +4120,6040,4200,6080 +4200,6080,4340,6080 +4340,6080,4500,6060 +4500,6060,4700,6060 +4700,6060,4880,6060 +4880,6060,5080,6060 +5080,6060,5280,6080 +5280,6080,5440,6100 +5440,6100,5660,6100 +5660,6100,5900,6080 +5900,6080,6120,6080 +6120,6080,6360,6080 +6360,6080,6480,6100 +6480,6100,6540,6060 +6540,6060,6720,6060 +6720,6060,6940,6060 +6940,6060,7140,6060 +7400,6060,7600,6060 +7140,6060,7400,6060 +7600,6060,7800,6060 +7800,6060,7860,6080 +7860,6080,8060,6080 +8060,6080,8220,6080 +8220,6080,8320,6140 +8320,6140,8360,6300 +8320,6460,8360,6300 +8320,6620,8320,6460 +8320,6800,8320,6620 +8320,6960,8320,6800 +8320,6960,8360,7120 +8320,7280,8360,7120 +8320,7440,8320,7280 +8320,7600,8320,7440 +8100,7580,8220,7600 +8220,7600,8320,7600 +7900,7560,8100,7580 +7680,7560,7900,7560 +7480,7580,7680,7560 +7280,7580,7480,7580 +7080,7580,7280,7580 +7000,7600,7080,7580 +6880,7600,7000,7600 +6800,7580,6880,7600 +6640,7580,6800,7580 +6540,7580,6640,7580 +6380,7600,6540,7580 +6280,7620,6380,7600 +6240,7700,6280,7620 +6240,7700,6240,7800 +6240,7840,6240,7800 +6080,7840,6240,7840 +5960,7820,6080,7840 +5660,7840,5800,7840 +5500,7800,5660,7840 +5440,7700,5500,7800 +5800,7840,5960,7820 +5440,7540,5440,7700 +5440,7440,5440,7540 +5440,7320,5440,7440 +5400,7320,5440,7320 +5340,7400,5400,7320 +5340,7400,5340,7500 +5340,7600,5340,7500 +5340,7600,5340,7720 +5340,7720,5340,7860 +5340,7860,5340,7960 +5340,7960,5440,8020 +5440,8020,5560,8020 +5560,8020,5720,8040 +5720,8040,5900,8060 +5900,8060,6080,8060 +6080,8060,6240,8060 +6720,8040,6840,8060 +6240,8060,6480,8040 +6480,8040,6720,8040 +6840,8060,6940,8060 +6940,8060,7080,8120 +7080,8120,7140,8180 +7140,8460,7140,8320 +7140,8620,7140,8460 +7140,8620,7140,8740 +7140,8860,7140,8740 +7140,8960,7140,8860 +7140,8960,7200,9080 +7140,9200,7200,9080 +7140,9200,7200,9320 +7200,9320,7200,9460 +7200,9760,7200,9900 +7200,9620,7200,9460 +7200,9620,7200,9760 +7200,9900,7200,10060 +7200,10220,7200,10060 +7200,10360,7200,10220 +7140,10400,7200,10360 +6880,10400,7140,10400 +6640,10360,6880,10400 +6420,10360,6640,10360 +6160,10380,6420,10360 +5940,10340,6160,10380 +5720,10320,5940,10340 +5500,10340,5720,10320 +5280,10300,5500,10340 +5080,10300,5280,10300 +4840,10280,5080,10300 +4700,10280,4840,10280 +4540,10280,4700,10280 +4360,10280,4540,10280 +4200,10300,4360,10280 +4040,10380,4200,10300 +4020,10500,4040,10380 +3980,10640,4020,10500 +3980,10640,3980,10760 +3980,10760,4020,10920 +4020,10920,4080,11000 +4080,11000,4340,11020 +4340,11020,4600,11060 +4600,11060,4840,11040 +4840,11040,4880,10960 +4880,10740,4880,10960 +4880,10740,4880,10600 +4880,10600,5080,10560 +5080,10560,5340,10620 +5340,10620,5660,10620 +5660,10620,6040,10600 +6040,10600,6120,10620 +6120,10620,6240,10720 +6240,10720,6420,10740 +6420,10740,6640,10760 +6640,10760,6880,10780 +7140,10780,7400,10780 +6880,10780,7140,10780 +7400,10780,7680,10780 +7680,10780,8100,10760 +8100,10760,8460,10740 +8460,10740,8700,10760 +8800,10840,8800,10980 +8700,10760,8800,10840 +8760,11200,8800,10980 +8760,11200,8760,11380 +8760,11380,8800,11560 +8760,11680,8800,11560 +8760,11760,8760,11680 +8760,11760,8760,11920 +8760,11920,8800,12080 +8800,12200,8800,12080 +8700,12240,8800,12200 +8560,12220,8700,12240 +8360,12220,8560,12220 +8160,12240,8360,12220 +7720,12220,7980,12220 +7980,12220,8160,12240 +7400,12200,7720,12220 +7200,12180,7400,12200 +7000,12160,7200,12180 +6800,12160,7000,12160 +6280,12140,6380,12180 +6120,12180,6280,12140 +6540,12180,6800,12160 +6380,12180,6540,12180 +5900,12200,6120,12180 +5620,12180,5900,12200 +5340,12120,5620,12180 +5140,12100,5340,12120 +4980,12120,5140,12100 +4840,12120,4980,12120 +4700,12200,4840,12120 +4700,12380,4700,12200 +4740,12480,4940,12520 +4700,12380,4740,12480 +4940,12520,5160,12560 +5160,12560,5340,12600 +5340,12600,5400,12600 +5400,12600,5500,12600 +5500,12600,5620,12600 +5620,12600,5720,12560 +5720,12560,5800,12440 +5800,12440,5900,12380 +5900,12380,6120,12420 +6120,12420,6380,12440 +6380,12440,6600,12460 +6720,12460,6840,12520 +6840,12520,6960,12520 +6600,12460,6720,12460 +6960,12520,7040,12500 +7040,12500,7140,12440 +7200,12440,7360,12500 +7360,12500,7600,12560 +7600,12560,7860,12600 +7860,12600,8060,12500 +8100,12500,8200,12340 +8200,12340,8360,12360 +8360,12360,8560,12400 +8560,12400,8660,12420 +8660,12420,8840,12400 +8840,12400,9000,12360 +9000,12360,9000,12360 +2900,4400,2900,4280 +900,7320,1000,7220 +2640,13040,2900,12920 +2900,12920,3160,12840 +3480,12760,3780,12620 +3780,12620,4020,12460 +4300,12360,4440,12260 +4020,12460,4300,12360 +3160,12840,3480,12760 +4440,12080,4440,12260 +4440,12080,4440,11880 +4440,11880,4440,11720 +4440,11720,4600,11720 +4600,11720,4760,11740 +4760,11740,4980,11760 +4980,11760,5160,11760 +5160,11760,5340,11780 +6000,11860,6120,11820 +5340,11780,5620,11820 +5620,11820,6000,11860 +6120,11820,6360,11820 +6360,11820,6640,11860 +6940,11920,7240,11940 +7240,11940,7520,11960 +7520,11960,7860,11960 +7860,11960,8100,11920 +8100,11920,8420,11940 +8420,11940,8460,11960 +8460,11960,8500,11860 +8460,11760,8500,11860 +8320,11720,8460,11760 +8160,11720,8320,11720 +7940,11720,8160,11720 +7720,11700,7940,11720 +7520,11680,7720,11700 +7320,11680,7520,11680 +7200,11620,7320,11680 +7200,11620,7200,11500 +7200,11500,7280,11440 +7280,11440,7420,11440 +7420,11440,7600,11440 +7600,11440,7980,11460 +7980,11460,8160,11460 +8160,11460,8360,11460 +8360,11460,8460,11400 +8420,11060,8500,11200 +8280,11040,8420,11060 +8100,11060,8280,11040 +8460,11400,8500,11200 +7800,11060,8100,11060 +7520,11060,7800,11060 +7240,11060,7520,11060 +6940,11040,7240,11060 +6640,11000,6940,11040 +6420,10980,6640,11000 +6360,11060,6420,10980 +6360,11180,6360,11060 +6200,11280,6360,11180 +5960,11300,6200,11280 +5720,11280,5960,11300 +5500,11280,5720,11280 +4940,11300,5200,11280 +4660,11260,4940,11300 +4440,11280,4660,11260 +4260,11280,4440,11280 +4220,11220,4260,11280 +4080,11280,4220,11220 +3980,11420,4080,11280 +3980,11420,4040,11620 +4040,11620,4040,11820 +3980,11960,4040,11820 +3840,12000,3980,11960 +3720,11940,3840,12000 +3680,11800,3720,11940 +3680,11580,3680,11800 +3680,11360,3680,11580 +3680,11360,3680,11260 +3680,11080,3680,11260 +3680,11080,3680,10880 +3680,10700,3680,10880 +3680,10700,3680,10620 +3680,10480,3680,10620 +3680,10480,3680,10300 +3680,10300,3680,10100 +3680,10100,3680,9940 +3680,9940,3720,9860 +3720,9860,3920,9900 +3920,9900,4220,9880 +4980,9940,5340,9960 +4220,9880,4540,9900 +4540,9900,4980,9940 +5340,9960,5620,9960 +5620,9960,5900,9960 +5900,9960,6160,10000 +6160,10000,6480,10000 +6480,10000,6720,10000 +6720,10000,6880,9860 +6880,9860,6880,9520 +6880,9520,6940,9340 +6940,9120,6940,9340 +6940,9120,6940,8920 +6940,8700,6940,8920 +6880,8500,6940,8700 +6880,8320,6880,8500 +7140,8320,7140,8180 +6760,8260,6880,8320 +6540,8240,6760,8260 +6420,8180,6540,8240 +6280,8240,6420,8180 +6160,8300,6280,8240 +6120,8400,6160,8300 +6080,8520,6120,8400 +5840,8480,6080,8520 +5620,8500,5840,8480 +5500,8500,5620,8500 +5340,8560,5500,8500 +5160,8540,5340,8560 +4620,8520,4880,8520 +4360,8480,4620,8520 +4880,8520,5160,8540 +4140,8440,4360,8480 +3920,8460,4140,8440 +3720,8380,3920,8460 +3680,8160,3720,8380 +3680,8160,3720,7940 +3720,7720,3720,7940 +3680,7580,3720,7720 +3680,7580,3720,7440 +3720,7440,3720,7300 +3720,7160,3720,7300 +3720,7160,3720,7020 +3720,7020,3780,6900 +3780,6900,4080,6940 +4080,6940,4340,6980 +4340,6980,4600,6980 +4600,6980,4880,6980 +4880,6980,5160,6980 +5160,6980,5400,7000 +5400,7000,5560,7020 +5560,7020,5660,7080 +5660,7080,5660,7280 +5660,7280,5660,7440 +5660,7440,5740,7520 +5740,7520,5740,7600 +5740,7600,5900,7600 +5900,7600,6040,7540 +6040,7540,6040,7320 +6040,7320,6120,7200 +6120,7200,6120,7040 +6120,7040,6240,7000 +6240,7000,6480,7060 +6480,7060,6800,7060 +6800,7060,7080,7080 +7080,7080,7320,7100 +7940,7100,7980,6920 +7860,6860,7980,6920 +7640,6860,7860,6860 +7400,6840,7640,6860 +7320,7100,7560,7120 +7560,7120,7760,7120 +7760,7120,7940,7100 +7200,6820,7400,6840 +7040,6820,7200,6820 +6600,6840,6840,6840 +6380,6800,6600,6840 +6120,6800,6380,6800 +5900,6840,6120,6800 +5620,6820,5900,6840 +5400,6800,5620,6820 +5140,6800,5400,6800 +4880,6780,5140,6800 +4600,6760,4880,6780 +4340,6760,4600,6760 +4080,6760,4340,6760 +3840,6740,4080,6760 +3680,6720,3840,6740 +3680,6720,3680,6560 +3680,6560,3720,6400 +3720,6400,3720,6200 +3720,6200,3780,6000 +3720,5780,3780,6000 +3720,5580,3720,5780 +3720,5360,3720,5580 +3720,5360,3840,5240 +3840,5240,4200,5260 +4200,5260,4600,5280 +4600,5280,4880,5280 +4880,5280,5140,5200 +5140,5200,5220,5100 +5220,5100,5280,4900 +5280,4900,5340,4840 +5340,4840,5720,4880 +6120,4880,6480,4860 +6880,4840,7200,4860 +6480,4860,6880,4840 +7200,4860,7320,4860 +7320,4860,7360,4740 +7360,4600,7440,4520 +7360,4600,7360,4740 +7440,4520,7640,4520 +7640,4520,7800,4480 +7800,4480,7800,4280 +7800,4280,7800,4040 +7800,4040,7800,3780 +7800,3560,7800,3780 +7800,3560,7860,3440 +7860,3440,8060,3460 +8060,3460,8160,3340 +8160,3340,8160,3140 +8160,3140,8160,2960 +8000,2900,8160,2960 +7860,2900,8000,2900 +7640,2940,7860,2900 +7400,2980,7640,2940 +7100,2980,7400,2980 +6840,3000,7100,2980 +5620,2980,5840,2980 +5840,2980,6500,3000 +6500,3000,6840,3000 +5560,2780,5620,2980 +5560,2780,5560,2580 +5560,2580,5560,2380 +5560,2140,5560,2380 +5560,2140,5560,1900 +5560,1900,5620,1660 +5620,1660,5660,1460 +5660,1460,5660,1300 +5500,1260,5660,1300 +5340,1260,5500,1260 +4600,1220,4840,1240 +4440,1220,4600,1220 +4440,1080,4440,1220 +4440,1080,4600,1020 +5080,1260,5340,1260 +4840,1240,5080,1260 +4600,1020,4940,1020 +4940,1020,5220,1020 +5220,1020,5560,960 +5560,960,5660,860 +5660,740,5660,860 +5280,740,5660,740 +4940,780,5280,740 +4660,760,4940,780 +4500,700,4660,760 +4500,520,4500,700 +4500,520,4700,460 +4700,460,5080,440 +5440,420,5740,420 +5080,440,5440,420 +5740,420,5840,360 +5800,280,5840,360 +5560,280,5800,280 +4980,300,5280,320 +4360,320,4660,300 +4200,360,4360,320 +5280,320,5560,280 +4660,300,4980,300 +4140,480,4200,360 +4140,480,4140,640 +4140,640,4200,780 +4200,780,4200,980 +4200,980,4220,1180 +4220,1400,4220,1180 +4220,1400,4260,1540 +4260,1540,4500,1540 +4500,1540,4700,1520 +4700,1520,4980,1540 +5280,1560,5400,1560 +4980,1540,5280,1560 +5400,1560,5400,1700 +5400,1780,5400,1700 +5340,1900,5400,1780 +5340,2020,5340,1900 +5340,2220,5340,2020 +5340,2220,5340,2420 +5340,2420,5340,2520 +5080,2600,5220,2580 +5220,2580,5340,2520 +4900,2580,5080,2600 +4700,2540,4900,2580 +4500,2540,4700,2540 +4220,2580,4340,2540 +4200,2700,4220,2580 +4340,2540,4500,2540 +3980,2740,4200,2700 +3840,2740,3980,2740 +3780,2640,3840,2740 +3780,2640,3780,2460 +3780,2280,3780,2460 +3620,2020,3780,2100 +3780,2280,3780,2100 +3360,2040,3620,2020 +3080,2040,3360,2040 +2840,2020,3080,2040 +2740,1940,2840,2020 +2740,1940,2800,1800 +2800,1640,2800,1800 +2800,1640,2800,1460 +2800,1300,2800,1460 +2700,1180,2800,1300 +2480,1140,2700,1180 +1580,1200,1720,1200 +2240,1180,2480,1140 +1960,1180,2240,1180 +1720,1200,1960,1180 +1500,1320,1580,1200 +1500,1440,1500,1320 +1500,1440,1760,1480 +1760,1480,1940,1480 +1940,1480,2140,1500 +2140,1500,2320,1520 +2400,1560,2400,1700 +2280,1820,2380,1780 +2320,1520,2400,1560 +2380,1780,2400,1700 +2080,1840,2280,1820 +1720,1820,2080,1840 +1420,1800,1720,1820 +1280,1800,1420,1800 +1240,1720,1280,1800 +1240,1720,1240,1600 +1240,1600,1280,1480 +1280,1340,1280,1480 +1180,1280,1280,1340 +1000,1280,1180,1280 +760,1280,1000,1280 +360,1240,540,1260 +180,1220,360,1240 +540,1260,760,1280 +180,1080,180,1220 +180,1080,180,1000 +180,1000,360,940 +360,940,540,960 +540,960,820,980 +1100,980,1200,920 +820,980,1100,980 +6640,11860,6940,11920 +5200,11280,5500,11280 +4120,7330,4120,7230 +4120,7230,4660,7250 +4660,7250,4940,7250 +4940,7250,5050,7340 +5010,7400,5050,7340 +4680,7380,5010,7400 +4380,7370,4680,7380 +4120,7330,4360,7370 +4120,7670,4120,7760 +4120,7670,4280,7650 +4280,7650,4540,7660 +4550,7660,4820,7680 +4820,7680,4900,7730 +4880,7800,4900,7730 +4620,7820,4880,7800 +4360,7790,4620,7820 +4120,7760,4360,7790 +6840,6840,7040,6820 +5720,4880,6120,4880 +1200,920,1340,810 +1340,810,1520,790 +1520,790,1770,800 +2400,790,2600,750 +2600,750,2640,520 +2520,470,2640,520 +2140,470,2520,470 +1760,800,2090,800 +2080,800,2400,790 +1760,450,2140,470 +1420,450,1760,450 +1180,440,1420,450 +900,480,1180,440 +640,450,900,480 +360,440,620,450 +120,430,360,440 +0,520,120,430 +-20,780,0,520 +-20,780,-20,1020 +-20,1020,-20,1150 +-20,1150,0,1300 +0,1470,60,1530 +0,1300,0,1470 +60,1530,360,1530 +360,1530,660,1520 +660,1520,980,1520 +980,1520,1040,1520 +1040,1520,1070,1560 +1070,1770,1070,1560 +1070,1770,1100,2010 +1070,2230,1100,2010 +1070,2240,1180,2340 +1180,2340,1580,2340 +1580,2340,1940,2350 +1940,2350,2440,2350 +2440,2350,2560,2380 +2560,2380,2600,2540 +2810,2640,3140,2680 +2600,2540,2810,2640 +3140,2680,3230,2780 +3230,2780,3260,2970 +3230,3220,3260,2970 +3200,3470,3230,3220 +3200,3480,3210,3760 +3210,3760,3210,4040 +3200,4040,3230,4310 +3210,4530,3230,4310 +3210,4530,3230,4730 +3230,4960,3230,4730 +3230,4960,3260,5190 +3170,5330,3260,5190 +2920,5330,3170,5330 +2660,5360,2920,5330 +2420,5330,2660,5360 +2200,5280,2400,5330 +2020,5280,2200,5280 +1840,5260,2020,5280 +1660,5280,1840,5260 +1500,5300,1660,5280 +1360,5270,1500,5300 +1200,5290,1340,5270 +1070,5400,1200,5290 +1040,5630,1070,5400 +1000,5900,1040,5630 +980,6170,1000,5900 +980,6280,980,6170 +980,6540,980,6280 +980,6540,1040,6720 +1040,6720,1360,6730 +1360,6730,1760,6710 +2110,6720,2420,6730 +1760,6710,2110,6720 +2420,6730,2640,6720 +2640,6720,2970,6720 +2970,6720,3160,6700 +3160,6700,3240,6710 +3240,6710,3260,6890 +3260,7020,3260,6890 +3230,7180,3260,7020 +3230,7350,3230,7180 +3210,7510,3230,7350 +3210,7510,3210,7690 +3210,7870,3210,7690 +3210,7870,3210,7980 +3200,8120,3210,7980 +3200,8330,3200,8120 +3160,8520,3200,8330 +2460,11100,2480,11020 +2200,11180,2460,11100 +1260,11350,1600,11320 +600,11430,930,11400 +180,11340,620,11430 +1600,11320,1910,11280 +1910,11280,2200,11180 +923.0029599285435,11398.99893503157,1264.002959928544,11351.99893503157
\ No newline at end of file diff --git a/samples/99_sample_game_the_little_probe/level_lava.txt b/samples/99_sample_game_the_little_probe/level_lava.txt new file mode 100644 index 0000000..e2bc2bd --- /dev/null +++ b/samples/99_sample_game_the_little_probe/level_lava.txt @@ -0,0 +1,235 @@ +100,10740,500,10780 +500,10780,960,10760 +960,10760,1340,10760 +1380,10760,1820,10780 +1820,10780,2240,10780 +2280,10780,2740,10740 +2740,10740,3000,10780 +3000,10780,3140,11020 +-520,8820,-480,9160 +-520,8480,-520,8820 +-520,8480,-480,8180 +-480,8180,-200,8120 +-200,8120,100,8220 +100,8220,420,8240 +420,8240,760,8260 +760,8260,1140,8280 +1140,8280,1500,8200 +1500,8200,1880,8240 +1880,8240,2240,8260 +2240,8260,2320,8480 +2320,8480,2380,8680 +2240,8860,2380,8680 +2240,9080,2240,8860 +2240,9080,2320,9260 +2320,9260,2480,9440 +2480,9440,2600,9640 +2480,9840,2600,9640 +2400,10020,2480,9840 +2240,10080,2400,10020 +1960,10080,2240,10080 +1720,10080,1960,10080 +1460,10080,1720,10080 +1180,10080,1420,10080 +900,10080,1180,10080 +640,10080,900,10080 +640,10080,640,9900 +60,10520,100,10740 +40,10240,60,10520 +40,10240,40,9960 +40,9960,40,9680 +40,9680,40,9360 +40,9360,60,9080 +60,9080,100,8860 +100,8860,460,9040 +460,9040,760,9220 +760,9220,1140,9220 +1140,9220,1720,9200 +-660,11580,-600,11420 +-660,11800,-660,11580 +-660,12000,-660,11800 +-660,12000,-600,12220 +-600,12220,-600,12440 +-600,12440,-600,12640 +-600,11240,-260,11280 +-260,11280,100,11240 +9000,12360,9020,12400 +9020,12620,9020,12400 +9020,12840,9020,12620 +9020,13060,9020,12840 +9020,13060,9020,13240 +9020,13240,9020,13420 +9020,13420,9020,13600 +9020,13600,9020,13780 +8880,13900,9020,13780 +8560,13800,8880,13900 +8220,13780,8560,13800 +7860,13760,8220,13780 +7640,13780,7860,13760 +7360,13800,7640,13780 +7100,13800,7360,13800 +6540,13760,6800,13780 +6800,13780,7100,13800 +6280,13760,6540,13760 +5760,13760,6280,13760 +5220,13780,5760,13760 +4700,13760,5220,13780 +4200,13740,4700,13760 +3680,13720,4200,13740 +3140,13700,3680,13720 +2600,13680,3140,13700 +2040,13940,2600,13680 +1640,13940,2040,13940 +1200,13960,1640,13940 +840,14000,1200,13960 +300,13960,840,14000 +-200,13900,300,13960 +-600,12840,-600,12640 +-600,13140,-600,12840 +-600,13140,-600,13420 +-600,13700,-600,13420 +-600,13700,-600,13820 +-600,13820,-200,13900 +-600,11240,-560,11000 +-560,11000,-480,10840 +-520,10660,-480,10840 +-520,10660,-520,10480 +-520,10480,-520,10300 +-520,10260,-480,10080 +-480,9880,-440,10060 +-520,9680,-480,9880 +-520,9680,-480,9400 +-480,9400,-480,9160 +1820,9880,2140,9800 +1540,9880,1820,9880 +1200,9920,1500,9880 +900,9880,1200,9920 +640,9900,840,9880 +2380,8760,2800,8760 +2800,8760,2840,8660 +2840,8660,2840,8420 +2840,8160,2840,8420 +2800,7900,2840,8160 +2800,7900,2800,7720 +2800,7540,2800,7720 +2800,7540,2800,7360 +2700,7220,2800,7360 +2400,7220,2700,7220 +2080,7240,2400,7220 +1760,7320,2080,7240 +1380,7360,1720,7320 +1040,7400,1340,7360 +640,7400,1000,7420 +300,7380,640,7400 +0,7300,240,7380 +-300,7180,-60,7300 +-380,6860,-360,7180 +-380,6880,-360,6700 +-360,6700,-260,6540 +-260,6540,0,6520 +0,6520,240,6640 +240,6640,460,6640 +460,6640,500,6480 +500,6260,500,6480 +460,6060,500,6260 +460,5860,460,6060 +460,5860,500,5640 +500,5640,540,5440 +540,5440,580,5220 +580,5220,580,5000 +580,4960,580,4740 +580,4740,960,4700 +960,4700,1140,4760 +1140,4760,1420,4740 +1420,4740,1720,4700 +1720,4700,2000,4740 +2000,4740,2380,4760 +2380,4760,2700,4800 +1720,4600,1760,4300 +1760,4300,2200,4340 +2200,4340,2560,4340 +2560,4340,2740,4340 +2160,12580,2440,12400 +1820,12840,2160,12580 +1500,13080,1820,12840 +1140,13340,1500,13080 +1140,13340,1580,13220 +2110,13080,2520,13000 +2520,13000,2900,12800 +1580,13220,2110,13080 +2900,12800,3200,12680 +3200,12680,3440,12640 +3440,12640,3720,12460 +3720,12460,4040,12320 +4040,12320,4360,12200 +4360,11940,4380,12180 +4360,11700,4360,11940 +4360,11700,4540,11500 +4540,11500,4880,11540 +6000,11660,6280,11640 +5440,11600,5720,11610 +5720,11610,6000,11660 +6280,11640,6760,11720 +6760,11720,7060,11780 +7060,11780,7360,11810 +7360,11810,7640,11840 +7640,11840,8000,11830 +8000,11830,8320,11850 +8320,11850,8390,11800 +8330,11760,8390,11800 +8160,11760,8330,11760 +7910,11750,8160,11760 +7660,11740,7900,11750 +7400,11730,7660,11740 +7160,11680,7400,11730 +7080,11570,7160,11680 +7080,11570,7100,11350 +7100,11350,7440,11280 +7440,11280,7940,11280 +7960,11280,8360,11280 +5840,11540,6650,11170 +4880,11540,5440,11600 +3410,11830,3420,11300 +3410,11260,3520,10920 +3520,10590,3520,10920 +3520,10590,3540,10260 +3520,9900,3540,10240 +3520,9900,3640,9590 +3640,9570,4120,9590 +4140,9590,4600,9680 +4620,9680,5030,9730 +5120,9750,5520,9800 +5620,9820,6080,9800 +6130,9810,6580,9820 +6640,9820,6800,9700 +6780,9400,6800,9700 +6780,9400,6840,9140 +6820,8860,6840,9120 +6780,8600,6820,8830 +6720,8350,6780,8570 +6480,8340,6720,8320 +6260,8400,6480,8340 +6050,8580,6240,8400 +5760,8630,6040,8590 +5520,8690,5740,8630 +5120,8690,5450,8700 +4570,8670,5080,8690 +4020,8610,4540,8670 +3540,8480,4020,8610 +3520,8230,3520,8480 +3520,7930,3520,8230 +3520,7930,3540,7630 +3480,7320,3540,7610 +3480,7280,3500,7010 +3500,6980,3680,6850 +3680,6850,4220,6840 +4230,6840,4760,6850 +4780,6850,5310,6860 +5310,6860,5720,6940 +5720,6940,5880,7250 +5880,7250,5900,7520 +100,11240,440,11300 +440,11300,760,11330 +1480,11280,1840,11230 +2200,11130,2360,11090 +1840,11230,2200,11130
\ No newline at end of file diff --git a/samples/99_sample_game_the_little_probe/license-for-sample.txt b/samples/99_sample_game_the_little_probe/license-for-sample.txt new file mode 100644 index 0000000..b1005ed --- /dev/null +++ b/samples/99_sample_game_the_little_probe/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC, Amir Rajan + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_game_the_little_probe/metadata/game_metadata.txt b/samples/99_sample_game_the_little_probe/metadata/game_metadata.txt new file mode 100644 index 0000000..cba2788 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/metadata/game_metadata.txt @@ -0,0 +1,6 @@ +devid=amirrajan +devtitle=Amir Rajan +gameid=the-little-probe +gametitle=The Little Probe +version=1.0 +icon=sprites/probe.png diff --git a/samples/99_sample_game_the_little_probe/sounds/0301.wav b/samples/99_sample_game_the_little_probe/sounds/0301.wav Binary files differnew file mode 100644 index 0000000..13bdf5a --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0301.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0302.wav b/samples/99_sample_game_the_little_probe/sounds/0302.wav Binary files differnew file mode 100644 index 0000000..b3e5849 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0302.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0303.wav b/samples/99_sample_game_the_little_probe/sounds/0303.wav Binary files differnew file mode 100644 index 0000000..0871983 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0303.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0304.wav b/samples/99_sample_game_the_little_probe/sounds/0304.wav Binary files differnew file mode 100644 index 0000000..9ee599e --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0304.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0305.wav b/samples/99_sample_game_the_little_probe/sounds/0305.wav Binary files differnew file mode 100644 index 0000000..d2f919f --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0305.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0306.wav b/samples/99_sample_game_the_little_probe/sounds/0306.wav Binary files differnew file mode 100644 index 0000000..4f15476 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0306.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0307.wav b/samples/99_sample_game_the_little_probe/sounds/0307.wav Binary files differnew file mode 100644 index 0000000..ffb55f9 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0307.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0308.wav b/samples/99_sample_game_the_little_probe/sounds/0308.wav Binary files differnew file mode 100644 index 0000000..86cae87 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0308.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0309.wav b/samples/99_sample_game_the_little_probe/sounds/0309.wav Binary files differnew file mode 100644 index 0000000..1dd2a65 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0309.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0310.wav b/samples/99_sample_game_the_little_probe/sounds/0310.wav Binary files differnew file mode 100644 index 0000000..cc0df6f --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0310.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0311.wav b/samples/99_sample_game_the_little_probe/sounds/0311.wav Binary files differnew file mode 100644 index 0000000..0e85a2d --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0311.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0312.wav b/samples/99_sample_game_the_little_probe/sounds/0312.wav Binary files differnew file mode 100644 index 0000000..0680440 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0312.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0313.wav b/samples/99_sample_game_the_little_probe/sounds/0313.wav Binary files differnew file mode 100644 index 0000000..466851b --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0313.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0314.wav b/samples/99_sample_game_the_little_probe/sounds/0314.wav Binary files differnew file mode 100644 index 0000000..81784c6 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0314.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0315.wav b/samples/99_sample_game_the_little_probe/sounds/0315.wav Binary files differnew file mode 100644 index 0000000..f6d0036 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0315.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0316.wav b/samples/99_sample_game_the_little_probe/sounds/0316.wav Binary files differnew file mode 100644 index 0000000..942c6d3 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0316.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0317.wav b/samples/99_sample_game_the_little_probe/sounds/0317.wav Binary files differnew file mode 100644 index 0000000..75e35ed --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0317.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0318.wav b/samples/99_sample_game_the_little_probe/sounds/0318.wav Binary files differnew file mode 100644 index 0000000..1fff907 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0318.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0319.wav b/samples/99_sample_game_the_little_probe/sounds/0319.wav Binary files differnew file mode 100644 index 0000000..016a76f --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0319.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0320.wav b/samples/99_sample_game_the_little_probe/sounds/0320.wav Binary files differnew file mode 100644 index 0000000..a41bafe --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0320.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/0321.wav b/samples/99_sample_game_the_little_probe/sounds/0321.wav Binary files differnew file mode 100644 index 0000000..dede4f1 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/0321.wav diff --git a/samples/99_sample_game_the_little_probe/sounds/bg.ogg b/samples/99_sample_game_the_little_probe/sounds/bg.ogg Binary files differnew file mode 100644 index 0000000..8a02a75 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sounds/bg.ogg diff --git a/samples/99_sample_game_the_little_probe/sprites/area_one.png b/samples/99_sample_game_the_little_probe/sprites/area_one.png Binary files differnew file mode 100644 index 0000000..afd2f46 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/area_one.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-black.png b/samples/99_sample_game_the_little_probe/sprites/circle-black.png Binary files differnew file mode 100644 index 0000000..c98e23d --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-black.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-blue.png b/samples/99_sample_game_the_little_probe/sprites/circle-blue.png Binary files differnew file mode 100644 index 0000000..1726d2a --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-blue.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-gray.png b/samples/99_sample_game_the_little_probe/sprites/circle-gray.png Binary files differnew file mode 100644 index 0000000..960f191 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-gray.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-green.png b/samples/99_sample_game_the_little_probe/sprites/circle-green.png Binary files differnew file mode 100644 index 0000000..43cf7ee --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-green.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-indigo.png b/samples/99_sample_game_the_little_probe/sprites/circle-indigo.png Binary files differnew file mode 100644 index 0000000..598e240 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-indigo.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-orange.png b/samples/99_sample_game_the_little_probe/sprites/circle-orange.png Binary files differnew file mode 100644 index 0000000..5604a42 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-orange.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-red.png b/samples/99_sample_game_the_little_probe/sprites/circle-red.png Binary files differnew file mode 100644 index 0000000..7f17ca6 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-red.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-violet.png b/samples/99_sample_game_the_little_probe/sprites/circle-violet.png Binary files differnew file mode 100644 index 0000000..681d210 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-violet.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-white.png b/samples/99_sample_game_the_little_probe/sprites/circle-white.png Binary files differnew file mode 100644 index 0000000..bd32155 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-white.png diff --git a/samples/99_sample_game_the_little_probe/sprites/circle-yellow.png b/samples/99_sample_game_the_little_probe/sprites/circle-yellow.png Binary files differnew file mode 100644 index 0000000..94992eb --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/circle-yellow.png diff --git a/samples/99_sample_game_the_little_probe/sprites/jupiter.png b/samples/99_sample_game_the_little_probe/sprites/jupiter.png Binary files differnew file mode 100644 index 0000000..7982713 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/jupiter.png diff --git a/samples/99_sample_game_the_little_probe/sprites/level.png b/samples/99_sample_game_the_little_probe/sprites/level.png Binary files differnew file mode 100644 index 0000000..1ce0f1a --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/level.png diff --git a/samples/99_sample_game_the_little_probe/sprites/probe.png b/samples/99_sample_game_the_little_probe/sprites/probe.png Binary files differnew file mode 100644 index 0000000..e29b144 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/probe.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-black.png b/samples/99_sample_game_the_little_probe/sprites/square-black.png Binary files differnew file mode 100644 index 0000000..cea7bd7 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-black.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-blue.png b/samples/99_sample_game_the_little_probe/sprites/square-blue.png Binary files differnew file mode 100644 index 0000000..b840849 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-blue.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-gray.png b/samples/99_sample_game_the_little_probe/sprites/square-gray.png Binary files differnew file mode 100644 index 0000000..2142b30 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-gray.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-green.png b/samples/99_sample_game_the_little_probe/sprites/square-green.png Binary files differnew file mode 100644 index 0000000..5ef7f75 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-green.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-indigo.png b/samples/99_sample_game_the_little_probe/sprites/square-indigo.png Binary files differnew file mode 100644 index 0000000..2384108 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-indigo.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-orange.png b/samples/99_sample_game_the_little_probe/sprites/square-orange.png Binary files differnew file mode 100644 index 0000000..bb1eee7 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-orange.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-red.png b/samples/99_sample_game_the_little_probe/sprites/square-red.png Binary files differnew file mode 100644 index 0000000..3ed5f13 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-red.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-violet.png b/samples/99_sample_game_the_little_probe/sprites/square-violet.png Binary files differnew file mode 100644 index 0000000..333540c --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-violet.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-white.png b/samples/99_sample_game_the_little_probe/sprites/square-white.png Binary files differnew file mode 100644 index 0000000..378c565 --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-white.png diff --git a/samples/99_sample_game_the_little_probe/sprites/square-yellow.png b/samples/99_sample_game_the_little_probe/sprites/square-yellow.png Binary files differnew file mode 100644 index 0000000..0edeeec --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/square-yellow.png diff --git a/samples/99_sample_game_the_little_probe/sprites/whisp.png b/samples/99_sample_game_the_little_probe/sprites/whisp.png Binary files differnew file mode 100644 index 0000000..07154ee --- /dev/null +++ b/samples/99_sample_game_the_little_probe/sprites/whisp.png diff --git a/samples/99_sample_nddnug_workshop/app/main.rb b/samples/99_sample_nddnug_workshop/app/main.rb new file mode 100644 index 0000000..273c36a --- /dev/null +++ b/samples/99_sample_nddnug_workshop/app/main.rb @@ -0,0 +1,108 @@ +# Focused tutorial video: https://s3.amazonaws.com/s3.dragonruby.org/dragonruby-nddnug-workshop.mp4 +# Workshop/Presentation which provides motivation for creating a game engine: https://www.youtube.com/watch?v=S3CFce1arC8 + +def defaults args + args.outputs.background_color = [0, 0, 0] + args.state.x ||= 640 + args.state.y ||= 360 + args.state.stars ||= 100.map do + [1280 * rand, 720 * rand, rand.fdiv(10), 255 * rand, 255 * rand, 255 * rand] + end + + args.state.sun ||= args.state.new_entity(:sun) do |s| + s.s = 100 + s.path = 'sprites/sun.png' + end + + args.state.planets = [ + [:mercury, 65, 5, 88], + [:venus, 100, 10, 225], + [:earth, 120, 10, 365], + [:mars, 140, 8, 687], + [:jupiter, 280, 30, 365 * 11.8], + [:saturn, 350, 20, 365 * 29.5], + [:uranus, 400, 15, 365 * 84], + [:neptune, 440, 15, 365 * 164.8], + [:pluto, 480, 5, 365 * 247.8], + ].map do |name, distance, size, year_in_days| + args.state.new_entity(name) do |p| + p.path = "sprites/#{name}.png" + p.distance = distance * 0.7 + p.s = size * 0.7 + p.year_in_days = year_in_days + end + end + + args.state.ship ||= args.state.new_entity(:ship) do |s| + s.x = 1280 * rand + s.y = 720 * rand + s.angle = 0 + end +end + +def to_sprite args, entity + x = 0 + y = 0 + + if entity.year_in_days + day = args.state.tick_count + day_in_year = day % entity.year_in_days + entity.random_start_day ||= day_in_year * rand + percentage_of_year = day_in_year.fdiv(entity.year_in_days) + angle = 365 * percentage_of_year + x = angle.vector_x(entity.distance) + y = angle.vector_y(entity.distance) + end + + [640 + x - entity.s.half, 360 + y - entity.s.half, entity.s, entity.s, entity.path] +end + +def render args + args.outputs.solids << [0, 0, 1280, 720] + + args.outputs.sprites << args.state.stars.map do |x, y, _, r, g, b| + [x, y, 10, 10, 'sprites/star.png', 0, 100, r, g, b] + end + + args.outputs.sprites << to_sprite(args, args.state.sun) + args.outputs.sprites << args.state.planets.map { |p| to_sprite args, p } + args.outputs.sprites << [args.state.ship.x, args.state.ship.y, 20, 20, 'sprites/ship.png', args.state.ship.angle] +end + +def calc args + args.state.stars = args.state.stars.map do |x, y, speed, r, g, b| + x += speed + y += speed + x = 0 if x > 1280 + y = 0 if y > 720 + [x, y, speed, r, g, b] + end + + if args.state.tick_count == 0 + args.outputs.sounds << 'sounds/bg.ogg' + end +end + +def process_inputs args + if args.inputs.keyboard.left || args.inputs.controller_one.key_held.left + args.state.ship.angle += 1 + elsif args.inputs.keyboard.right || args.inputs.controller_one.key_held.right + args.state.ship.angle -= 1 + end + + if args.inputs.keyboard.up || args.inputs.controller_one.key_held.a + args.state.ship.x += args.state.ship.angle.x_vector + args.state.ship.y += args.state.ship.angle.y_vector + end +end + +def tick args + defaults args + render args + calc args + process_inputs args +end + +def r + $gtk.reset +end diff --git a/samples/99_sample_nddnug_workshop/app/repl.rb b/samples/99_sample_nddnug_workshop/app/repl.rb new file mode 100644 index 0000000..a892243 --- /dev/null +++ b/samples/99_sample_nddnug_workshop/app/repl.rb @@ -0,0 +1,7 @@ +# ==================================================================================== +# DragonRuby's Primer for the Ruby Programming Language +# ==================================================================================== +# +# Welcome you awesome person you. Look at the txt files. Copy what's in there +# and paste it here. Save this file. The code will automatically execute +# and you'll see the output in the console window. diff --git a/samples/99_sample_nddnug_workshop/license-for-sample.txt b/samples/99_sample_nddnug_workshop/license-for-sample.txt new file mode 100644 index 0000000..2f938ad --- /dev/null +++ b/samples/99_sample_nddnug_workshop/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC (code), Nick Culbertson @mobypixel (art), Rafael Langoni Smith (music) + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_nddnug_workshop/replay.txt b/samples/99_sample_nddnug_workshop/replay.txt new file mode 100644 index 0000000..948639c --- /dev/null +++ b/samples/99_sample_nddnug_workshop/replay.txt @@ -0,0 +1,1472 @@ +replay_version 2.0 +stopped_at 1198 +seed 100 +recorded_at Sun Sep 29 23:34:16 2019 +[:mouse_move, 1156, 500, 2, 1, 74] +[:mouse_move, 1151, 501, 2, 2, 75] +[:mouse_move, 1148, 502, 2, 3, 76] +[:mouse_move, 1136, 503, 2, 4, 77] +[:mouse_move, 1125, 503, 2, 5, 78] +[:mouse_move, 1089, 502, 2, 6, 79] +[:mouse_move, 1069, 498, 2, 7, 80] +[:mouse_move, 1020, 485, 2, 8, 81] +[:mouse_move, 969, 470, 2, 9, 82] +[:mouse_move, 930, 458, 2, 10, 83] +[:mouse_move, 842, 428, 2, 11, 84] +[:mouse_move, 788, 407, 2, 12, 85] +[:mouse_move, 711, 377, 2, 13, 86] +[:mouse_move, 665, 358, 2, 14, 87] +[:mouse_move, 609, 336, 2, 15, 88] +[:mouse_move, 583, 324, 2, 16, 89] +[:mouse_move, 545, 305, 2, 17, 90] +[:mouse_move, 531, 297, 2, 18, 91] +[:mouse_move, 512, 279, 2, 19, 92] +[:mouse_move, 481, 273, 2, 20, 160] +[:mouse_move, 452, 262, 2, 21, 161] +[:mouse_move, 414, 248, 2, 22, 162] +[:mouse_move, 391, 241, 2, 23, 163] +[:mouse_move, 293, 212, 2, 24, 164] +[:mouse_move, 242, 198, 2, 25, 165] +[:mouse_move, 220, 191, 2, 26, 166] +[:mouse_move, 163, 174, 2, 27, 167] +[:mouse_move, 134, 166, 2, 28, 168] +[:mouse_move, 109, 156, 2, 29, 169] +[:mouse_move, 95, 150, 2, 30, 170] +[:mouse_move, 82, 144, 2, 31, 171] +[:mouse_move, 77, 141, 2, 32, 172] +[:mouse_move, 72, 137, 2, 33, 173] +[:mouse_move, 70, 137, 2, 34, 174] +[:mouse_move, 69, 135, 2, 35, 175] +[:mouse_move, 66, 135, 2, 36, 177] +[:mouse_move, 65, 135, 2, 37, 178] +[:mouse_move, 62, 135, 2, 38, 179] +[:mouse_move, 60, 135, 2, 39, 180] +[:mouse_move, 57, 136, 2, 40, 181] +[:mouse_move, 55, 137, 2, 41, 182] +[:mouse_move, 50, 138, 2, 42, 183] +[:mouse_move, 49, 139, 2, 43, 184] +[:mouse_move, 44, 141, 2, 44, 185] +[:mouse_move, 42, 143, 2, 45, 186] +[:mouse_move, 36, 146, 2, 46, 187] +[:mouse_move, 34, 147, 2, 47, 188] +[:mouse_move, 30, 149, 2, 48, 189] +[:mouse_move, 28, 151, 2, 49, 190] +[:mouse_move, 26, 152, 2, 50, 191] +[:mouse_move, 26, 156, 2, 51, 194] +[:mouse_move, 27, 158, 2, 52, 195] +[:mouse_move, 30, 162, 2, 53, 196] +[:mouse_move, 33, 164, 2, 54, 197] +[:mouse_move, 36, 167, 2, 55, 198] +[:mouse_move, 38, 168, 2, 56, 199] +[:mouse_move, 43, 168, 2, 57, 200] +[:mouse_move, 46, 166, 2, 58, 201] +[:mouse_move, 51, 157, 2, 59, 202] +[:mouse_move, 53, 152, 2, 60, 203] +[:mouse_move, 55, 145, 2, 61, 204] +[:mouse_move, 56, 141, 2, 62, 205] +[:mouse_move, 57, 134, 2, 63, 206] +[:mouse_move, 57, 131, 2, 64, 207] +[:mouse_move, 56, 125, 2, 65, 208] +[:mouse_move, 54, 123, 2, 66, 209] +[:mouse_move, 48, 119, 2, 67, 210] +[:mouse_move, 44, 117, 2, 68, 211] +[:mouse_move, 33, 113, 2, 69, 212] +[:mouse_move, 28, 112, 2, 70, 213] +[:mouse_move, 21, 111, 2, 71, 214] +[:mouse_move, 18, 111, 2, 72, 215] +[:mouse_move, 11, 112, 2, 73, 216] +[:mouse_move, 10, 113, 2, 74, 217] +[:mouse_move, 6, 119, 2, 75, 218] +[:mouse_move, 4, 122, 2, 76, 219] +[:mouse_move, 1, 127, 2, 77, 220] +[:mouse_move, 0, 137, 2, 78, 221] +[:mouse_move, 1, 173, 2, 79, 226] +[:mouse_move, 10, 177, 2, 80, 226] +[:mouse_move, 20, 182, 2, 81, 227] +[:mouse_move, 44, 190, 2, 82, 228] +[:mouse_move, 58, 192, 2, 83, 229] +[:mouse_move, 63, 193, 2, 84, 230] +[:mouse_move, 84, 194, 2, 85, 231] +[:mouse_move, 89, 194, 2, 86, 232] +[:mouse_move, 93, 193, 2, 87, 232] +[:mouse_move, 95, 190, 2, 88, 233] +[:mouse_move, 98, 187, 2, 89, 234] +[:mouse_move, 101, 176, 2, 90, 235] +[:mouse_move, 102, 169, 2, 91, 236] +[:mouse_move, 100, 148, 2, 92, 237] +[:mouse_move, 96, 139, 2, 93, 238] +[:mouse_move, 87, 126, 2, 94, 239] +[:mouse_move, 82, 120, 2, 95, 240] +[:mouse_move, 68, 111, 2, 96, 241] +[:mouse_move, 62, 108, 2, 97, 242] +[:mouse_move, 51, 105, 2, 98, 243] +[:mouse_move, 46, 104, 2, 99, 244] +[:mouse_move, 37, 104, 2, 100, 245] +[:mouse_move, 32, 104, 2, 101, 246] +[:mouse_move, 27, 104, 2, 102, 247] +[:mouse_move, 23, 104, 2, 103, 247] +[:mouse_move, 21, 105, 2, 104, 248] +[:mouse_move, 18, 107, 2, 105, 249] +[:mouse_move, 15, 109, 2, 106, 249] +[:mouse_move, 12, 112, 2, 107, 250] +[:mouse_move, 9, 116, 2, 108, 251] +[:mouse_move, 8, 121, 2, 109, 251] +[:mouse_move, 8, 128, 2, 110, 252] +[:mouse_move, 8, 145, 2, 111, 253] +[:mouse_move, 16, 162, 2, 112, 253] +[:mouse_move, 29, 183, 2, 113, 254] +[:mouse_move, 46, 203, 2, 114, 255] +[:mouse_move, 69, 223, 2, 115, 255] +[:mouse_move, 96, 241, 2, 116, 256] +[:mouse_move, 108, 245, 2, 117, 257] +[:mouse_move, 161, 261, 2, 118, 258] +[:mouse_move, 201, 263, 2, 119, 259] +[:mouse_move, 249, 262, 2, 120, 260] +[:mouse_move, 261, 262, 2, 121, 261] +[:mouse_move, 310, 261, 2, 122, 262] +[:key_down_player_one, 4, 0, 1, 123, 274] +[:key_down_player_one, 27, 0, 1, 124, 274] +[:key_held_player_one, 4, 0, 1, 125, 275] +[:key_held_player_one, 27, 0, 1, 126, 275] +[:key_held_player_one, 4, 0, 1, 127, 276] +[:key_held_player_one, 27, 0, 1, 128, 276] +[:key_held_player_one, 4, 0, 1, 129, 277] +[:key_held_player_one, 27, 0, 1, 130, 277] +[:key_held_player_one, 4, 0, 1, 131, 278] +[:key_held_player_one, 27, 0, 1, 132, 278] +[:key_held_player_one, 4, 0, 1, 133, 279] +[:key_held_player_one, 27, 0, 1, 134, 279] +[:key_held_player_one, 4, 0, 1, 135, 280] +[:key_held_player_one, 27, 0, 1, 136, 280] +[:key_held_player_one, 4, 0, 1, 137, 281] +[:key_held_player_one, 27, 0, 1, 138, 281] +[:key_held_player_one, 4, 0, 1, 139, 282] +[:key_held_player_one, 27, 0, 1, 140, 282] +[:key_held_player_one, 4, 0, 1, 141, 283] +[:key_held_player_one, 27, 0, 1, 142, 283] +[:key_held_player_one, 4, 0, 1, 143, 284] +[:key_held_player_one, 27, 0, 1, 144, 284] +[:key_held_player_one, 4, 0, 1, 145, 285] +[:key_held_player_one, 27, 0, 1, 146, 285] +[:key_held_player_one, 4, 0, 1, 147, 286] +[:key_held_player_one, 27, 0, 1, 148, 286] +[:key_held_player_one, 4, 0, 1, 149, 287] +[:key_held_player_one, 27, 0, 1, 150, 287] +[:key_held_player_one, 4, 0, 1, 151, 288] +[:key_held_player_one, 27, 0, 1, 152, 288] +[:key_held_player_one, 4, 0, 1, 153, 289] +[:key_held_player_one, 27, 0, 1, 154, 289] +[:key_held_player_one, 4, 0, 1, 155, 290] +[:key_held_player_one, 27, 0, 1, 156, 290] +[:key_held_player_one, 4, 0, 1, 157, 291] +[:key_held_player_one, 27, 0, 1, 158, 291] +[:key_held_player_one, 4, 0, 1, 159, 292] +[:key_held_player_one, 27, 0, 1, 160, 292] +[:key_held_player_one, 4, 0, 1, 161, 293] +[:key_held_player_one, 27, 0, 1, 162, 293] +[:key_held_player_one, 4, 0, 1, 163, 294] +[:key_held_player_one, 27, 0, 1, 164, 294] +[:key_held_player_one, 4, 0, 1, 165, 295] +[:key_held_player_one, 27, 0, 1, 166, 295] +[:key_held_player_one, 4, 0, 1, 167, 296] +[:key_held_player_one, 27, 0, 1, 168, 296] +[:key_held_player_one, 4, 0, 1, 169, 297] +[:key_held_player_one, 27, 0, 1, 170, 297] +[:key_held_player_one, 4, 0, 1, 171, 298] +[:key_held_player_one, 27, 0, 1, 172, 298] +[:key_held_player_one, 4, 0, 1, 173, 299] +[:key_held_player_one, 27, 0, 1, 174, 299] +[:key_held_player_one, 4, 0, 1, 175, 300] +[:key_held_player_one, 27, 0, 1, 176, 300] +[:key_held_player_one, 4, 0, 1, 177, 301] +[:key_held_player_one, 27, 0, 1, 178, 301] +[:key_up_player_one, 4, 0, 1, 179, 302] +[:key_up_player_one, 27, 0, 1, 180, 302] +[:key_down_player_one, 3, 0, 1, 181, 313] +[:key_down_player_one, 26, 0, 1, 182, 313] +[:key_held_player_one, 3, 0, 1, 183, 314] +[:key_held_player_one, 26, 0, 1, 184, 314] +[:key_held_player_one, 3, 0, 1, 185, 315] +[:key_held_player_one, 26, 0, 1, 186, 315] +[:key_held_player_one, 3, 0, 1, 187, 316] +[:key_held_player_one, 26, 0, 1, 188, 316] +[:key_held_player_one, 3, 0, 1, 189, 317] +[:key_held_player_one, 26, 0, 1, 190, 317] +[:key_held_player_one, 3, 0, 1, 191, 318] +[:key_held_player_one, 26, 0, 1, 192, 318] +[:key_held_player_one, 3, 0, 1, 193, 319] +[:key_held_player_one, 26, 0, 1, 194, 319] +[:key_held_player_one, 3, 0, 1, 195, 320] +[:key_held_player_one, 26, 0, 1, 196, 320] +[:key_held_player_one, 3, 0, 1, 197, 321] +[:key_held_player_one, 26, 0, 1, 198, 321] +[:key_up_player_one, 3, 0, 1, 199, 322] +[:key_up_player_one, 26, 0, 1, 200, 322] +[:key_down_player_one, 19, 0, 1, 201, 344] +[:key_held_player_one, 19, 0, 1, 202, 345] +[:key_held_player_one, 19, 0, 1, 203, 346] +[:key_held_player_one, 19, 0, 1, 204, 347] +[:key_held_player_one, 19, 0, 1, 205, 348] +[:key_held_player_one, 19, 0, 1, 206, 349] +[:key_held_player_one, 19, 0, 1, 207, 350] +[:key_held_player_one, 19, 0, 1, 208, 351] +[:key_held_player_one, 19, 0, 1, 209, 352] +[:key_held_player_one, 19, 0, 1, 210, 353] +[:key_held_player_one, 19, 0, 1, 211, 354] +[:key_held_player_one, 19, 0, 1, 212, 355] +[:key_held_player_one, 19, 0, 1, 213, 356] +[:key_held_player_one, 19, 0, 1, 214, 357] +[:key_held_player_one, 19, 0, 1, 215, 358] +[:key_held_player_one, 19, 0, 1, 216, 359] +[:key_held_player_one, 19, 0, 1, 217, 360] +[:key_held_player_one, 19, 0, 1, 218, 361] +[:key_held_player_one, 19, 0, 1, 219, 362] +[:key_held_player_one, 19, 0, 1, 220, 363] +[:key_held_player_one, 19, 0, 1, 221, 364] +[:key_held_player_one, 19, 0, 1, 222, 365] +[:key_held_player_one, 19, 0, 1, 223, 366] +[:key_held_player_one, 19, 0, 1, 224, 367] +[:key_held_player_one, 19, 0, 1, 225, 368] +[:key_held_player_one, 19, 0, 1, 226, 369] +[:key_held_player_one, 19, 0, 1, 227, 370] +[:key_down_player_one, 1, 0, 1, 228, 371] +[:key_up_player_one, 19, 0, 1, 229, 371] +[:key_down_player_one, 24, 0, 1, 230, 371] +[:key_held_player_one, 1, 0, 1, 231, 372] +[:key_held_player_one, 24, 0, 1, 232, 372] +[:key_held_player_one, 1, 0, 1, 233, 373] +[:key_held_player_one, 24, 0, 1, 234, 373] +[:key_held_player_one, 1, 0, 1, 235, 374] +[:key_held_player_one, 24, 0, 1, 236, 374] +[:key_held_player_one, 1, 0, 1, 237, 375] +[:key_held_player_one, 24, 0, 1, 238, 375] +[:key_held_player_one, 1, 0, 1, 239, 376] +[:key_held_player_one, 24, 0, 1, 240, 376] +[:key_held_player_one, 1, 0, 1, 241, 377] +[:key_held_player_one, 24, 0, 1, 242, 377] +[:key_held_player_one, 1, 0, 1, 243, 378] +[:key_held_player_one, 24, 0, 1, 244, 378] +[:key_held_player_one, 1, 0, 1, 245, 379] +[:key_held_player_one, 24, 0, 1, 246, 379] +[:key_held_player_one, 1, 0, 1, 247, 380] +[:key_held_player_one, 24, 0, 1, 248, 380] +[:key_held_player_one, 1, 0, 1, 249, 381] +[:key_held_player_one, 24, 0, 1, 250, 381] +[:key_held_player_one, 1, 0, 1, 251, 382] +[:key_held_player_one, 24, 0, 1, 252, 382] +[:key_held_player_one, 1, 0, 1, 253, 383] +[:key_held_player_one, 24, 0, 1, 254, 383] +[:key_held_player_one, 1, 0, 1, 255, 384] +[:key_held_player_one, 24, 0, 1, 256, 384] +[:key_held_player_one, 1, 0, 1, 257, 385] +[:key_held_player_one, 24, 0, 1, 258, 385] +[:key_held_player_one, 1, 0, 1, 259, 386] +[:key_held_player_one, 24, 0, 1, 260, 386] +[:key_held_player_one, 1, 0, 1, 261, 387] +[:key_held_player_one, 24, 0, 1, 262, 387] +[:key_held_player_one, 1, 0, 1, 263, 388] +[:key_held_player_one, 24, 0, 1, 264, 388] +[:key_held_player_one, 1, 0, 1, 265, 389] +[:key_held_player_one, 24, 0, 1, 266, 389] +[:key_held_player_one, 1, 0, 1, 267, 390] +[:key_held_player_one, 24, 0, 1, 268, 390] +[:key_held_player_one, 1, 0, 1, 269, 391] +[:key_held_player_one, 24, 0, 1, 270, 391] +[:key_held_player_one, 1, 0, 1, 271, 392] +[:key_held_player_one, 24, 0, 1, 272, 392] +[:key_held_player_one, 1, 0, 1, 273, 393] +[:key_held_player_one, 24, 0, 1, 274, 393] +[:key_held_player_one, 1, 0, 1, 275, 394] +[:key_held_player_one, 24, 0, 1, 276, 394] +[:key_held_player_one, 1, 0, 1, 277, 395] +[:key_held_player_one, 24, 0, 1, 278, 395] +[:key_held_player_one, 1, 0, 1, 279, 396] +[:key_held_player_one, 24, 0, 1, 280, 396] +[:key_held_player_one, 1, 0, 1, 281, 397] +[:key_held_player_one, 24, 0, 1, 282, 397] +[:key_held_player_one, 1, 0, 1, 283, 398] +[:key_held_player_one, 24, 0, 1, 284, 398] +[:key_held_player_one, 1, 0, 1, 285, 399] +[:key_held_player_one, 24, 0, 1, 286, 399] +[:key_held_player_one, 1, 0, 1, 287, 400] +[:key_held_player_one, 24, 0, 1, 288, 400] +[:key_held_player_one, 1, 0, 1, 289, 401] +[:key_held_player_one, 24, 0, 1, 290, 401] +[:key_held_player_one, 1, 0, 1, 291, 402] +[:key_held_player_one, 24, 0, 1, 292, 402] +[:key_held_player_one, 1, 0, 1, 293, 403] +[:key_held_player_one, 24, 0, 1, 294, 403] +[:key_held_player_one, 1, 0, 1, 295, 404] +[:key_held_player_one, 24, 0, 1, 296, 404] +[:key_held_player_one, 1, 0, 1, 297, 405] +[:key_held_player_one, 24, 0, 1, 298, 405] +[:key_held_player_one, 1, 0, 1, 299, 406] +[:key_held_player_one, 24, 0, 1, 300, 406] +[:key_held_player_one, 1, 0, 1, 301, 407] +[:key_held_player_one, 24, 0, 1, 302, 407] +[:key_held_player_one, 1, 0, 1, 303, 408] +[:key_held_player_one, 24, 0, 1, 304, 408] +[:key_up_player_one, 1, 0, 1, 305, 409] +[:key_up_player_one, 24, 0, 1, 306, 409] +[:key_down_player_one, 14, 0, 1, 307, 411] +[:key_held_player_one, 14, 0, 1, 308, 412] +[:key_held_player_one, 14, 0, 1, 309, 413] +[:key_held_player_one, 14, 0, 1, 310, 414] +[:key_held_player_one, 14, 0, 1, 311, 415] +[:key_held_player_one, 14, 0, 1, 312, 416] +[:key_held_player_one, 14, 0, 1, 313, 417] +[:key_held_player_one, 14, 0, 1, 314, 418] +[:key_held_player_one, 14, 0, 1, 315, 419] +[:key_held_player_one, 14, 0, 1, 316, 420] +[:key_held_player_one, 14, 0, 1, 317, 421] +[:key_held_player_one, 14, 0, 1, 318, 422] +[:key_held_player_one, 14, 0, 1, 319, 423] +[:key_held_player_one, 14, 0, 1, 320, 424] +[:key_held_player_one, 14, 0, 1, 321, 425] +[:key_held_player_one, 14, 0, 1, 322, 426] +[:key_down_player_one, 4, 0, 1, 323, 427] +[:key_held_player_one, 14, 0, 1, 324, 427] +[:key_down_player_one, 27, 0, 1, 325, 427] +[:key_held_player_one, 4, 0, 1, 326, 428] +[:key_held_player_one, 14, 0, 1, 327, 428] +[:key_held_player_one, 27, 0, 1, 328, 428] +[:key_held_player_one, 4, 0, 1, 329, 429] +[:key_held_player_one, 14, 0, 1, 330, 429] +[:key_held_player_one, 27, 0, 1, 331, 429] +[:key_held_player_one, 4, 0, 1, 332, 430] +[:key_held_player_one, 14, 0, 1, 333, 430] +[:key_held_player_one, 27, 0, 1, 334, 430] +[:key_held_player_one, 4, 0, 1, 335, 431] +[:key_held_player_one, 14, 0, 1, 336, 431] +[:key_held_player_one, 27, 0, 1, 337, 431] +[:key_held_player_one, 4, 0, 1, 338, 432] +[:key_held_player_one, 14, 0, 1, 339, 432] +[:key_held_player_one, 27, 0, 1, 340, 432] +[:key_held_player_one, 4, 0, 1, 341, 433] +[:key_held_player_one, 14, 0, 1, 342, 433] +[:key_held_player_one, 27, 0, 1, 343, 433] +[:key_held_player_one, 4, 0, 1, 344, 434] +[:key_held_player_one, 14, 0, 1, 345, 434] +[:key_held_player_one, 27, 0, 1, 346, 434] +[:key_held_player_one, 4, 0, 1, 347, 435] +[:key_held_player_one, 14, 0, 1, 348, 435] +[:key_held_player_one, 27, 0, 1, 349, 435] +[:key_held_player_one, 4, 0, 1, 350, 436] +[:key_up_player_one, 14, 0, 1, 351, 436] +[:key_held_player_one, 27, 0, 1, 352, 436] +[:key_held_player_one, 4, 0, 1, 353, 437] +[:key_held_player_one, 27, 0, 1, 354, 437] +[:key_held_player_one, 4, 0, 1, 355, 438] +[:key_held_player_one, 27, 0, 1, 356, 438] +[:key_up_player_one, 4, 0, 1, 357, 439] +[:key_up_player_one, 27, 0, 1, 358, 439] +[:key_down_player_one, 2, 0, 1, 359, 440] +[:key_down_player_one, 3, 0, 1, 360, 440] +[:key_down_player_one, 25, 0, 1, 361, 440] +[:key_down_player_one, 26, 0, 1, 362, 440] +[:key_up_player_one, 2, 0, 1, 363, 441] +[:key_held_player_one, 3, 0, 1, 364, 441] +[:key_up_player_one, 25, 0, 1, 365, 441] +[:key_held_player_one, 26, 0, 1, 366, 441] +[:key_held_player_one, 3, 0, 1, 367, 442] +[:key_held_player_one, 26, 0, 1, 368, 442] +[:key_held_player_one, 3, 0, 1, 369, 443] +[:key_held_player_one, 26, 0, 1, 370, 443] +[:key_held_player_one, 3, 0, 1, 371, 444] +[:key_held_player_one, 26, 0, 1, 372, 444] +[:key_held_player_one, 3, 0, 1, 373, 445] +[:key_held_player_one, 26, 0, 1, 374, 445] +[:key_held_player_one, 3, 0, 1, 375, 446] +[:key_held_player_one, 26, 0, 1, 376, 446] +[:key_held_player_one, 3, 0, 1, 377, 447] +[:key_held_player_one, 26, 0, 1, 378, 447] +[:key_held_player_one, 3, 0, 1, 379, 448] +[:key_held_player_one, 26, 0, 1, 380, 448] +[:key_held_player_one, 3, 0, 1, 381, 449] +[:key_down_player_one, 15, 0, 1, 382, 449] +[:key_held_player_one, 26, 0, 1, 383, 449] +[:key_held_player_one, 3, 0, 1, 384, 450] +[:key_held_player_one, 15, 0, 1, 385, 450] +[:key_held_player_one, 26, 0, 1, 386, 450] +[:key_held_player_one, 3, 0, 1, 387, 451] +[:key_held_player_one, 15, 0, 1, 388, 451] +[:key_held_player_one, 26, 0, 1, 389, 451] +[:key_held_player_one, 3, 0, 1, 390, 452] +[:key_held_player_one, 15, 0, 1, 391, 452] +[:key_held_player_one, 26, 0, 1, 392, 452] +[:key_held_player_one, 3, 0, 1, 393, 453] +[:key_held_player_one, 15, 0, 1, 394, 453] +[:key_held_player_one, 26, 0, 1, 395, 453] +[:key_held_player_one, 3, 0, 1, 396, 454] +[:key_held_player_one, 15, 0, 1, 397, 454] +[:key_held_player_one, 26, 0, 1, 398, 454] +[:key_held_player_one, 3, 0, 1, 399, 455] +[:key_held_player_one, 15, 0, 1, 400, 455] +[:key_held_player_one, 26, 0, 1, 401, 455] +[:key_held_player_one, 3, 0, 1, 402, 456] +[:key_held_player_one, 15, 0, 1, 403, 456] +[:key_held_player_one, 26, 0, 1, 404, 456] +[:key_held_player_one, 3, 0, 1, 405, 457] +[:key_held_player_one, 15, 0, 1, 406, 457] +[:key_held_player_one, 26, 0, 1, 407, 457] +[:key_held_player_one, 3, 0, 1, 408, 458] +[:key_held_player_one, 15, 0, 1, 409, 458] +[:key_held_player_one, 26, 0, 1, 410, 458] +[:key_held_player_one, 3, 0, 1, 411, 459] +[:key_held_player_one, 15, 0, 1, 412, 459] +[:key_held_player_one, 26, 0, 1, 413, 459] +[:key_held_player_one, 3, 0, 1, 414, 460] +[:key_held_player_one, 15, 0, 1, 415, 460] +[:key_held_player_one, 26, 0, 1, 416, 460] +[:key_held_player_one, 3, 0, 1, 417, 461] +[:key_held_player_one, 15, 0, 1, 418, 461] +[:key_held_player_one, 26, 0, 1, 419, 461] +[:key_held_player_one, 3, 0, 1, 420, 462] +[:key_held_player_one, 15, 0, 1, 421, 462] +[:key_held_player_one, 26, 0, 1, 422, 462] +[:key_held_player_one, 3, 0, 1, 423, 463] +[:key_held_player_one, 15, 0, 1, 424, 463] +[:key_held_player_one, 26, 0, 1, 425, 463] +[:key_held_player_one, 3, 0, 1, 426, 464] +[:key_held_player_one, 15, 0, 1, 427, 464] +[:key_held_player_one, 26, 0, 1, 428, 464] +[:key_up_player_one, 3, 0, 1, 429, 465] +[:key_held_player_one, 15, 0, 1, 430, 465] +[:key_up_player_one, 26, 0, 1, 431, 465] +[:key_held_player_one, 15, 0, 1, 432, 466] +[:key_held_player_one, 15, 0, 1, 433, 467] +[:key_held_player_one, 15, 0, 1, 434, 468] +[:key_held_player_one, 15, 0, 1, 435, 469] +[:key_held_player_one, 15, 0, 1, 436, 470] +[:key_held_player_one, 15, 0, 1, 437, 471] +[:key_held_player_one, 15, 0, 1, 438, 472] +[:key_held_player_one, 15, 0, 1, 439, 473] +[:key_held_player_one, 15, 0, 1, 440, 474] +[:key_held_player_one, 15, 0, 1, 441, 475] +[:key_held_player_one, 15, 0, 1, 442, 476] +[:key_held_player_one, 15, 0, 1, 443, 477] +[:key_held_player_one, 15, 0, 1, 444, 478] +[:key_held_player_one, 15, 0, 1, 445, 479] +[:key_held_player_one, 15, 0, 1, 446, 480] +[:key_down_player_one, 4, 0, 1, 447, 481] +[:key_held_player_one, 15, 0, 1, 448, 481] +[:key_down_player_one, 27, 0, 1, 449, 481] +[:key_held_player_one, 4, 0, 1, 450, 482] +[:key_held_player_one, 15, 0, 1, 451, 482] +[:key_held_player_one, 27, 0, 1, 452, 482] +[:key_held_player_one, 4, 0, 1, 453, 483] +[:key_held_player_one, 15, 0, 1, 454, 483] +[:key_held_player_one, 27, 0, 1, 455, 483] +[:key_held_player_one, 4, 0, 1, 456, 484] +[:key_held_player_one, 15, 0, 1, 457, 484] +[:key_held_player_one, 27, 0, 1, 458, 484] +[:key_held_player_one, 4, 0, 1, 459, 485] +[:key_held_player_one, 15, 0, 1, 460, 485] +[:key_held_player_one, 27, 0, 1, 461, 485] +[:key_held_player_one, 4, 0, 1, 462, 486] +[:key_held_player_one, 15, 0, 1, 463, 486] +[:key_held_player_one, 27, 0, 1, 464, 486] +[:key_held_player_one, 4, 0, 1, 465, 487] +[:key_held_player_one, 15, 0, 1, 466, 487] +[:key_held_player_one, 27, 0, 1, 467, 487] +[:key_held_player_one, 4, 0, 1, 468, 488] +[:key_held_player_one, 15, 0, 1, 469, 488] +[:key_held_player_one, 27, 0, 1, 470, 488] +[:key_held_player_one, 4, 0, 1, 471, 489] +[:key_held_player_one, 15, 0, 1, 472, 489] +[:key_held_player_one, 27, 0, 1, 473, 489] +[:key_held_player_one, 4, 0, 1, 474, 490] +[:key_held_player_one, 15, 0, 1, 475, 490] +[:key_held_player_one, 27, 0, 1, 476, 490] +[:key_held_player_one, 4, 0, 1, 477, 491] +[:key_held_player_one, 15, 0, 1, 478, 491] +[:key_held_player_one, 27, 0, 1, 479, 491] +[:key_held_player_one, 4, 0, 1, 480, 492] +[:key_held_player_one, 15, 0, 1, 481, 492] +[:key_held_player_one, 27, 0, 1, 482, 492] +[:key_held_player_one, 4, 0, 1, 483, 493] +[:key_held_player_one, 15, 0, 1, 484, 493] +[:key_held_player_one, 27, 0, 1, 485, 493] +[:key_held_player_one, 4, 0, 1, 486, 494] +[:key_held_player_one, 15, 0, 1, 487, 494] +[:key_held_player_one, 27, 0, 1, 488, 494] +[:key_held_player_one, 4, 0, 1, 489, 495] +[:key_held_player_one, 15, 0, 1, 490, 495] +[:key_held_player_one, 27, 0, 1, 491, 495] +[:key_held_player_one, 4, 0, 1, 492, 496] +[:key_held_player_one, 15, 0, 1, 493, 496] +[:key_held_player_one, 27, 0, 1, 494, 496] +[:key_held_player_one, 4, 0, 1, 495, 497] +[:key_held_player_one, 15, 0, 1, 496, 497] +[:key_held_player_one, 27, 0, 1, 497, 497] +[:key_held_player_one, 4, 0, 1, 498, 498] +[:key_held_player_one, 15, 0, 1, 499, 498] +[:key_held_player_one, 27, 0, 1, 500, 498] +[:key_held_player_one, 4, 0, 1, 501, 499] +[:key_held_player_one, 15, 0, 1, 502, 499] +[:key_held_player_one, 27, 0, 1, 503, 499] +[:key_held_player_one, 4, 0, 1, 504, 500] +[:key_held_player_one, 15, 0, 1, 505, 500] +[:key_held_player_one, 27, 0, 1, 506, 500] +[:key_held_player_one, 4, 0, 1, 507, 501] +[:key_held_player_one, 15, 0, 1, 508, 501] +[:key_held_player_one, 27, 0, 1, 509, 501] +[:key_held_player_one, 4, 0, 1, 510, 502] +[:key_held_player_one, 15, 0, 1, 511, 502] +[:key_held_player_one, 27, 0, 1, 512, 502] +[:key_held_player_one, 4, 0, 1, 513, 503] +[:key_held_player_one, 15, 0, 1, 514, 503] +[:key_held_player_one, 27, 0, 1, 515, 503] +[:key_held_player_one, 4, 0, 1, 516, 504] +[:key_held_player_one, 15, 0, 1, 517, 504] +[:key_held_player_one, 27, 0, 1, 518, 504] +[:key_held_player_one, 4, 0, 1, 519, 505] +[:key_held_player_one, 15, 0, 1, 520, 505] +[:key_held_player_one, 27, 0, 1, 521, 505] +[:key_held_player_one, 4, 0, 1, 522, 506] +[:key_held_player_one, 15, 0, 1, 523, 506] +[:key_held_player_one, 27, 0, 1, 524, 506] +[:key_held_player_one, 4, 0, 1, 525, 507] +[:key_held_player_one, 15, 0, 1, 526, 507] +[:key_held_player_one, 27, 0, 1, 527, 507] +[:key_held_player_one, 4, 0, 1, 528, 508] +[:key_held_player_one, 15, 0, 1, 529, 508] +[:key_held_player_one, 27, 0, 1, 530, 508] +[:key_held_player_one, 4, 0, 1, 531, 509] +[:key_held_player_one, 15, 0, 1, 532, 509] +[:key_held_player_one, 27, 0, 1, 533, 509] +[:key_held_player_one, 4, 0, 1, 534, 510] +[:key_held_player_one, 15, 0, 1, 535, 510] +[:key_held_player_one, 27, 0, 1, 536, 510] +[:key_held_player_one, 4, 0, 1, 537, 511] +[:key_held_player_one, 15, 0, 1, 538, 511] +[:key_held_player_one, 27, 0, 1, 539, 511] +[:key_held_player_one, 4, 0, 1, 540, 512] +[:key_held_player_one, 15, 0, 1, 541, 512] +[:key_held_player_one, 27, 0, 1, 542, 512] +[:key_held_player_one, 4, 0, 1, 543, 513] +[:key_held_player_one, 15, 0, 1, 544, 513] +[:key_held_player_one, 27, 0, 1, 545, 513] +[:key_held_player_one, 4, 0, 1, 546, 514] +[:key_held_player_one, 15, 0, 1, 547, 514] +[:key_held_player_one, 27, 0, 1, 548, 514] +[:key_held_player_one, 4, 0, 1, 549, 515] +[:key_held_player_one, 15, 0, 1, 550, 515] +[:key_held_player_one, 27, 0, 1, 551, 515] +[:key_held_player_one, 4, 0, 1, 552, 516] +[:key_held_player_one, 15, 0, 1, 553, 516] +[:key_held_player_one, 27, 0, 1, 554, 516] +[:key_held_player_one, 4, 0, 1, 555, 517] +[:key_held_player_one, 15, 0, 1, 556, 517] +[:key_held_player_one, 27, 0, 1, 557, 517] +[:key_held_player_one, 4, 0, 1, 558, 518] +[:key_held_player_one, 15, 0, 1, 559, 518] +[:key_held_player_one, 27, 0, 1, 560, 518] +[:key_held_player_one, 4, 0, 1, 561, 519] +[:key_held_player_one, 15, 0, 1, 562, 519] +[:key_held_player_one, 27, 0, 1, 563, 519] +[:key_held_player_one, 4, 0, 1, 564, 520] +[:key_held_player_one, 15, 0, 1, 565, 520] +[:key_held_player_one, 27, 0, 1, 566, 520] +[:key_held_player_one, 4, 0, 1, 567, 521] +[:key_held_player_one, 15, 0, 1, 568, 521] +[:key_held_player_one, 27, 0, 1, 569, 521] +[:key_held_player_one, 4, 0, 1, 570, 522] +[:key_held_player_one, 15, 0, 1, 571, 522] +[:key_held_player_one, 27, 0, 1, 572, 522] +[:key_up_player_one, 4, 0, 1, 573, 523] +[:key_held_player_one, 15, 0, 1, 574, 523] +[:key_up_player_one, 27, 0, 1, 575, 523] +[:key_held_player_one, 15, 0, 1, 576, 524] +[:key_held_player_one, 15, 0, 1, 577, 525] +[:key_held_player_one, 15, 0, 1, 578, 526] +[:key_held_player_one, 15, 0, 1, 579, 527] +[:key_held_player_one, 15, 0, 1, 580, 528] +[:key_held_player_one, 15, 0, 1, 581, 529] +[:key_held_player_one, 15, 0, 1, 582, 530] +[:key_held_player_one, 15, 0, 1, 583, 531] +[:key_held_player_one, 15, 0, 1, 584, 532] +[:key_held_player_one, 15, 0, 1, 585, 533] +[:key_held_player_one, 15, 0, 1, 586, 534] +[:key_held_player_one, 15, 0, 1, 587, 535] +[:key_held_player_one, 15, 0, 1, 588, 536] +[:key_held_player_one, 15, 0, 1, 589, 537] +[:key_held_player_one, 15, 0, 1, 590, 538] +[:key_held_player_one, 15, 0, 1, 591, 539] +[:key_held_player_one, 15, 0, 1, 592, 540] +[:key_held_player_one, 15, 0, 1, 593, 541] +[:key_held_player_one, 15, 0, 1, 594, 542] +[:key_held_player_one, 15, 0, 1, 595, 543] +[:key_held_player_one, 15, 0, 1, 596, 544] +[:key_held_player_one, 15, 0, 1, 597, 545] +[:key_held_player_one, 15, 0, 1, 598, 546] +[:key_held_player_one, 15, 0, 1, 599, 547] +[:key_down_player_one, 3, 0, 1, 600, 548] +[:key_held_player_one, 15, 0, 1, 601, 548] +[:key_down_player_one, 26, 0, 1, 602, 548] +[:key_held_player_one, 3, 0, 1, 603, 549] +[:key_held_player_one, 15, 0, 1, 604, 549] +[:key_held_player_one, 26, 0, 1, 605, 549] +[:key_held_player_one, 3, 0, 1, 606, 550] +[:key_held_player_one, 15, 0, 1, 607, 550] +[:key_held_player_one, 26, 0, 1, 608, 550] +[:key_held_player_one, 3, 0, 1, 609, 551] +[:key_held_player_one, 15, 0, 1, 610, 551] +[:key_held_player_one, 26, 0, 1, 611, 551] +[:key_held_player_one, 3, 0, 1, 612, 552] +[:key_held_player_one, 15, 0, 1, 613, 552] +[:key_held_player_one, 26, 0, 1, 614, 552] +[:key_held_player_one, 3, 0, 1, 615, 553] +[:key_held_player_one, 15, 0, 1, 616, 553] +[:key_held_player_one, 26, 0, 1, 617, 553] +[:key_held_player_one, 3, 0, 1, 618, 554] +[:key_held_player_one, 15, 0, 1, 619, 554] +[:key_held_player_one, 26, 0, 1, 620, 554] +[:key_held_player_one, 3, 0, 1, 621, 555] +[:key_held_player_one, 15, 0, 1, 622, 555] +[:key_held_player_one, 26, 0, 1, 623, 555] +[:key_held_player_one, 3, 0, 1, 624, 556] +[:key_held_player_one, 15, 0, 1, 625, 556] +[:key_held_player_one, 26, 0, 1, 626, 556] +[:key_held_player_one, 3, 0, 1, 627, 557] +[:key_held_player_one, 15, 0, 1, 628, 557] +[:key_held_player_one, 26, 0, 1, 629, 557] +[:key_held_player_one, 3, 0, 1, 630, 558] +[:key_held_player_one, 15, 0, 1, 631, 558] +[:key_held_player_one, 26, 0, 1, 632, 558] +[:key_held_player_one, 3, 0, 1, 633, 559] +[:key_held_player_one, 15, 0, 1, 634, 559] +[:key_held_player_one, 26, 0, 1, 635, 559] +[:key_held_player_one, 3, 0, 1, 636, 560] +[:key_held_player_one, 15, 0, 1, 637, 560] +[:key_held_player_one, 26, 0, 1, 638, 560] +[:key_held_player_one, 3, 0, 1, 639, 561] +[:key_held_player_one, 15, 0, 1, 640, 561] +[:key_held_player_one, 26, 0, 1, 641, 561] +[:key_held_player_one, 3, 0, 1, 642, 562] +[:key_held_player_one, 15, 0, 1, 643, 562] +[:key_held_player_one, 26, 0, 1, 644, 562] +[:key_held_player_one, 3, 0, 1, 645, 563] +[:key_held_player_one, 15, 0, 1, 646, 563] +[:key_held_player_one, 26, 0, 1, 647, 563] +[:key_held_player_one, 3, 0, 1, 648, 564] +[:key_held_player_one, 15, 0, 1, 649, 564] +[:key_held_player_one, 26, 0, 1, 650, 564] +[:key_held_player_one, 3, 0, 1, 651, 565] +[:key_held_player_one, 15, 0, 1, 652, 565] +[:key_held_player_one, 26, 0, 1, 653, 565] +[:key_held_player_one, 3, 0, 1, 654, 566] +[:key_held_player_one, 15, 0, 1, 655, 566] +[:key_held_player_one, 26, 0, 1, 656, 566] +[:key_held_player_one, 3, 0, 1, 657, 567] +[:key_held_player_one, 15, 0, 1, 658, 567] +[:key_held_player_one, 26, 0, 1, 659, 567] +[:key_held_player_one, 3, 0, 1, 660, 568] +[:key_held_player_one, 15, 0, 1, 661, 568] +[:key_held_player_one, 26, 0, 1, 662, 568] +[:key_held_player_one, 3, 0, 1, 663, 569] +[:key_held_player_one, 15, 0, 1, 664, 569] +[:key_held_player_one, 26, 0, 1, 665, 569] +[:key_held_player_one, 3, 0, 1, 666, 570] +[:key_held_player_one, 15, 0, 1, 667, 570] +[:key_held_player_one, 26, 0, 1, 668, 570] +[:key_held_player_one, 3, 0, 1, 669, 571] +[:key_held_player_one, 15, 0, 1, 670, 571] +[:key_held_player_one, 26, 0, 1, 671, 571] +[:key_held_player_one, 3, 0, 1, 672, 572] +[:key_held_player_one, 15, 0, 1, 673, 572] +[:key_held_player_one, 26, 0, 1, 674, 572] +[:key_held_player_one, 3, 0, 1, 675, 573] +[:key_held_player_one, 15, 0, 1, 676, 573] +[:key_held_player_one, 26, 0, 1, 677, 573] +[:key_held_player_one, 3, 0, 1, 678, 574] +[:key_held_player_one, 15, 0, 1, 679, 574] +[:key_held_player_one, 26, 0, 1, 680, 574] +[:key_held_player_one, 3, 0, 1, 681, 575] +[:key_held_player_one, 15, 0, 1, 682, 575] +[:key_held_player_one, 26, 0, 1, 683, 575] +[:key_held_player_one, 3, 0, 1, 684, 576] +[:key_held_player_one, 15, 0, 1, 685, 576] +[:key_held_player_one, 26, 0, 1, 686, 576] +[:key_held_player_one, 3, 0, 1, 687, 577] +[:key_held_player_one, 15, 0, 1, 688, 577] +[:key_held_player_one, 26, 0, 1, 689, 577] +[:key_held_player_one, 3, 0, 1, 690, 578] +[:key_held_player_one, 15, 0, 1, 691, 578] +[:key_held_player_one, 26, 0, 1, 692, 578] +[:key_held_player_one, 3, 0, 1, 693, 579] +[:key_held_player_one, 15, 0, 1, 694, 579] +[:key_held_player_one, 26, 0, 1, 695, 579] +[:key_held_player_one, 3, 0, 1, 696, 580] +[:key_held_player_one, 15, 0, 1, 697, 580] +[:key_held_player_one, 26, 0, 1, 698, 580] +[:key_held_player_one, 3, 0, 1, 699, 581] +[:key_held_player_one, 15, 0, 1, 700, 581] +[:key_held_player_one, 26, 0, 1, 701, 581] +[:key_held_player_one, 3, 0, 1, 702, 582] +[:key_held_player_one, 15, 0, 1, 703, 582] +[:key_held_player_one, 26, 0, 1, 704, 582] +[:key_held_player_one, 3, 0, 1, 705, 583] +[:key_held_player_one, 15, 0, 1, 706, 583] +[:key_held_player_one, 26, 0, 1, 707, 583] +[:key_held_player_one, 3, 0, 1, 708, 584] +[:key_held_player_one, 15, 0, 1, 709, 584] +[:key_held_player_one, 26, 0, 1, 710, 584] +[:key_held_player_one, 3, 0, 1, 711, 585] +[:key_held_player_one, 15, 0, 1, 712, 585] +[:key_held_player_one, 26, 0, 1, 713, 585] +[:key_held_player_one, 3, 0, 1, 714, 586] +[:key_held_player_one, 15, 0, 1, 715, 586] +[:key_held_player_one, 26, 0, 1, 716, 586] +[:key_held_player_one, 3, 0, 1, 717, 587] +[:key_held_player_one, 15, 0, 1, 718, 587] +[:key_held_player_one, 26, 0, 1, 719, 587] +[:key_held_player_one, 3, 0, 1, 720, 588] +[:key_held_player_one, 15, 0, 1, 721, 588] +[:key_held_player_one, 26, 0, 1, 722, 588] +[:key_held_player_one, 3, 0, 1, 723, 589] +[:key_held_player_one, 15, 0, 1, 724, 589] +[:key_held_player_one, 26, 0, 1, 725, 589] +[:key_held_player_one, 3, 0, 1, 726, 590] +[:key_held_player_one, 15, 0, 1, 727, 590] +[:key_held_player_one, 26, 0, 1, 728, 590] +[:key_held_player_one, 3, 0, 1, 729, 591] +[:key_held_player_one, 15, 0, 1, 730, 591] +[:key_held_player_one, 26, 0, 1, 731, 591] +[:key_held_player_one, 3, 0, 1, 732, 592] +[:key_held_player_one, 15, 0, 1, 733, 592] +[:key_held_player_one, 26, 0, 1, 734, 592] +[:key_up_player_one, 3, 0, 1, 735, 593] +[:key_held_player_one, 15, 0, 1, 736, 593] +[:key_up_player_one, 26, 0, 1, 737, 593] +[:key_held_player_one, 15, 0, 1, 738, 594] +[:key_held_player_one, 15, 0, 1, 739, 595] +[:key_held_player_one, 15, 0, 1, 740, 596] +[:key_held_player_one, 15, 0, 1, 741, 597] +[:key_held_player_one, 15, 0, 1, 742, 598] +[:key_held_player_one, 15, 0, 1, 743, 599] +[:key_held_player_one, 15, 0, 1, 744, 600] +[:key_held_player_one, 15, 0, 1, 745, 601] +[:key_held_player_one, 15, 0, 1, 746, 602] +[:key_held_player_one, 15, 0, 1, 747, 603] +[:key_held_player_one, 15, 0, 1, 748, 604] +[:key_held_player_one, 15, 0, 1, 749, 605] +[:key_held_player_one, 15, 0, 1, 750, 606] +[:key_held_player_one, 15, 0, 1, 751, 607] +[:key_held_player_one, 15, 0, 1, 752, 608] +[:key_held_player_one, 15, 0, 1, 753, 609] +[:key_held_player_one, 15, 0, 1, 754, 610] +[:key_held_player_one, 15, 0, 1, 755, 611] +[:key_held_player_one, 15, 0, 1, 756, 612] +[:key_held_player_one, 15, 0, 1, 757, 613] +[:key_held_player_one, 15, 0, 1, 758, 614] +[:key_held_player_one, 15, 0, 1, 759, 615] +[:key_held_player_one, 15, 0, 1, 760, 616] +[:key_held_player_one, 15, 0, 1, 761, 617] +[:key_held_player_one, 15, 0, 1, 762, 618] +[:key_held_player_one, 15, 0, 1, 763, 619] +[:key_held_player_one, 15, 0, 1, 764, 620] +[:key_held_player_one, 15, 0, 1, 765, 621] +[:key_down_player_one, 4, 0, 1, 766, 622] +[:key_held_player_one, 15, 0, 1, 767, 622] +[:key_down_player_one, 27, 0, 1, 768, 622] +[:key_held_player_one, 4, 0, 1, 769, 623] +[:key_held_player_one, 15, 0, 1, 770, 623] +[:key_held_player_one, 27, 0, 1, 771, 623] +[:key_held_player_one, 4, 0, 1, 772, 624] +[:key_held_player_one, 15, 0, 1, 773, 624] +[:key_held_player_one, 27, 0, 1, 774, 624] +[:key_held_player_one, 4, 0, 1, 775, 625] +[:key_held_player_one, 15, 0, 1, 776, 625] +[:key_held_player_one, 27, 0, 1, 777, 625] +[:key_held_player_one, 4, 0, 1, 778, 626] +[:key_held_player_one, 15, 0, 1, 779, 626] +[:key_held_player_one, 27, 0, 1, 780, 626] +[:key_held_player_one, 4, 0, 1, 781, 627] +[:key_held_player_one, 15, 0, 1, 782, 627] +[:key_held_player_one, 27, 0, 1, 783, 627] +[:key_held_player_one, 4, 0, 1, 784, 628] +[:key_held_player_one, 15, 0, 1, 785, 628] +[:key_held_player_one, 27, 0, 1, 786, 628] +[:key_held_player_one, 4, 0, 1, 787, 629] +[:key_held_player_one, 15, 0, 1, 788, 629] +[:key_held_player_one, 27, 0, 1, 789, 629] +[:key_held_player_one, 4, 0, 1, 790, 630] +[:key_held_player_one, 15, 0, 1, 791, 630] +[:key_held_player_one, 27, 0, 1, 792, 630] +[:key_held_player_one, 4, 0, 1, 793, 631] +[:key_held_player_one, 15, 0, 1, 794, 631] +[:key_held_player_one, 27, 0, 1, 795, 631] +[:key_held_player_one, 4, 0, 1, 796, 632] +[:key_held_player_one, 15, 0, 1, 797, 632] +[:key_held_player_one, 27, 0, 1, 798, 632] +[:key_held_player_one, 4, 0, 1, 799, 633] +[:key_held_player_one, 15, 0, 1, 800, 633] +[:key_held_player_one, 27, 0, 1, 801, 633] +[:key_held_player_one, 4, 0, 1, 802, 634] +[:key_held_player_one, 15, 0, 1, 803, 634] +[:key_held_player_one, 27, 0, 1, 804, 634] +[:key_held_player_one, 4, 0, 1, 805, 635] +[:key_held_player_one, 15, 0, 1, 806, 635] +[:key_held_player_one, 27, 0, 1, 807, 635] +[:key_held_player_one, 4, 0, 1, 808, 636] +[:key_held_player_one, 15, 0, 1, 809, 636] +[:key_held_player_one, 27, 0, 1, 810, 636] +[:key_held_player_one, 4, 0, 1, 811, 637] +[:key_held_player_one, 15, 0, 1, 812, 637] +[:key_held_player_one, 27, 0, 1, 813, 637] +[:key_held_player_one, 4, 0, 1, 814, 638] +[:key_held_player_one, 15, 0, 1, 815, 638] +[:key_held_player_one, 27, 0, 1, 816, 638] +[:key_held_player_one, 4, 0, 1, 817, 639] +[:key_held_player_one, 15, 0, 1, 818, 639] +[:key_held_player_one, 27, 0, 1, 819, 639] +[:key_held_player_one, 4, 0, 1, 820, 640] +[:key_held_player_one, 15, 0, 1, 821, 640] +[:key_held_player_one, 27, 0, 1, 822, 640] +[:key_held_player_one, 4, 0, 1, 823, 641] +[:key_held_player_one, 15, 0, 1, 824, 641] +[:key_held_player_one, 27, 0, 1, 825, 641] +[:key_held_player_one, 4, 0, 1, 826, 642] +[:key_held_player_one, 15, 0, 1, 827, 642] +[:key_held_player_one, 27, 0, 1, 828, 642] +[:key_held_player_one, 4, 0, 1, 829, 643] +[:key_held_player_one, 15, 0, 1, 830, 643] +[:key_held_player_one, 27, 0, 1, 831, 643] +[:key_held_player_one, 4, 0, 1, 832, 644] +[:key_held_player_one, 15, 0, 1, 833, 644] +[:key_held_player_one, 27, 0, 1, 834, 644] +[:key_held_player_one, 4, 0, 1, 835, 645] +[:key_held_player_one, 15, 0, 1, 836, 645] +[:key_held_player_one, 27, 0, 1, 837, 645] +[:key_held_player_one, 4, 0, 1, 838, 646] +[:key_held_player_one, 15, 0, 1, 839, 646] +[:key_held_player_one, 27, 0, 1, 840, 646] +[:key_held_player_one, 4, 0, 1, 841, 647] +[:key_held_player_one, 15, 0, 1, 842, 647] +[:key_held_player_one, 27, 0, 1, 843, 647] +[:key_held_player_one, 4, 0, 1, 844, 648] +[:key_held_player_one, 15, 0, 1, 845, 648] +[:key_held_player_one, 27, 0, 1, 846, 648] +[:key_held_player_one, 4, 0, 1, 847, 649] +[:key_held_player_one, 15, 0, 1, 848, 649] +[:key_held_player_one, 27, 0, 1, 849, 649] +[:key_held_player_one, 4, 0, 1, 850, 650] +[:key_held_player_one, 15, 0, 1, 851, 650] +[:key_held_player_one, 27, 0, 1, 852, 650] +[:key_held_player_one, 4, 0, 1, 853, 651] +[:key_held_player_one, 15, 0, 1, 854, 651] +[:key_held_player_one, 27, 0, 1, 855, 651] +[:key_held_player_one, 4, 0, 1, 856, 652] +[:key_held_player_one, 15, 0, 1, 857, 652] +[:key_held_player_one, 27, 0, 1, 858, 652] +[:key_held_player_one, 4, 0, 1, 859, 653] +[:key_held_player_one, 15, 0, 1, 860, 653] +[:key_held_player_one, 27, 0, 1, 861, 653] +[:key_held_player_one, 4, 0, 1, 862, 654] +[:key_held_player_one, 15, 0, 1, 863, 654] +[:key_held_player_one, 27, 0, 1, 864, 654] +[:key_held_player_one, 4, 0, 1, 865, 655] +[:key_held_player_one, 15, 0, 1, 866, 655] +[:key_held_player_one, 27, 0, 1, 867, 655] +[:key_held_player_one, 4, 0, 1, 868, 656] +[:key_held_player_one, 15, 0, 1, 869, 656] +[:key_held_player_one, 27, 0, 1, 870, 656] +[:key_held_player_one, 4, 0, 1, 871, 657] +[:key_held_player_one, 15, 0, 1, 872, 657] +[:key_held_player_one, 27, 0, 1, 873, 657] +[:key_up_player_one, 4, 0, 1, 874, 658] +[:key_held_player_one, 15, 0, 1, 875, 658] +[:key_up_player_one, 27, 0, 1, 876, 658] +[:key_held_player_one, 15, 0, 1, 877, 659] +[:key_held_player_one, 15, 0, 1, 878, 660] +[:key_held_player_one, 15, 0, 1, 879, 661] +[:key_held_player_one, 15, 0, 1, 880, 662] +[:key_held_player_one, 15, 0, 1, 881, 663] +[:key_held_player_one, 15, 0, 1, 882, 664] +[:key_held_player_one, 15, 0, 1, 883, 665] +[:key_held_player_one, 15, 0, 1, 884, 666] +[:key_held_player_one, 15, 0, 1, 885, 667] +[:key_held_player_one, 15, 0, 1, 886, 668] +[:key_held_player_one, 15, 0, 1, 887, 669] +[:key_held_player_one, 15, 0, 1, 888, 670] +[:key_held_player_one, 15, 0, 1, 889, 671] +[:key_held_player_one, 15, 0, 1, 890, 672] +[:key_held_player_one, 15, 0, 1, 891, 673] +[:key_held_player_one, 15, 0, 1, 892, 674] +[:key_held_player_one, 15, 0, 1, 893, 675] +[:key_held_player_one, 15, 0, 1, 894, 676] +[:key_held_player_one, 15, 0, 1, 895, 677] +[:key_held_player_one, 15, 0, 1, 896, 678] +[:key_held_player_one, 15, 0, 1, 897, 679] +[:key_held_player_one, 15, 0, 1, 898, 680] +[:key_held_player_one, 15, 0, 1, 899, 681] +[:key_held_player_one, 15, 0, 1, 900, 682] +[:key_held_player_one, 15, 0, 1, 901, 683] +[:key_held_player_one, 15, 0, 1, 902, 684] +[:key_held_player_one, 15, 0, 1, 903, 685] +[:key_held_player_one, 15, 0, 1, 904, 686] +[:key_held_player_one, 15, 0, 1, 905, 687] +[:key_held_player_one, 15, 0, 1, 906, 688] +[:key_held_player_one, 15, 0, 1, 907, 689] +[:key_held_player_one, 15, 0, 1, 908, 690] +[:key_held_player_one, 15, 0, 1, 909, 691] +[:key_held_player_one, 15, 0, 1, 910, 692] +[:key_held_player_one, 15, 0, 1, 911, 693] +[:key_held_player_one, 15, 0, 1, 912, 694] +[:key_held_player_one, 15, 0, 1, 913, 695] +[:key_held_player_one, 15, 0, 1, 914, 696] +[:key_held_player_one, 15, 0, 1, 915, 697] +[:key_held_player_one, 15, 0, 1, 916, 698] +[:key_held_player_one, 15, 0, 1, 917, 699] +[:key_held_player_one, 15, 0, 1, 918, 700] +[:key_held_player_one, 15, 0, 1, 919, 701] +[:key_held_player_one, 15, 0, 1, 920, 702] +[:key_held_player_one, 15, 0, 1, 921, 703] +[:key_held_player_one, 15, 0, 1, 922, 704] +[:key_held_player_one, 15, 0, 1, 923, 705] +[:key_held_player_one, 15, 0, 1, 924, 706] +[:key_held_player_one, 15, 0, 1, 925, 707] +[:key_held_player_one, 15, 0, 1, 926, 708] +[:key_held_player_one, 15, 0, 1, 927, 709] +[:key_held_player_one, 15, 0, 1, 928, 710] +[:key_held_player_one, 15, 0, 1, 929, 711] +[:key_held_player_one, 15, 0, 1, 930, 712] +[:key_held_player_one, 15, 0, 1, 931, 713] +[:key_held_player_one, 15, 0, 1, 932, 714] +[:key_held_player_one, 15, 0, 1, 933, 715] +[:key_held_player_one, 15, 0, 1, 934, 716] +[:key_held_player_one, 15, 0, 1, 935, 717] +[:key_held_player_one, 15, 0, 1, 936, 718] +[:key_held_player_one, 15, 0, 1, 937, 719] +[:key_held_player_one, 15, 0, 1, 938, 720] +[:key_held_player_one, 15, 0, 1, 939, 721] +[:key_held_player_one, 15, 0, 1, 940, 722] +[:key_held_player_one, 15, 0, 1, 941, 723] +[:key_held_player_one, 15, 0, 1, 942, 724] +[:key_held_player_one, 15, 0, 1, 943, 725] +[:key_held_player_one, 15, 0, 1, 944, 726] +[:key_held_player_one, 15, 0, 1, 945, 727] +[:key_held_player_one, 15, 0, 1, 946, 728] +[:key_held_player_one, 15, 0, 1, 947, 729] +[:key_held_player_one, 15, 0, 1, 948, 730] +[:key_held_player_one, 15, 0, 1, 949, 731] +[:key_held_player_one, 15, 0, 1, 950, 732] +[:key_held_player_one, 15, 0, 1, 951, 733] +[:key_held_player_one, 15, 0, 1, 952, 734] +[:key_held_player_one, 15, 0, 1, 953, 735] +[:key_held_player_one, 15, 0, 1, 954, 736] +[:key_held_player_one, 15, 0, 1, 955, 737] +[:key_held_player_one, 15, 0, 1, 956, 738] +[:key_held_player_one, 15, 0, 1, 957, 739] +[:key_held_player_one, 15, 0, 1, 958, 740] +[:key_held_player_one, 15, 0, 1, 959, 741] +[:key_held_player_one, 15, 0, 1, 960, 742] +[:key_held_player_one, 15, 0, 1, 961, 743] +[:key_held_player_one, 15, 0, 1, 962, 744] +[:key_held_player_one, 15, 0, 1, 963, 745] +[:key_held_player_one, 15, 0, 1, 964, 746] +[:key_held_player_one, 15, 0, 1, 965, 747] +[:key_held_player_one, 15, 0, 1, 966, 748] +[:key_held_player_one, 15, 0, 1, 967, 749] +[:key_held_player_one, 15, 0, 1, 968, 750] +[:key_held_player_one, 15, 0, 1, 969, 751] +[:key_held_player_one, 15, 0, 1, 970, 752] +[:key_held_player_one, 15, 0, 1, 971, 753] +[:key_held_player_one, 15, 0, 1, 972, 754] +[:key_held_player_one, 15, 0, 1, 973, 755] +[:key_held_player_one, 15, 0, 1, 974, 756] +[:key_held_player_one, 15, 0, 1, 975, 757] +[:key_held_player_one, 15, 0, 1, 976, 758] +[:key_held_player_one, 15, 0, 1, 977, 759] +[:key_held_player_one, 15, 0, 1, 978, 760] +[:key_held_player_one, 15, 0, 1, 979, 761] +[:key_held_player_one, 15, 0, 1, 980, 762] +[:key_held_player_one, 15, 0, 1, 981, 763] +[:key_held_player_one, 15, 0, 1, 982, 764] +[:key_held_player_one, 15, 0, 1, 983, 765] +[:key_held_player_one, 15, 0, 1, 984, 766] +[:key_held_player_one, 15, 0, 1, 985, 767] +[:key_held_player_one, 15, 0, 1, 986, 768] +[:key_held_player_one, 15, 0, 1, 987, 769] +[:key_held_player_one, 15, 0, 1, 988, 770] +[:key_held_player_one, 15, 0, 1, 989, 771] +[:key_held_player_one, 15, 0, 1, 990, 772] +[:key_held_player_one, 15, 0, 1, 991, 773] +[:key_held_player_one, 15, 0, 1, 992, 774] +[:key_held_player_one, 15, 0, 1, 993, 775] +[:key_held_player_one, 15, 0, 1, 994, 776] +[:key_held_player_one, 15, 0, 1, 995, 777] +[:key_held_player_one, 15, 0, 1, 996, 778] +[:key_held_player_one, 15, 0, 1, 997, 779] +[:key_held_player_one, 15, 0, 1, 998, 780] +[:key_held_player_one, 15, 0, 1, 999, 781] +[:key_held_player_one, 15, 0, 1, 1000, 782] +[:key_held_player_one, 15, 0, 1, 1001, 783] +[:key_held_player_one, 15, 0, 1, 1002, 784] +[:key_held_player_one, 15, 0, 1, 1003, 785] +[:key_held_player_one, 15, 0, 1, 1004, 786] +[:key_held_player_one, 15, 0, 1, 1005, 787] +[:key_held_player_one, 15, 0, 1, 1006, 788] +[:key_held_player_one, 15, 0, 1, 1007, 789] +[:key_held_player_one, 15, 0, 1, 1008, 790] +[:key_held_player_one, 15, 0, 1, 1009, 791] +[:key_held_player_one, 15, 0, 1, 1010, 792] +[:key_held_player_one, 15, 0, 1, 1011, 793] +[:key_held_player_one, 15, 0, 1, 1012, 794] +[:key_held_player_one, 15, 0, 1, 1013, 795] +[:key_held_player_one, 15, 0, 1, 1014, 796] +[:key_held_player_one, 15, 0, 1, 1015, 797] +[:key_held_player_one, 15, 0, 1, 1016, 798] +[:key_held_player_one, 15, 0, 1, 1017, 799] +[:key_held_player_one, 15, 0, 1, 1018, 800] +[:key_held_player_one, 15, 0, 1, 1019, 801] +[:key_held_player_one, 15, 0, 1, 1020, 802] +[:key_held_player_one, 15, 0, 1, 1021, 803] +[:key_held_player_one, 15, 0, 1, 1022, 804] +[:key_held_player_one, 15, 0, 1, 1023, 805] +[:key_held_player_one, 15, 0, 1, 1024, 806] +[:key_held_player_one, 15, 0, 1, 1025, 807] +[:key_held_player_one, 15, 0, 1, 1026, 808] +[:key_held_player_one, 15, 0, 1, 1027, 809] +[:key_held_player_one, 15, 0, 1, 1028, 810] +[:key_held_player_one, 15, 0, 1, 1029, 811] +[:key_held_player_one, 15, 0, 1, 1030, 812] +[:key_held_player_one, 15, 0, 1, 1031, 813] +[:key_held_player_one, 15, 0, 1, 1032, 814] +[:key_held_player_one, 15, 0, 1, 1033, 815] +[:key_held_player_one, 15, 0, 1, 1034, 816] +[:key_held_player_one, 15, 0, 1, 1035, 817] +[:key_held_player_one, 15, 0, 1, 1036, 818] +[:key_held_player_one, 15, 0, 1, 1037, 819] +[:key_held_player_one, 15, 0, 1, 1038, 820] +[:key_held_player_one, 15, 0, 1, 1039, 821] +[:key_held_player_one, 15, 0, 1, 1040, 822] +[:key_held_player_one, 15, 0, 1, 1041, 823] +[:key_held_player_one, 15, 0, 1, 1042, 824] +[:key_held_player_one, 15, 0, 1, 1043, 825] +[:key_held_player_one, 15, 0, 1, 1044, 826] +[:key_held_player_one, 15, 0, 1, 1045, 827] +[:key_held_player_one, 15, 0, 1, 1046, 828] +[:key_held_player_one, 15, 0, 1, 1047, 829] +[:key_held_player_one, 15, 0, 1, 1048, 830] +[:key_held_player_one, 15, 0, 1, 1049, 831] +[:key_held_player_one, 15, 0, 1, 1050, 832] +[:key_held_player_one, 15, 0, 1, 1051, 833] +[:key_held_player_one, 15, 0, 1, 1052, 834] +[:key_held_player_one, 15, 0, 1, 1053, 835] +[:key_held_player_one, 15, 0, 1, 1054, 836] +[:key_held_player_one, 15, 0, 1, 1055, 837] +[:key_held_player_one, 15, 0, 1, 1056, 838] +[:key_held_player_one, 15, 0, 1, 1057, 839] +[:key_held_player_one, 15, 0, 1, 1058, 840] +[:key_held_player_one, 15, 0, 1, 1059, 841] +[:key_held_player_one, 15, 0, 1, 1060, 842] +[:key_held_player_one, 15, 0, 1, 1061, 843] +[:key_held_player_one, 15, 0, 1, 1062, 844] +[:key_held_player_one, 15, 0, 1, 1063, 845] +[:key_held_player_one, 15, 0, 1, 1064, 846] +[:key_held_player_one, 15, 0, 1, 1065, 847] +[:key_held_player_one, 15, 0, 1, 1066, 848] +[:key_held_player_one, 15, 0, 1, 1067, 849] +[:key_held_player_one, 15, 0, 1, 1068, 850] +[:key_held_player_one, 15, 0, 1, 1069, 851] +[:key_held_player_one, 15, 0, 1, 1070, 852] +[:key_held_player_one, 15, 0, 1, 1071, 853] +[:key_held_player_one, 15, 0, 1, 1072, 854] +[:key_held_player_one, 15, 0, 1, 1073, 855] +[:key_held_player_one, 15, 0, 1, 1074, 856] +[:key_held_player_one, 15, 0, 1, 1075, 857] +[:key_held_player_one, 15, 0, 1, 1076, 858] +[:key_held_player_one, 15, 0, 1, 1077, 859] +[:key_held_player_one, 15, 0, 1, 1078, 860] +[:key_held_player_one, 15, 0, 1, 1079, 861] +[:key_held_player_one, 15, 0, 1, 1080, 862] +[:key_held_player_one, 15, 0, 1, 1081, 863] +[:key_held_player_one, 15, 0, 1, 1082, 864] +[:key_held_player_one, 15, 0, 1, 1083, 865] +[:key_held_player_one, 15, 0, 1, 1084, 866] +[:key_held_player_one, 15, 0, 1, 1085, 867] +[:key_held_player_one, 15, 0, 1, 1086, 868] +[:key_held_player_one, 15, 0, 1, 1087, 869] +[:key_held_player_one, 15, 0, 1, 1088, 870] +[:key_held_player_one, 15, 0, 1, 1089, 871] +[:key_held_player_one, 15, 0, 1, 1090, 872] +[:key_down_player_one, 4, 0, 1, 1091, 873] +[:key_held_player_one, 15, 0, 1, 1092, 873] +[:key_down_player_one, 27, 0, 1, 1093, 873] +[:key_held_player_one, 4, 0, 1, 1094, 874] +[:key_held_player_one, 15, 0, 1, 1095, 874] +[:key_held_player_one, 27, 0, 1, 1096, 874] +[:key_held_player_one, 4, 0, 1, 1097, 875] +[:key_held_player_one, 15, 0, 1, 1098, 875] +[:key_held_player_one, 27, 0, 1, 1099, 875] +[:key_held_player_one, 4, 0, 1, 1100, 876] +[:key_held_player_one, 15, 0, 1, 1101, 876] +[:key_held_player_one, 27, 0, 1, 1102, 876] +[:key_held_player_one, 4, 0, 1, 1103, 877] +[:key_held_player_one, 15, 0, 1, 1104, 877] +[:key_held_player_one, 27, 0, 1, 1105, 877] +[:key_held_player_one, 4, 0, 1, 1106, 878] +[:key_held_player_one, 15, 0, 1, 1107, 878] +[:key_held_player_one, 27, 0, 1, 1108, 878] +[:key_held_player_one, 4, 0, 1, 1109, 879] +[:key_held_player_one, 15, 0, 1, 1110, 879] +[:key_held_player_one, 27, 0, 1, 1111, 879] +[:key_held_player_one, 4, 0, 1, 1112, 880] +[:key_held_player_one, 15, 0, 1, 1113, 880] +[:key_held_player_one, 27, 0, 1, 1114, 880] +[:key_held_player_one, 4, 0, 1, 1115, 881] +[:key_held_player_one, 15, 0, 1, 1116, 881] +[:key_held_player_one, 27, 0, 1, 1117, 881] +[:key_held_player_one, 4, 0, 1, 1118, 882] +[:key_held_player_one, 15, 0, 1, 1119, 882] +[:key_held_player_one, 27, 0, 1, 1120, 882] +[:key_held_player_one, 4, 0, 1, 1121, 883] +[:key_held_player_one, 15, 0, 1, 1122, 883] +[:key_held_player_one, 27, 0, 1, 1123, 883] +[:key_held_player_one, 4, 0, 1, 1124, 884] +[:key_held_player_one, 15, 0, 1, 1125, 884] +[:key_held_player_one, 27, 0, 1, 1126, 884] +[:key_up_player_one, 4, 0, 1, 1127, 885] +[:key_held_player_one, 15, 0, 1, 1128, 885] +[:key_up_player_one, 27, 0, 1, 1129, 885] +[:key_held_player_one, 15, 0, 1, 1130, 886] +[:key_held_player_one, 15, 0, 1, 1131, 887] +[:key_held_player_one, 15, 0, 1, 1132, 888] +[:key_held_player_one, 15, 0, 1, 1133, 889] +[:key_held_player_one, 15, 0, 1, 1134, 890] +[:key_held_player_one, 15, 0, 1, 1135, 891] +[:key_held_player_one, 15, 0, 1, 1136, 892] +[:key_held_player_one, 15, 0, 1, 1137, 893] +[:key_held_player_one, 15, 0, 1, 1138, 894] +[:key_held_player_one, 15, 0, 1, 1139, 895] +[:key_held_player_one, 15, 0, 1, 1140, 896] +[:key_held_player_one, 15, 0, 1, 1141, 897] +[:key_held_player_one, 15, 0, 1, 1142, 898] +[:key_held_player_one, 15, 0, 1, 1143, 899] +[:key_held_player_one, 15, 0, 1, 1144, 900] +[:key_held_player_one, 15, 0, 1, 1145, 901] +[:key_held_player_one, 15, 0, 1, 1146, 902] +[:key_held_player_one, 15, 0, 1, 1147, 903] +[:key_held_player_one, 15, 0, 1, 1148, 904] +[:key_held_player_one, 15, 0, 1, 1149, 905] +[:key_held_player_one, 15, 0, 1, 1150, 906] +[:key_held_player_one, 15, 0, 1, 1151, 907] +[:key_down_player_one, 4, 0, 1, 1152, 908] +[:key_held_player_one, 15, 0, 1, 1153, 908] +[:key_down_player_one, 27, 0, 1, 1154, 908] +[:key_held_player_one, 4, 0, 1, 1155, 909] +[:key_held_player_one, 15, 0, 1, 1156, 909] +[:key_held_player_one, 27, 0, 1, 1157, 909] +[:key_held_player_one, 4, 0, 1, 1158, 910] +[:key_held_player_one, 15, 0, 1, 1159, 910] +[:key_held_player_one, 27, 0, 1, 1160, 910] +[:key_held_player_one, 4, 0, 1, 1161, 911] +[:key_held_player_one, 15, 0, 1, 1162, 911] +[:key_held_player_one, 27, 0, 1, 1163, 911] +[:key_held_player_one, 4, 0, 1, 1164, 912] +[:key_held_player_one, 15, 0, 1, 1165, 912] +[:key_held_player_one, 27, 0, 1, 1166, 912] +[:key_held_player_one, 4, 0, 1, 1167, 913] +[:key_held_player_one, 15, 0, 1, 1168, 913] +[:key_held_player_one, 27, 0, 1, 1169, 913] +[:key_held_player_one, 4, 0, 1, 1170, 914] +[:key_held_player_one, 15, 0, 1, 1171, 914] +[:key_held_player_one, 27, 0, 1, 1172, 914] +[:key_held_player_one, 4, 0, 1, 1173, 915] +[:key_held_player_one, 15, 0, 1, 1174, 915] +[:key_held_player_one, 27, 0, 1, 1175, 915] +[:key_held_player_one, 4, 0, 1, 1176, 916] +[:key_held_player_one, 15, 0, 1, 1177, 916] +[:key_held_player_one, 27, 0, 1, 1178, 916] +[:key_held_player_one, 4, 0, 1, 1179, 917] +[:key_held_player_one, 15, 0, 1, 1180, 917] +[:key_held_player_one, 27, 0, 1, 1181, 917] +[:key_held_player_one, 4, 0, 1, 1182, 918] +[:key_held_player_one, 15, 0, 1, 1183, 918] +[:key_held_player_one, 27, 0, 1, 1184, 918] +[:key_held_player_one, 4, 0, 1, 1185, 919] +[:key_held_player_one, 15, 0, 1, 1186, 919] +[:key_held_player_one, 27, 0, 1, 1187, 919] +[:key_held_player_one, 4, 0, 1, 1188, 920] +[:key_held_player_one, 15, 0, 1, 1189, 920] +[:key_held_player_one, 27, 0, 1, 1190, 920] +[:key_up_player_one, 4, 0, 1, 1191, 921] +[:key_held_player_one, 15, 0, 1, 1192, 921] +[:key_up_player_one, 27, 0, 1, 1193, 921] +[:key_held_player_one, 15, 0, 1, 1194, 922] +[:key_held_player_one, 15, 0, 1, 1195, 923] +[:key_held_player_one, 15, 0, 1, 1196, 924] +[:key_held_player_one, 15, 0, 1, 1197, 925] +[:key_held_player_one, 15, 0, 1, 1198, 926] +[:key_held_player_one, 15, 0, 1, 1199, 927] +[:key_held_player_one, 15, 0, 1, 1200, 928] +[:key_held_player_one, 15, 0, 1, 1201, 929] +[:key_held_player_one, 15, 0, 1, 1202, 930] +[:key_held_player_one, 15, 0, 1, 1203, 931] +[:key_held_player_one, 15, 0, 1, 1204, 932] +[:key_held_player_one, 15, 0, 1, 1205, 933] +[:key_held_player_one, 15, 0, 1, 1206, 934] +[:key_held_player_one, 15, 0, 1, 1207, 935] +[:key_held_player_one, 15, 0, 1, 1208, 936] +[:key_held_player_one, 15, 0, 1, 1209, 937] +[:key_held_player_one, 15, 0, 1, 1210, 938] +[:key_held_player_one, 15, 0, 1, 1211, 939] +[:key_held_player_one, 15, 0, 1, 1212, 940] +[:key_held_player_one, 15, 0, 1, 1213, 941] +[:key_held_player_one, 15, 0, 1, 1214, 942] +[:key_held_player_one, 15, 0, 1, 1215, 943] +[:key_held_player_one, 15, 0, 1, 1216, 944] +[:key_held_player_one, 15, 0, 1, 1217, 945] +[:key_held_player_one, 15, 0, 1, 1218, 946] +[:key_held_player_one, 15, 0, 1, 1219, 947] +[:key_held_player_one, 15, 0, 1, 1220, 948] +[:key_held_player_one, 15, 0, 1, 1221, 949] +[:key_held_player_one, 15, 0, 1, 1222, 950] +[:key_held_player_one, 15, 0, 1, 1223, 951] +[:key_held_player_one, 15, 0, 1, 1224, 952] +[:key_held_player_one, 15, 0, 1, 1225, 953] +[:key_held_player_one, 15, 0, 1, 1226, 954] +[:key_held_player_one, 15, 0, 1, 1227, 955] +[:key_held_player_one, 15, 0, 1, 1228, 956] +[:key_held_player_one, 15, 0, 1, 1229, 957] +[:key_held_player_one, 15, 0, 1, 1230, 958] +[:key_held_player_one, 15, 0, 1, 1231, 959] +[:key_held_player_one, 15, 0, 1, 1232, 960] +[:key_held_player_one, 15, 0, 1, 1233, 961] +[:key_held_player_one, 15, 0, 1, 1234, 962] +[:key_held_player_one, 15, 0, 1, 1235, 963] +[:key_held_player_one, 15, 0, 1, 1236, 964] +[:key_held_player_one, 15, 0, 1, 1237, 965] +[:key_held_player_one, 15, 0, 1, 1238, 966] +[:key_held_player_one, 15, 0, 1, 1239, 967] +[:key_held_player_one, 15, 0, 1, 1240, 968] +[:key_held_player_one, 15, 0, 1, 1241, 969] +[:key_held_player_one, 15, 0, 1, 1242, 970] +[:key_held_player_one, 15, 0, 1, 1243, 971] +[:key_held_player_one, 15, 0, 1, 1244, 972] +[:key_held_player_one, 15, 0, 1, 1245, 973] +[:key_held_player_one, 15, 0, 1, 1246, 974] +[:key_held_player_one, 15, 0, 1, 1247, 975] +[:key_held_player_one, 15, 0, 1, 1248, 976] +[:key_held_player_one, 15, 0, 1, 1249, 977] +[:key_held_player_one, 15, 0, 1, 1250, 978] +[:key_held_player_one, 15, 0, 1, 1251, 979] +[:key_held_player_one, 15, 0, 1, 1252, 980] +[:key_held_player_one, 15, 0, 1, 1253, 981] +[:key_held_player_one, 15, 0, 1, 1254, 982] +[:key_held_player_one, 15, 0, 1, 1255, 983] +[:key_held_player_one, 15, 0, 1, 1256, 984] +[:key_held_player_one, 15, 0, 1, 1257, 985] +[:key_held_player_one, 15, 0, 1, 1258, 986] +[:key_held_player_one, 15, 0, 1, 1259, 987] +[:key_held_player_one, 15, 0, 1, 1260, 988] +[:key_held_player_one, 15, 0, 1, 1261, 989] +[:key_held_player_one, 15, 0, 1, 1262, 990] +[:key_held_player_one, 15, 0, 1, 1263, 991] +[:key_held_player_one, 15, 0, 1, 1264, 992] +[:key_held_player_one, 15, 0, 1, 1265, 993] +[:key_held_player_one, 15, 0, 1, 1266, 994] +[:key_held_player_one, 15, 0, 1, 1267, 995] +[:key_held_player_one, 15, 0, 1, 1268, 996] +[:key_held_player_one, 15, 0, 1, 1269, 997] +[:key_held_player_one, 15, 0, 1, 1270, 998] +[:key_held_player_one, 15, 0, 1, 1271, 999] +[:key_held_player_one, 15, 0, 1, 1272, 1000] +[:key_held_player_one, 15, 0, 1, 1273, 1001] +[:key_held_player_one, 15, 0, 1, 1274, 1002] +[:key_held_player_one, 15, 0, 1, 1275, 1003] +[:key_held_player_one, 15, 0, 1, 1276, 1004] +[:key_held_player_one, 15, 0, 1, 1277, 1005] +[:key_held_player_one, 15, 0, 1, 1278, 1006] +[:key_held_player_one, 15, 0, 1, 1279, 1007] +[:key_held_player_one, 15, 0, 1, 1280, 1008] +[:key_held_player_one, 15, 0, 1, 1281, 1009] +[:key_held_player_one, 15, 0, 1, 1282, 1010] +[:key_held_player_one, 15, 0, 1, 1283, 1011] +[:key_held_player_one, 15, 0, 1, 1284, 1012] +[:key_held_player_one, 15, 0, 1, 1285, 1013] +[:key_held_player_one, 15, 0, 1, 1286, 1014] +[:key_held_player_one, 15, 0, 1, 1287, 1015] +[:key_held_player_one, 15, 0, 1, 1288, 1016] +[:key_held_player_one, 15, 0, 1, 1289, 1017] +[:key_held_player_one, 15, 0, 1, 1290, 1018] +[:key_held_player_one, 15, 0, 1, 1291, 1019] +[:key_held_player_one, 15, 0, 1, 1292, 1020] +[:key_held_player_one, 15, 0, 1, 1293, 1021] +[:key_held_player_one, 15, 0, 1, 1294, 1022] +[:key_held_player_one, 15, 0, 1, 1295, 1023] +[:key_held_player_one, 15, 0, 1, 1296, 1024] +[:key_held_player_one, 15, 0, 1, 1297, 1025] +[:key_held_player_one, 15, 0, 1, 1298, 1026] +[:key_held_player_one, 15, 0, 1, 1299, 1027] +[:key_held_player_one, 15, 0, 1, 1300, 1028] +[:key_held_player_one, 15, 0, 1, 1301, 1029] +[:key_held_player_one, 15, 0, 1, 1302, 1030] +[:key_held_player_one, 15, 0, 1, 1303, 1031] +[:key_held_player_one, 15, 0, 1, 1304, 1032] +[:key_held_player_one, 15, 0, 1, 1305, 1033] +[:key_held_player_one, 15, 0, 1, 1306, 1034] +[:key_held_player_one, 15, 0, 1, 1307, 1035] +[:key_held_player_one, 15, 0, 1, 1308, 1036] +[:key_held_player_one, 15, 0, 1, 1309, 1037] +[:key_held_player_one, 15, 0, 1, 1310, 1038] +[:key_held_player_one, 15, 0, 1, 1311, 1039] +[:key_held_player_one, 15, 0, 1, 1312, 1040] +[:key_held_player_one, 15, 0, 1, 1313, 1041] +[:key_held_player_one, 15, 0, 1, 1314, 1042] +[:key_held_player_one, 15, 0, 1, 1315, 1043] +[:key_held_player_one, 15, 0, 1, 1316, 1044] +[:key_held_player_one, 15, 0, 1, 1317, 1045] +[:key_held_player_one, 15, 0, 1, 1318, 1046] +[:key_held_player_one, 15, 0, 1, 1319, 1047] +[:key_held_player_one, 15, 0, 1, 1320, 1048] +[:key_held_player_one, 15, 0, 1, 1321, 1049] +[:key_held_player_one, 15, 0, 1, 1322, 1050] +[:key_held_player_one, 15, 0, 1, 1323, 1051] +[:key_held_player_one, 15, 0, 1, 1324, 1052] +[:key_held_player_one, 15, 0, 1, 1325, 1053] +[:key_held_player_one, 15, 0, 1, 1326, 1054] +[:key_held_player_one, 15, 0, 1, 1327, 1055] +[:key_held_player_one, 15, 0, 1, 1328, 1056] +[:key_held_player_one, 15, 0, 1, 1329, 1057] +[:key_held_player_one, 15, 0, 1, 1330, 1058] +[:key_held_player_one, 15, 0, 1, 1331, 1059] +[:key_held_player_one, 15, 0, 1, 1332, 1060] +[:key_held_player_one, 15, 0, 1, 1333, 1061] +[:key_held_player_one, 15, 0, 1, 1334, 1062] +[:key_held_player_one, 15, 0, 1, 1335, 1063] +[:key_down_player_one, 3, 0, 1, 1336, 1064] +[:key_held_player_one, 15, 0, 1, 1337, 1064] +[:key_down_player_one, 26, 0, 1, 1338, 1064] +[:key_held_player_one, 3, 0, 1, 1339, 1065] +[:key_held_player_one, 15, 0, 1, 1340, 1065] +[:key_held_player_one, 26, 0, 1, 1341, 1065] +[:key_held_player_one, 3, 0, 1, 1342, 1066] +[:key_held_player_one, 15, 0, 1, 1343, 1066] +[:key_held_player_one, 26, 0, 1, 1344, 1066] +[:key_held_player_one, 3, 0, 1, 1345, 1067] +[:key_held_player_one, 15, 0, 1, 1346, 1067] +[:key_held_player_one, 26, 0, 1, 1347, 1067] +[:key_held_player_one, 3, 0, 1, 1348, 1068] +[:key_held_player_one, 15, 0, 1, 1349, 1068] +[:key_held_player_one, 26, 0, 1, 1350, 1068] +[:key_held_player_one, 3, 0, 1, 1351, 1069] +[:key_held_player_one, 15, 0, 1, 1352, 1069] +[:key_held_player_one, 26, 0, 1, 1353, 1069] +[:key_held_player_one, 3, 0, 1, 1354, 1070] +[:key_held_player_one, 15, 0, 1, 1355, 1070] +[:key_held_player_one, 26, 0, 1, 1356, 1070] +[:key_held_player_one, 3, 0, 1, 1357, 1071] +[:key_held_player_one, 15, 0, 1, 1358, 1071] +[:key_held_player_one, 26, 0, 1, 1359, 1071] +[:key_held_player_one, 3, 0, 1, 1360, 1072] +[:key_held_player_one, 15, 0, 1, 1361, 1072] +[:key_held_player_one, 26, 0, 1, 1362, 1072] +[:key_held_player_one, 3, 0, 1, 1363, 1073] +[:key_held_player_one, 15, 0, 1, 1364, 1073] +[:key_held_player_one, 26, 0, 1, 1365, 1073] +[:key_held_player_one, 3, 0, 1, 1366, 1074] +[:key_held_player_one, 15, 0, 1, 1367, 1074] +[:key_held_player_one, 26, 0, 1, 1368, 1074] +[:key_held_player_one, 3, 0, 1, 1369, 1075] +[:key_held_player_one, 15, 0, 1, 1370, 1075] +[:key_held_player_one, 26, 0, 1, 1371, 1075] +[:key_held_player_one, 3, 0, 1, 1372, 1076] +[:key_held_player_one, 15, 0, 1, 1373, 1076] +[:key_held_player_one, 26, 0, 1, 1374, 1076] +[:key_held_player_one, 3, 0, 1, 1375, 1077] +[:key_held_player_one, 15, 0, 1, 1376, 1077] +[:key_held_player_one, 26, 0, 1, 1377, 1077] +[:key_held_player_one, 3, 0, 1, 1378, 1078] +[:key_held_player_one, 15, 0, 1, 1379, 1078] +[:key_held_player_one, 26, 0, 1, 1380, 1078] +[:key_held_player_one, 3, 0, 1, 1381, 1079] +[:key_held_player_one, 15, 0, 1, 1382, 1079] +[:key_held_player_one, 26, 0, 1, 1383, 1079] +[:key_held_player_one, 3, 0, 1, 1384, 1080] +[:key_held_player_one, 15, 0, 1, 1385, 1080] +[:key_held_player_one, 26, 0, 1, 1386, 1080] +[:key_held_player_one, 3, 0, 1, 1387, 1081] +[:key_held_player_one, 15, 0, 1, 1388, 1081] +[:key_held_player_one, 26, 0, 1, 1389, 1081] +[:key_held_player_one, 3, 0, 1, 1390, 1082] +[:key_held_player_one, 15, 0, 1, 1391, 1082] +[:key_held_player_one, 26, 0, 1, 1392, 1082] +[:key_held_player_one, 3, 0, 1, 1393, 1083] +[:key_held_player_one, 15, 0, 1, 1394, 1083] +[:key_held_player_one, 26, 0, 1, 1395, 1083] +[:key_held_player_one, 3, 0, 1, 1396, 1084] +[:key_held_player_one, 15, 0, 1, 1397, 1084] +[:key_held_player_one, 26, 0, 1, 1398, 1084] +[:key_held_player_one, 3, 0, 1, 1399, 1085] +[:key_held_player_one, 15, 0, 1, 1400, 1085] +[:key_held_player_one, 26, 0, 1, 1401, 1085] +[:key_held_player_one, 3, 0, 1, 1402, 1086] +[:key_held_player_one, 15, 0, 1, 1403, 1086] +[:key_held_player_one, 26, 0, 1, 1404, 1086] +[:key_held_player_one, 3, 0, 1, 1405, 1087] +[:key_held_player_one, 15, 0, 1, 1406, 1087] +[:key_held_player_one, 26, 0, 1, 1407, 1087] +[:key_held_player_one, 3, 0, 1, 1408, 1088] +[:key_held_player_one, 15, 0, 1, 1409, 1088] +[:key_held_player_one, 26, 0, 1, 1410, 1088] +[:key_held_player_one, 3, 0, 1, 1411, 1089] +[:key_held_player_one, 15, 0, 1, 1412, 1089] +[:key_held_player_one, 26, 0, 1, 1413, 1089] +[:key_held_player_one, 3, 0, 1, 1414, 1090] +[:key_held_player_one, 15, 0, 1, 1415, 1090] +[:key_held_player_one, 26, 0, 1, 1416, 1090] +[:key_held_player_one, 3, 0, 1, 1417, 1091] +[:key_held_player_one, 15, 0, 1, 1418, 1091] +[:key_held_player_one, 26, 0, 1, 1419, 1091] +[:key_held_player_one, 3, 0, 1, 1420, 1092] +[:key_held_player_one, 15, 0, 1, 1421, 1092] +[:key_held_player_one, 26, 0, 1, 1422, 1092] +[:key_held_player_one, 3, 0, 1, 1423, 1093] +[:key_held_player_one, 15, 0, 1, 1424, 1093] +[:key_held_player_one, 26, 0, 1, 1425, 1093] +[:key_held_player_one, 3, 0, 1, 1426, 1094] +[:key_held_player_one, 15, 0, 1, 1427, 1094] +[:key_held_player_one, 26, 0, 1, 1428, 1094] +[:key_held_player_one, 3, 0, 1, 1429, 1095] +[:key_held_player_one, 15, 0, 1, 1430, 1095] +[:key_held_player_one, 26, 0, 1, 1431, 1095] +[:key_held_player_one, 3, 0, 1, 1432, 1096] +[:key_held_player_one, 15, 0, 1, 1433, 1096] +[:key_held_player_one, 26, 0, 1, 1434, 1096] +[:key_held_player_one, 3, 0, 1, 1435, 1097] +[:key_held_player_one, 15, 0, 1, 1436, 1097] +[:key_held_player_one, 26, 0, 1, 1437, 1097] +[:key_held_player_one, 3, 0, 1, 1438, 1098] +[:key_held_player_one, 15, 0, 1, 1439, 1098] +[:key_held_player_one, 26, 0, 1, 1440, 1098] +[:key_held_player_one, 3, 0, 1, 1441, 1099] +[:key_held_player_one, 15, 0, 1, 1442, 1099] +[:key_held_player_one, 26, 0, 1, 1443, 1099] +[:key_held_player_one, 3, 0, 1, 1444, 1100] +[:key_held_player_one, 15, 0, 1, 1445, 1100] +[:key_held_player_one, 26, 0, 1, 1446, 1100] +[:key_held_player_one, 3, 0, 1, 1447, 1101] +[:key_held_player_one, 15, 0, 1, 1448, 1101] +[:key_held_player_one, 26, 0, 1, 1449, 1101] +[:key_held_player_one, 3, 0, 1, 1450, 1102] +[:key_held_player_one, 15, 0, 1, 1451, 1102] +[:key_held_player_one, 26, 0, 1, 1452, 1102] +[:key_held_player_one, 3, 0, 1, 1453, 1103] +[:key_held_player_one, 15, 0, 1, 1454, 1103] +[:key_held_player_one, 26, 0, 1, 1455, 1103] +[:key_held_player_one, 3, 0, 1, 1456, 1104] +[:key_up_player_one, 15, 0, 1, 1457, 1104] +[:key_held_player_one, 26, 0, 1, 1458, 1104] +[:key_held_player_one, 3, 0, 1, 1459, 1105] +[:key_held_player_one, 26, 0, 1, 1460, 1105] +[:key_held_player_one, 3, 0, 1, 1461, 1106] +[:key_held_player_one, 26, 0, 1, 1462, 1106] +[:key_up_player_one, 3, 0, 1, 1463, 1107] +[:key_up_player_one, 26, 0, 1, 1464, 1107] +[:key_down_raw, 1073742051, 1024, 2, 1465, 1197] +[:key_down_raw, 113, 1024, 2, 1466, 1197] +[:key_up_raw, 113, 1024, 2, 1467, 1197] +[:key_up_raw, 1073742051, 0, 2, 1468, 1197] diff --git a/samples/99_sample_nddnug_workshop/sounds/bg.ogg b/samples/99_sample_nddnug_workshop/sounds/bg.ogg Binary files differnew file mode 100644 index 0000000..8a02a75 --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sounds/bg.ogg diff --git a/samples/99_sample_nddnug_workshop/sprites/earth.png b/samples/99_sample_nddnug_workshop/sprites/earth.png Binary files differnew file mode 100644 index 0000000..294f3aa --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/earth.png diff --git a/samples/99_sample_nddnug_workshop/sprites/jupiter.png b/samples/99_sample_nddnug_workshop/sprites/jupiter.png Binary files differnew file mode 100644 index 0000000..b128b0e --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/jupiter.png diff --git a/samples/99_sample_nddnug_workshop/sprites/mars.png b/samples/99_sample_nddnug_workshop/sprites/mars.png Binary files differnew file mode 100644 index 0000000..5d0f8ed --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/mars.png diff --git a/samples/99_sample_nddnug_workshop/sprites/mercury.png b/samples/99_sample_nddnug_workshop/sprites/mercury.png Binary files differnew file mode 100644 index 0000000..3ace04d --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/mercury.png diff --git a/samples/99_sample_nddnug_workshop/sprites/neptune.png b/samples/99_sample_nddnug_workshop/sprites/neptune.png Binary files differnew file mode 100644 index 0000000..1f22686 --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/neptune.png diff --git a/samples/99_sample_nddnug_workshop/sprites/orbit.png b/samples/99_sample_nddnug_workshop/sprites/orbit.png Binary files differnew file mode 100644 index 0000000..39d0891 --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/orbit.png diff --git a/samples/99_sample_nddnug_workshop/sprites/particle.png b/samples/99_sample_nddnug_workshop/sprites/particle.png Binary files differnew file mode 100644 index 0000000..6143f2f --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/particle.png diff --git a/samples/99_sample_nddnug_workshop/sprites/pluto.png b/samples/99_sample_nddnug_workshop/sprites/pluto.png Binary files differnew file mode 100644 index 0000000..2d9916c --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/pluto.png diff --git a/samples/99_sample_nddnug_workshop/sprites/saturn.png b/samples/99_sample_nddnug_workshop/sprites/saturn.png Binary files differnew file mode 100644 index 0000000..8ca95a8 --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/saturn.png diff --git a/samples/99_sample_nddnug_workshop/sprites/ship.png b/samples/99_sample_nddnug_workshop/sprites/ship.png Binary files differnew file mode 100644 index 0000000..3ef5f0b --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/ship.png diff --git a/samples/99_sample_nddnug_workshop/sprites/star.png b/samples/99_sample_nddnug_workshop/sprites/star.png Binary files differnew file mode 100644 index 0000000..e0ee0f9 --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/star.png diff --git a/samples/99_sample_nddnug_workshop/sprites/sun.png b/samples/99_sample_nddnug_workshop/sprites/sun.png Binary files differnew file mode 100644 index 0000000..9ee3cba --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/sun.png diff --git a/samples/99_sample_nddnug_workshop/sprites/uranus.png b/samples/99_sample_nddnug_workshop/sprites/uranus.png Binary files differnew file mode 100644 index 0000000..bb9c206 --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/uranus.png diff --git a/samples/99_sample_nddnug_workshop/sprites/venus.png b/samples/99_sample_nddnug_workshop/sprites/venus.png Binary files differnew file mode 100644 index 0000000..28ac8e4 --- /dev/null +++ b/samples/99_sample_nddnug_workshop/sprites/venus.png diff --git a/samples/99_sample_snakemoji/app/main.rb b/samples/99_sample_snakemoji/app/main.rb new file mode 100644 index 0000000..3bffa22 --- /dev/null +++ b/samples/99_sample_snakemoji/app/main.rb @@ -0,0 +1,165 @@ +# coding: utf-8 +################################ +# So I was working on a snake game while +# learning DragonRuby, and at some point I had a thought +# what if I use "😀" as a function name, surely it wont work right...? +# RIGHT....? +# BUT IT DID, IT WORKED +# it all went downhill from then +# Created by Anton K. (ai Doge) +# https://gist.github.com/scorp200 +#############LICENSE############ +# Feel free to use this anywhere and however you want +# You can sell this to EA for $1,000,000 if you want, its completely free. +# Just rememeber you are helping this... thing... to spread... +# ALSO! I am not liable for any mental, physical or financial damage caused. +#############LICENSE############ + + +class Array + #Helper function + def move! vector + self.x += vector.x + self.y += vector.y + return self + end + + #Helper function to draw snake body + def draw! 🎮, 📺, color + translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color] + end + + #This is where it all started, I was trying to find good way to multiply a map by a number, * is already used so is ** + #I kept trying different combinations of symbols, when suddenly... + def 😀 value + self.map {|d| d * value} + end +end + +#Draw stuff with an offset +def translate output_collection, ⛓, what + what.x += ⛓.x + what.y += ⛓.y + output_collection << what +end + +BLUE = [33, 150, 243] +RED = [244, 67, 54] +GOLD = [255, 193, 7] +LAST = 0 + +def tick args + defaults args.state + render args.state, args.outputs + input args.state, args.inputs + update args.state +end + +def update 🎮 + #Update every 10 frames + if 🎮.tick_count.mod_zero? 10 + #Add new snake body piece at head's location + 🎮.🐍 << [*🎮.🤖] + #Assign Next Direction to Direction + 🎮.🚗 = *🎮.🚦 + + #Trim the snake a bit if its longer than current size + if 🎮.🐍.length > 🎮.🛒 + 🎮.🐍 = 🎮.🐍[-🎮.🛒..-1] + end + + #Move the head in the Direction + 🎮.🤖.move! 🎮.🚗 + + #If Head is outside the playing field, or inside snake's body restart game + if 🎮.🤖.x < 0 || 🎮.🤖.x >= 🎮.🗺.x || 🎮.🤖.y < 0 || 🎮.🤖.y >= 🎮.🗺.y || 🎮.🚗 != [0, 0] && 🎮.🐍.any? {|s| s == 🎮.🤖} + LAST = 🎮.💰 + 🎮.as_hash.clear + return + end + + #If head lands on food add size and score + if 🎮.🤖 == 🎮.🍎 + 🎮.🛒 += 1 + 🎮.💰 += (🎮.🛒 * 0.8).floor.to_i + 5 + spawn_🍎 🎮 + puts 🎮.🍎 + end + end + + #Every second remove 1 point + if 🎮.💰 > 0 && 🎮.tick_count.mod_zero?(60) + 🎮.💰 -= 1 + end +end + +def spawn_🍎 🎮 + #Food + 🎮.🍎 ||= [*🎮.🤖] + #Randomly spawns food inside the playing field, keep doing this if the food keeps landing on the snake's body + while 🎮.🐍.any? {|s| s == 🎮.🍎} || 🎮.🍎 == 🎮.🤖 do + 🎮.🍎 = [rand(🎮.🗺.x), rand(🎮.🗺.y)] + end +end + +def render 🎮, 📺 + #Paint the background black + 📺.solids << [0, 0, 1280, 720, 0, 0, 0, 255] + #Draw a border for the playing field + translate 📺.borders, 🎮.⛓, [0, 0, 🎮.🗺.x * 🎮.⚖️, 🎮.🗺.y * 🎮.⚖️, 255, 255, 255] + + #Draw the snake's body + 🎮.🐍.map do |🐍| 🐍.draw! 🎮, 📺, BLUE end + #Draw the head + 🎮.🤖.draw! 🎮, 📺, BLUE + #Draw the food + 🎮.🍎.draw! 🎮, 📺, RED + + #Draw current score + translate 📺.labels, 🎮.⛓, [5, 715, "Score: #{🎮.💰}", GOLD] + #Draw your last score, if any + translate 📺.labels, 🎮.⛓, [[*🎮.🤖.😀(🎮.⚖️)].move!([0, 🎮.⚖️ * 2]), "Your Last score is #{LAST}", 0, 1, GOLD] unless LAST == 0 || 🎮.🚗 != [0, 0] + #Draw starting message, only if Direction is 0 + translate 📺.labels, 🎮.⛓, [🎮.🤖.😀(🎮.⚖️), "Press any Arrow key to start", 0, 1, GOLD] unless 🎮.🚗 != [0, 0] +end + +def input 🎮, 🕹 + #Left and Right keyboard input, only change if X direction is 0 + if 🕹.keyboard.key_held.left && 🎮.🚗.x == 0 + 🎮.🚦 = [-1, 0] + elsif 🕹.keyboard.key_held.right && 🎮.🚗.x == 0 + 🎮.🚦 = [1, 0] + end + + #Up and Down keyboard input, only change if Y direction is 0 + if 🕹.keyboard.key_held.up && 🎮.🚗.y == 0 + 🎮.🚦 = [0, 1] + elsif 🕹.keyboard.key_held.down && 🎮.🚗.y == 0 + 🎮.🚦 = [0, -1] + end +end + +def defaults 🎮 + #Playing field size + 🎮.🗺 ||= [20, 20] + #Scale for drawing, screen height / Field height + 🎮.⚖️ ||= 720 / 🎮.🗺.y + #Offset, offset all rendering to the center of the screen + 🎮.⛓ ||= [(1280 - 720).fdiv(2), 0] + #Padding, make the snake body slightly smaller than the scale + 🎮.🛶 ||= (🎮.⚖️ * 0.2).to_i + #Snake Size + 🎮.🛒 ||= 3 + #Snake head, the only part we are actually controlling + 🎮.🤖 ||= [🎮.🗺.x / 2, 🎮.🗺.y / 2] + #Snake body map, follows the head + 🎮.🐍 ||= [] + #Direction the head moves to + 🎮.🚗 ||= [0, 0] + #Next_Direction, during input check only change this variable and then when game updates asign this to Direction + 🎮.🚦 ||= [*🎮.🚗] + #Your score + 🎮.💰 ||= 0 + #Spawns Food randomly + spawn_🍎(🎮) unless 🎮.🍎? +end diff --git a/samples/99_sample_snakemoji/license-for-sample.txt b/samples/99_sample_snakemoji/license-for-sample.txt new file mode 100644 index 0000000..376dd0e --- /dev/null +++ b/samples/99_sample_snakemoji/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 Anton K. (ai Doge) + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_snakemoji/replay.txt b/samples/99_sample_snakemoji/replay.txt new file mode 100644 index 0000000..48b3833 --- /dev/null +++ b/samples/99_sample_snakemoji/replay.txt @@ -0,0 +1,145 @@ +replay_version 2.0 +stopped_at 1147 +seed 100 +recorded_at Sun Sep 29 23:35:11 2019 +[:mouse_move, 313, 259, 2, 1, 111] +[:mouse_move, 317, 254, 2, 2, 112] +[:mouse_move, 325, 238, 2, 3, 113] +[:mouse_move, 332, 217, 2, 4, 114] +[:mouse_move, 345, 162, 2, 5, 115] +[:mouse_move, 347, 147, 2, 6, 116] +[:mouse_move, 351, 114, 2, 7, 117] +[:mouse_move, 352, 97, 2, 8, 118] +[:mouse_move, 352, 74, 2, 9, 119] +[:mouse_move, 350, 67, 2, 10, 120] +[:mouse_move, 347, 63, 2, 11, 121] +[:mouse_move, 344, 62, 2, 12, 122] +[:mouse_move, 338, 60, 2, 13, 123] +[:mouse_move, 334, 60, 2, 14, 124] +[:mouse_move, 325, 60, 2, 15, 125] +[:mouse_move, 319, 60, 2, 16, 126] +[:mouse_move, 313, 59, 2, 17, 127] +[:mouse_move, 310, 59, 2, 18, 128] +[:mouse_move, 307, 58, 2, 19, 129] +[:mouse_move, 303, 57, 2, 20, 130] +[:mouse_move, 301, 56, 2, 21, 131] +[:mouse_move, 299, 54, 2, 22, 132] +[:mouse_move, 298, 54, 2, 23, 133] +[:mouse_move, 297, 52, 2, 24, 134] +[:mouse_move, 297, 51, 2, 25, 135] +[:mouse_move, 295, 48, 2, 26, 136] +[:mouse_move, 294, 46, 2, 27, 137] +[:mouse_move, 291, 43, 2, 28, 138] +[:mouse_move, 290, 42, 2, 29, 139] +[:mouse_move, 289, 40, 2, 30, 140] +[:mouse_move, 288, 39, 2, 31, 141] +[:mouse_move, 289, 39, 2, 32, 145] +[:mouse_move, 299, 39, 2, 33, 146] +[:mouse_move, 308, 40, 2, 34, 147] +[:mouse_move, 337, 41, 2, 35, 148] +[:mouse_move, 344, 41, 2, 36, 149] +[:mouse_move, 360, 41, 2, 37, 150] +[:mouse_move, 367, 41, 2, 38, 151] +[:mouse_move, 375, 41, 2, 39, 152] +[:mouse_move, 377, 40, 2, 40, 153] +[:mouse_move, 378, 40, 2, 41, 154] +[:mouse_move, 379, 40, 2, 42, 155] +[:mouse_move, 380, 46, 2, 43, 165] +[:mouse_move, 383, 54, 2, 44, 166] +[:mouse_move, 393, 90, 2, 45, 167] +[:mouse_move, 408, 132, 2, 46, 168] +[:mouse_move, 444, 221, 2, 47, 169] +[:mouse_move, 470, 282, 2, 48, 170] +[:mouse_move, 533, 412, 2, 49, 171] +[:mouse_move, 548, 439, 2, 50, 172] +[:mouse_move, 585, 507, 2, 51, 173] +[:mouse_move, 592, 518, 2, 52, 174] +[:mouse_move, 590, 518, 2, 53, 184] +[:mouse_move, 584, 518, 2, 54, 185] +[:mouse_move, 572, 513, 2, 55, 186] +[:mouse_move, 564, 507, 2, 56, 187] +[:mouse_move, 548, 491, 2, 57, 188] +[:mouse_move, 541, 483, 2, 58, 189] +[:mouse_move, 523, 464, 2, 59, 190] +[:mouse_move, 518, 459, 2, 60, 191] +[:mouse_move, 502, 441, 2, 61, 192] +[:mouse_move, 496, 434, 2, 62, 193] +[:mouse_move, 488, 424, 2, 63, 194] +[:mouse_move, 484, 420, 2, 64, 195] +[:mouse_move, 479, 414, 2, 65, 196] +[:mouse_move, 478, 413, 2, 66, 197] +[:mouse_move, 476, 411, 2, 67, 198] +[:mouse_move, 475, 410, 2, 68, 199] +[:mouse_move, 475, 408, 2, 69, 200] +[:mouse_move, 474, 408, 2, 70, 202] +[:mouse_move, 474, 407, 2, 71, 204] +[:mouse_move, 476, 407, 2, 72, 205] +[:mouse_move, 481, 406, 2, 73, 206] +[:mouse_move, 487, 406, 2, 74, 207] +[:mouse_move, 501, 405, 2, 75, 208] +[:mouse_move, 511, 405, 2, 76, 209] +[:mouse_move, 519, 405, 2, 77, 210] +[:mouse_move, 540, 405, 2, 78, 211] +[:mouse_move, 545, 405, 2, 79, 212] +[:mouse_move, 564, 405, 2, 80, 213] +[:mouse_move, 578, 405, 2, 81, 214] +[:mouse_move, 592, 405, 2, 82, 215] +[:mouse_move, 600, 405, 2, 83, 216] +[:mouse_move, 613, 405, 2, 84, 217] +[:mouse_move, 618, 406, 2, 85, 218] +[:mouse_move, 628, 407, 2, 86, 219] +[:mouse_move, 632, 407, 2, 87, 220] +[:mouse_move, 642, 408, 2, 88, 221] +[:mouse_move, 647, 408, 2, 89, 222] +[:mouse_move, 658, 409, 2, 90, 223] +[:mouse_move, 664, 409, 2, 91, 224] +[:mouse_move, 676, 409, 2, 92, 225] +[:mouse_move, 682, 409, 2, 93, 226] +[:mouse_move, 696, 409, 2, 94, 227] +[:mouse_move, 703, 409, 2, 95, 228] +[:mouse_move, 724, 409, 2, 96, 229] +[:mouse_move, 732, 409, 2, 97, 230] +[:mouse_move, 745, 409, 2, 98, 231] +[:mouse_move, 754, 409, 2, 99, 232] +[:mouse_move, 770, 410, 2, 100, 233] +[:mouse_move, 777, 410, 2, 101, 234] +[:mouse_move, 789, 410, 2, 102, 235] +[:mouse_move, 791, 410, 2, 103, 236] +[:mouse_move, 795, 410, 2, 104, 237] +[:mouse_move, 802, 410, 2, 105, 238] +[:mouse_move, 804, 410, 2, 106, 239] +[:mouse_move, 806, 410, 2, 107, 240] +[:mouse_move, 807, 410, 2, 108, 241] +[:mouse_move, 808, 410, 2, 109, 244] +[:key_down_raw, 1073741903, 0, 2, 110, 371] +[:key_up_raw, 1073741903, 0, 2, 111, 381] +[:key_down_raw, 1073741906, 0, 2, 112, 428] +[:key_up_raw, 1073741906, 0, 2, 113, 437] +[:key_down_raw, 1073741904, 0, 2, 114, 459] +[:key_up_raw, 1073741904, 0, 2, 115, 468] +[:key_down_raw, 1073741905, 0, 2, 116, 495] +[:key_up_raw, 1073741905, 0, 2, 117, 504] +[:key_down_raw, 1073741904, 0, 2, 118, 521] +[:key_up_raw, 1073741904, 0, 2, 119, 529] +[:key_down_raw, 1073741906, 0, 2, 120, 631] +[:key_up_raw, 1073741906, 0, 2, 121, 640] +[:key_down_raw, 1073741903, 0, 2, 122, 673] +[:key_up_raw, 1073741903, 0, 2, 123, 683] +[:key_down_raw, 1073741906, 0, 2, 124, 697] +[:key_up_raw, 1073741906, 0, 2, 125, 704] +[:key_down_raw, 1073741903, 0, 2, 126, 739] +[:key_up_raw, 1073741903, 0, 2, 127, 747] +[:key_down_raw, 1073741906, 0, 2, 128, 767] +[:key_up_raw, 1073741906, 0, 2, 129, 773] +[:key_down_raw, 1073741903, 0, 2, 130, 776] +[:key_up_raw, 1073741903, 0, 2, 131, 784] +[:key_down_raw, 1073741905, 0, 2, 132, 880] +[:key_up_raw, 1073741905, 0, 2, 133, 887] +[:key_down_raw, 1073741904, 0, 2, 134, 960] +[:key_up_raw, 1073741904, 0, 2, 135, 967] +[:key_down_raw, 1073741905, 0, 2, 136, 980] +[:key_up_raw, 1073741905, 0, 2, 137, 987] +[:key_down_raw, 1073741903, 0, 2, 138, 1013] +[:key_up_raw, 1073741903, 0, 2, 139, 1022] +[:key_down_raw, 1073742051, 1024, 2, 140, 1146] +[:key_down_raw, 113, 1024, 2, 141, 1146] diff --git a/samples/99_sample_sprite_animation_creator/app/main.rb b/samples/99_sample_sprite_animation_creator/app/main.rb new file mode 100644 index 0000000..14456e3 --- /dev/null +++ b/samples/99_sample_sprite_animation_creator/app/main.rb @@ -0,0 +1,447 @@ +class OneBitLowrezPaint + attr_gtk + + def tick + outputs.background_color = [0, 0, 0] + defaults + render_instructions + render_canvas + render_buttons_frame_selection + render_animation_frame_thumbnails + render_animation + input_mouse_click + input_keyboard + calc_auto_export + calc_buttons_frame_selection + calc_animation_frames + process_queue_create_sprite + process_queue_reset_sprite + process_queue_update_rt_animation_frame + end + + def defaults + state.animation_frames_per_second = 12 + queues.create_sprite ||= [] + queues.reset_sprite ||= [] + queues.update_rt_animation_frame ||= [] + + if !state.animation_frames + state.animation_frames ||= [] + add_animation_frame_to_end + end + + state.last_mouse_down ||= 0 + state.last_mouse_up ||= 0 + + state.buttons_frame_selection.left = 10 + state.buttons_frame_selection.top = grid.top - 10 + state.buttons_frame_selection.size = 20 + + defaults_canvas_sprite + + state.edit_mode ||= :drawing + end + + def defaults_canvas_sprite + rt_canvas.size = 16 + rt_canvas.zoom = 30 + rt_canvas.width = rt_canvas.size * rt_canvas.zoom + rt_canvas.height = rt_canvas.size * rt_canvas.zoom + rt_canvas.sprite = { x: 0, + y: 0, + w: rt_canvas.width, + h: rt_canvas.height, + path: :rt_canvas }.center_inside_rect(x: 0, y: 0, w: 640, h: 720) + + return unless state.tick_count == 1 + + outputs[:rt_canvas].width = rt_canvas.width + outputs[:rt_canvas].height = rt_canvas.height + outputs[:rt_canvas].sprites << (rt_canvas.size + 1).map_with_index do |x| + (rt_canvas.size + 1).map_with_index do |y| + path = 'sprites/square-white.png' + path = 'sprites/square-blue.png' if x == 7 || x == 8 + { x: x * rt_canvas.zoom, + y: y * rt_canvas.zoom, + w: rt_canvas.zoom, + h: rt_canvas.zoom, + path: path, + a: 50 } + end + end + end + + def render_instructions + instructions = <<-S +* Instructions: +- All data is stored in the ~canvas~ directory. +- Hold ~d~ to set the edit mode to erase. +- Release ~d~ to set the edit mode drawing. +- Press ~a~ to added a frame to the end. +- Press ~b~ to select the previous frame. +- Press ~f~ to select the next frame. +- Press ~c~ to copy a frame. +- Press ~v~ to paste a copied frame into the selected frame. +- Press ~x~ to delete the currently selected frame. +- Press ~w~ to save the canvas and export all sprites. +- Press ~l~ to load the canvas. +S + + instructions.strip.each_line.with_index do |l, i| + outputs.labels << { x: 840, y: 500 - (i * 20), text: "#{l}", + r: 180, g: 180, b: 180, size_enum: -3 } + end + end + + def render_canvas + return if state.tick_count.zero? + outputs.sprites << rt_canvas.sprite + end + + def render_buttons_frame_selection + args.outputs.primitives << state.buttons_frame_selection.items.map_with_index do |b, i| + label = { x: b.x + state.buttons_frame_selection.size.half, + y: b.y, + text: "#{i + 1}", r: 180, g: 180, b: 180, + size_enum: -4, alignment_enum: 1 }.label + + selection_border = b.merge(r: 40, g: 40, b: 40).border + + if i == state.animation_frames_selected_index + selection_border = b.merge(r: 40, g: 230, b: 200).border + end + + [selection_border, label] + end + end + + def render_animation_frame_thumbnails + return if state.tick_count.zero? + + outputs[:current_animation_frame].width = rt_canvas.size + outputs[:current_animation_frame].height = rt_canvas.size + outputs[:current_animation_frame].solids << selected_animation_frame[:pixels].map_with_index do |f, i| + { x: f.x, + y: f.y, + w: 1, + h: 1, r: 255, g: 255, b: 255 } + end + + outputs.sprites << rt_canvas.sprite.merge(path: :current_animation_frame) + + state.animation_frames.map_with_index do |animation_frame, animation_frame_index| + outputs.sprites << state.buttons_frame_selection[:items][animation_frame_index][:inner_rect] + .merge(path: animation_frame[:rt_name]) + end + end + + def render_animation + sprite_index = 0.frame_index count: state.animation_frames.length, + hold_for: 60 / state.animation_frames_per_second, + repeat: true + + args.outputs.sprites << { x: 700 - 8, + y: 120, + w: 16, + h: 16, + path: (sprite_path sprite_index) } + + args.outputs.sprites << { x: 700 - 16, + y: 230, + w: 32, + h: 32, + path: (sprite_path sprite_index) } + + args.outputs.sprites << { x: 700 - 32, + y: 360, + w: 64, + h: 64, + path: (sprite_path sprite_index) } + + args.outputs.sprites << { x: 700 - 64, + y: 520, + w: 128, + h: 128, + path: (sprite_path sprite_index) } + end + + def input_mouse_click + if inputs.mouse.up + state.last_mouse_up = state.tick_count + elsif inputs.mouse.moved && user_is_editing? + edit_current_animation_frame inputs.mouse.point + end + + return unless inputs.mouse.click + + clicked_frame_button = state.buttons_frame_selection.items.find do |b| + inputs.mouse.point.inside_rect? b + end + + if (clicked_frame_button) + state.animation_frames_selected_index = clicked_frame_button[:index] + end + + if (inputs.mouse.point.inside_rect? rt_canvas.sprite) + state.last_mouse_down = state.tick_count + edit_current_animation_frame inputs.mouse.point + end + end + + def input_keyboard + # w to save + if inputs.keyboard.key_down.w + t = Time.now + state.save_description = "Time: #{t} (#{t.to_i})" + gtk.serialize_state 'canvas/state.txt', state + gtk.serialize_state "tmp/canvas_backups/#{t.to_i}/state.txt", state + animation_frames.each_with_index do |animation_frame, i| + queues.update_rt_animation_frame << { index: i, + at: state.tick_count + i, + queue_sprite_creation: true } + queues.create_sprite << { index: i, + at: state.tick_count + animation_frames.length + i, + path_override: "tmp/canvas_backups/#{t.to_i}/sprite-#{i}.png" } + end + gtk.notify! "Canvas saved." + end + + # l to load + if inputs.keyboard.key_down.l + args.state = gtk.deserialize_state 'canvas/state.txt' + animation_frames.each_with_index do |a, i| + queues.update_rt_animation_frame << { index: i, + at: state.tick_count + i, + queue_sprite_creation: true } + end + gtk.notify! "Canvas loaded." + end + + # d to go into delete mode, release to paint + if inputs.keyboard.key_held.d + state.edit_mode = :erasing + gtk.notify! "Erasing." if inputs.keyboard.key_held.d == (state.tick_count - 1) + elsif inputs.keyboard.key_up.d + state.edit_mode = :drawing + gtk.notify! "Drawing." + end + + # a to add a frame to the end + if inputs.keyboard.key_down.a + queues.create_sprite << { index: state.animation_frames_selected_index, + at: state.tick_count } + queues.create_sprite << { index: state.animation_frames_selected_index + 1, + at: state.tick_count } + add_animation_frame_to_end + gtk.notify! "Frame added to end." + end + + # c or t to copy + if (inputs.keyboard.key_down.c || inputs.keyboard.key_down.t) + state.clipboard = [selected_animation_frame[:pixels]].flatten + gtk.notify! "Current frame copied." + end + + # v or q to paste + if (inputs.keyboard.key_down.v || inputs.keyboard.key_down.q) && state.clipboard + selected_animation_frame[:pixels] = [state.clipboard].flatten + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, + at: state.tick_count, + queue_sprite_creation: true } + gtk.notify! "Pasted." + end + + # f to go forward/next frame + if (inputs.keyboard.key_down.f) + if (state.animation_frames_selected_index == (state.animation_frames.length - 1)) + state.animation_frames_selected_index = 0 + else + state.animation_frames_selected_index += 1 + end + gtk.notify! "Next frame." + end + + # b to go back/previous frame + if (inputs.keyboard.key_down.b) + if (state.animation_frames_selected_index == 0) + state.animation_frames_selected_index = state.animation_frames.length - 1 + else + state.animation_frames_selected_index -= 1 + end + gtk.notify! "Previous frame." + end + + # x to delete frame + if (inputs.keyboard.key_down.x) && animation_frames.length > 1 + state.clipboard = selected_animation_frame[:pixels] + state.animation_frames = animation_frames.find_all { |v| v[:index] != state.animation_frames_selected_index } + if state.animation_frames_selected_index >= state.animation_frames.length + state.animation_frames_selected_index = state.animation_frames.length - 1 + end + gtk.notify! "Frame deleted." + end + end + + def calc_auto_export + return if user_is_editing? + return if state.last_mouse_up.elapsed_time != 30 + # auto export current animation frame if there is no editing for 30 ticks + queues.create_sprite << { index: state.animation_frames_selected_index, + at: state.tick_count } + end + + def calc_buttons_frame_selection + state.buttons_frame_selection.items = animation_frames.length.map_with_index do |i| + { x: state.buttons_frame_selection.left + i * state.buttons_frame_selection.size, + y: state.buttons_frame_selection.top - state.buttons_frame_selection.size, + inner_rect: { + x: (state.buttons_frame_selection.left + 2) + i * state.buttons_frame_selection.size, + y: (state.buttons_frame_selection.top - state.buttons_frame_selection.size + 2), + w: 16, + h: 16, + }, + w: state.buttons_frame_selection.size, + h: state.buttons_frame_selection.size, + index: i } + end + end + + def calc_animation_frames + animation_frames.each_with_index do |animation_frame, i| + animation_frame[:index] = i + animation_frame[:rt_name] = "animation_frame_#{i}" + end + end + + def process_queue_create_sprite + sprites_to_create = queues.create_sprite + .find_all { |h| h[:at].elapsed? } + + queues.create_sprite = queues.create_sprite - sprites_to_create + + sprites_to_create.each do |h| + export_animation_frame h[:index], h[:path_override] + end + end + + def process_queue_reset_sprite + sprites_to_reset = queues.reset_sprite + .find_all { |h| h[:at].elapsed? } + + queues.reset_sprite -= sprites_to_reset + + sprites_to_reset.each { |h| gtk.reset_sprite (sprite_path h[:index]) } + end + + def process_queue_update_rt_animation_frame + animation_frames_to_update = queues.update_rt_animation_frame + .find_all { |h| h[:at].elapsed? } + + queues.update_rt_animation_frame -= animation_frames_to_update + + animation_frames_to_update.each do |h| + update_animation_frame_render_target animation_frames[h[:index]] + + if h[:queue_sprite_creation] + queues.create_sprite << { index: h[:index], + at: state.tick_count + 1 } + end + end + end + + def update_animation_frame_render_target animation_frame + return if !animation_frame + + outputs[animation_frame[:rt_name]].width = state.rt_canvas.size + outputs[animation_frame[:rt_name]].height = state.rt_canvas.size + outputs[animation_frame[:rt_name]].solids << animation_frame[:pixels].map do |f| + { x: f.x, + y: f.y, + w: 1, + h: 1, r: 255, g: 255, b: 255 } + end + end + + def animation_frames + state.animation_frames + end + + def add_animation_frame_to_end + animation_frames << { + index: animation_frames.length, + pixels: [], + rt_name: "animation_frame_#{animation_frames.length}" + } + + state.animation_frames_selected_index = (animation_frames.length - 1) + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, + at: state.tick_count, + queue_sprite_creation: true } + end + + def sprite_path i + "canvas/sprite-#{i}.png" + end + + def export_animation_frame i, path_override = nil + return if !state.animation_frames[i] + + outputs.screenshots << state.buttons_frame_selection + .items[i][:inner_rect] + .merge(path: path_override || (sprite_path i)) + + outputs.screenshots << state.buttons_frame_selection + .items[i][:inner_rect] + .merge(path: "tmp/sprite_backups/#{Time.now.to_i}-sprite-#{i}.png") + + queues.reset_sprite << { index: i, at: state.tick_count } + end + + def selected_animation_frame + state.animation_frames[state.animation_frames_selected_index] + end + + def edit_current_animation_frame point + draw_area_point = (to_draw_area point) + if state.edit_mode == :drawing && (!selected_animation_frame[:pixels].include? draw_area_point) + selected_animation_frame[:pixels] << draw_area_point + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, + at: state.tick_count, + queue_sprite_creation: !user_is_editing? } + elsif state.edit_mode == :erasing && (selected_animation_frame[:pixels].include? draw_area_point) + selected_animation_frame[:pixels] = selected_animation_frame[:pixels].reject { |p| p == draw_area_point } + queues.update_rt_animation_frame << { index: state.animation_frames_selected_index, + at: state.tick_count, + queue_sprite_creation: !user_is_editing? } + end + end + + def user_is_editing? + state.last_mouse_down > state.last_mouse_up + end + + def to_draw_area point + x, y = point + x -= rt_canvas.sprite.x + y -= rt_canvas.sprite.y + { x: x.idiv(rt_canvas.zoom), + y: y.idiv(rt_canvas.zoom) } + end + + def rt_canvas + state.rt_canvas ||= state.new_entity(:rt_canvas) + end + + def queues + state.queues ||= state.new_entity(:queues) + end +end + +$game = OneBitLowrezPaint.new + +def tick args + $game.args = args + $game.tick +end + +# $gtk.reset diff --git a/samples/99_sample_sprite_animation_creator/license-for-sample.txt b/samples/99_sample_sprite_animation_creator/license-for-sample.txt new file mode 100644 index 0000000..376dd0e --- /dev/null +++ b/samples/99_sample_sprite_animation_creator/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 Anton K. (ai Doge) + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/99_sample_sprite_animation_creator/replay.txt b/samples/99_sample_sprite_animation_creator/replay.txt new file mode 100644 index 0000000..ca25af6 --- /dev/null +++ b/samples/99_sample_sprite_animation_creator/replay.txt @@ -0,0 +1,908 @@ +replay_version 2.0 +stopped_at 2856 +seed 100 +recorded_at Thu Aug 06 06:37:39 2020 +[:key_up_raw, 13, 0, 2, 1, 2] +[:mouse_move, 280, 591, 2, 2, 73] +[:mouse_move, 290, 613, 2, 3, 74] +[:mouse_move, 292, 621, 2, 4, 75] +[:mouse_move, 284, 628, 2, 5, 76] +[:mouse_move, 272, 628, 2, 6, 77] +[:mouse_move, 255, 628, 2, 7, 78] +[:mouse_move, 215, 606, 2, 8, 79] +[:mouse_move, 193, 590, 2, 9, 80] +[:mouse_move, 156, 544, 2, 10, 81] +[:mouse_move, 151, 535, 2, 11, 82] +[:mouse_move, 138, 503, 2, 12, 83] +[:mouse_move, 137, 490, 2, 13, 84] +[:mouse_move, 137, 472, 2, 14, 85] +[:mouse_move, 139, 470, 2, 15, 86] +[:mouse_move, 145, 462, 2, 16, 87] +[:mouse_move, 149, 459, 2, 17, 89] +[:mouse_move, 150, 458, 2, 18, 90] +[:mouse_move, 151, 457, 2, 19, 91] +[:mouse_move, 152, 457, 2, 20, 92] +[:mouse_move, 152, 456, 2, 21, 93] +[:mouse_move, 152, 451, 2, 22, 114] +[:mouse_move, 153, 442, 2, 23, 115] +[:mouse_move, 158, 427, 2, 24, 116] +[:mouse_move, 160, 422, 2, 25, 117] +[:mouse_move, 166, 404, 2, 26, 118] +[:mouse_move, 169, 398, 2, 27, 119] +[:mouse_move, 175, 386, 2, 28, 120] +[:mouse_move, 180, 378, 2, 29, 121] +[:mouse_move, 183, 373, 2, 30, 122] +[:mouse_move, 185, 370, 2, 31, 123] +[:mouse_move, 188, 366, 2, 32, 124] +[:mouse_move, 189, 364, 2, 33, 125] +[:mouse_move, 190, 362, 2, 34, 126] +[:mouse_move, 191, 361, 2, 35, 128] +[:mouse_button_pressed, 1, 0, 1, 36, 291] +[:mouse_move, 190, 358, 2, 37, 291] +[:mouse_move, 190, 357, 2, 38, 292] +[:mouse_move, 189, 354, 2, 39, 293] +[:mouse_move, 186, 346, 2, 40, 294] +[:mouse_move, 185, 344, 2, 41, 295] +[:mouse_move, 182, 326, 2, 42, 296] +[:mouse_move, 182, 323, 2, 43, 296] +[:mouse_move, 182, 318, 2, 44, 297] +[:mouse_move, 182, 315, 2, 45, 298] +[:mouse_move, 182, 311, 2, 46, 299] +[:mouse_move, 183, 307, 2, 47, 301] +[:mouse_move, 185, 302, 2, 48, 302] +[:mouse_move, 187, 299, 2, 49, 303] +[:mouse_move, 190, 295, 2, 50, 304] +[:mouse_move, 193, 292, 2, 51, 305] +[:mouse_move, 199, 287, 2, 52, 306] +[:mouse_move, 203, 283, 2, 53, 307] +[:mouse_move, 206, 280, 2, 54, 308] +[:mouse_move, 216, 273, 2, 55, 309] +[:mouse_move, 220, 271, 2, 56, 310] +[:mouse_move, 232, 264, 2, 57, 311] +[:mouse_move, 238, 261, 2, 58, 312] +[:mouse_move, 250, 256, 2, 59, 313] +[:mouse_move, 256, 253, 2, 60, 314] +[:mouse_move, 266, 251, 2, 61, 315] +[:mouse_move, 275, 248, 2, 62, 316] +[:mouse_move, 288, 245, 2, 63, 317] +[:mouse_move, 294, 245, 2, 64, 318] +[:mouse_move, 307, 245, 2, 65, 319] +[:mouse_move, 316, 245, 2, 66, 320] +[:mouse_move, 332, 247, 2, 67, 321] +[:mouse_move, 343, 250, 2, 68, 322] +[:mouse_move, 350, 253, 2, 69, 323] +[:mouse_move, 367, 261, 2, 70, 324] +[:mouse_move, 385, 272, 2, 71, 325] +[:mouse_move, 394, 279, 2, 72, 326] +[:mouse_move, 408, 294, 2, 73, 327] +[:mouse_move, 416, 301, 2, 74, 328] +[:mouse_move, 426, 318, 2, 75, 329] +[:mouse_move, 432, 326, 2, 76, 330] +[:mouse_move, 439, 342, 2, 77, 331] +[:mouse_move, 442, 351, 2, 78, 332] +[:mouse_move, 447, 369, 2, 79, 333] +[:mouse_move, 449, 382, 2, 80, 334] +[:mouse_move, 451, 405, 2, 81, 335] +[:mouse_move, 452, 410, 2, 82, 336] +[:mouse_move, 452, 417, 2, 83, 337] +[:mouse_move, 449, 426, 2, 84, 338] +[:mouse_move, 444, 437, 2, 85, 338] +[:mouse_move, 440, 441, 2, 86, 339] +[:mouse_move, 430, 450, 2, 87, 340] +[:mouse_move, 423, 456, 2, 88, 341] +[:mouse_move, 412, 464, 2, 89, 342] +[:mouse_move, 407, 467, 2, 90, 343] +[:mouse_move, 402, 470, 2, 91, 344] +[:mouse_move, 382, 480, 2, 92, 345] +[:mouse_move, 371, 485, 2, 93, 346] +[:mouse_move, 351, 491, 2, 94, 347] +[:mouse_move, 344, 492, 2, 95, 348] +[:mouse_move, 321, 498, 2, 96, 349] +[:mouse_move, 312, 499, 2, 97, 350] +[:mouse_move, 290, 497, 2, 98, 351] +[:mouse_move, 283, 496, 2, 99, 352] +[:mouse_move, 266, 490, 2, 100, 353] +[:mouse_move, 260, 487, 2, 101, 354] +[:mouse_move, 246, 478, 2, 102, 355] +[:mouse_move, 241, 472, 2, 103, 356] +[:mouse_move, 230, 461, 2, 104, 357] +[:mouse_move, 226, 455, 2, 105, 358] +[:mouse_move, 217, 443, 2, 106, 359] +[:mouse_move, 213, 435, 2, 107, 360] +[:mouse_move, 207, 422, 2, 108, 361] +[:mouse_move, 205, 418, 2, 109, 362] +[:mouse_move, 201, 401, 2, 110, 363] +[:mouse_move, 199, 396, 2, 111, 364] +[:mouse_move, 197, 385, 2, 112, 365] +[:mouse_move, 197, 380, 2, 113, 366] +[:mouse_move, 196, 372, 2, 114, 367] +[:mouse_move, 196, 367, 2, 115, 368] +[:mouse_move, 195, 361, 2, 116, 369] +[:mouse_move, 195, 358, 2, 117, 370] +[:mouse_move, 195, 353, 2, 118, 371] +[:mouse_move, 195, 347, 2, 119, 372] +[:mouse_move, 196, 344, 2, 120, 373] +[:mouse_move, 196, 338, 2, 121, 374] +[:mouse_move, 197, 337, 2, 122, 375] +[:mouse_move, 197, 334, 2, 123, 376] +[:mouse_move, 197, 333, 2, 124, 377] +[:mouse_move, 197, 332, 2, 125, 379] +[:mouse_button_up, 1, 0, 1, 126, 393] +[:mouse_move, 224, 331, 2, 127, 394] +[:mouse_move, 237, 327, 2, 128, 395] +[:mouse_move, 257, 317, 2, 129, 396] +[:mouse_move, 267, 310, 2, 130, 397] +[:mouse_move, 289, 295, 2, 131, 398] +[:mouse_move, 315, 268, 2, 132, 399] +[:mouse_move, 340, 234, 2, 133, 400] +[:mouse_move, 353, 204, 2, 134, 401] +[:mouse_move, 359, 188, 2, 135, 402] +[:mouse_move, 361, 172, 2, 136, 403] +[:mouse_move, 361, 163, 2, 137, 404] +[:mouse_move, 361, 154, 2, 138, 405] +[:mouse_move, 361, 152, 2, 139, 406] +[:mouse_move, 361, 151, 2, 140, 407] +[:mouse_move, 361, 150, 2, 141, 408] +[:key_down_raw, 97, 0, 2, 142, 408] +[:mouse_move, 360, 150, 2, 143, 408] +[:mouse_move, 360, 151, 2, 144, 412] +[:key_up_raw, 97, 0, 2, 145, 412] +[:mouse_move, 360, 152, 2, 146, 413] +[:mouse_move, 360, 153, 2, 147, 414] +[:mouse_move, 360, 155, 2, 148, 415] +[:mouse_move, 360, 157, 2, 149, 416] +[:mouse_move, 361, 170, 2, 150, 417] +[:mouse_move, 361, 171, 2, 151, 418] +[:mouse_move, 361, 174, 2, 152, 419] +[:mouse_move, 361, 175, 2, 153, 421] +[:mouse_move, 361, 176, 2, 154, 423] +[:mouse_move, 359, 179, 2, 155, 425] +[:mouse_move, 359, 180, 2, 156, 427] +[:mouse_move, 358, 181, 2, 157, 428] +[:mouse_move, 358, 182, 2, 158, 429] +[:mouse_move, 358, 183, 2, 159, 430] +[:mouse_move, 345, 202, 2, 160, 431] +[:mouse_move, 340, 207, 2, 161, 432] +[:mouse_move, 337, 210, 2, 162, 433] +[:mouse_move, 335, 213, 2, 163, 434] +[:mouse_move, 331, 217, 2, 164, 435] +[:mouse_move, 327, 221, 2, 165, 436] +[:mouse_move, 325, 223, 2, 166, 437] +[:mouse_move, 325, 224, 2, 167, 438] +[:mouse_move, 322, 226, 2, 168, 439] +[:mouse_move, 322, 228, 2, 169, 440] +[:mouse_move, 321, 229, 2, 170, 441] +[:mouse_move, 321, 230, 2, 171, 445] +[:mouse_move, 320, 231, 2, 172, 463] +[:mouse_move, 319, 233, 2, 173, 465] +[:mouse_move, 318, 233, 2, 174, 466] +[:mouse_move, 318, 234, 2, 175, 467] +[:mouse_move, 316, 236, 2, 176, 468] +[:mouse_move, 315, 236, 2, 177, 469] +[:mouse_move, 314, 238, 2, 178, 470] +[:mouse_move, 313, 238, 2, 179, 471] +[:mouse_move, 312, 239, 2, 180, 472] +[:mouse_move, 311, 240, 2, 181, 474] +[:mouse_move, 310, 240, 2, 182, 477] +[:mouse_button_pressed, 1, 0, 1, 183, 499] +[:mouse_move, 307, 239, 2, 184, 499] +[:mouse_move, 303, 238, 2, 185, 500] +[:mouse_move, 295, 234, 2, 186, 501] +[:mouse_move, 291, 233, 2, 187, 502] +[:mouse_move, 262, 231, 2, 188, 503] +[:mouse_move, 256, 232, 2, 189, 504] +[:mouse_move, 254, 233, 2, 190, 505] +[:mouse_move, 249, 236, 2, 191, 506] +[:mouse_move, 246, 239, 2, 192, 507] +[:mouse_move, 243, 242, 2, 193, 508] +[:mouse_move, 241, 244, 2, 194, 509] +[:mouse_move, 235, 250, 2, 195, 510] +[:mouse_move, 234, 252, 2, 196, 511] +[:mouse_move, 230, 258, 2, 197, 512] +[:mouse_move, 227, 262, 2, 198, 513] +[:mouse_move, 223, 268, 2, 199, 514] +[:mouse_move, 221, 270, 2, 200, 515] +[:mouse_move, 219, 273, 2, 201, 516] +[:mouse_move, 217, 277, 2, 202, 517] +[:mouse_move, 215, 281, 2, 203, 518] +[:mouse_move, 213, 288, 2, 204, 519] +[:mouse_move, 212, 292, 2, 205, 520] +[:mouse_move, 211, 302, 2, 206, 521] +[:mouse_move, 210, 307, 2, 207, 522] +[:mouse_move, 210, 318, 2, 208, 523] +[:mouse_move, 210, 323, 2, 209, 524] +[:mouse_move, 212, 335, 2, 210, 525] +[:mouse_move, 214, 340, 2, 211, 526] +[:mouse_move, 218, 351, 2, 212, 527] +[:mouse_move, 222, 356, 2, 213, 528] +[:mouse_move, 230, 368, 2, 214, 529] +[:mouse_move, 235, 374, 2, 215, 530] +[:mouse_move, 247, 387, 2, 216, 531] +[:mouse_move, 254, 393, 2, 217, 532] +[:mouse_move, 268, 407, 2, 218, 533] +[:mouse_move, 275, 413, 2, 219, 534] +[:mouse_move, 290, 424, 2, 220, 535] +[:mouse_move, 298, 429, 2, 221, 536] +[:mouse_move, 311, 436, 2, 222, 537] +[:mouse_move, 319, 441, 2, 223, 538] +[:mouse_move, 333, 445, 2, 224, 539] +[:mouse_move, 337, 446, 2, 225, 540] +[:mouse_move, 350, 448, 2, 226, 541] +[:mouse_move, 357, 448, 2, 227, 542] +[:mouse_move, 368, 445, 2, 228, 543] +[:mouse_move, 376, 440, 2, 229, 544] +[:mouse_move, 382, 435, 2, 230, 545] +[:mouse_move, 393, 424, 2, 231, 546] +[:mouse_move, 398, 418, 2, 232, 547] +[:mouse_move, 405, 404, 2, 233, 548] +[:mouse_move, 408, 397, 2, 234, 549] +[:mouse_move, 414, 385, 2, 235, 550] +[:mouse_move, 415, 380, 2, 236, 551] +[:mouse_move, 418, 368, 2, 237, 552] +[:mouse_move, 419, 362, 2, 238, 553] +[:mouse_move, 420, 352, 2, 239, 554] +[:mouse_move, 420, 349, 2, 240, 555] +[:mouse_move, 420, 342, 2, 241, 556] +[:mouse_move, 420, 340, 2, 242, 557] +[:mouse_move, 420, 339, 2, 243, 558] +[:mouse_move, 420, 337, 2, 244, 559] +[:mouse_move, 420, 336, 2, 245, 560] +[:mouse_move, 420, 334, 2, 246, 561] +[:mouse_move, 417, 332, 2, 247, 562] +[:mouse_move, 416, 331, 2, 248, 563] +[:mouse_move, 412, 327, 2, 249, 564] +[:mouse_move, 410, 325, 2, 250, 565] +[:mouse_move, 402, 320, 2, 251, 566] +[:mouse_move, 397, 317, 2, 252, 567] +[:mouse_move, 385, 312, 2, 253, 568] +[:mouse_move, 379, 310, 2, 254, 569] +[:mouse_move, 366, 305, 2, 255, 570] +[:mouse_move, 358, 303, 2, 256, 571] +[:mouse_move, 352, 302, 2, 257, 572] +[:mouse_move, 338, 300, 2, 258, 573] +[:mouse_move, 331, 300, 2, 259, 574] +[:mouse_move, 314, 300, 2, 260, 575] +[:mouse_move, 307, 301, 2, 261, 576] +[:mouse_move, 293, 302, 2, 262, 577] +[:mouse_move, 288, 303, 2, 263, 578] +[:mouse_move, 275, 305, 2, 264, 579] +[:mouse_move, 267, 305, 2, 265, 580] +[:mouse_move, 258, 307, 2, 266, 581] +[:mouse_move, 250, 308, 2, 267, 582] +[:mouse_move, 239, 310, 2, 268, 583] +[:mouse_move, 233, 311, 2, 269, 584] +[:mouse_move, 225, 312, 2, 270, 585] +[:mouse_move, 222, 313, 2, 271, 586] +[:mouse_move, 217, 315, 2, 272, 587] +[:mouse_move, 215, 315, 2, 273, 588] +[:mouse_move, 212, 317, 2, 274, 589] +[:mouse_move, 212, 318, 2, 275, 590] +[:mouse_move, 211, 319, 2, 276, 591] +[:mouse_move, 211, 320, 2, 277, 593] +[:mouse_button_up, 1, 0, 1, 278, 608] +[:mouse_move, 215, 335, 2, 279, 608] +[:mouse_move, 220, 349, 2, 280, 609] +[:mouse_move, 225, 378, 2, 281, 610] +[:mouse_move, 226, 403, 2, 282, 612] +[:mouse_move, 226, 419, 2, 283, 613] +[:mouse_move, 220, 442, 2, 284, 614] +[:mouse_move, 210, 449, 2, 285, 615] +[:mouse_move, 196, 450, 2, 286, 616] +[:mouse_move, 187, 450, 2, 287, 617] +[:mouse_move, 173, 441, 2, 288, 618] +[:mouse_move, 168, 435, 2, 289, 619] +[:mouse_move, 164, 427, 2, 290, 620] +[:mouse_move, 161, 422, 2, 291, 621] +[:mouse_move, 159, 415, 2, 292, 622] +[:mouse_move, 159, 414, 2, 293, 623] +[:mouse_move, 159, 412, 2, 294, 624] +[:mouse_move, 159, 411, 2, 295, 625] +[:mouse_move, 159, 410, 2, 296, 627] +[:mouse_move, 160, 410, 2, 297, 632] +[:mouse_move, 161, 410, 2, 298, 639] +[:key_down_raw, 97, 0, 2, 299, 673] +[:key_up_raw, 97, 0, 2, 300, 677] +[:mouse_move, 161, 409, 2, 301, 680] +[:mouse_move, 162, 408, 2, 302, 682] +[:mouse_move, 162, 407, 2, 303, 683] +[:mouse_move, 163, 405, 2, 304, 684] +[:mouse_move, 164, 403, 2, 305, 685] +[:mouse_move, 164, 402, 2, 306, 689] +[:key_down_raw, 98, 0, 2, 307, 705] +[:key_up_raw, 98, 0, 2, 308, 709] +[:key_down_raw, 99, 0, 2, 309, 723] +[:key_up_raw, 99, 0, 2, 310, 729] +[:key_down_raw, 98, 0, 2, 311, 763] +[:key_up_raw, 98, 0, 2, 312, 769] +[:key_down_raw, 102, 0, 2, 313, 874] +[:key_up_raw, 102, 0, 2, 314, 877] +[:key_down_raw, 102, 0, 2, 315, 881] +[:key_up_raw, 102, 0, 2, 316, 886] +[:key_down_raw, 113, 0, 2, 317, 898] +[:key_up_raw, 113, 0, 2, 318, 902] +[:mouse_move, 167, 401, 2, 319, 945] +[:mouse_move, 170, 399, 2, 320, 946] +[:mouse_move, 180, 393, 2, 321, 947] +[:mouse_move, 190, 388, 2, 322, 948] +[:mouse_move, 202, 382, 2, 323, 949] +[:mouse_move, 216, 376, 2, 324, 950] +[:mouse_move, 226, 375, 2, 325, 951] +[:mouse_move, 235, 374, 2, 326, 952] +[:mouse_move, 245, 375, 2, 327, 953] +[:mouse_move, 247, 377, 2, 328, 954] +[:mouse_move, 255, 383, 2, 329, 955] +[:mouse_move, 261, 387, 2, 330, 956] +[:mouse_move, 270, 391, 2, 331, 957] +[:mouse_move, 275, 393, 2, 332, 958] +[:mouse_move, 285, 393, 2, 333, 959] +[:mouse_move, 296, 392, 2, 334, 960] +[:mouse_move, 318, 377, 2, 335, 961] +[:mouse_move, 331, 365, 2, 336, 962] +[:mouse_move, 368, 335, 2, 337, 963] +[:mouse_move, 386, 319, 2, 338, 964] +[:mouse_move, 404, 303, 2, 339, 965] +[:mouse_move, 426, 281, 2, 340, 966] +[:mouse_move, 438, 269, 2, 341, 967] +[:mouse_move, 449, 257, 2, 342, 968] +[:mouse_move, 456, 250, 2, 343, 969] +[:mouse_move, 467, 237, 2, 344, 970] +[:mouse_move, 468, 235, 2, 345, 971] +[:mouse_move, 471, 231, 2, 346, 972] +[:mouse_move, 472, 230, 2, 347, 973] +[:mouse_move, 473, 228, 2, 348, 974] +[:mouse_move, 474, 228, 2, 349, 975] +[:mouse_move, 475, 226, 2, 350, 976] +[:mouse_move, 475, 225, 2, 351, 977] +[:mouse_move, 476, 223, 2, 352, 978] +[:mouse_move, 476, 222, 2, 353, 980] +[:mouse_button_pressed, 1, 0, 1, 354, 992] +[:mouse_move, 473, 223, 2, 355, 992] +[:mouse_move, 470, 225, 2, 356, 993] +[:mouse_move, 466, 226, 2, 357, 994] +[:mouse_move, 460, 229, 2, 358, 995] +[:mouse_move, 455, 231, 2, 359, 996] +[:mouse_move, 401, 266, 2, 360, 997] +[:mouse_move, 381, 280, 2, 361, 998] +[:mouse_move, 371, 287, 2, 362, 999] +[:mouse_move, 354, 301, 2, 363, 1000] +[:mouse_move, 346, 308, 2, 364, 1001] +[:mouse_move, 329, 323, 2, 365, 1002] +[:mouse_move, 322, 331, 2, 366, 1003] +[:mouse_move, 307, 343, 2, 367, 1004] +[:mouse_move, 301, 349, 2, 368, 1005] +[:mouse_move, 287, 362, 2, 369, 1006] +[:mouse_move, 281, 369, 2, 370, 1007] +[:mouse_move, 264, 387, 2, 371, 1008] +[:mouse_move, 256, 396, 2, 372, 1009] +[:mouse_move, 246, 407, 2, 373, 1010] +[:mouse_move, 234, 420, 2, 374, 1012] +[:mouse_move, 231, 423, 2, 375, 1013] +[:mouse_move, 226, 430, 2, 376, 1014] +[:mouse_move, 224, 432, 2, 377, 1015] +[:mouse_move, 223, 434, 2, 378, 1016] +[:mouse_move, 221, 436, 2, 379, 1017] +[:mouse_move, 220, 438, 2, 380, 1018] +[:mouse_move, 219, 439, 2, 381, 1019] +[:mouse_move, 218, 440, 2, 382, 1020] +[:mouse_move, 217, 441, 2, 383, 1021] +[:mouse_move, 216, 442, 2, 384, 1023] +[:mouse_move, 214, 445, 2, 385, 1024] +[:mouse_move, 212, 447, 2, 386, 1025] +[:mouse_move, 211, 448, 2, 387, 1026] +[:mouse_move, 209, 450, 2, 388, 1027] +[:mouse_move, 209, 451, 2, 389, 1028] +[:mouse_move, 208, 452, 2, 390, 1029] +[:mouse_move, 207, 452, 2, 391, 1030] +[:mouse_move, 206, 453, 2, 392, 1031] +[:mouse_move, 206, 454, 2, 393, 1032] +[:mouse_move, 204, 456, 2, 394, 1033] +[:mouse_move, 203, 457, 2, 395, 1034] +[:mouse_move, 202, 458, 2, 396, 1035] +[:mouse_button_up, 1, 0, 1, 397, 1050] +[:mouse_move, 217, 484, 2, 398, 1050] +[:mouse_move, 232, 510, 2, 399, 1051] +[:mouse_move, 256, 554, 2, 400, 1052] +[:mouse_move, 266, 571, 2, 401, 1053] +[:mouse_move, 278, 588, 2, 402, 1054] +[:mouse_move, 288, 604, 2, 403, 1055] +[:mouse_move, 299, 620, 2, 404, 1056] +[:mouse_move, 302, 624, 2, 405, 1057] +[:mouse_move, 303, 626, 2, 406, 1058] +[:mouse_move, 303, 624, 2, 407, 1062] +[:mouse_move, 302, 622, 2, 408, 1063] +[:mouse_move, 302, 621, 2, 409, 1064] +[:mouse_move, 301, 619, 2, 410, 1065] +[:mouse_move, 301, 618, 2, 411, 1066] +[:mouse_move, 301, 617, 2, 412, 1068] +[:mouse_move, 301, 616, 2, 413, 1072] +[:mouse_move, 301, 615, 2, 414, 1075] +[:mouse_move, 301, 614, 2, 415, 1076] +[:mouse_move, 301, 612, 2, 416, 1077] +[:mouse_move, 301, 611, 2, 417, 1078] +[:mouse_move, 299, 604, 2, 418, 1079] +[:mouse_move, 297, 599, 2, 419, 1080] +[:mouse_move, 292, 586, 2, 420, 1081] +[:mouse_move, 268, 518, 2, 421, 1082] +[:mouse_move, 261, 492, 2, 422, 1083] +[:mouse_move, 252, 466, 2, 423, 1084] +[:mouse_move, 243, 437, 2, 424, 1085] +[:mouse_move, 239, 425, 2, 425, 1086] +[:mouse_move, 218, 366, 2, 426, 1087] +[:mouse_move, 216, 360, 2, 427, 1088] +[:mouse_move, 215, 358, 2, 428, 1089] +[:mouse_move, 216, 358, 2, 429, 1100] +[:mouse_move, 216, 360, 2, 430, 1102] +[:mouse_move, 217, 360, 2, 431, 1103] +[:mouse_move, 221, 366, 2, 432, 1104] +[:mouse_move, 225, 372, 2, 433, 1105] +[:mouse_move, 232, 383, 2, 434, 1106] +[:mouse_move, 237, 391, 2, 435, 1107] +[:mouse_move, 242, 399, 2, 436, 1108] +[:mouse_move, 245, 404, 2, 437, 1109] +[:mouse_move, 248, 409, 2, 438, 1110] +[:mouse_move, 249, 410, 2, 439, 1111] +[:mouse_move, 250, 411, 2, 440, 1112] +[:mouse_move, 250, 412, 2, 441, 1118] +[:mouse_move, 251, 412, 2, 442, 1125] +[:mouse_move, 251, 413, 2, 443, 1127] +[:key_down_raw, 97, 0, 2, 444, 1217] +[:key_up_raw, 97, 0, 2, 445, 1221] +[:key_down_raw, 97, 0, 2, 446, 1233] +[:key_up_raw, 97, 0, 2, 447, 1237] +[:key_down_raw, 98, 0, 2, 448, 1248] +[:key_up_raw, 98, 0, 2, 449, 1252] +[:key_down_raw, 98, 0, 2, 450, 1256] +[:key_up_raw, 98, 0, 2, 451, 1258] +[:key_down_raw, 98, 0, 2, 452, 1293] +[:key_up_raw, 98, 0, 2, 453, 1297] +[:key_down_raw, 99, 0, 2, 454, 1334] +[:key_up_raw, 99, 0, 2, 455, 1339] +[:key_down_raw, 98, 0, 2, 456, 1419] +[:key_up_raw, 98, 0, 2, 457, 1422] +[:key_down_raw, 98, 0, 2, 458, 1426] +[:key_up_raw, 98, 0, 2, 459, 1429] +[:key_down_raw, 98, 0, 2, 460, 1473] +[:key_up_raw, 98, 0, 2, 461, 1478] +[:key_down_raw, 113, 0, 2, 462, 1534] +[:key_up_raw, 113, 0, 2, 463, 1538] +[:key_down_raw, 98, 0, 2, 464, 1636] +[:key_up_raw, 98, 0, 2, 465, 1642] +[:key_down_raw, 102, 0, 2, 466, 1676] +[:key_up_raw, 102, 0, 2, 467, 1680] +[:key_down_raw, 102, 0, 2, 468, 1684] +[:key_up_raw, 102, 0, 2, 469, 1688] +[:key_down_raw, 113, 0, 2, 470, 1697] +[:key_up_raw, 113, 0, 2, 471, 1700] +[:key_down_raw, 98, 0, 2, 472, 1739] +[:key_up_raw, 98, 0, 2, 473, 1742] +[:key_down_raw, 98, 0, 2, 474, 1746] +[:key_up_raw, 98, 0, 2, 475, 1748] +[:key_down_raw, 102, 0, 2, 476, 1866] +[:key_up_raw, 102, 0, 2, 477, 1871] +[:key_down_raw, 120, 0, 2, 478, 1891] +[:key_up_raw, 120, 0, 2, 479, 1896] +[:mouse_move, 251, 415, 2, 480, 1934] +[:mouse_move, 255, 423, 2, 481, 1935] +[:mouse_move, 261, 433, 2, 482, 1936] +[:mouse_move, 277, 463, 2, 483, 1937] +[:mouse_move, 288, 481, 2, 484, 1938] +[:mouse_move, 302, 510, 2, 485, 1939] +[:mouse_move, 310, 526, 2, 486, 1940] +[:mouse_move, 323, 551, 2, 487, 1941] +[:mouse_move, 324, 554, 2, 488, 1942] +[:mouse_move, 327, 562, 2, 489, 1943] +[:mouse_move, 328, 565, 2, 490, 1944] +[:mouse_move, 328, 567, 2, 491, 1945] +[:mouse_move, 328, 566, 2, 492, 1949] +[:mouse_move, 326, 564, 2, 493, 1950] +[:mouse_move, 325, 562, 2, 494, 1951] +[:mouse_move, 323, 556, 2, 495, 1952] +[:mouse_move, 323, 553, 2, 496, 1953] +[:mouse_move, 321, 549, 2, 497, 1954] +[:mouse_move, 320, 545, 2, 498, 1955] +[:mouse_move, 319, 540, 2, 499, 1956] +[:mouse_move, 319, 538, 2, 500, 1957] +[:mouse_move, 319, 535, 2, 501, 1958] +[:mouse_move, 319, 534, 2, 502, 1959] +[:mouse_move, 319, 533, 2, 503, 2199] +[:mouse_move, 318, 533, 2, 504, 2201] +[:mouse_move, 317, 531, 2, 505, 2207] +[:mouse_move, 316, 530, 2, 506, 2208] +[:mouse_move, 314, 527, 2, 507, 2209] +[:mouse_move, 311, 522, 2, 508, 2210] +[:mouse_move, 300, 505, 2, 509, 2211] +[:mouse_move, 293, 492, 2, 510, 2212] +[:mouse_move, 272, 455, 2, 511, 2213] +[:key_down_raw, 100, 0, 2, 512, 2214] +[:mouse_move, 259, 434, 2, 513, 2214] +[:mouse_move, 243, 403, 2, 514, 2215] +[:mouse_move, 232, 382, 2, 515, 2216] +[:mouse_move, 221, 355, 2, 516, 2217] +[:mouse_move, 220, 351, 2, 517, 2218] +[:mouse_move, 218, 344, 2, 518, 2219] +[:mouse_move, 216, 335, 2, 519, 2220] +[:mouse_move, 216, 332, 2, 520, 2221] +[:mouse_move, 216, 327, 2, 521, 2222] +[:key_down_raw, 100, 0, 2, 522, 2229] +[:key_down_raw, 100, 0, 2, 523, 2231] +[:key_down_raw, 100, 0, 2, 524, 2233] +[:key_down_raw, 100, 0, 2, 525, 2235] +[:key_down_raw, 100, 0, 2, 526, 2237] +[:mouse_button_pressed, 1, 0, 1, 527, 2238] +[:key_down_raw, 100, 0, 2, 528, 2239] +[:mouse_move, 216, 325, 2, 529, 2239] +[:mouse_move, 216, 315, 2, 530, 2240] +[:key_down_raw, 100, 0, 2, 531, 2241] +[:mouse_move, 216, 305, 2, 532, 2241] +[:mouse_move, 219, 281, 2, 533, 2242] +[:key_down_raw, 100, 0, 2, 534, 2243] +[:mouse_move, 230, 234, 2, 535, 2243] +[:mouse_move, 231, 228, 2, 536, 2243] +[:key_down_raw, 100, 0, 2, 537, 2244] +[:mouse_move, 233, 223, 2, 538, 2244] +[:mouse_move, 237, 214, 2, 539, 2245] +[:mouse_move, 244, 207, 2, 540, 2246] +[:key_down_raw, 100, 0, 2, 541, 2246] +[:mouse_move, 247, 204, 2, 542, 2247] +[:mouse_move, 254, 199, 2, 543, 2248] +[:key_down_raw, 100, 0, 2, 544, 2248] +[:mouse_move, 257, 197, 2, 545, 2249] +[:mouse_move, 262, 194, 2, 546, 2250] +[:key_down_raw, 100, 0, 2, 547, 2250] +[:mouse_move, 264, 194, 2, 548, 2251] +[:mouse_move, 268, 193, 2, 549, 2252] +[:key_down_raw, 100, 0, 2, 550, 2252] +[:mouse_move, 269, 193, 2, 551, 2253] +[:mouse_move, 271, 193, 2, 552, 2254] +[:key_down_raw, 100, 0, 2, 553, 2254] +[:mouse_move, 272, 195, 2, 554, 2255] +[:mouse_move, 274, 202, 2, 555, 2256] +[:key_down_raw, 100, 0, 2, 556, 2256] +[:mouse_move, 275, 208, 2, 557, 2257] +[:mouse_move, 276, 225, 2, 558, 2258] +[:key_down_raw, 100, 0, 2, 559, 2258] +[:mouse_move, 275, 234, 2, 560, 2259] +[:mouse_move, 270, 247, 2, 561, 2260] +[:key_down_raw, 100, 0, 2, 562, 2260] +[:mouse_move, 265, 255, 2, 563, 2261] +[:mouse_move, 254, 270, 2, 564, 2262] +[:key_down_raw, 100, 0, 2, 565, 2262] +[:mouse_move, 248, 275, 2, 566, 2263] +[:mouse_move, 235, 285, 2, 567, 2264] +[:key_down_raw, 100, 0, 2, 568, 2264] +[:mouse_move, 232, 287, 2, 569, 2265] +[:mouse_move, 223, 291, 2, 570, 2266] +[:key_down_raw, 100, 0, 2, 571, 2266] +[:mouse_move, 219, 293, 2, 572, 2267] +[:mouse_move, 214, 295, 2, 573, 2268] +[:key_down_raw, 100, 0, 2, 574, 2268] +[:mouse_move, 212, 296, 2, 575, 2269] +[:mouse_move, 210, 297, 2, 576, 2270] +[:key_down_raw, 100, 0, 2, 577, 2270] +[:mouse_move, 208, 297, 2, 578, 2270] +[:mouse_move, 208, 298, 2, 579, 2271] +[:mouse_move, 207, 298, 2, 580, 2272] +[:key_down_raw, 100, 0, 2, 581, 2272] +[:mouse_move, 206, 298, 2, 582, 2273] +[:key_down_raw, 100, 0, 2, 583, 2274] +[:mouse_move, 206, 297, 2, 584, 2276] +[:key_down_raw, 100, 0, 2, 585, 2276] +[:mouse_move, 207, 291, 2, 586, 2276] +[:mouse_move, 209, 285, 2, 587, 2277] +[:mouse_move, 213, 271, 2, 588, 2278] +[:key_down_raw, 100, 0, 2, 589, 2278] +[:mouse_move, 215, 265, 2, 590, 2278] +[:mouse_move, 221, 251, 2, 591, 2279] +[:mouse_move, 227, 238, 2, 592, 2280] +[:key_down_raw, 100, 0, 2, 593, 2280] +[:mouse_move, 231, 228, 2, 594, 2280] +[:mouse_move, 235, 219, 2, 595, 2281] +[:mouse_move, 240, 211, 2, 596, 2282] +[:key_down_raw, 100, 0, 2, 597, 2282] +[:mouse_move, 247, 203, 2, 598, 2283] +[:mouse_move, 250, 199, 2, 599, 2284] +[:key_down_raw, 100, 0, 2, 600, 2284] +[:mouse_move, 259, 194, 2, 601, 2285] +[:mouse_move, 264, 193, 2, 602, 2286] +[:key_down_raw, 100, 0, 2, 603, 2286] +[:mouse_move, 276, 192, 2, 604, 2287] +[:mouse_move, 281, 192, 2, 605, 2288] +[:key_down_raw, 100, 0, 2, 606, 2288] +[:mouse_move, 289, 194, 2, 607, 2289] +[:mouse_move, 294, 194, 2, 608, 2290] +[:key_down_raw, 100, 0, 2, 609, 2290] +[:mouse_move, 301, 197, 2, 610, 2291] +[:key_down_raw, 100, 0, 2, 611, 2292] +[:mouse_move, 305, 199, 2, 612, 2292] +[:mouse_move, 308, 201, 2, 613, 2293] +[:key_down_raw, 100, 0, 2, 614, 2294] +[:mouse_move, 310, 201, 2, 615, 2294] +[:mouse_move, 311, 202, 2, 616, 2295] +[:mouse_move, 312, 203, 2, 617, 2296] +[:key_down_raw, 100, 0, 2, 618, 2296] +[:mouse_move, 312, 205, 2, 619, 2298] +[:key_down_raw, 100, 0, 2, 620, 2298] +[:mouse_move, 312, 207, 2, 621, 2299] +[:mouse_move, 310, 216, 2, 622, 2300] +[:key_down_raw, 100, 0, 2, 623, 2300] +[:mouse_move, 306, 224, 2, 624, 2301] +[:mouse_move, 298, 235, 2, 625, 2302] +[:key_down_raw, 100, 0, 2, 626, 2302] +[:mouse_move, 295, 238, 2, 627, 2303] +[:mouse_move, 286, 247, 2, 628, 2304] +[:key_down_raw, 100, 0, 2, 629, 2304] +[:mouse_move, 280, 252, 2, 630, 2305] +[:mouse_move, 270, 261, 2, 631, 2306] +[:key_down_raw, 100, 0, 2, 632, 2306] +[:mouse_move, 267, 263, 2, 633, 2307] +[:mouse_move, 258, 274, 2, 634, 2308] +[:key_down_raw, 100, 0, 2, 635, 2308] +[:mouse_move, 254, 279, 2, 636, 2309] +[:mouse_move, 245, 295, 2, 637, 2310] +[:key_down_raw, 100, 0, 2, 638, 2310] +[:mouse_move, 242, 303, 2, 639, 2311] +[:mouse_move, 240, 315, 2, 640, 2312] +[:key_down_raw, 100, 0, 2, 641, 2312] +[:mouse_move, 238, 323, 2, 642, 2313] +[:mouse_move, 238, 335, 2, 643, 2314] +[:key_down_raw, 100, 0, 2, 644, 2314] +[:mouse_move, 238, 338, 2, 645, 2315] +[:mouse_move, 238, 345, 2, 646, 2316] +[:key_down_raw, 100, 0, 2, 647, 2316] +[:mouse_move, 241, 349, 2, 648, 2317] +[:mouse_move, 247, 350, 2, 649, 2318] +[:key_down_raw, 100, 0, 2, 650, 2318] +[:mouse_move, 252, 350, 2, 651, 2319] +[:mouse_move, 260, 344, 2, 652, 2320] +[:key_down_raw, 100, 0, 2, 653, 2320] +[:mouse_move, 264, 340, 2, 654, 2321] +[:mouse_move, 266, 337, 2, 655, 2322] +[:key_down_raw, 100, 0, 2, 656, 2322] +[:mouse_move, 268, 334, 2, 657, 2322] +[:mouse_move, 270, 331, 2, 658, 2323] +[:mouse_move, 271, 329, 2, 659, 2324] +[:key_down_raw, 100, 0, 2, 660, 2324] +[:mouse_move, 272, 326, 2, 661, 2324] +[:mouse_move, 272, 323, 2, 662, 2325] +[:mouse_move, 272, 319, 2, 663, 2326] +[:key_down_raw, 100, 0, 2, 664, 2326] +[:mouse_move, 271, 317, 2, 665, 2326] +[:mouse_move, 266, 312, 2, 666, 2327] +[:mouse_move, 262, 310, 2, 667, 2328] +[:key_down_raw, 100, 0, 2, 668, 2328] +[:mouse_move, 256, 308, 2, 669, 2328] +[:mouse_move, 249, 306, 2, 670, 2329] +[:mouse_move, 243, 305, 2, 671, 2330] +[:key_down_raw, 100, 0, 2, 672, 2330] +[:mouse_move, 236, 304, 2, 673, 2330] +[:mouse_move, 231, 304, 2, 674, 2331] +[:mouse_move, 226, 306, 2, 675, 2332] +[:key_down_raw, 100, 0, 2, 676, 2332] +[:mouse_move, 219, 309, 2, 677, 2332] +[:mouse_move, 211, 315, 2, 678, 2333] +[:mouse_move, 206, 323, 2, 679, 2334] +[:key_down_raw, 100, 0, 2, 680, 2334] +[:mouse_move, 200, 332, 2, 681, 2334] +[:mouse_move, 197, 340, 2, 682, 2335] +[:mouse_move, 195, 344, 2, 683, 2336] +[:key_down_raw, 100, 0, 2, 684, 2336] +[:mouse_move, 190, 353, 2, 685, 2336] +[:mouse_move, 190, 358, 2, 686, 2337] +[:mouse_move, 188, 363, 2, 687, 2338] +[:key_down_raw, 100, 0, 2, 688, 2338] +[:mouse_move, 187, 376, 2, 689, 2339] +[:mouse_move, 187, 379, 2, 690, 2340] +[:key_down_raw, 100, 0, 2, 691, 2340] +[:mouse_move, 195, 388, 2, 692, 2341] +[:mouse_move, 201, 391, 2, 693, 2342] +[:key_down_raw, 100, 0, 2, 694, 2342] +[:mouse_move, 212, 395, 2, 695, 2343] +[:mouse_move, 218, 395, 2, 696, 2344] +[:key_down_raw, 100, 0, 2, 697, 2344] +[:mouse_move, 229, 395, 2, 698, 2345] +[:mouse_move, 234, 393, 2, 699, 2346] +[:key_down_raw, 100, 0, 2, 700, 2346] +[:mouse_move, 241, 385, 2, 701, 2347] +[:key_down_raw, 100, 0, 2, 702, 2348] +[:mouse_move, 245, 380, 2, 703, 2348] +[:mouse_move, 247, 374, 2, 704, 2349] +[:mouse_move, 251, 366, 2, 705, 2350] +[:key_down_raw, 100, 0, 2, 706, 2350] +[:mouse_move, 252, 363, 2, 707, 2351] +[:mouse_move, 254, 359, 2, 708, 2352] +[:key_down_raw, 100, 0, 2, 709, 2352] +[:mouse_move, 254, 357, 2, 710, 2353] +[:mouse_move, 255, 356, 2, 711, 2354] +[:key_down_raw, 100, 0, 2, 712, 2354] +[:mouse_move, 256, 357, 2, 713, 2356] +[:key_down_raw, 100, 0, 2, 714, 2356] +[:mouse_move, 257, 360, 2, 715, 2357] +[:mouse_move, 259, 373, 2, 716, 2358] +[:key_down_raw, 100, 0, 2, 717, 2358] +[:mouse_move, 260, 382, 2, 718, 2359] +[:mouse_move, 263, 395, 2, 719, 2360] +[:key_down_raw, 100, 0, 2, 720, 2360] +[:mouse_move, 263, 402, 2, 721, 2361] +[:mouse_move, 264, 414, 2, 722, 2362] +[:key_down_raw, 100, 0, 2, 723, 2362] +[:mouse_move, 265, 420, 2, 724, 2363] +[:mouse_move, 266, 428, 2, 725, 2364] +[:key_down_raw, 100, 0, 2, 726, 2364] +[:mouse_move, 267, 431, 2, 727, 2365] +[:mouse_move, 270, 434, 2, 728, 2366] +[:key_down_raw, 100, 0, 2, 729, 2366] +[:mouse_move, 273, 437, 2, 730, 2367] +[:mouse_move, 279, 437, 2, 731, 2368] +[:key_down_raw, 100, 0, 2, 732, 2368] +[:mouse_move, 281, 437, 2, 733, 2369] +[:mouse_move, 290, 436, 2, 734, 2370] +[:key_down_raw, 100, 0, 2, 735, 2370] +[:mouse_move, 294, 434, 2, 736, 2371] +[:mouse_move, 301, 431, 2, 737, 2372] +[:key_down_raw, 100, 0, 2, 738, 2372] +[:mouse_move, 304, 431, 2, 739, 2373] +[:mouse_move, 312, 428, 2, 740, 2374] +[:key_down_raw, 100, 0, 2, 741, 2374] +[:mouse_move, 318, 427, 2, 742, 2375] +[:mouse_move, 325, 425, 2, 743, 2376] +[:key_down_raw, 100, 0, 2, 744, 2376] +[:mouse_move, 327, 424, 2, 745, 2377] +[:mouse_move, 330, 423, 2, 746, 2378] +[:key_down_raw, 100, 0, 2, 747, 2378] +[:mouse_move, 333, 422, 2, 748, 2378] +[:mouse_move, 335, 422, 2, 749, 2379] +[:mouse_move, 338, 420, 2, 750, 2380] +[:key_down_raw, 100, 0, 2, 751, 2380] +[:mouse_move, 340, 420, 2, 752, 2380] +[:mouse_move, 344, 419, 2, 753, 2381] +[:mouse_move, 347, 419, 2, 754, 2382] +[:key_down_raw, 100, 0, 2, 755, 2382] +[:mouse_move, 351, 419, 2, 756, 2382] +[:mouse_move, 353, 419, 2, 757, 2383] +[:mouse_move, 358, 419, 2, 758, 2384] +[:key_down_raw, 100, 0, 2, 759, 2384] +[:mouse_move, 360, 419, 2, 760, 2384] +[:mouse_move, 365, 419, 2, 761, 2385] +[:mouse_move, 367, 419, 2, 762, 2386] +[:key_down_raw, 100, 0, 2, 763, 2386] +[:mouse_move, 373, 420, 2, 764, 2386] +[:mouse_move, 378, 420, 2, 765, 2387] +[:mouse_move, 382, 420, 2, 766, 2388] +[:key_down_raw, 100, 0, 2, 767, 2388] +[:mouse_move, 389, 419, 2, 768, 2389] +[:mouse_move, 394, 417, 2, 769, 2390] +[:key_down_raw, 100, 0, 2, 770, 2390] +[:mouse_move, 401, 411, 2, 771, 2391] +[:mouse_move, 404, 407, 2, 772, 2392] +[:key_down_raw, 100, 0, 2, 773, 2392] +[:mouse_move, 411, 398, 2, 774, 2393] +[:mouse_move, 412, 394, 2, 775, 2394] +[:key_down_raw, 100, 0, 2, 776, 2394] +[:mouse_move, 415, 387, 2, 777, 2395] +[:mouse_move, 416, 383, 2, 778, 2396] +[:key_down_raw, 100, 0, 2, 779, 2396] +[:mouse_move, 418, 375, 2, 780, 2397] +[:mouse_move, 418, 370, 2, 781, 2398] +[:key_down_raw, 100, 0, 2, 782, 2398] +[:mouse_move, 419, 359, 2, 783, 2399] +[:mouse_move, 419, 354, 2, 784, 2400] +[:key_down_raw, 100, 0, 2, 785, 2400] +[:mouse_move, 419, 348, 2, 786, 2401] +[:mouse_move, 419, 344, 2, 787, 2402] +[:key_down_raw, 100, 0, 2, 788, 2402] +[:mouse_move, 419, 341, 2, 789, 2403] +[:mouse_move, 419, 338, 2, 790, 2404] +[:key_down_raw, 100, 0, 2, 791, 2404] +[:mouse_move, 419, 337, 2, 792, 2405] +[:mouse_move, 417, 336, 2, 793, 2406] +[:key_down_raw, 100, 0, 2, 794, 2406] +[:mouse_move, 415, 336, 2, 795, 2408] +[:key_down_raw, 100, 0, 2, 796, 2408] +[:mouse_move, 414, 336, 2, 797, 2409] +[:key_down_raw, 100, 0, 2, 798, 2410] +[:key_down_raw, 100, 0, 2, 799, 2412] +[:mouse_move, 414, 334, 2, 800, 2414] +[:key_down_raw, 100, 0, 2, 801, 2414] +[:mouse_move, 416, 334, 2, 802, 2416] +[:key_down_raw, 100, 0, 2, 803, 2416] +[:mouse_move, 418, 339, 2, 804, 2418] +[:key_down_raw, 100, 0, 2, 805, 2418] +[:mouse_move, 419, 347, 2, 806, 2419] +[:mouse_move, 420, 366, 2, 807, 2420] +[:key_down_raw, 100, 0, 2, 808, 2420] +[:mouse_move, 420, 383, 2, 809, 2421] +[:mouse_move, 412, 412, 2, 810, 2422] +[:key_down_raw, 100, 0, 2, 811, 2422] +[:mouse_move, 409, 420, 2, 812, 2423] +[:mouse_move, 402, 433, 2, 813, 2424] +[:key_down_raw, 100, 0, 2, 814, 2424] +[:mouse_move, 399, 439, 2, 815, 2425] +[:mouse_move, 395, 446, 2, 816, 2426] +[:key_down_raw, 100, 0, 2, 817, 2426] +[:mouse_move, 393, 448, 2, 818, 2427] +[:mouse_move, 390, 451, 2, 819, 2428] +[:key_down_raw, 100, 0, 2, 820, 2428] +[:mouse_move, 389, 452, 2, 821, 2429] +[:mouse_move, 387, 453, 2, 822, 2430] +[:key_down_raw, 100, 0, 2, 823, 2430] +[:mouse_move, 385, 453, 2, 824, 2431] +[:mouse_move, 383, 453, 2, 825, 2432] +[:key_down_raw, 100, 0, 2, 826, 2432] +[:mouse_move, 381, 453, 2, 827, 2432] +[:mouse_move, 379, 452, 2, 828, 2433] +[:mouse_move, 377, 451, 2, 829, 2434] +[:key_down_raw, 100, 0, 2, 830, 2434] +[:mouse_move, 376, 449, 2, 831, 2434] +[:mouse_move, 374, 445, 2, 832, 2435] +[:mouse_move, 373, 442, 2, 833, 2436] +[:key_down_raw, 100, 0, 2, 834, 2436] +[:mouse_move, 371, 437, 2, 835, 2436] +[:mouse_move, 370, 435, 2, 836, 2437] +[:mouse_move, 370, 432, 2, 837, 2438] +[:key_down_raw, 100, 0, 2, 838, 2438] +[:mouse_move, 370, 428, 2, 839, 2438] +[:mouse_move, 370, 424, 2, 840, 2439] +[:mouse_move, 370, 419, 2, 841, 2440] +[:key_down_raw, 100, 0, 2, 842, 2440] +[:mouse_move, 370, 417, 2, 843, 2440] +[:mouse_move, 371, 414, 2, 844, 2441] +[:mouse_move, 373, 411, 2, 845, 2442] +[:key_down_raw, 100, 0, 2, 846, 2442] +[:mouse_move, 376, 409, 2, 847, 2442] +[:mouse_move, 378, 407, 2, 848, 2443] +[:mouse_move, 380, 406, 2, 849, 2444] +[:key_down_raw, 100, 0, 2, 850, 2444] +[:mouse_move, 383, 405, 2, 851, 2444] +[:mouse_move, 385, 405, 2, 852, 2445] +[:mouse_move, 386, 404, 2, 853, 2446] +[:key_down_raw, 100, 0, 2, 854, 2446] +[:mouse_move, 388, 403, 2, 855, 2447] +[:mouse_move, 389, 403, 2, 856, 2448] +[:key_down_raw, 100, 0, 2, 857, 2448] +[:key_down_raw, 100, 0, 2, 858, 2450] +[:key_down_raw, 100, 0, 2, 859, 2452] +[:key_down_raw, 100, 0, 2, 860, 2454] +[:key_down_raw, 100, 0, 2, 861, 2456] +[:mouse_move, 389, 404, 2, 862, 2458] +[:key_down_raw, 100, 0, 2, 863, 2458] +[:key_down_raw, 100, 0, 2, 864, 2460] +[:key_down_raw, 100, 0, 2, 865, 2462] +[:key_down_raw, 100, 0, 2, 866, 2464] +[:key_down_raw, 100, 0, 2, 867, 2466] +[:key_up_raw, 100, 0, 2, 868, 2468] +[:mouse_button_up, 1, 0, 1, 869, 2473] +[:mouse_move, 276, 362, 2, 870, 2473] +[:mouse_move, 239, 339, 2, 871, 2474] +[:mouse_move, 210, 314, 2, 872, 2475] +[:mouse_move, 186, 291, 2, 873, 2476] +[:mouse_move, 167, 265, 2, 874, 2477] +[:mouse_move, 159, 253, 2, 875, 2478] +[:mouse_move, 154, 245, 2, 876, 2479] +[:mouse_move, 150, 236, 2, 877, 2480] +[:mouse_move, 149, 234, 2, 878, 2481] +[:mouse_move, 149, 232, 2, 879, 2482] +[:mouse_move, 152, 232, 2, 880, 2484] +[:mouse_move, 154, 233, 2, 881, 2485] +[:mouse_move, 157, 236, 2, 882, 2486] +[:mouse_move, 159, 238, 2, 883, 2487] +[:mouse_move, 163, 242, 2, 884, 2488] +[:mouse_move, 165, 245, 2, 885, 2489] +[:mouse_move, 170, 253, 2, 886, 2490] +[:mouse_move, 173, 257, 2, 887, 2491] +[:mouse_move, 180, 270, 2, 888, 2492] +[:mouse_move, 183, 275, 2, 889, 2493] +[:mouse_move, 190, 287, 2, 890, 2494] +[:mouse_move, 192, 290, 2, 891, 2495] +[:mouse_move, 199, 303, 2, 892, 2496] +[:mouse_move, 203, 307, 2, 893, 2497] +[:mouse_move, 206, 313, 2, 894, 2498] +[:mouse_move, 207, 317, 2, 895, 2499] +[:mouse_move, 209, 321, 2, 896, 2500] +[:mouse_move, 210, 322, 2, 897, 2501] +[:mouse_move, 211, 324, 2, 898, 2502] +[:mouse_move, 212, 325, 2, 899, 2504] +[:mouse_move, 213, 326, 2, 900, 2505] +[:mouse_move, 214, 326, 2, 901, 2510] +[:key_down_raw, 96, 0, 2, 902, 2711] +[:key_up_raw, 96, 0, 2, 903, 2716] +[:key_down_raw, 13, 0, 2, 904, 2856] diff --git a/samples/99_sample_sprite_animation_creator/sprites/square-blue.png b/samples/99_sample_sprite_animation_creator/sprites/square-blue.png Binary files differnew file mode 100644 index 0000000..b840849 --- /dev/null +++ b/samples/99_sample_sprite_animation_creator/sprites/square-blue.png diff --git a/samples/99_sample_sprite_animation_creator/sprites/square-white.png b/samples/99_sample_sprite_animation_creator/sprites/square-white.png Binary files differnew file mode 100644 index 0000000..378c565 --- /dev/null +++ b/samples/99_sample_sprite_animation_creator/sprites/square-white.png diff --git a/samples/99_zz_gtk_unit_tests/exception_raising_tests.rb b/samples/99_zz_gtk_unit_tests/exception_raising_tests.rb new file mode 100644 index 0000000..57efdb2 --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/exception_raising_tests.rb @@ -0,0 +1,21 @@ +begin :shared + class ExceptionalClass + def initialize exception_to_throw = nil + raise exception_to_throw if exception_to_throw + end + end +end + +def test_exception_in_newing_object args, assert + begin + ExceptionalClass.new TypeError + raise "Exception wasn't thrown!" + rescue Exception => e + assert.equal! e.class, TypeError, "Exceptions within constructor should be retained." + end +end + +puts "running tests" +$gtk.reset 100 +$gtk.log_level = :off +$gtk.tests.start diff --git a/samples/99_zz_gtk_unit_tests/gen_docs.rb b/samples/99_zz_gtk_unit_tests/gen_docs.rb new file mode 100644 index 0000000..0e41326 --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/gen_docs.rb @@ -0,0 +1,2 @@ +# sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/gen_docs.rb --no-tick +Kernel.export_docs! diff --git a/samples/99_zz_gtk_unit_tests/geometry_tests.rb b/samples/99_zz_gtk_unit_tests/geometry_tests.rb new file mode 100644 index 0000000..d823d78 --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/geometry_tests.rb @@ -0,0 +1,116 @@ +begin :shared + def primitive_representations x, y, w, h + [ + [x, y, w, h], + { x: x, y: y, w: w, h: h }, + RectForTest.new(x, y, w, h) + ] + end + + class RectForTest + attr_sprite + + def initialize x, y, w, h + @x = x + @y = y + @w = w + @h = h + end + + def to_s + "RectForTest: #{[x, y, w, h]}" + end + end +end + +begin :intersect_rect? + def test_intersect_rect_point args, assert + assert.true! [16, 13].intersect_rect?([13, 12, 4, 4]), "point intersects with rect." + end + + def test_intersect_rect args, assert + intersecting = primitive_representations(0, 0, 100, 100) + + primitive_representations(20, 20, 20, 20) + + intersecting.product(intersecting).each do |rect_one, rect_two| + assert.true! rect_one.intersect_rect?(rect_two), + "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected true)." + end + + not_intersecting = [ + [ 0, 0, 5, 5], + { x: 10, y: 10, w: 5, h: 5 }, + RectForTest.new(20, 20, 5, 5) + ] + + not_intersecting.product(not_intersecting) + .reject { |rect_one, rect_two| rect_one == rect_two } + .each do |rect_one, rect_two| + assert.false! rect_one.intersect_rect?(rect_two), + "intersect_rect? assertion failed for #{rect_one}, #{rect_two} (expected false)." + end + end +end + +begin :inside_rect? + def assert_inside_rect outer: nil, inner: nil, expected: nil, assert: nil + assert.true! inner.inside_rect?(outer) == expected, + "inside_rect? assertion failed for outer: #{outer} inner: #{inner} (expected #{expected})." + end + + def test_inside_rect args, assert + outer_rects = primitive_representations(0, 0, 10, 10) + inner_rects = primitive_representations(1, 1, 5, 5) + primitive_representations(0, 0, 10, 10).product(primitive_representations(1, 1, 5, 5)) + .each do |outer, inner| + assert_inside_rect outer: outer, inner: inner, + expected: true, assert: assert + end + end +end + +begin :angle_to + def test_angle_to args, assert + origins = primitive_representations(0, 0, 0, 0) + rights = primitive_representations(1, 0, 0, 0) + aboves = primitive_representations(0, 1, 0, 0) + + origins.product(aboves).each do |origin, above| + assert.equal! origin.angle_to(above), 90, + "A point directly above should be 90 degrees." + + assert.equal! above.angle_from(origin), 90, + "A point coming from above should be 90 degrees." + end + + origins.product(rights).each do |origin, right| + assert.equal! origin.angle_to(right) % 360, 0, + "A point directly to the right should be 0 degrees." + + assert.equal! right.angle_from(origin) % 360, 0, + "A point coming from the right should be 0 degrees." + + end + end +end + +begin :scale_rect + def test_scale_rect args, assert + assert.equal! [0, 0, 100, 100].scale_rect(0.5, 0.5), + [25.0, 25.0, 50.0, 50.0] + + assert.equal! [0, 0, 100, 100].scale_rect(0.5), + [0.0, 0.0, 50.0, 50.0] + + assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0.5, anchor_y: 0.5), + [25.0, 25.0, 50.0, 50.0] + + assert.equal! [0, 0, 100, 100].scale_rect_extended(percentage_x: 0.5, percentage_y: 0.5, anchor_x: 0, anchor_y: 0), + [0.0, 0.0, 50.0, 50.0] + end +end + +puts "running tests" +$gtk.reset 100 +$gtk.log_level = :off +$gtk.tests.start diff --git a/samples/99_zz_gtk_unit_tests/http_tests.rb b/samples/99_zz_gtk_unit_tests/http_tests.rb new file mode 100644 index 0000000..1132f85 --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/http_tests.rb @@ -0,0 +1,24 @@ +def try_assert_or_schedule args, assert + if $result[:complete] + log_info "Request completed! Verifying." + if $result[:http_response_code] != 200 + log_info "The request yielded a result of #{$result[:http_response_code]} instead of 200." + exit + end + log_info ":try_assert_or_schedule succeeded!" + else + args.gtk.schedule_callback Kernel.tick_count + 10 do + try_assert_or_schedule args, assert + end + end +end + +def test_http args, assert + $result = $gtk.http_get 'http://dragonruby.org' + try_assert_or_schedule args, assert +end + +puts "running tests" +$gtk.reset 100 +$gtk.log_level = :off +$gtk.tests.start diff --git a/samples/99_zz_gtk_unit_tests/object_to_primitive_tests.rb b/samples/99_zz_gtk_unit_tests/object_to_primitive_tests.rb new file mode 100644 index 0000000..4686c6e --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/object_to_primitive_tests.rb @@ -0,0 +1,17 @@ +class PlayerSpriteForTest +end + +def test_array_to_sprite args, assert + array = [[0, 0, 100, 100, "test.png"]].sprites + puts "No exception was thrown. Sweet!" +end + +def test_class_to_sprite args, assert + array = [PlayerSprite.new].sprites + assert.true! array.first.is_a?(PlayerSprite) + puts "No exception was thrown. Sweet!" +end + +$gtk.reset 100 +$gtk.log_level = :off +$gtk.tests.start diff --git a/samples/99_zz_gtk_unit_tests/parsing_tests.rb b/samples/99_zz_gtk_unit_tests/parsing_tests.rb new file mode 100644 index 0000000..4dede2b --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/parsing_tests.rb @@ -0,0 +1,29 @@ +def test_parse_json args, assert + result = args.gtk.parse_json '{ "name": "John Doe", "aliases": ["JD"] }' + assert.equal! result, { "name"=>"John Doe", "aliases"=>["JD"] }, "Parsing JSON failed." +end + +def test_parse_xml args, assert + result = args.gtk.parse_xml <<-S +<Person id="100"> + <Name>John Doe</Name> +</Person> +S + + expected = {:type=>:element, + :name=>nil, + :children=>[{:type=>:element, + :name=>"Person", + :children=>[{:type=>:element, + :name=>"Name", + :children=>[{:type=>:content, + :data=>"John Doe"}]}], + :attributes=>{"id"=>"100"}}]} + + assert.equal! result, expected, "Parsing xml failed." +end + +puts "running tests" +$gtk.reset 100 +$gtk.log_level = :off +$gtk.tests.start diff --git a/samples/99_zz_gtk_unit_tests/run-bash.sh b/samples/99_zz_gtk_unit_tests/run-bash.sh new file mode 100644 index 0000000..005077b --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/run-bash.sh @@ -0,0 +1,4 @@ +sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/geometry_tests.rb --no-tick +sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/parsing_tests.rb --no-tick +sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/http_tests.rb --no-tick +sh ./amir-build-and-run.sh --eval samples/99_zz_gtk_unit_tests/array_to_primitive_tests.rb --no-tick diff --git a/samples/99_zz_gtk_unit_tests/serialize_deserialize_tests.rb b/samples/99_zz_gtk_unit_tests/serialize_deserialize_tests.rb new file mode 100644 index 0000000..22fa862 --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/serialize_deserialize_tests.rb @@ -0,0 +1,86 @@ +def test_serialize args, assert + GTK::Entity.__reset_id__! + args.state.player_one = "test" + result = args.gtk.serialize_state args.state + assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" + + GTK::Entity.__reset_id__! + args.gtk.write_file 'state.txt', '' + result = args.gtk.serialize_state 'state.txt', args.state + assert.equal! result, "{:entity_id=>3, :tick_count=>-1, :player_one=>\"test\"}" +end + +def test_deserialize args, assert + GTK::Entity.__reset_id__! + result = args.gtk.deserialize_state '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' + assert.equal! result.player_one, "test" + + GTK::Entity.__reset_id__! + args.gtk.write_file 'state.txt', '{:entity_id=>3, :tick_count=>-1, :player_one=>"test"}' + result = args.gtk.deserialize_state 'state.txt' + assert.equal! result.player_one, "test" +end + +def test_very_large_serialization args, assert + GTK::Entity.__reset_id__! + size = 3000 + size.map_with_index do |i| + args.state.send("k#{i}=".to_sym, i) + end + + result = args.gtk.serialize_state args.state + assert.true! (args.gtk.console.log.join.include? "unlikely a string this large will deserialize correctly") +end + +def test_strict_entity_serialization args, assert + GTK::Entity.__reset_id__! + args.state.player_one = args.state.new_entity(:player, name: "Ryu") + args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken") + + serialized_state = args.gtk.serialize_state args.state + assert.equal! serialized_state, '{:entity_id=>1, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken"}}' + + deserialize_state = args.gtk.deserialize_state serialized_state + + assert.equal! args.state.player_one.name, deserialize_state.player_one.name + assert.true! args.state.player_one.is_a? GTK::OpenEntity + + assert.equal! args.state.player_two.name, deserialize_state.player_two.name + assert.true! args.state.player_two.is_a? GTK::StrictEntity +end + +def test_strict_entity_serialization_with_nil args, assert + GTK::Entity.__reset_id__! + args.state.player_one = args.state.new_entity(:player, name: "Ryu") + args.state.player_two = args.state.new_entity_strict(:player_strict, name: "Ken", blood_type: nil) + + serialized_state = args.gtk.serialize_state args.state + assert.equal! serialized_state, '{:entity_id=>3, :tick_count=>-1, :player_one=>{:entity_id=>1, :entity_name=>:player, :entity_type=>:player, :created_at=>-1, :global_created_at=>-1, :name=>"Ryu"}, :player_two=>{:entity_id=>3, :entity_name=>:player_strict, :created_at=>-1, :global_created_at_elapsed=>-1, :entity_strict=>true, :name=>"Ken", :blood_type=>nil}}' + + deserialized_state = args.gtk.deserialize_state serialized_state + + assert.equal! args.state.player_one.name, deserialized_state.player_one.name + assert.true! args.state.player_one.is_a? GTK::OpenEntity + + assert.equal! args.state.player_two.name, deserialized_state.player_two.name + assert.equal! args.state.player_two.blood_type, deserialized_state.player_two.blood_type + assert.equal! deserialized_state.player_two.blood_type, nil + assert.true! args.state.player_two.is_a? GTK::StrictEntity + + deserialized_state.player_two.blood_type = :O + assert.equal! deserialized_state.player_two.blood_type, :O +end + +def test_multiple_strict_entities args, assert + GTK::Entity.__reset_id__! + args.state.player = args.state.new_entity_strict(:player_one, name: "Ryu") + args.state.enemy = args.state.new_entity_strict(:enemy, name: "Bison", other_property: 'extra mean') + + serialized_state = args.gtk.serialize_state args.state + deserialized_state = args.gtk.deserialize_state serialized_state + + assert.equal! deserialized_state.player.name, "Ryu" + assert.equal! deserialized_state.enemy.other_property, "extra mean" +end + +$tests.start diff --git a/samples/99_zz_gtk_unit_tests/state_serialization_experimental_tests.rb b/samples/99_zz_gtk_unit_tests/state_serialization_experimental_tests.rb new file mode 100644 index 0000000..ffd8064 --- /dev/null +++ b/samples/99_zz_gtk_unit_tests/state_serialization_experimental_tests.rb @@ -0,0 +1,107 @@ +MAX_CODE_GEN_LENGTH = 50 + +# NOTE: This is experimental/advanced stuff. +def needs_partitioning? target + target[:value].to_s.length > MAX_CODE_GEN_LENGTH +end + +def partition target + return [] unless needs_partitioning? target + if target[:value].is_a? GTK::OpenEntity + target[:value] = target[:value].hash + end + + results = [] + idx = 0 + left, right = target[:value].partition do + idx += 1 + idx.even? + end + left, right = Hash[left], Hash[right] + left = { value: left } + right = { value: right} + [left, right] +end + +def add_partition target, path, aggregate, final_result + partitions = partition target + partitions.each do |part| + if needs_partitioning? part + if part[:value].keys.length == 1 + first_key = part[:value].keys[0] + new_part = { value: part[:value][first_key] } + path.push first_key + add_partition new_part, path, aggregate, final_result + path.pop + else + add_partition part, path, aggregate, final_result + end + else + final_result << { value: { __path__: [*path] } } + final_result << { value: part[:value] } + end + end +end + +def state_to_string state + parts_queue = [] + final_queue = [] + add_partition({ value: state.hash }, + [], + parts_queue, + final_queue) + final_queue.reject {|i| i[:value].keys.length == 0}.map do |i| + i[:value].to_s + end.join("\n#==================================================#\n") +end + +def state_from_string string + Kernel.eval("$load_data = {}") + lines = string.split("\n#==================================================#\n") + lines.each do |l| + puts "todo: #{l}" + end + + GTK::OpenEntity.parse_from_hash $load_data +end + +def test_save_and_load args, assert + args.state.item_1.name = "Jane" + string = state_to_string args.state + state = state_from_string string + assert.equal! args.state.item_1.name, state.item_1.name +end + +def test_save_and_load_big args, assert + size = 1000 + size.map_with_index do |i| + args.state.send("k#{i}=".to_sym, i) + end + + string = state_to_string args.state + state = state_from_string string + size.map_with_index do |i| + assert.equal! args.state.send("k#{i}".to_sym), state.send("k#{i}".to_sym) + assert.equal! args.state.send("k#{i}".to_sym), i + assert.equal! state.send("k#{i}".to_sym), i + end +end + +def test_save_and_load_big_nested args, assert + args.state.player_one.friend.nested_hash.k0 = 0 + args.state.player_one.friend.nested_hash.k1 = 1 + args.state.player_one.friend.nested_hash.k2 = 2 + args.state.player_one.friend.nested_hash.k3 = 3 + args.state.player_one.friend.nested_hash.k4 = 4 + args.state.player_one.friend.nested_hash.k5 = 5 + args.state.player_one.friend.nested_hash.k6 = 6 + args.state.player_one.friend.nested_hash.k7 = 7 + args.state.player_one.friend.nested_hash.k8 = 8 + args.state.player_one.friend.nested_hash.k9 = 9 + string = state_to_string args.state + state = state_from_string string +end + +$gtk.reset 100 +$gtk.log_level = :off +$gtk.tests.start |
