Skip to content

Instantly share code, notes, and snippets.

View OutlawGameTools's full-sized avatar

J. A. Whye OutlawGameTools

View GitHub Profile
--
-- Project: What the Shell?!
-- Description:
--
-- Version: 1.0
--
-- Copyright 2016 Three Ring Ranch. All Rights Reserved.
--
-- most commonly used screen coordinates
<?php
ob_start();
include 'act_dbconnect.php';
//
// Sonic Sneak - Server Edition
// Another Mohawk Man Creation
@OutlawGameTools
OutlawGameTools / GetWorldPosition.cs
Created July 2, 2016 21:22
GetWorldPosition -- pass in col # and row # and get back a position for that cell.
Vector2 GetWorldPosition(int col, int row)
{
return new Vector2 (transform.position.x - numCols/2.0f + col, transform.position.y + numRows/2.0f - row);
}
@OutlawGameTools
OutlawGameTools / Pickup.cs
Last active February 15, 2019 22:41
CS109 C# - Attach to a coin or other pickup item. Destroys the item and optionally shows a particle effect.
using UnityEngine;
using System.Collections;
public class Pickup : MonoBehaviour {
public GameObject pickupEffect; // optional prefab particle effect
void OnTriggerEnter2D (Collider2D other)
{
if (other.CompareTag("Player"))
@OutlawGameTools
OutlawGameTools / Animal.js
Created March 16, 2016 10:41
CS109 For the animal matching mini-game.
#pragma strict
import UnityEngine.UI;
private var origPos : Vector2;
public var animalName : String;
public var touchingWord : GameObject;
function Start ()
{
@OutlawGameTools
OutlawGameTools / walkableMapFromTMX.lua
Created January 12, 2016 04:31
Corona SDK. Make walkable map for Jumper from a Tiled map exported as Lua.
local map
local level01 = require("wasilla") -- the Tiled map exported as wasilla.lua
--=======================================================================================
-- pass in the table that holds the level info from: local level01 = require("level01")
-- get back a table that can be used as a map for Pathfinder
--=======================================================================================
local function walkableMapFromTMX(lvl)
local t = {}
local idx = 1
for h = 1, lvl.layers[1].height do
@OutlawGameTools
OutlawGameTools / StringExplode.lua
Created January 4, 2016 12:00
Corona SDK. Use like split -- pass in divider character and a string and get back a table/array holding each piece between the dividers.
-- works like PHP explode() function
function explode(div,str) -- credit: http://richard.warburton.it
if (div=='') then return false end
local pos,arr = 0,{}
-- for each divider found
for st,sp in function() return string.find(str,div,pos,true) end do
table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider
pos = sp + 1 -- Jump past current divider
end
table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider
@OutlawGameTools
OutlawGameTools / ScreenCoords.lua
Created January 4, 2016 11:56
Corona SDK. Local vars that hold the most commonly used screen coordinates.
-- most commonly used screen coordinates
local centerX = display.contentCenterX
local centerY = display.contentCenterY
local screenLeft = display.screenOriginX
local screenWidth = display.viewableContentWidth - screenLeft * 2
local screenRight = screenLeft + screenWidth
local screenTop = display.screenOriginY
local screenHeight = display.viewableContentHeight - screenTop * 2
local screenBottom = screenTop + screenHeight
local screenTopSB = screenTop + display.topStatusBarContentHeight -- when status bar is showing
@OutlawGameTools
OutlawGameTools / Animal.cs
Created November 21, 2015 02:48
Attached to an animal prefab. For the "Many Game Objects from One Prefab and an Array of Sprites" tutorial.
using UnityEngine;
using System.Collections;
public class Animal : MonoBehaviour {
private Vector2 origPos;
public string animalName;
public bool returnToOrigin = false;
void Start () {
using UnityEngine;
using System.Collections;
public class SpawnAnimal : MonoBehaviour {
public GameObject animalPrefab;
public Sprite[] animalSprites;
public void MakeRandomAnimal()
{