Skip to content

Instantly share code, notes, and snippets.

View grifdail's full-sized avatar

Julien Berthou grifdail

View GitHub Profile
@celechii
celechii / PronounSystem.cs
Last active January 18, 2024 06:22
Pronoun System to be used for keeping track of character's pronouns and determining when and how to use them :)
/*
MIT License
Copyright (c) 2021 Noé Charron
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
@wilbefast
wilbefast / babysitter.js
Last active December 13, 2015 19:20
Coroutines in Javascript
var babysitter = {
coroutines : []
}
babysitter.add = function(c)
{
// add a new coroutine to be "babysat"
babysitter.coroutines.push(c());
}
@grifdail
grifdail / Input.js
Last active January 17, 2021 04:02
The best javascript input controller for game. Include gamepad support.
/*
Input.jump = {
key: 32//Space
gamepad: 0// A button on as XBOX360 gamepad
}
dont forget to call
Input.update();
at the end of each frame.
@cheery
cheery / exponentials.js
Created October 5, 2014 15:07
Exponential chirps
function dsp(t, f) {
var o = env(0.25, Math.PI*2*200*Math.sin(Math.PI*2*t*0.7), -5, 25, t);
return o*0.2;
}
function env(measure, x, y, z, t){
var ts = t / 2 % measure;
return Math.sin(x * (Math.exp(-ts * y))) * Math.exp(-ts * z);
}
@grifdail
grifdail / realtime.js
Last active August 29, 2015 13:58
Everything you need to make realtime connection between peer (perfect for simple multiplayer game with no cheat protection) with socket.io and express in 53 line (plus a chat in the console & a bunny)
realtime