Skip to content

Instantly share code, notes, and snippets.

@jpsarda
jpsarda / MiniJSON.cs
Last active July 10, 2020 00:46 — forked from darktable/MiniJSON.cs
Added comments support, everything after a "#" is ignored, except if the "#" is in a token. It seems to work approximately the way monodevelop show the comments in orange color in a json file. (I know comments are not part of the json format, but it comes in handy sometimes).
/*
* Copyright (c) 2012 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
@jpsarda
jpsarda / FSpeechBubble.cs
Created September 28, 2013 23:59
FSpeechBubble for Futile. Uses latest version of GoKit (which renamed almost all classes this way : Tween > GoTween) Demo http://bonuslevel.org/experiments/futiletests/futiletests.html You need to include the following classes too : Drawing polygons https://gist.github.com/wtrebella/5444072 Drawing lines https://gist.github.com/jpsarda/4573831 D…
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Text;
using System.Reflection;
public class FSpeechBubble : FContainer
{
@jpsarda
jpsarda / FSplitSprite.cs
Created September 27, 2013 21:58
FSplitSprite, can be used for progress/life bars.
using UnityEngine;
using System;
/*
A sprite split in 2 parts, bottom, and top, each with its own color and alpha values.
*/
public class FSplitSprite : FSprite
{
protected Color _bottomColor=Futile.white;
@MattRix
MattRix / HealthBar.cs
Created September 26, 2013 15:52
HealthBar from Snow Siege
using System;
using UnityEngine;
public class HealthBar : FContainer
{
private const float INSET = 1.0f;
private const float DOUBLE_INSET = INSET*2.0f;
private static Color BAD_COLOR = Color.red;
private static Color OKAY_COLOR = Color.yellow;
@jpsarda
jpsarda / ShakeUtil.cs
Last active December 23, 2015 06:29
A shake action for Futile 2G Game engine for Unity3D.
/*
Usage :
ShakeUtil.Go(myFNode,myDurationInSeconds,myAmplitudeInPixels);
*/
public class ShakeUtil {
static Dictionary<FNode, ShakeUtil> _pendings = new Dictionary<FNode, ShakeUtil>();
public Vector2 oPosition;
@jpsarda
jpsarda / FSubSprite.cs
Last active December 21, 2015 09:59
Displays a sub area of a sprite in Futile (Unity3D) 2D game engine. Supports trimmed atlas element.
using UnityEngine;
using System;
/*
Displays a sub area of a sprite. Supports trimmed atlas elements.
Examples :
// left half
@jpsarda
jpsarda / FPseudoHtmlText.cs
Last active December 21, 2015 09:39
Renders pseudo html code with Futile (Unity2D) 2D game engine. Can render texts but also FSprites and FButtons. Example in the first comments.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Text;
using System.Reflection;
@jpsarda
jpsarda / FBicolorSprite.cs
Created July 30, 2013 21:05
FBicolorSprite is a FSprite class for Futile (Unity 2D engine) that manages 2 colors/alpha instead of one. Bottom color and top color.
using UnityEngine;
using System;
/*
FBicolorSprite is a FSprite with 2 colors (bottom and top).
Usage :
FBicolorSprite bicolorSprite=new FBicolorSprite("Futile_White");
@jpsarda
jpsarda / FShadowSprite.cs
Created July 29, 2013 15:50
FShadowSprite, a class for Futile (Unity 2D engine). A FSprite showing a shadow.
using UnityEngine;
using System;
/*
FShadowSprite is a FSprite with a shadow.
TODO :
setters for _shadowOffsetX, _shadowOffsetY, _shadowColor and _shadowAlphaRatio
@wtrebella
wtrebella / WTDrawingPolygonsScene.cs
Last active December 16, 2015 13:48
This is a collection of classes that will allow you to simply make an array of vertices and have them drawn on screen as a polygon (with a solid color). You will also be able to collide a circle with that polygon, or just get the vertex points based on its rotation, scale, and position.
using UnityEngine;
using System.Collections;
// This is just an example of how to use the polygon sprite
public class WTDrawingPolygonsScene : MonoBehaviour {
void Start () {
FutileParams fp = new FutileParams(true, true, false, false);
fp.AddResolutionLevel(480f, 1.0f, 1.0f, "-res1");
fp.backgroundColor = Color.black;
fp.origin = Vector2.zero;