GregP

Members
  • Content count

    10
  • Joined

  • Last visited

  • Days Won

    2

GregP last won the day on November 24 2013

GregP had the most liked content!

About GregP

  • Rank
    Member

Contact Methods

  • Website URL
    http://pixelchinchilla.com
  • Twitter
    GregPabian

Profile Information

  • Gender
    Male
  • Location
    Warsaw, Poland
  1. RT @steipete: That’s a whole new level of planned obsolescence. https://t.co/BMnITeaSxC

  2. @C9Support It is, thanks a lot!

  3. [js13k] Captain Reverso

    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: http://js13kgames.com/entries/captain-reverso 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. BitmapText fixedToCamera

    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. Ludei Cocoonjs XML / bitmap font workaround?

    Hi Rex, here's my sample JSON: http://gpabian.pl/blocks/fonts/Komika.json Cheers
  6. Frames Per Second

    game.time.fps
  7. Ludei Cocoonjs XML / bitmap font workaround?

    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 http://gpabian.pl/blocks/ (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.
  8. Glad to hear that. Besides, “one who makes no mistakes makes nothing”... Cheers
  9. 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?
  10. 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) { game.world._container.scale.x = ratio.x; game.world._container.scale.y = ratio.y; game.world._container.updateTransform(); } 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: https://dl.dropboxusercontent.com/u/30342997/Screenshot_2013-11-22-23-10-20.png To this: https://dl.dropboxusercontent.com/u/30342997/Screenshot_2013-11-22-23-08-55.png I also tested touch events and these work as expected Complete sample app can be downloaded here: https://dl.dropboxusercontent.com/u/30342997/scale_test.zip 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'
  11. 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 ^^
  12. Welcome!

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