Skip to content

Instantly share code, notes, and snippets.

@jpsarda
jpsarda / FMotionStreakSprite.cs
Created January 17, 2013 23:27
Motion Streak C# classes for Futile (tested with development branch, not with 0.67 Alpha) 2D game engine for Unity3D. FMotionStreakSprite for simple band FMotionStreakWithBandSprite for band with borders
/* Author @jpsarda
* A motion streak class.
*
* Examples :
*
* // A band with constant width and color
motionStreak = new FMotionStreakSprite("sprite.png", // texture name
20, //Number of following quads
x => 10.0f, // width of the band function, x represents the offset in the band and 0<= x <=1
x => new Color(1,1,1,1) //color of the band function, x represents the offset in the band and 0<= x <=1
@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 :
*
@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 / 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 / FScrollContainer.cs
Last active July 23, 2017 16:36
FScrollContainer for Unity3D Futile 2D game engine. To test it you need to change a few things in the Futile code : * _theSingleTouchable must be protected and not private * Update() must be declared virtual.
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/*
A serie of 4 classes extending Futile classes in order to manage scrollable containers with scrollable buttons.
@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;
@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;