Skip to content

Instantly share code, notes, and snippets.

View zachwlewis's full-sized avatar
💭
Shipping!

Zachary Lewis zachwlewis

💭
Shipping!
View GitHub Profile
@zachwlewis
zachwlewis / GetCharacterProfessions.lua
Created March 2, 2013 23:02
Gets a characters profession information and print it out.
function GetProfessionInformation()
local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions()
if prof1 ~= nil then PrintProfessionInformation(prof1) end
if prof2 ~= nil then PrintProfessionInformation(prof2) end
if archaeology ~= nil then PrintProfessionInformation(archaeology) end
if fishing ~= nil then PrintProfessionInformation(fishing) end
if cooking ~= nil then PrintProfessionInformation(cooking) end
if firstAid ~= nil then PrintProfessionInformation(firstAid) end
end
@zachwlewis
zachwlewis / MyAddOnSettings.lua
Created February 20, 2013 07:47
Using Blizzard's Interface Options Addons Panel in World of Warcraft
function MyAddOnSettingsFrame_OnLoad(self)
-- Set the name for the Category for the Panel
self.name = "My AddOn" .. GetAddOnMetadata("MyAddon", "Version")
-- When the player clicks okay, run this function.
self.okay = function (self) print("MyAddOnSettings: Okay clicked") end
-- When the player clicks cancel, run this function.
self.cancel = function (self) print("MyAddOnSettings: Cancel clicked.") end
@zachwlewis
zachwlewis / SimpleTilemapManager.as
Created April 11, 2012 23:34
A simple (untested) class used to manage and reuse a fixed number of Tilemaps in FlashPunk to prevent slowdown caused by multiple Tilemaps and garbage collection.
package net.thegamestudio.SimpleTilemapManager
{
import net.flashpunk.graphics.Tilemap;
/**
* Manages a fixed number of Tilemaps so you can reuse them.
* @author Zachary Weston Lewis (http://zacharylew.is)
*/
public class SimpleTilemapManager
{
@zachwlewis
zachwlewis / SpriteFlipWorld.as
Created April 9, 2012 19:50
Sprite Switching Example
package
{
import flash.display.*;
import net.flashpunk.*;
import net.flashpunk.graphics.*;
import net.flashpunk.utils.*;
/**
* A sample world to demonstrate swapping a sprite from the World on player input.
* @author Zachary Weston Lewis (http://zacharylew.is)
@zachwlewis
zachwlewis / EmitterWorld.as
Created April 4, 2012 16:24
Emitter Tutorial Game
package
{
import flash.display.BitmapData;
import flash.geom.Rectangle;
import net.flashpunk.FP;
import net.flashpunk.graphics.Emitter;
import net.flashpunk.graphics.Graphiclist;
import net.flashpunk.graphics.Image;
import net.flashpunk.graphics.Text;
import net.flashpunk.utils.Input;
@zachwlewis
zachwlewis / Main.as
Created February 8, 2012 19:17
An attempt to create a reusable, design-based Flash UI boilerplate.
/**
* @author Zachary Weston Lewis
*/
class Main extends MovieClip
{
public function Main(target:Object)
{
target.__proto__ = this.__proto__;
target.__constructor__ = PlayerHUD;
@zachwlewis
zachwlewis / ButtonWorld.as
Created December 31, 2011 09:45
A FlashPunk World that shows how to make a simple button as well as Text manipulation and some fun tricks.
package
{
import flash.display.*;
import flash.geom.*;
import net.flashpunk.*;
import net.flashpunk.graphics.*;
import net.flashpunk.utils.*;
/**
@zachwlewis
zachwlewis / GameWorld.as
Created December 8, 2010 21:54
Splitscreen Game World Rendering
package
{
import flash.display.BitmapData;
import flash.events.FocusEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.graphics.Backdrop;
import net.flashpunk.graphics.Image;
package
{
import flash.geom.Rectangle;
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.graphics.Image;
/**
* Describes an enemy.
* @author Zachary Weston Lewis
//=============================================================================
// [GLOBALS]
//=============================================================================
float4x4 World;
float4x4 Projection;
int ShaderIndex = 0;
float3 DiffuseColor;
struct VertexPositionColor