Skip to content

Instantly share code, notes, and snippets.

View McFunkypants's full-sized avatar
💭
Making games

Christer Kaitila McFunkypants

💭
Making games
View GitHub Profile
@xem
xem / JSGameFramework2020.html
Last active November 11, 2023 19:53
JS game framework 2020
<body style=margin:0>
<canvas id=a>
<script>
// initialize 2D canvas (c)
// initialize game state (s)
// initialize keys states (u,r,d,l for directions, k for all the keyboard)
c=a.getContext`2d`,k=[u=r=d=l=s=0]
// (initialize your global variables here)
@Draknek
Draknek / zip-app.py
Last active March 27, 2024 15:21
Normally if you zip a .app directory on Windows and unzip it on Mac OS X, it won't run. This tool creates a zip file that should have the correct executable flags set to work correctly.
#!/usr/bin/env python3
import os
import sys
import time
import zipfile
startingdir = os.getcwd()
if (len(sys.argv) == 1):
print("Usage: " + os.path.basename(sys.argv[0]) + " path/to/application.app [path/to/output.zip]")
@xem
xem / readme.md
Last active May 11, 2024 23:57
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@kylemcdonald
kylemcdonald / three.js.shader.html
Last active March 27, 2023 00:45
Minimal three.js shader example.
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0px;
overflow: hidden;
}