Skip to content

Instantly share code, notes, and snippets.

View Kattoor's full-sized avatar

Jasper Catthoor Kattoor

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This is a quick tutorial following a post about transport belts I made earlier this week.

Disclaimer: I'm fairly new with working with GameMaker so I might not be following the best practices, sorry for that! Some parts of this might be refactored, but I wrote them this way for the (in my opinion) best readability for this tutorial. Also, English is not my native language.

The way we'll be implementing the transport belts is like a linked list data structure.

In computer science, a linked list is a linear collection of data elements, whose order is not given by their physical placement in memory. Instead, each element points to the next. --- Wikipedia

In other words: each belt object points to the next belt object in line.

@Kattoor
Kattoor / terrainGeneration.html
Created November 16, 2017 10:54
Terrain Generation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dag Randy</title>
<style>
body {
margin: 0;
overflow: hidden;
}
var container = {
application: {
id: "awesome-app",
state: {
id: "running"
},
solution: {
id: "awesome-solution",
application: [
{
const position = { x: 0, y: 0 }
// left up right down
const Dir = [ [0, 3, 1, {x: -1, y: 0}], [1, 0, 2, {x: 0, y: 1}], [2, 1, 3, {x: 1, y: 0}], [3, 2, 0, {x: 0, y: -1}]]
const positionHistory = []
let currentDirectionIndex = 1
function move(input) {
const position = { x: 0, y: 0 }
// left up right down
const Dir = [ [0, 3, 1, {x: -1, y: 0}], [1, 0, 2, {x: 0, y: 1}], [2, 1, 3, {x: 1, y: 0}], [3, 2, 0, {x: 0, y: -1}]]
let currentDirectionIndex = 1
function move(input) {
const dir = input[0]
const steps = input.substr(1)
var startXp = getTotalXp();
var startTime = Date.now();
var hourlyXpArray = [];
var xpPerMinute;
function getTarget() {
let entityValues = Object.values(parent.entities);
//let greenWorms = entityValues.filter(entity => entity.mtype === 'armadillo');
//let redWorms = entityValues.filter(entity => entity.mtype === 'squigtoad');
function getTarget() {
let entityValues = Object.values(parent.entities);
let greenWorms = entityValues.filter(entity => entity.mtype === 'worm');
let redWorms = entityValues.filter(entity => entity.mtype === 'osnake');
let target;
if (redWorms.length > 0)
target = findClosest(redWorms);
"use strict";
var fs = require('fs');
var http = require('http');
var container = {};
var server = http.createServer(handleRequest);
function handleRequest(request, response) {
"use strict";
function overload(f1, f2) {
if (f1.length === f2.length)
throw new TypeError;
else
return function(...args) {
let params = Array.prototype.splice.call(arguments, 0);
if (params.length === f1.length)