Skip to content

Commit

Permalink
Updating code to run on latest Phaser 2.8 CE
Browse files Browse the repository at this point in the history
  • Loading branch information
kestrelm committed Jun 14, 2017
1 parent 3d9ba88 commit c89ad54
Show file tree
Hide file tree
Showing 3 changed files with 105,371 additions and 19 deletions.
10 changes: 5 additions & 5 deletions CreaturePixiJSRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ function CreatureRenderer(manager_in, texture_in)

var target_creature = this.creature_manager.target_creature;

this.verticies = new PIXI.Float32Array(target_creature.total_num_pts * 2);
this.uvs = new PIXI.Float32Array(target_creature.total_num_pts * 2);
this.verticies = new Float32Array(target_creature.total_num_pts * 2);
this.uvs = new Float32Array(target_creature.total_num_pts * 2);

this.indices = new PIXI.Uint16Array(target_creature.global_indices.length);
this.indices = new Uint16Array(target_creature.global_indices.length);
for(var i = 0; i < this.indices.length; i++)
{
this.indices[i] = target_creature.global_indices[i];
}

this.colors = new PIXI.Float32Array(target_creature.total_num_pts * 4);
this.colors = new Float32Array(target_creature.total_num_pts * 4);
for(var i = 0; i < this.colors.length; i++)
{
this.colors[i] = 1.0;
Expand Down Expand Up @@ -220,7 +220,7 @@ CreatureRenderer.prototype.UpdateCreatureBounds = function()
this.worldTransform.apply(this.creatureBoundsMax, this.creatureBoundsMax);
};

CreatureRenderer.prototype.SetAnchorPoint = function(x, y, anim_clip_name_in = 'default') {
CreatureRenderer.prototype.SetAnchorPoint = function(x, y, anim_clip_name_in) {
var target_creature = this.creature_manager.target_creature;
target_creature.ComputeBoundaryMinMax();

Expand Down
22 changes: 8 additions & 14 deletions Phasor-Demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<title>hello phaser!</title>
<script src="phaser.js"></script>
<script src="phaser-2.js"></script>
<script src="gl-matrix.js"></script>
<script src="flatbuffers.js"></script>
<script src="CreatureFlatData_generated.js"></script>
Expand All @@ -30,18 +30,12 @@
var creaturePhasorObject2 = null;

function preload () {

//game.load.image('logo', 'phaser.png');
game.load.text('iceJSON', 'iceAnchorExport_character_data.json');
//game.load.binary('succBin', 'succ_data.bytes', binaryLoadCallback, this);
//game.load.binary('succBin', 'opacityExport_character_data.bytes', binaryLoadCallback, this);

// create a texture from an image path

texture = PIXI.Texture.fromImage("iceDemonExport_character_img.png");
//texture = PIXI.Texture.fromImage("debug3Export_character_img.png");
//texture = PIXI.Texture.fromImage("opacityExport_character_img.png");

// create a texture from an image path
//game.load.image('succTexture', 'debug3Export_character_img.png');
game.load.image('iceDemonTexture', 'iceDemonExport_character_img.png');
}

function binaryLoadCallback(key, data) {
Expand All @@ -57,9 +51,10 @@
}

function create () {
// Grab actual texture for rendering
texture = new PIXI.Texture(game.cache.getBaseTexture('iceDemonTexture'));

initDebugging();
//var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'logo');
//logo.anchor.setTo(0.5, 0.5);

// Core Creature Objects
var actual_data = JSON.parse(game.cache.getText('iceJSON'));
Expand Down Expand Up @@ -103,8 +98,7 @@

console.log('Loaded and created Core Creature Objects.');

// Phasor Creature Object

// Phasor Creature Object
creaturePhasorObject = new Phaser.CreatureDraw(game.world,
game.world.centerX,
game.world.centerY,
Expand Down
Loading

0 comments on commit c89ad54

Please sign in to comment.