• Content Count

  • Joined

  • Last visited

  • Days Won


GregP last won the day on November 24 2013

GregP had the most liked content!

About GregP

  • Rank

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
  • Location
    Warsaw, Poland

Recent Profile Visitors

1223 profile views
  1. RT @steipete: That’s a whole new level of planned obsolescence.

  2. @C9Support It is, thanks a lot!

  3. Heya all! It's been a while since my last post here, but here it goes... Let me present you my entry for this year's js13kGames competition - Captain Reverso: The missing truckers Link to the entry: Plot You're a truck driver named Bob, who wakes up one day with a huge hangover, realizing that for some mysterious reason all other truckers disappeared... That's how Captain Reverso is born! This year's competition theme was Reversed and flawless reversing is Captain Reverso's super power! Your quest is to park all the trailers on time and safe the world from complete chaos. Controls wasd / arrows - drive / menu navigationspace / enter - attach/detach trailer / menu clickescape - pause gameNotes Use Chrome or Safari for the best user experience. The game also runs Firefox (crap performance) and IE11 (no sound). Screenshots The final build size is 13.311 bytes. The game itself is quite difficult at the beginning so take your time in the tutorial level to practice. I'm planning to write a longer post-mortem after the results so stay tuned! Hope you enjoy that
  4. Hi guys, I'm wondering if any of you ever tried to place a bitmapText in fixed-to-camera position? I checked the source code and unfortunately there's no such flag for bitmapText... (Phaser 1.1.6) So I tried to position it manually (via .x and .y) every inside update() loop, but the text is 'vibraiting' every time the camera is moving... Do you have any idea how this can be sorted out without modifying original Phaser source code? Best, Greg
  5. Hi Rex, here's my sample JSON: Cheers
  6. Hi guys, I was playing with this topic last weekend and came out with small hack. Basically, the idea is to recognize the environment using navigator.isCocoonJS and depending on that: - override window.DOMParser with own parser implementation - load bitmap font data from JSON instead of XML Ladies and gents, let me introduce to you.. DOMishParser if (navigator.isCocoonJS) { window.DOMParser = DOMishParser;}function DOMishParser() {}DOMishParser.prototype.parseFromString = function (data) { return new DOMishObject(JSON.parse(data));};function DOMishAttributes() {}DOMishAttributes.prototype.getNamedItem = function (name) { return { nodeValue: this[name] || null };};function makeDOMishObject(data) { return new DOMishObject(data);}function DOMishObject(data) { this.attributes = this.convertContent(data); this.length = Object.keys(this.attributes).length;}DOMishObject.prototype.documentElement = document;DOMishObject.prototype.convertContent = function (obj) { var attributes = new DOMishAttributes(), prop; for (prop in obj) { if (obj[prop] !== null && typeof obj[prop] === 'object') { attributes[prop] = Array.isArray(obj[prop]) ? obj[prop].map(makeDOMishObject) : new DOMishObject(obj[prop]); } else { attributes[prop] = obj[prop]; } } return attributes;};DOMishObject.prototype.getElementsByTagName = function(name) { return this.attributes[name] ? Array.isArray(this.attributes[name]) ? this.attributes[name] : [this.attributes[name]] : [];};Looks a bit ugly but does the trick - you can check it on my simple blocks game (still under development). On browsers it loads bitmap font data from XML, on Cocoon uses JSON... Forgot to mention - the JSON file was made of BMFont's XML output using xml2js library and node.js.
  7. Glad to hear that. Besides, “one who makes no mistakes makes nothing”... Cheers
  8. Huh, that's weird. I just reuploaded the .zip package to my Dropbox account and tested in on my old Nexus 7 and Samsung Galaxy Ace 3 and it worked on both like a charm... Any logs on the debug console?
  9. Hi Guys, Just wanted to share with you the result of my recent struggling with Phaser and CocoonJS - I finally managed to scale my game properly while running in WebGL mode! I spent some time digging in Phaser and Pixi.js source codes, also this thread was really helpful. And here's the code: (function () { 'use strict'; var width = navigator.isCocoonJS ? window.innerWidth : 320, height = navigator.isCocoonJS ? window.innerHeight : 480, game, nanoha; game = new Phaser.Game(width, height, Phaser.WEBGL, '', { preload: preload, create: create, update: update }); function preload() { game.load.image('bg', 'assets/bg.png'); game.load.image('nanoha', 'assets/nanoha.png'); } function getRatio(type, w, h) { var scaleX = width / w, scaleY = height / h, result = { x: 1, y: 1 }; switch (type) { case 'all': result.x = scaleX > scaleY ? scaleY : scaleX; result.y = scaleX > scaleY ? scaleY : scaleX; break; case 'fit': result.x = scaleX > scaleY ? scaleX : scaleY; result.y = scaleX > scaleY ? scaleX : scaleY; break; case 'fill': result.x = scaleX; result.y = scaleY; break; } return result; } function create() { var ratio = getRatio('all', 320, 480); if (navigator.isCocoonJS) { = ratio.x; = ratio.y;; } else { game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL; game.stage.scale.minWidth = 320; game.stage.scale.minHeight = 480; game.stage.scale.pageAlignHorizontally = true; game.stage.scale.setScreenSize(true); } game.add.sprite(0, 0, 'bg'); nanoha = game.add.sprite(160, 240, 'nanoha'); nanoha.anchor.x = 0.5; nanoha.anchor.y = 0.5; } function update() { nanoha.angle -= 2; }})();All the magic happens at the top of the create function - scaling world._container does the trick - the scale factor is applied to all it's children. As a result I came from this: To this: I also tested touch events and these work as expected Complete sample app can be downloaded here: Please let me know what you think about such approach, maybe there's a better way around? By the way, it would be soooo great to have Phaser supporting CocoonJS by default with no additional hacks... just tellin'
  10. GregP

    cocoonjs launcher

    Hi sergil, I was playing with similar problem recently. The reason your code wasn't launching properly before is the way how Phaser's Game class is implemented. You were creating new Game on window's load event, in this case Phaser is checking for document.readyState value and expects it to equal 'complete' or 'interactive'. And since these states aren't available in CocoonJS, it registers another load/DOMContentLoaded event callbacks. (lines 236 - 244 inside src/core/Game.js) The way I solved this issue was overriding readyState value inside my onload handler. Hope it helps ^^
  11. GregP


    Hi All! Nice to see soooo many people interested in developing games in HTML5! Cheers!