jansensan

Members
  • Content Count

    5
  • Joined

  • Last visited

About jansensan

  • Rank
    Newbie

Contact Methods

  • Twitter
    jansensan
  1. So I ended up rolling my own collision logic, without the use of the Phaser.Physics.ARCADE engine. That's too bad, although since this tile-based prototype may not need physics in the end, it may not be a bad thing either. Repo renamed and is available here: https://github.com/jansensan/test-phaser-js-tile-based-movement
  2. I recently started with PhaserJS. I was delighted that I was able to test a platformer concept quite quickly, see it here: https://github.com/jansensan/test-phaser-js-platformer So as a next project I wanted to test a top-down movement concept with grid movement, à la NES/SNES Dragon Quest/FF and the likes. So far, I built the map in the Tiled Map Editor and I'm able to get the sprite to move properly on the map. However the collision is not applied, see it in action. You can also check out the repo here. I would welcome any guidance as of how to get this collision working. Thanks!
  3. For those who stumble on this post, this is the article that @Rich was talking about: Phaser Coding Tips 4 - Cloud Platforms. However, this is not what I meant in my original question. Maybe I did not use the term "cloud platform" correctly. What the article calls a cloud platform I call an elevator. So I went to explore Tiled a bit more and noticed there was a way to apply properties to tiles directly in the tilesheet, so I added my collision this way. Then, in my code, I went through each tile in the collision layer to see its index and assigned collision accordingly: // set basic collision _map.setCollisionByExclusion([0]); // manually set directional collision var i = 0, j = 0, collisionTile, targetTile, collisions; for(i = 0; i < 23; i++) { for(j = 0; j < 40; j++) { collisionTile = _collisionLayer.layer.data[j]; targetTile = _tilesLayer.layer.data[j]; if(collisionTile.index > 0) { // set collision blocks if(collisionTile.properties.collisions === 'true') { targetTile.collideDown = true; targetTile.collideLeft = true; targetTile.collideRight = true; targetTile.collideUp = true; // set directional collision } else { collisions = collisionTile.properties.collisions.split(','); targetTile.collideDown = collisions[0] === 'false'; targetTile.collideRight = collisions[1] === 'true'; targetTile.collideUp = collisions[2] === 'false'; targetTile.collideLeft = collisions[3] === 'true'; } } } } Is there a better way to do this? Any opinion on this method is appreciated, I feel this may do the work in double. Check out the code here if you want. From here I can move forward. Cheers!
  4. @rich: That's an awesome coincidence! Looking forward to it, thanks!
  5. I have recently decided to try PhaserJS. I have created a platform test. Demo: https://rawgit.com/jansensan/test-phaser-js-platformer/02-implement-cloud-platforms/src/index.html Repository: https://github.com/jansensan/test-phaser-js-platformer/tree/02-implement-cloud-platforms This seems to work well so far, however I can't seem to find documentation on how to make cloud platforms collision (a platform that the player can stand on, but can traverse from other directions). I am using Tiled as a map editor. I have created a tileset that represent the collisions. The empty tile is for pass through, the red tile os a full block and the blue tile represents cloud platforms. See a screenshot of the map editor below: How can I choose the type of collision I need per tile type or ID? I have looked into setCollisionByIndex, but the doc says it's an internal function. Also, it seems to target tile IDs on the map and not relative to what the tileset is. Could anyone provide any assistance? Thanks in advance!