Skip to content

Instantly share code, notes, and snippets.

View grifdail's full-sized avatar

Julien Berthou grifdail

View GitHub Profile
@grifdail
grifdail / game.json
Last active November 13, 2022 18:49
{
"meta": {
"name": "Flower-Demo",
"creator": "@grifdail",
"creatorUrl": "https://twitter.com/grifdail/"
},
"objects": [
{
"key": "475b3914-485b-4dc9-867a-7ddede9e7378",
"name": "object",
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
public class ClickEffect : MonoBehaviour, IPointerClickHandler
{
public float RotationMax = 10;
public float DropMax = 10;
public float Duration = 0.2f;
function setup() {
createCanvas(16000, 16000);
noLoop();
}
function draw() {
background(220);
drawSquare([0,0,0,0,0,0,0,0,0],0,0,width,height, 0);
}
@grifdail
grifdail / VectorSwizzle.cs
Created August 21, 2018 19:31
Vector swizzle in unity
using UnityEngine;
static class Vector2Swizzles {
// swizzle of size 2
public static Vector2 Swizzle_xx(this Vector2 a) { return new Vector2(a.x, a.x); }
public static Vector2 Swizzle_xy(this Vector2 a) { return new Vector2(a.x, a.y); }
public static Vector2 Swizzle_x0(this Vector2 a) { return new Vector2(a.x, 0); }
public static Vector2 Swizzle_x1(this Vector2 a) { return new Vector2(a.x, 1); }
public static Vector2 Swizzle_yx(this Vector2 a) { return new Vector2(a.y, a.x); }
@grifdail
grifdail / TwitterWithLessCrap.css
Created May 1, 2018 20:23
Remove everything but the tweet field from twitter.
.topbar {
display: none;
}
.dashboard {
display: none;
}
.stream-container {
display: none;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
public float speed = 10;
public float frequency = 1;
public FootTarget leftFoot;
public FootTarget rightFoot;
@grifdail
grifdail / color.pde
Created February 20, 2018 07:12
the template i used with processing
color black = #000000;
color darkBlue = #1D2B53;
color darkPurple = #7E2553;
color darkGreen = #008751;
color brown = #AB5236;
color darkGray = #5F574F;
color lightGray = #C2C3C7;
color white = #FFF1E8;
color red = #FF004D;
color orange = #FFA300;
// Try on
// http://meshplayground.space/
var palette = randomPalette();
setBackgroundColor(palette[0])
scale(15)
for(var x = 0; x<10; x++) {
for(var y= 0; y<10; y++) {
push();
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class ExemplePromise : MonoBehaviour {
public int Pokemon1 = 1;
public int Pokemon2 = 2;
@grifdail
grifdail / AsyncError.cs
Last active December 11, 2017 11:04
Unity Deferred
public class AsyncError {
public string Message { get; private set; }
public AsyncError(string _message) {
Message = _message;
}
}