Nikolay Tsenkov

Members
  • Content Count

    8
  • Joined

  • Last visited

About Nikolay Tsenkov

  • Rank
    Newbie

Contact Methods

  • Twitter
    NikolayTsenkov
  1. Thanks for the input! And I apologize for the late response (I didn't know I need to subscribe to my own topics and didn't get a message on your comment). What web app? Where did you register?
  2. BTW, I forgot to mention - using Pagehop you can read pretty much any core web-related docs - through MDN you can get a reference for JS, CSS and HTML, and through DocSearch... well the list is too big to post here, but you can check them out. One other thing, that you might enjoy is the CodeSearch recipe (using the API of searchcode.com), which basically allows you to search an index of more than 7 000 000 projects from Github, Bitbucket, Codeplex and other sources. So whenever you wonder how to use some function or instantiate a specific class of object, you could search for examples in real-world projects. You can even specify source (Github etc.), language (javascript etc.) and/or repo name. Here you can check the sample usages of this recipe. There are also recipes for jQuery's doc search, NPM (NodeJS) search, Stackoverflow search (which should be useful for any programming you do) etc.
  3. Hi guys, I've built an app called Pagehop (a launcher for the web) and I just released a new version, which includes a plugin ("recipe" as they are called in Pagehop) for the documentation of pixi.js. Basically, you can search and read the online docs of PIXI through Pagehop, which is always a key-shortcut away from you. So wherever you are, you just press Ctrl + Option + Space (only on Mac, right now, coming on Windows later this year) to open up Pagehop and for example to search the docs for the Sprite class, you just write: pixi sprite classand this is the result The app has a free, unlimited evaluation period, so you can try it out for as long as you like before paying anything for it. Just download and install! The recipe is open-source and if you like to make an improvement - please, fork the repo and submit a pull request, or post in this thread so we can discuss it. I'd be happy to receive contributions. I hope this will be helpful to you. Please, don't hesitate to post your thoughts about it - I am always looking for feedback. Cheers!
  4. I've worked around the issue by a custom build step in my games build process (I'm using grunt). What I do is replicate the rotation prop in object.properties.rotation, since phaser successfully copies .properties. To save some time to anyone that might be struggling with this - here is my procedure (read json, edit, replace the file): var pathUtils = require('path'), fs = require('fs')// custom tasksgrunt.task.registerTask( "tilemapEdit", "copy the rotation prop of objects", function() { var path = pathUtils.resolve( __dirname, "src", "game", "assets", "levels", "tilemap.json" ); if ( fs.existsSync( path ) ) { var jsonText = fs.readFileSync( path, "utf-8" ); if ( jsonText ) { console.log( "tilemap.json file successfully read." ); try { var json = JSON.parse( jsonText ), layers = json.layers; console.log( "tilemap.json file successfully parsed." ); if ( layers && layers.length ) { layers.forEach( function(layer) { if ( layer.type === "objectgroup" ) { var objects = layer.objects; if ( objects && objects.length ) { objects.forEach( function(object) { if ( object.rotation !== undefined ) { if ( !object.properties ) { object.properties = {}; } object.properties.rotation = object.rotation; } } ); } } } ); var newJsonText = JSON.stringify( json ); fs.writeFileSync( path, newJsonText ); console.log( "tilemap.json file successfully updated with rotation props." ); } } catch(exception) { console.error( "Error: tilemap.json isn't a valid JSON" ); } } } else { console.error( "Error: tilemap.json file doesn't exist" ); }} );I will report the issue to the Phaser team.
  5. Just went through phaser's code for parsing the tilemap... it doesn't know about the rotation prop: for (var v = 0, len = json.layers[i].objects.length; v < len; v++) { // Object Tiles if (json.layers[i].objects[v].gid) { var object = { gid: json.layers[i].objects[v].gid, name: json.layers[i].objects[v].name, x: json.layers[i].objects[v].x, y: json.layers[i].objects[v].y, visible: json.layers[i].objects[v].visible, properties: json.layers[i].objects[v].properties }; objects[json.layers[i].name].push(object); } else if (json.layers[i].objects[v].polyline) { var object = { name: json.layers[i].objects[v].name, type: json.layers[i].objects[v].type, x: json.layers[i].objects[v].x, y: json.layers[i].objects[v].y, width: json.layers[i].objects[v].width, height: json.layers[i].objects[v].height, visible: json.layers[i].objects[v].visible, properties: json.layers[i].objects[v].properties }; object.polyline = []; // Parse the polyline into an array for (var p = 0; p < json.layers[i].objects[v].polyline.length; p++) { object.polyline.push([ json.layers[i].objects[v].polyline[p].x, json.layers[i].objects[v].polyline[p].y ]); } collision[json.layers[i].name].push(object); objects[json.layers[i].name].push(object); } // polygon else if (json.layers[i].objects[v].polygon) { var object = slice(json.layers[i].objects[v], ["name", "type", "x", "y", "visible", "properties" ]); // Parse the polygon into an array object.polygon = []; for (var p = 0; p < json.layers[i].objects[v].polygon.length; p++) { object.polygon.push([ json.layers[i].objects[v].polygon[p].x, json.layers[i].objects[v].polygon[p].y ]); } objects[json.layers[i].name].push(object); } // ellipse else if (json.layers[i].objects[v].ellipse) { var object = slice(json.layers[i].objects[v], ["name", "type", "ellipse", "x", "y", "width", "height", "visible", "properties" ]); objects[json.layers[i].name].push(object); } // otherwise it's a rectangle else { var object = slice(json.layers[i].objects[v], ["name", "type", "x", "y", "width", "height", "visible", "properties" ]); object.rectangle = true; objects[json.layers[i].name].push(object); } }}Is there an API in Phaser for accessing the raw son, so I can manually get these rotation props (or probably the entire object group layers)?
  6. I am setting the angle prop of my sprites. The problem is that the objects in map.objects[ objectsLayerName ] don't have it: [{ "name": "start", "type": "", "x": 770.941, "y": 623.224, "width": 48, "height": 49, "visible": true, "properties": {}, "rectangle": true}...]
  7. This is how I load the tilemap, instantiate a background layer and get the object layer for it: // preload levelgame.load.tilemap( "tilemap", "assets/levels/tilemap.json", null, Phaser.Tilemap.TILED_JSON );game.load.image( "tiles", "assets/levels/tileset.png" );var map = game.add.tilemap( 'tilemap' );map.addTilesetImage('tile-set', 'tiles');// create background layervar layer = map.createLayer( backgroundLayerName );// get objects from the object layervar levelObjects = map.objects[ objectsLayerName ];levelObjects.forEach( function( element ) { //...} );I get the position and name properties, but there is no rotation. I've made sure tiliemap.json has the rotation values for every object. I am trying to use the Arcade physics engine, could this be the reason? Thanks.
  8. @Fishrock123, did you manage to write that tutorial?