Jump to content

rockleaf99

Members
  • Posts

    7
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

rockleaf99's Achievements

Newbie

Newbie (1/14)

3

Reputation

  1. I've read a few articles on how phaser games can be deployed onto steam however I can't find anything related to how to store the data in this case. Essentially what i would want to do would be to create a game that runs on windows and save data locally instead of relying on the internet to handle save progress. Could anyone provide details on what options are available? Is it possible to still use local storage if the game is an exe file?
  2. game.input.keyboard.onPressCallback = function(e){console.log("key pressed", e);} This can be used to detect keyboard button presses. I would set it back to null when not at the menu screen so that it doesn't fire all the time. http://phaser.io/docs/2.4.6/Phaser.Keyboard.html
  3. For anyone interested after downgrading tiled to v0.18.2 i got the game to work. It seems that phaser does not support json maps that are exported by tiled v1.0.1. This was a tricky one as the code was correct, glad I can move on. I think this should be documented somewhere and there could be a schema for the json objects that are accepted by the phasers tile map parser. Unless it already exists? tiled download link v0.18.2
  4. Im using tiled version 1.0.1 which was released june 13th 2017. Maybe phaser does not support the json format of the new tiled? What version of tiled is the norm to use with phaser?
  5. 1. The tile set is in the same folder. 2. That is the line where the phaser library is failing.
  6. I've been having a look through the phaser tutorials for json tiled maps and I've noticed that it's not clear on how to create a json tiled map that is 'phaser ready'. After creating a tiled map in tiled and following the code examples I've been unable to get passed the following error. Cannot read property '2' of undefined line phaser.js:98679 // find the relevant tileset sid = map.tiles[tile.index][2]; set = map.tilesets[sid]; version: 2.6.2 Is there anything obviously wrong with the code or the exported json tile map? Maybe there is a special way to export maps from tiled? Help would be appreciated. Thanks. game = new Phaser.Game(600, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload() { game.load.tilemap('map', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tmw_desert_spacing', 'assets/tmw_desert_spacing.png'); } function create() { map = game.add.tilemap('map'); map.addTilesetImage('tmw_desert_spacing'); layer = map.createLayer('Tile Layer 1'); } { "height":14, "layers":[ { "data":[0, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 40, 40, 40, 40, 0, 0, 40, 40, 0, 0, 40, 40, 40, 0, 40, 40, 0, 40, 0, 0, 40, 40, 0, 0, 0, 40, 40, 40, 40, 40, 40, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 40, 0, 40, 40, 40, 0, 40, 40, 40, 40, 40, 40, 40, 0, 40, 0, 40, 0, 40, 40, 40, 40, 40, 0, 40, 40, 40, 0, 40, 40, 0, 40, 0, 40, 40, 0, 40, 0, 40, 40, 40, 0, 0, 40, 40, 40, 0, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 0, 0, 40, 40, 40, 40, 40, 40, 40, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 40, 40, 40], "height":14, "name":"Tile Layer 1", "opacity":1, "type":"tilelayer", "visible":true, "width":14, "x":0, "y":0 }], "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tiledversion":"1.0.1", "tileheight":32, "tilesets":[ { "firstgid":1, "source": { "columns":8, "image":"tmw_desert_spacing.png", "imageheight":199, "imagewidth":265, "margin":0, "name":"tmw_desert_spacing", "spacing":0, "tilecount":48, "tileheight":32, "tilewidth":32, "type":"tileset" } }], "tilewidth":32, "type":"map", "version":1, "width":14 }
  7. I've just started with phaser and I'm looking into csv tile maps. I'm using tiled to create the maps with multiple layers to separate parts of the map such as collision, npc, etc. Exporting the map to csv leads to multiple csv files being created which is what im unsure on how to handle with phaser. To get around this i've combined the layers before exporting them however this is not ideal as I would prefer less coupling. A problem that I have faced is that i'm not sure how to add and reference multiple csv tile layers to a game based on the phaser documentation. Reference: https://phaser.io/examples/v2/tilemaps/csv-map Q1. Why is the parameter passed in 0 when creating a layer based on the csv tiles? layer = map.createLayer(0); Q2. How would I go about adding in a second layer so that it's part of the same map and is shown at the same time as the first layer? function preload() { game.load.tilemap('map', 'assets/tilemaps/csv/catastrophi_level1.csv', null, Phaser.Tilemap.CSV); game.load.tilemap('map2', 'assets/tilemaps/csv/catastrophi_level2.csv', null, Phaser.Tilemap.CSV); game.load.image('tiles', 'assets/tilemaps/tiles/catastrophi_tiles_16.png'); game.load.image('tiles2', 'assets/tilemaps/tiles/catastrophi_tiles_16.png'); } var map; var layer; var cursors; function create() { // Because we're loading CSV map data we have to specify the tile size here or we can't render it map = game.add.tilemap('map', 16, 16); // Now add in the tileset map.addTilesetImage('tiles'); // Create our layer layer = map.createLayer(0); map2 = game.add.tilemap('map2', 16, 16); map2.addTilesetImage('tiles'); layer2 = map2.createLayer(?);// 0? map.layers.push(layer2);//make sure both layers are on the same map?
×
×
  • Create New...