MeMyMo

Members
  • Content count

    17
  • Joined

  • Last visited

  1. I don't know if this helps, but someone ported Box2D to JS recently: https://github.com/shakiba/planck.js Maybe the performance is better?
  2. How do you guys build your UI?

    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. Easystar pathfinding path always empty

    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: https://max-arias.github.io/miner-idle-1click/ (source is 0,0) Calculation is here: https://github.com/max-arias/miner-idle-1click/blob/master/src/entities/Map.js ... let walkableTiles = [2, 150, 152, 166, 35, 68, 18] this.pathfinder = this.game.plugins.add(PathFinderPlugin); 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: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
  6. Getting a 2D array for Easystar?

    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: https://github.com/appsbu-de/phaser_plugin_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. How to move and shoot at same time with multi-touch?

    Maybe something simpler, like: if (direction != 0) { //Move this.player.body.velocity.y = direction * this.PLAYER_SPEED; } if (firePress) { //Fire this.createPlayerBullet(); }
  9. Using phaser for Curve Fever (multiplayer snake)

    Might have better luck here: http://www.html5gamedevs.com/forum/22-jobs-hiring-and-freelance/
  10. Ah, sorry about that. Googled a bit and it looks like it's not as straightforward. Maybe: http://www.html5gamedevs.com/topic/4760-best-way-to-recreate-old-physicsoverlap-using-p2/ ?
  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": http://104.131.68.91:3000/ (Yeah, sometimes it doesn't spawn where it should...) My repo: https://github.com/max-arias/mp-phaser Any help appreciated!
  12. Discover Phaser Pdf

    I would start with free resoures, Phaser has some: https://phaser.io/tutorials/making-your-first-phaser-game
  13. Maybe overlap? http://phaser.io/docs/2.6.2/Phaser.Physics.Arcade.html#overlap
  14. If they're in groups, you can countAlive
  15. QR Code Generation in Phaser

    I don't think this has to go throught Phaser at all, just use something like: https://davidshimjs.github.io/qrcodejs/