Skip to content

Instantly share code, notes, and snippets.

View BrentFarris's full-sized avatar
✝️
Some Assembly required

Brent Farris BrentFarris

✝️
Some Assembly required
View GitHub Profile
@BrentFarris
BrentFarris / main-2.js
Created December 18, 2016 07:54
HTML5 Game Framework Part 2 Debug displaying rectangle collision
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth;
canvas.height = document.body.clientHeight;
canvas.style.width = canvas.width + "px";
canvas.style.height = canvas.height + "px";
var ctx = canvas.getContext("2d");
// Debug code below
var rect = new Rectangle(15, 15, 50, 50);
@BrentFarris
BrentFarris / index-2.html
Created December 18, 2016 07:22
HTML5 Game Framework Part 2 Updating the index
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML 5 Canvas</html>
<style type="text/css">
* {margin:;padding:0;}
html, body {
background-color: #000;
overflow: hidden;
@BrentFarris
BrentFarris / rectangle-3.js
Last active December 18, 2016 07:29
HTML5 Game Framework Part 2 Rectangle drawing and colliding
Rectangle = function(x, y, w, h) {
if (x == null || y == null || w == null || h == null) {
alert("You must pass in all the veriables for a rectange: (x, y, width, height)");
var errorMsg = "The following are not provided:";
if (x == null) {
errorMsg += " 'x' ";
}
if (y == null) {
errorMsg += " 'y' ";
@BrentFarris
BrentFarris / rectangle-2.js
Last active December 18, 2016 07:29
HTML5 Game Framework Part 2 Rectangle intersection
Rectangle = function(x, y, w, h)
{
if (x == null || y == null || w == null || h == null)
{
alert("You must pass in all the veriables for a rectange: (x, y, width, height)");
var errorMsg = "The following are not provided:";
if (x == null)
errorMsg += " 'x' ";
if (y == null)
@BrentFarris
BrentFarris / rectangle-1.js
Last active December 18, 2016 07:28
HTML5 Game Framework Part 2 Rectangle setup and contains
Rectangle = function(x, y, w, h)
{
if (x == null || y == null || w == null || h == null)
{
alert("You must pass in all the veriables for a rectange: (x, y, width, height)");
var errorMsg = "The following are not provided:";
if (x == null)
errorMsg += " 'x' ";
if (y == null)
@BrentFarris
BrentFarris / main.js
Created December 18, 2016 06:44
HTML5 Game Framework Part 1 Setup the Canvas
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth;
canvas.height = document.body.clientHeight;
canvas.style.width = canvas.width + "px";
canvas.style.height = canvas.height + "px";
var ctx = canvas.getContext("2d");
@BrentFarris
BrentFarris / index.html
Created December 18, 2016 05:51
HTML5 Game Framework Part 1 Setup the Canvas
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML 5 Canvas</html>
<style type="text/css">
* {margin:;padding:0;}
html, body {
background-color: #000;
overflow: hidden;
@BrentFarris
BrentFarris / jsRPGFaceFlip.js
Created March 29, 2016 21:54
RPG Maker MV - Face flip on the X axis for message boxes
//=============================================================================
// jsRPGFaceFlip.js
//=============================================================================
/*:
* @plugindesc Flip faces on the X axis in message boxes
* @author Brent Farris
*
* @help
* This will flip any face within a message box along the X axis.
@BrentFarris
BrentFarris / index.html
Created January 14, 2016 19:31
TemplateMVC
<!DOCTYPE html>
<html>
<head>
<title>PHP Template MVC</title><script src="http://localhost:80/public/Index/js/index.js"></script><style type=""text/css"><!--#demoCSS {
border: 1px solid black;
}
.logo {
max-width: 250px;
@BrentFarris
BrentFarris / SyncAnimDemo.cs
Created October 30, 2015 20:23
Forge Networking Synchronizing Mecanim Animations
using UnityEngine;
using BeardedManStudios.Network
public class SyncAnimDemo : NetworkedMonoBehavior
{
[NetSync]
private bool jump = false;
public Animator animatorRef = null;