Skip to content

Instantly share code, notes, and snippets.

@azrafe7
azrafe7 / Effect.as
Created March 28, 2012 20:42
Initial Effect Class (still working on it)
package punk.transition.effects
{
import flash.utils.getTimer;
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.Tween;
public class Effect extends Entity
{
protected static var _autoStart:Boolean = false;
@azrafe7
azrafe7 / Fade.as
Created April 10, 2012 08:52
Fade effect (extending initial Effect)
package punk.transition.effects
{
import net.flashpunk.FP;
import net.flashpunk.graphics.Image;
/**
* Fade effect class.
*
* @author azrafe7
*/
@azrafe7
azrafe7 / [modded] SoundFX.as
Created July 8, 2012 16:43
azrafe7 - Modified version of SoundFx.as (http://goo.gl/8Uugf) that supports embedded Sound objects
/*
The MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@azrafe7
azrafe7 / readChildOutput.c
Created November 16, 2012 18:28
read from process stdout
// Slightly modified code from http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx
// Ma non capisco perché non mi termina dopo aver stampato l'output
// E comunque popen continua a non funzionarmi (CodeBlocks with MinGW - gcc 4.7.2)
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
//#include <strsafe.h>
@azrafe7
azrafe7 / TitleEntity.as
Last active December 10, 2015 21:28
TitleEntity using bloom and glitch effects from the punk.fx library.
package
{
import net.flashpunk.Entity;
import net.flashpunk.FP;
import punk.fx.effects.BloomFX;
import punk.fx.effects.GlitchFX;
import punk.fx.graphics.FXImage;
/**
* TitleEntity
@azrafe7
azrafe7 / ScreenShot.as
Created January 20, 2013 18:14
Utility class to save BitmapData as PNG.
package
{
import com.adobe.images.PNGEncoder;
import flash.display.BitmapData;
import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
@azrafe7
azrafe7 / ScreenShot.as
Last active December 17, 2015 12:49
Utility class to save BitmapData as PNG. Needs the PNGEncoder class from as3corelib (https://github.com/mikechambers/as3corelib).
package
{
import com.adobe.images.PNGEncoder;
import flash.display.BitmapData;
import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
@azrafe7
azrafe7 / Draw.as
Created July 23, 2013 21:33
FlashPunk's modified Draw class to support dots, arrows, arcs and rotated rects.
package net.flashpunk.utils
{
import flash.display.*;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.Graphic;
import net.flashpunk.graphics.Text;
@azrafe7
azrafe7 / applyAlphaMask.hx
Created January 29, 2014 23:01
Simple applyAlphaMask for haxe/openfl...
/**
* Masks the `source` BitmapData (in place) using alpha data from `alphaMask`.
*
* Note: `source` and `alphaMask` must be of the same size.
*
* @param source BitmapData to be masked.
* @param alphaMask BitmapData to be used as mask.
* @param copyAlpha If true the alpha value of `alphaMask` will be copied over to `source`.
*/
public static function applyAlphaMask(source:BitmapData, alphaMask:BitmapData, copyAlpha:Bool = false):Void
@azrafe7
azrafe7 / TestWorld.as
Created March 29, 2014 20:39
Collision tests for FlashPunk (testing new Circle and Polygon classes too)
// see https://github.com/azrafe7/FlashPunk/commit/475c4c4fb11a3554261ba871f64f16c5ddd53693
package
{
import flash.display.BlendMode;
import flash.geom.Point;
import flash.system.System;
import flash.text.AntiAliasType;
import flash.text.TextField;
import flash.text.TextFormat;