Skip to content

Instantly share code, notes, and snippets.

View pctroll's full-sized avatar

Jorge Palacios pctroll

View GitHub Profile
TimerHandler = function (timerHandlerData, context, timerSound) {
this.timerSound = timerSound;
this.data = timerHandlerData;
//Reference to the guide sprite on the scene
if (timerHandlerData.timerAtlas == "")
this.timerHolderSprite = context.add.sprite(timerHandlerData.timerX,timerHandlerData.timerY,timerHandlerData.timerHolderSpriteName);
else
this.timerHolderSprite = context.add.sprite(timerHandlerData.timerX, timerHandlerData.timerY, timerHandlerData.timerAtlas, timerHandlerData.timerHolderSpriteName);
using System;
using System.Collections.Generic;
/// <summary>
/// Originally found on GPWiki and uploaded to GitHub by Jorge Palacios so,
/// readers of the Unity 5.X AI Programming Cookbook could make use of it
/// </summary>
namespace GPWiki
{
/// <summary>
/// A binary heap, useful for sorting data and priority queues.
@pctroll
pctroll / gist:807fc644b3e4f05e2244
Last active August 29, 2015 14:21
How to use Phaser.Group.forEach
create: function () {
var offsetX = 120; // offset from the screen border
var offsetY = 30;
var margin = 10; // margin between enemies
var rows = 4;
var cols = 6;
// loop for using the offset and margin variables
this.enemies = game.add.group();
for (i = 0; i < rows; i++) {
@pctroll
pctroll / RayCastExample.cs
Last active August 29, 2015 14:02
Example Raycast with mouse click
using UnityEngine;
using System.Collections;
public class AiMscCrosshair : MonoBehaviour {
// Use this for initialization
void Start () {
}