Push Start (very good, mostly retro / pixel art) Amazon
Game Art (40 Interviews, covers about 2000+) Amazon
The Art of Naughty Dog (sublime!) Amazon
// Phaser 3 has the new Loader method, texture: | |
load.texture('factory', { | |
etc1: 'assets/factory_etc1.pkm', | |
s3tc: 'assets/factory_dxt1.pvr', | |
pvrtc: 'assets/factory_pvrtc.pvr', | |
truecolor: 'assets/factory.png' | |
}); | |
// You can also use load.image: |
var PewPew = { | |
// Our global Sprite, shared between States | |
spaceship: null | |
}; | |
PewPew.Preloader = function () {}; | |
PewPew.Preloader.prototype = { |
// audio context | |
var ChiptuneAudioContext = window['AudioContext'] || window['webkitAudioContext']; | |
// config | |
var ChiptuneJsConfig = function (repeatCount, context) | |
{ | |
this.repeatCount = repeatCount; | |
this.context = context; | |
} |
var conf = { | |
width: 800, | |
height: 600, | |
renderer: Phaser.AUTO, | |
parent: 'phaser-example', | |
transparent: false, | |
antialias: false, | |
state: this, | |
scaleMode: Phaser.ScaleManager.EXACT_FIT | |
}; |
/** | |
* Negate sideways velocity on an object being acted upon by a Phaser physics engine. | |
* The primary use for this is to simulate vehicle movement by negating "drift" when the vehicle turns. | |
* @param {Phaser.Sprite} sprite The sprite whose sideways velocity you want to negate | |
*/ | |
function stopSidewaysVelocity(sprite) { | |
// Recycle the same object to conserve memory | |
if(!stopSidewaysVelocity.sideways) { | |
stopSidewaysVelocity.sideways = {}; | |
} |
function shuffleArray(array) { | |
for (var i = array.length - 1; i > 0; i--) { | |
var j = Math.floor(Math.random() * (i + 1)); | |
var temp = array[i]; | |
array[i] = array[j]; | |
array[j] = temp; | |
} | |
return array; |
// The following code, on its own (with nothing else) | |
// generates ~500 KB of gc every ~2.5 seconds in 49.0.2568.0 canary (64-bit / Windows 7) | |
// Update: Appears it's an issue with Dev Tools: https://code.google.com/p/chromium/issues/detail?id=120186 | |
// Using JS Profiler creates lots of garbage in the JS Heap. Wonderful. | |
function update (now) { | |
window.requestAnimationFrame(update); |
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update }); | |
function preload() { | |
game.load.image('ball', 'assets/sprites/shinyball.png'); | |
} | |
var sprite; |
/* | |
Bullet Manager | |
*/ | |
GAME.BulletManager = function () { | |
this.data; | |
this.container; | |
this.bulletSpeed = 500; |