Skip to content

Instantly share code, notes, and snippets.

/* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
*/
// Inspired by base2 and Prototype
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
this.Class = function(){};

Notes on using PIXI Renderer

Assets

  • PIXI loads various image & json data only. Image data for both sprites and fonts. JSON data utilized with Texture packer for texture atlas.
  • Due to the way PIXI Sprite work, I think it would be wise to hook into the PIXI Textures similar to how phaser does it: https://github.com/photonstorm/phaser/blob/master/src/loader/Cache.js#L303. It will take some experimenting to see how to hook it properly into the loader callback. This also goes for things like tileset images, TPS, etc.

The container

We can potentially keep the container as we have it, but I'm not sure if that would really be ideal, giving the fact PIXI uses its own. This would handle various optimizations for us. But to keep entity pooling the same, we'll need to write a wrapper for it. addChild and removeChild luckily exist. For an index t

(function() {
if(!Math.imul) {
Math.imul = function(x, y) { return x * y; };
}
var MB = 1024 * 1024;
var SIZE = 256 * MB;
var STACK_SIZE = 2 * MB;
var HEAP_SIZE = SIZE - STACK_SIZE;

Talk ideas - HTML5 games

Benefits of HTML5 for games

Distrubition much easier over compiling for different operating systems. Being familiar with Javascript makes it an easy enough transition. Get to be one of the cool kids.

Downsides

Can be harder to monetize. Users are quite used to playing games in their browser for free. Mobile market however is not much different.

DialogueCompleteEvent nde = new DialogueCompleteEvent() {
@Override
public void complete() {
Layer layer = getLayerByIndex(0);
layer.nextDialogue();
}
};
game.PlayerEntity = me.ObjectEntity.extend({
init: function(x,y,settings){
this.parent(x,y,settings);
this.setVelocity(4,15);
this.updateColRect(8,48,-1,0);
me.game.viewport.follow(this.pos, me.game.viewport.AXIS.HORIZONTAL);
},
update: function(){
if(me.input.isKeyPressed("left")){
this.flipX(true);
/*
* Copyright (c) 2014, Jay Oster
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
game.PlayScreen = me.ScreenObject.extend({
/**
* action to perform on state change
*/
onResetEvent: function() {
var renderable = me.Renderable.extend({
init: function() {
this.parent(new me.Vector2d(0, 0), me.game.viewport.width, me.game.viewport.height / 2);
this.filled = false;
var _this = this;
@agmcleod
agmcleod / gist:10928358
Created April 16, 2014 20:14
Check for value in string array that has highest count, or collect what the highest ties with
var answers = [
"A",
"B",
"C",
"C"
];
answers.sort();
var types = {};
for(var i = 0; i < answers.length; i++) {
class ApplicationController < ActionController::Base
protect_from_forgery
force_ssl
helper_method :current_shop, :shopify_session
protected
def current_shop
@current_shop ||= Shop.find(session[:shop_id]) if session[:shop_id].present?
end