MeMyMo

Members
  • Content count

    13
  • Joined

  • Last visited

  1. You would need to use something like this: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
  2. 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
  3. 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.
  4. Maybe something simpler, like: if (direction != 0) { //Move this.player.body.velocity.y = direction * this.PLAYER_SPEED; } if (firePress) { //Fire this.createPlayerBullet(); }
  5. Might have better luck here: http://www.html5gamedevs.com/forum/22-jobs-hiring-and-freelance/
  6. 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/ ?
  7. 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!
  8. I would start with free resoures, Phaser has some: https://phaser.io/tutorials/making-your-first-phaser-game
  9. Maybe overlap? http://phaser.io/docs/2.6.2/Phaser.Physics.Arcade.html#overlap
  10. If they're in groups, you can countAlive
  11. I don't think this has to go throught Phaser at all, just use something like: https://davidshimjs.github.io/qrcodejs/
  12. And I forgot to pass the asset! Doh! This works: import Phaser from 'phaser' import Player from '../sprites/Player' export default class extends Phaser.State { init () {} preload () {} create () { this.player = new Player({ game: this.game, x: this.world.centerX, y: this.world.centerY, asset: 'characters' }) this.game.add.existing(this.player) this.player.animations.add('anim', ['soldier1_hold.png'], 24, true) this.player.animations.play('anim') } render () { if (__DEV__) { this.game.debug.spriteInfo(this.player, 32, 32) } } } import Phaser from 'phaser' export default class extends Phaser.Sprite { constructor ({ game, x, y, asset, frame }) { super(game, x, y, asset, frame) this.anchor.setTo(0.5, 0.5); } update () { ... Thanks!
  13. Hi, I'm trying out this ES6 + Webpack + Phaser bootstrap project and I'm tring to load an Atlas, then create a sprite and add an animation to it: import Phaser from 'phaser' import Player from '../sprites/Player' export default class extends Phaser.State { init () {} preload () {} create () { this.player = new Player({ game: this.game, x: this.world.centerX, y: this.world.centerY }) this.game.add.existing(this.player) this.player.animations.add('anim', ['soldier1_hold.png'], 24, true) this.player.animations.play('anim') } } The Sprite: import Phaser from 'phaser' export default class extends Phaser.Sprite { constructor ({ game, x, y, key, frame }) { super(game, x, y, key, frame) } update () {} } In another state I load the atlas: import Phaser from 'phaser' import { centerGameObjects } from '../utils' export default class extends Phaser.State { init () {} preload () { this.loaderBg = this.add.sprite(this.game.world.centerX, this.game.world.centerY, 'loaderBg') this.loaderBar = this.add.sprite(this.game.world.centerX, this.game.world.centerY, 'loaderBar') centerGameObjects([this.loaderBg, this.loaderBar]) this.load.setPreloadSprite(this.loaderBar) this.load.atlasXML('characters', 'assets/images/topdown-shooter/Spritesheet/spritesheet_characters.png', 'assets/images/topdown-shooter/Spritesheet/spritesheet_characters.xml'); } create () { this.state.start('Game') } } I'm not sure where I'm messing up, seems to me that it may be related to ES6, but I'm pretty new to it. Any ideas? src.zip