ZRT

Members
  • Content Count

    56
  • Joined

  • Last visited

About ZRT

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. I got this working with an older version of Tiled (0.14.2) on Linux. Here's the working code. var game = new Phaser.Game(800, 640, Phaser.AUTO, 'phaser', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.tilemap('tilemap', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tiles', 'assets/atlas.png'); } function create() { game.stage.backgroundColor = '#666'; map = game.add.tilemap('tilemap'); map.addTilesetImage('atlas', 'tiles'); layer = map.createLayer('layer'); layer.resizeWorld(); } function update() { } function render() { }
  2. Hey guys. I've been trying to get Phaser 2.9.3 with the latest TileMap (v1.1.1). It fails on a simple tileset preload. I haven't touched Phaser since early version, not sure if what I do here is right anyway. I looked around the forum for similar problems, but nothing solved it so far. Any help is appreciated. Thanks in advance. So, the error first: And here's the very simple code: var game = new Phaser.Game(1600, 800, Phaser.AUTO, 'phaser', { preload: preload, create: create, update: update, render: render }); function preload() { this.game.load.tilemap('tilemap', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON); this.game.load.image('tiles', 'assets/space.png'); console.log('preloads'); } function create() { game.stage.backgroundColor = '#666'; map = game.add.tilemap('tilemap'); map.addTilesetImage('tile', 'tiles'); layer = map.createLayer('layer'); layer.resizeWorld(); } function update() { } function render() { } And the .json file I think it's the culprit. { "height":20, "infinite":false, "layers":[ { "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19], "height":48, "name":"layer", "opacity":1, "type":"tilelayer", "visible":true, "width":48, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tiledversion":"1.1.1", "tileheight":48, "tilesets":[ { "columns":8, "firstgid":1, "image":"space.png", "imageheight":1530, "imagewidth":384, "margin":0, "name":"tile", "spacing":0, "tilecount":248, "tileheight":48, "tilewidth":48, "source:": "space.png" }], "tilewidth":48, "type":"map", "version":1, "width":30 }
  3. Yes, it works! I should've checked my other project before posting. The adding of the states is always below. Thanks. <script src="js/phaser.min-2.0.js"></script> <script src="js/load.js"></script> <script src="js/play.js"></script> <script src="js/config.js"></script>
  4. Hey guys, First of all, thanks to all of those who made 2.0 happen. Keep up the good work! Now.. I'm trying to make states work but it seems that I'm missing something. I'm getting this error: Phaser.StateManager - No state found with the key: Boot I have some code sample here, might be a little ugly, I usually put every state in a different .js file Game = {};var width = 600;var height = 480;var game = new Phaser.Game(width, height, Phaser.AUTO,'');game.state.add('Boot', Game.Boot);game.state.add('Load', Game.Load);game.state.add('Play', Game.Play);game.state.add('Over', Game.Over);game.state.start('Boot');Game.Boot = function(game) {};Game.Boot.prototype = { preload: function() { label = game.add.text(width / 2 , height / 2, 'Loading...', { font: '20px Lucida Console', fill: '#FFFFFF' }); label.anchor.setTo(0.5, 0.5); game.load.image('player', 'assets/pl.png'); }, create: function() { game.state.start('Load'); }};Game.Load = function(game) {};Game.Load.prototype = { preload: function() { label = game.add.text(width / 2, height / 2, 'Click', { font: '20px Lucida Console', fill: '#FFF' }); label.anchor.setTo(0.5, 0.5); }, update: function() { if (game.input.activePointer.isDown) game.state.start('Play'); } };Game.Play = function(game) {};// Game.Play.prototype = {// };Thanks!
  5. ZRT

    Phaser 2.0.0 Released!

    Excellent! Keep up the amazing work!
  6. One of the best Phaser games I've seen. Awesome!
  7. ZRT

    [Phaser] Obstak

    Thanks! Yep, the FlappyJam rules said "make an impossible" game. So I said, why not.
  8. Obstak, Flappy Bird variation I made for FlappyJam. http://www.html5gamedevs.com/topic/3990-phaser-obstak/
  9. Awesome! Thanks! There are some nice, useful practices in your tutorial. I think we need a subforum here for Phaser tutorials. It's just a suggestion, it's nice to have all tutorials in one place.
  10. ZRT

    [Phaser] Obstak

    If I manage to port it properly with PhoneGap, both I guess, but Google Play is primary because I have access to multiple Android devices to be tested on. I think they don't approve games with 'flappy' in the name, not the genre.
  11. ZRT

    [Phaser] Obstak

    Here's the code for anyone interested: https://github.com/werk42/obstak I will improve and refactor, I know some things are mess.
  12. My entry for FlappyJam, made with Phaser. Here it is: http://obstaq.itch.io/obstak I will upload the code on GitHub today. Also, I know it has small bugs and no sound, but I'm working on it and will be fixed soon. Mobile version is also on the way.
  13. Yes, but there are two backgrounds there. I put one background then the other? And I put a piece of what I want to move and set the tilePosition and it goes to a loop the whole time? Obviously I don't get how this works. :S EDIT: I GOT IT! It was suppose to be: this.bg.tilePosition.x += 1;With emphasis on +=
  14. I tried with 512x512 image with the same canvas size. With an image that easily can be detected and still no movement whatsoever.
  15. Does the image has to be bigger than the canvas or it doesn't matter? I have a 1024x1024 image background, my canvas is w: 400, h: 600 and I have this set up but can't see any movement effect. What am I missing here? create: function() { this.bg = game.add.tileSprite(0, 0, 400, 600, 'bg'); update: function() { this.bg.tilePosition.x = 0.5;