• Content count

  • Joined

  • Last visited

  1. I don't know if this helps, but someone ported Box2D to JS recently: Maybe the performance is better?
  2. Basically what the title says. I'm having a hard time thinking how you can build a simple UI with some dynamic text/buttons/scrollable fields, etc. A group with sprites? Outside of Phaser with HTML/CSS?
  3. I'm an idiot, the walkable tile was 3, not 2.
  4. Hey, I'm messing around with pathfinding. Modified the Easystar Phaser plugin for ES6, but it seems to always return an empty path: (source is 0,0) Calculation is here: ... let walkableTiles = [2, 150, 152, 166, 35, 68, 18] this.pathfinder =; this.pathfinder.setGrid(this.layers[1].data, walkableTiles); } update () {} findPathTo(fromX, fromY, toX, toY) { this.pathfinder.setCallbackFunction((path) => { path = path || []; console.log(`path: ${path}`); // for(var i = 0, ilen = path.length; i < ilen; i++) { // map.putTile(46, path[i].x, path[i].y); // } }); console.log(this.layers[1].data); console.log(toX); console.log(toY); this.pathfinder.preparePathCalculation([0, 0], [toX, toY]); this.pathfinder.calculatePath(); } Grid data looks good... ideas?
  5. You would need to use something like this:
  6. You could do something like: var tile; var map = []; var tileWidth = 38; for (var xx = 0; xx < 10; xx++) { map[xx] = []; for (var yy = 0; yy < 10; yy++) { // Create a tile using the new game.add.isoSprite factory method at the specified position. // The last parameter is the group you want to add it to (just like game.add.sprite) tile = game.add.isoSprite(xx tileWidth, yy * tileWidth, 0, 'tile', 0, tileGroup); tile.anchor.set(0.5, 0); map[xx][yy] = 1; } } console.log(map) But you should probably look into tilemaps and Tiled, it'll help a lot. Also, there's a Phaser plugin to help out with pathfinding:
  7. I've been looking at how BrowserQuest does it and I'm getting a better idea. I'll read up on your link Skeptron, too. For the moment I'll go with something a bit more amateur-ish, I don't think it's all that important that it's 'hackable' as much as releasing something is. Appreciate the input guys, thanks.
  8. Maybe something simpler, like: if (direction != 0) { //Move this.player.body.velocity.y = direction * this.PLAYER_SPEED; } if (firePress) { //Fire this.createPlayerBullet(); }
  9. Might have better luck here:
  10. Ah, sorry about that. Googled a bit and it looks like it's not as straightforward. Maybe: ?
  11. Hey, So I'm messing around with Phaser and Socket.IO, I got a simple "game" working where multiple players can connect and you can see each other/move. The thing is that movement/collisions (for the current player) is client side, relying on arcade physics and x/y velocities. I'm a webdev, so I know it's not smart to rely on the client, but I'm having some difficulty understanding how I would do collisions/movement on the server side. Movement might be easier, I could probably have an update loop on the server and just send over the player's moving direction and then calculate the new coords on the server and send them back, but that would defeat the purpose of using collisions on the client, no? Am I right thinking that I will have to run my own collision logic in the server? Any pointers on what I should do? My "game": (Yeah, sometimes it doesn't spawn where it should...) My repo: Any help appreciated!
  12. I would start with free resoures, Phaser has some:
  13. Maybe overlap?
  14. If they're in groups, you can countAlive
  15. I don't think this has to go throught Phaser at all, just use something like: