Skip to content

Instantly share code, notes, and snippets.

@jpsarda
jpsarda / FDrawingSprite.cs
Last active December 11, 2023 04:17
A class to draw lines with Futile, 2D engine for Unity3D. API inspired from Flash AS3 drawing API. Works with transparent colors. Cap styles : NONE, ROUND, SQUARE, TRIANGLE, ARROW Joint styles : MITER, ROUND, BEVEL Experimental (but working for most usages) support of borders (so far only supported with styles NONE / BEVEL).
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/* Author @jpsarda
* A drawing class.
*
* Examples :
*
@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;
@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
@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 / 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 / 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 / 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;
@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 / 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;
@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
{