• Content Count

  • Joined

  • Last visited

  1. dark

    lebeling sprites

    Here are some snippets from a game I'm working on that has text labels that follow the sprites around. Not the only way to do it, but basically create a text object and make it follow the sprite around. create: function() { label = game.add.text(0, 0, user.name, textStyle); label.anchor.set(0.5); } update: function() { label.alignTo(sprite, Phaser.BOTTOM_CENTER, 0, 0); } Making the text a child of the sprite might also be an option and wouldn't require updating the position every time. In my case my sprites rotate, and the text would also rotate if it was a child. Is that the type of thing you're looking for?
  2. If you trust the client won't hack things, you could have something as simple as a timer that counts up and applies credits to a total on a regular basis, and a total that decreases as the currency is spent in game - depending how you want to implement it. If you don't trust the client you would want to look at a server that keeps track of those same things, and then work out how you wanted to deliver only the content that was available based on their purchases or progression etc.
  3. I'm writing a 2D space shooter. It started as a single player Phaser2 game a couple of years back, and now it's multiplayer with socketcluster.io providing the back end on node.js. The game is at the point where performance is starting to matter (and degrade), and I'm having a bad time rendering the slither.io-quantity of sprites on the screen. I'm probably just writing bad code, and I'm quite happy to work through that myself, but I'm not sure that I'm using the right frameworks underneath, and I'd like some help sorting that out before I start working through the problems I am having. What I'm wondering is whether I should persist with Phaser2 and socketcluster.io and debug my performance issues here (Chrome dev-tools reckons that most of my time is being spent in drawImage or textaImage2D in Phaser2), or if I should first upgrade from Phaser2 to something else like Phaser3 or PIXI4? Perhaps socketcluster is not as important as I once thought? Can anyone give me a kick in the right direction on this? Thanks!